:root {
  color-scheme: dark;
  font-family: "Avenir Next", "Nunito", system-ui, sans-serif;
  background: #07192f;
  color: #f3f8ff;
  font-synthesis: none;
  --navy: #14294a;
  --muted: #536988;
  --blue: #234fcd;
  --mint: #80e7e2;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  background: radial-gradient(ellipse at 84% 26%, #123f70 0%, transparent 51%),
    radial-gradient(ellipse at 14% 84%, #102b50 0%, transparent 42%), #081c36;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid #087fbc;
  outline-offset: 3px;
}
button:focus:not(:focus-visible), h1:focus { outline: none; }
[hidden] { display: none !important; }
.topbar { border-bottom: 1px solid #a5d8ff22; background: #071d38a8; }
.top-inner {
  max-width: 1184px; margin: auto; min-height: 77px; padding: 0 30px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand, .nav-button {
  color: #f3f8ff; background: transparent; border: 0;
  display: inline-flex; align-items: center; gap: 10px; border-radius: 9px;
  min-height: 44px;
}
.brand { font-size: 20px; font-weight: 750; padding: 0; letter-spacing: -.6px; }
.brand > span:last-child { white-space: nowrap; }
.brand strong { color: #8feae5; font-weight: 750; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 13px;
  display: grid; place-items: center; background: #91ebe3;
  border: 1px solid #b0f8ef; color: #163e71;
}
.brand-mark span {
  width: 18px; height: 18px; display: grid; place-items: center;
  border: 1.6px solid currentColor; border-radius: 50%;
}
.brand-mark span::after {
  content: ""; width: 7px; height: 11px; transform: rotate(38deg);
  background: currentColor; clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%);
}
nav { display: flex; gap: 10px; }
.nav-button { padding: 0 13px; font-size: 15px; font-weight: 650; color: #dcecff; }
.nav-button:hover { background: #b6e3ff18; }
.nav-button > span { color: #a7e3f8; font-size: 20px; line-height: 1; }
.book-icon { width: 14px; height: 13px; border: 1.6px solid #a7e3f8; border-radius: 3px; position: relative; }
.book-icon::after { content: ""; position: absolute; height: 11px; border-left: 1.6px solid #a7e3f8; left: 5px; top: -.5px; }
.layout { max-width: 1184px; margin: 0 auto; padding: 36px 30px 0; }
.page-intro { margin-bottom: 25px; }
.kicker {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
  color: var(--mint); font-size: .875rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}
.kicker > span:first-child { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 13px #80e7e28c; }
h1, h2, h3, p, figure { margin-top: 0; }
h1 { font-size: clamp(2.5rem, 6vw, 3.75rem); font-weight: 800; letter-spacing: -.065em; line-height: 1.06; margin-bottom: 9px; }
.page-intro > p:last-child { color: #c2d9f3; font-size: 1.08rem; margin: 0; line-height: 1.5; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.game-card {
  background: #f6f9ff; color: var(--navy); color-scheme: light;
  border: 1px solid #fff; border-radius: 25px; padding: 23px 25px;
  box-shadow: 0 17px 38px #020b1c40; min-width: 0;
}
.game-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.challenge-label {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px;
  border-radius: 7px; background: #e4ebff; color: #2547a2;
  font-size: .875rem; font-weight: 800;
}
.challenge-label span { font-size: 14px; }
.challenge-steps { color: var(--muted); font-size: .875rem; font-weight: 750; display: flex; align-items: center; gap: 9px; }
.step-dots { display: flex; gap: 4px; }
.step-dots i { width: 7px; height: 7px; border-radius: 9px; background: #d7e2f2; }
.step-dots i.done { background: #73a4f8; }
.step-dots i.current { width: 14px; background: #2853d1; }
.game-card h2 { margin: 13px 0 3px; font-size: clamp(1.46rem, 3vw, 2.05rem); line-height: 1.15; letter-spacing: -.045em; font-weight: 800; }
.pair-chip { color: #234cbd; white-space: nowrap; }
.instructions { margin: 0 0 14px; color: #4c6380; font-size: .98rem; line-height: 1.5; }
.board {
  background: radial-gradient(ellipse at 55% 46%, #f1f9ff 0%, #e9f3fd 100%);
  border: 1px solid #d7e6f8; border-radius: 17px; padding: 10px 16px;
  display: grid; place-items: center; position: relative;
}
.graph {
  position: relative; container-type: inline-size;
  width: min(100%, 350px); aspect-ratio: 1; color: #324b71;
  --left: 14%; --top: 9%; --span: 78%; --intervals: 6;
}
.graph-field {
  position: absolute; width: var(--span); height: var(--span); left: var(--left); top: var(--top);
  background-color: #f4faff;
  background-image: linear-gradient(to right, #adc8e8 1px, transparent 1px),
    linear-gradient(to bottom, #adc8e8 1px, transparent 1px);
  background-size: calc(100% / var(--intervals)) calc(100% / var(--intervals));
  border-bottom: 2px solid #405b86; border-left: 2px solid #405b86;
  padding-right: 1px; background-origin: border-box;
}
.graph-field::after { content: ""; position: absolute; height: 100%; right: 0; top: 0; border-right: 1px solid #adc8e8; }
.axis-extension { position: absolute; background: #405b86; }
.axis-x { height: 2px; left: 92%; width: 4%; top: calc(87% - 2px); }
.axis-y { width: 2px; left: 14%; height: 4%; top: 5%; }
.axis-x::after, .axis-y::after {
  content: ""; position: absolute; border: solid #405b86; border-width: 0 2px 2px 0;
  width: 5px; height: 5px;
}
.axis-x::after { right: 0; top: -2.5px; transform: rotate(-45deg); }
.axis-y::after { top: 0; left: -2.5px; transform: rotate(225deg); }
.graph-label, .axis-name, .graph-point, .graph-cursor, .guide-line, .guide-point { position: absolute; }
.graph-label {
  font-size: clamp(.71rem, 4.1cqw, .92rem); font-weight: 750; line-height: 1;
  transform: translate(-50%, -50%); user-select: none;
}
.axis-name { font-size: clamp(.75rem, 4.1cqw, .92rem); font-weight: 850; color: #284774; }
.axis-name-x { right: 2%; top: 90%; }
.axis-name-y { left: 8%; top: 1%; }
.graph.context .axis-name-x { top: 95%; right: 8%; }
.graph.context .axis-name-y { top: 2%; left: 16%; }
.graph-point, .graph-cursor, .guide-point {
  translate: -50% -50%; border-radius: 50%; width: 19px; height: 19px;
  background: #ec7294; border: 2px solid #602853; box-shadow: 0 0 0 4px #ec729447;
  z-index: 2;
}
.graph-point.secondary { background: #72c8f0; border-color: #36629a; box-shadow: 0 0 0 3px #72c8f046; width: 13px; height: 13px; }
.graph-cursor { background: #3157d4; border-color: #fff; box-shadow: 0 0 0 2px #3157d4; pointer-events: none; }
.graph-cursor.correct { background: #138476; box-shadow: 0 0 0 2px #138476; }
.graph-cursor.incorrect { background: #ac4f32; box-shadow: 0 0 0 2px #ac4f32; }
.plot-surface {
  position: absolute; top: 1%; right: 0; bottom: 5%; left: 6%;
  border-radius: 9px; touch-action: manipulation; cursor: crosshair; z-index: 3;
}
.plot-surface:focus-visible { outline: 2px dashed #244dbe; outline-offset: 0; }
.plot-surface[aria-disabled="true"] { cursor: default; }
.guide-line { background: #5c6cde; height: 4px; border-radius: 4px; translate: 0 -50%; z-index: 1; }
.guide-line.vertical { width: 4px; height: auto; translate: -50% 0; }
.guide-point { background: #7967df; border-color: #fff; box-shadow: 0 0 0 3px #7967df; }
.guide-line, .guide-point { animation: appear .35s ease both; }
.guide-line.vertical, .guide-point { animation-delay: .26s; }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.answer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px;
}
.answer-row > div:first-child { min-width: 0; }
.answer-display { color: #3c5477; font-size: .91rem; font-weight: 700; }
.answer-display strong { color: #183b9a; }
.actions { display: flex; gap: 8px; align-items: center; }
.action {
  border: 1px solid transparent; border-radius: 10px; min-height: 43px;
  padding: 8px 15px; font-size: .94rem; font-weight: 800; line-height: 1.2;
}
.primary { background: #2550cd; color: #fff; box-shadow: 0 2px 3px #11359720; }
.primary:hover { background: #1b3eab; }
.primary:disabled { background: #dce6fa; color: #536a91; box-shadow: none; }
.secondary-action { border-color: #cbd9ef; color: #274674; background: #f4f8ff; }
.secondary-action:hover { background: #e9f2ff; }
.feedback { margin: 12px 0 0; border-radius: 9px; padding: 9px 12px; background: #ebefff; color: #304886; font-weight: 650; line-height: 1.45; font-size: .92rem; }
.feedback:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); padding: 0; margin: 0; }
.feedback.success { background: #e1f3ee; color: #1c695b; }
.feedback.retry { background: #ffede5; color: #884a29; }
.sidebar { display: grid; gap: 14px; }
.reef-art {
  position: relative; min-height: 310px; aspect-ratio: .86; overflow: hidden;
  border: 1px solid #99d6ff46; border-radius: 23px; margin: 0; background: #0c2d5b;
}
.reef-art img { position: absolute; display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 46%; }
.reef-art::after { content: ""; background: linear-gradient(transparent 61%, #061532c7 100%); position: absolute; inset: 0; pointer-events: none; }
.reef-art figcaption { position: absolute; z-index: 1; bottom: 19px; left: 21px; display: flex; flex-direction: column; gap: 3px; }
.art-caption-label { color: #a6edec; font-weight: 850; font-size: .78rem; letter-spacing: .12em; }
.reef-art strong { color: #fff; font-size: 1.55rem; font-weight: 800; letter-spacing: -.04em; }
.reef-collectibles {
  position: absolute; z-index: 1; right: 13px; top: 13px;
  display: flex; flex-wrap: wrap; gap: 4px; justify-content: end;
}
.reef-collectibles span {
  display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%;
  background: #062a56ce; border: 1px solid #a5e4f48c; animation: appear .35s ease both;
}
.progress-card {
  border: 1px solid #9cc9ff34; background: #163559b3; border-radius: 17px;
  padding: 13px 16px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center;
}
.progress-heading { display: flex; gap: 10px; align-items: center; }
.reef-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 11px; background: #2b4b71; color: #a1e7ea; }
.progress-card h2 { font-size: 1rem; margin: 0 0 1px; }
.progress-card p { margin: 0; color: #c9ddf6; font-size: .875rem; }
.reef-badges { display: flex; gap: 4px; }
.reef-badges span { border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; font-size: .84rem; color: #91aacb; background: #233f62; }
.reef-badges .earned { color: #143e50; background: #91ebe3; }
footer { padding: 21px 0; color: #a7c3dd; font-size: .875rem; }
footer span { margin: 0 4px; color: #75ced7; }
.pair-input { display: flex; align-items: center; gap: 7px; color: #233e68; font-weight: 800; }
.pair-input label { display: flex; align-items: center; gap: 4px; }
.pair-input input {
  width: 3ch; min-width: 42px; height: 42px; text-align: center; border-radius: 8px;
  border: 1px solid #bacce7; background: white; color: #172c4c; padding: 3px;
}
.choice-list { display: grid; gap: 7px; margin: 12px 0; }
.choice {
  display: flex; gap: 9px; align-items: center; border: 1px solid #cddbf0; border-radius: 9px;
  background: #fff; color: #233e68; padding: 9px 12px; text-align: left; font-weight: 670;
  min-height: 43px;
}
.choice:hover { border-color: #718edb; }
.choice[aria-pressed="true"] { border-color: #3157d4; background: #e8eeff; }
.choice span:first-child { font-size: .8rem; color: #3157ac; background: #e4ebfa; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; }
.data-table { border-collapse: collapse; margin: 8px 0 12px; text-align: center; font-size: .92rem; }
.data-table th, .data-table td { border: 1px solid #cbdaee; padding: 5px 10px; }
.data-table th { background: #e6effc; text-align: left; }
.results-card { min-height: 400px; }
.results-card h2 { margin-top: 16px; }
.result-list { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 8px; }
.result-list li { border: 1px solid #d4e1f4; background: #ebf3fd; border-radius: 10px; padding: 9px 12px; display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.result-list strong { color: #2446a1; }
.results-card .actions { flex-wrap: wrap; margin-top: 19px; }
.lesson-copy { border-radius: 12px; background: #e9f0ff; color: #26457c; padding: 12px 15px; margin: 12px 0; }
.lesson-copy p { margin-bottom: 0; line-height: 1.5; }
.panel {
  width: min(550px, calc(100% - 28px)); max-height: min(80vh, 720px);
  border: 1px solid white; border-radius: 22px; padding: 20px 22px; color-scheme: light;
  background: #f4f8ff; color: var(--navy); box-shadow: 0 20px 70px #0006;
}
.panel::backdrop { background: #061325ba; }
.panel header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.panel h2 { margin: 0; letter-spacing: -.04em; font-size: 1.7rem; }
.panel header form { margin: 0; }
.panel p, .panel li { line-height: 1.5; }
.close { min-width: 40px; min-height: 40px; font-size: 27px; border-radius: 9px; border: 0; background: #e5edfc; color: #2c4773; }
.map-list { display: grid; gap: 8px; margin-top: 15px; }
.map-item {
  display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center;
  text-align: left; background: #eaf1fd; border: 1px solid #d1ddf3;
  color: #19345e; border-radius: 10px; padding: 9px; min-height: 50px;
}
.map-item:hover { background: #e0ecff; }
.map-item .map-icon { display: grid; place-items: center; border-radius: 8px; background: #dbe6fc; width: 32px; height: 32px; color: #2b4faa; }
.map-item small { color: #415b82; font-size: .8rem; }
details { border-bottom: 1px solid #d1ddf3; padding: 10px 0; }
summary { cursor: pointer; font-weight: 800; }
details p { margin: 7px 0 3px; }
details .board { margin-top: 10px; }
details .graph { width: min(100%, 250px); }
@media (max-width: 860px) {
  .game-layout { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; }
  .layout, .top-inner { padding-left: 20px; padding-right: 20px; }
  .game-card { padding: 18px; }
  .reef-art { min-height: 0; }
}
@media (max-width: 650px) {
  .top-inner { min-height: 60px; gap: 6px; }
  .layout, .top-inner { padding-left: 13px; padding-right: 13px; }
  .layout { padding-top: 25px; }
  .brand { font-size: 16px; gap: 6px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 9px; }
  .brand-mark span { width: 15px; height: 15px; }
  nav { gap: 0; }
  .nav-button { padding: 0 6px; font-size: 14px; }
  .nav-button > span { display: none; }
  .page-intro { margin-bottom: 17px; }
  .page-intro > p:last-child { font-size: 1rem; }
  .game-layout { grid-template-columns: minmax(0, 1fr); }
  .game-card { padding: 14px; border-radius: 19px; }
  .board { padding: 6px 10px; }
  .sidebar { grid-template-columns: minmax(0, 1fr); }
  .reef-art { aspect-ratio: 1.65; }
  .reef-art img { object-position: 50% 44%; }
}
@media (max-width: 370px) {
  .answer-row { flex-wrap: wrap; }
  .answer-row .actions { margin-left: auto; }
  .challenge-steps { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
