:root {
  color-scheme: light;
  --paper: #f7f4eb;
  --ink: #17212b;
  --muted: #5f6872;
  --line: rgba(23, 33, 43, 0.16);
  --ocean: #163b59;
  --land: #d8b36a;
  --mint: #4fa07f;
  --coral: #df6a57;
  --sun: #f5c84b;
  --panel: rgba(255, 252, 244, 0.92);
  --shadow: 0 16px 48px rgba(20, 25, 30, 0.16);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: #1f5e86;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: rgba(23, 33, 43, 0.32);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(79, 160, 127, 0.32);
  outline-offset: 2px;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.page.narrow {
  width: min(760px, calc(100% - 32px));
}

.crumb {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.92rem;
  text-decoration: none;
}

.lesson-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 7vw, 4.8rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: 0;
}

p {
  margin: 0 0 14px;
}

.lede {
  max-width: 66ch;
  margin-top: 18px;
  color: #2f3d48;
  font-size: 1.08rem;
}

.resource-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 252, 244, 0.7);
  color: var(--ink);
  font-size: 0.9rem;
  text-decoration: none;
}

.trainer-shell {
  display: grid;
  min-height: min(720px, calc(100vh - 190px));
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #69add5;
  box-shadow: var(--shadow);
}

.globe-stage {
  position: relative;
  min-height: 540px;
}

#globe-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.globe-status {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: min(440px, calc(100% - 36px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(13, 48, 73, 0.56);
  color: #fff7e6;
  font-size: 0.92rem;
  backdrop-filter: blur(8px);
}

.globe-status strong {
  color: #ffffff;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--panel);
  padding: 22px;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf0;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 2px;
  font-size: 1.7rem;
  line-height: 1;
}

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.set-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: -10px;
}

.mode-button,
.set-button {
  min-height: 42px;
  padding: 8px;
}

.mode-button[aria-pressed="true"],
.set-button[aria-pressed="true"] {
  border-color: rgba(79, 160, 127, 0.7);
  background: #dff0e8;
}

.target-box {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.target-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.target-name {
  min-height: 78px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 7vw, 3.4rem);
  line-height: 0.98;
}

.answer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.answer-row input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
}

.primary-button {
  min-height: 46px;
  border-color: rgba(22, 59, 89, 0.35);
  background: var(--ocean);
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 700;
}

.primary-button:hover {
  border-color: rgba(22, 59, 89, 0.65);
}

.feedback {
  min-height: 56px;
  margin: 0;
  color: #27343f;
}

.feedback.good {
  color: #27684e;
}

.feedback.miss {
  color: #9c3c2e;
}

.lesson-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 30px;
}

.note-block {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.note-block ul {
  margin: 0;
  padding-left: 20px;
}

@media (max-width: 880px) {
  .lesson-header,
  .trainer-shell,
  .lesson-notes {
    grid-template-columns: 1fr;
  }

  .lesson-header {
    align-items: start;
  }

  .resource-links {
    justify-content: flex-start;
  }

  .trainer-shell {
    min-height: 0;
  }

  .globe-stage {
    min-height: min(72vw, 520px);
  }

  .control-panel {
    border-top: 1px solid rgba(23, 33, 43, 0.14);
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .page {
    width: min(100% - 22px, 1120px);
    padding-top: 22px;
  }

  .globe-stage {
    min-height: 380px;
  }

  .score-grid,
  .answer-row {
    grid-template-columns: 1fr;
  }

  .target-name {
    min-height: auto;
  }
}
