/* ============================================================
   MEASUREMENT & GRAPHING — unit page styles
   Hero specimen card · time-trial phenomenon · toolkit ·
   dartboard of precision · metric converter · Time Trial Board ·
   graph chooser · myth flips · flashcards · exit ticket
   ============================================================ */

/* the hidden attribute must always win over the display rules below */
[hidden] { display: none !important; }

/* ---------- hero ---------- */
.mg-hero {
  position: relative;
  padding-top: clamp(150px, 20vh, 200px);
  overflow: hidden;
  background: linear-gradient(180deg, #F7F2E4 0%, var(--sand-50) 60%, var(--sand-100) 100%);
}
.mg-hero-grid {
  position: relative; z-index: 1; /* above .sun */
  display: grid; grid-template-columns: 1.15fr 0.85fr;
  align-items: center; gap: clamp(30px, 5vw, 60px);
  padding-bottom: 70px;
}
.mg-hero-grid > * { min-width: 0; }
.mg-title { font-size: clamp(2.9rem, 6.5vw, 5.4rem); margin-bottom: 26px; }
.mg-title .char { display: inline-block; }
.mg-hero .lede em { font-style: italic; color: var(--iris-500); }
.mg-chips { display: flex; gap: 10px; margin-top: 30px; flex-wrap: wrap; }

/* specimen card */
.hero-spec {
  max-width: 420px; margin-left: auto; width: 100%;
  background: #FFFDF6; border: 1px solid rgb(13 13 17 / 0.08);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 22px 24px 16px;
}
.spec-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 14px; margin-bottom: 8px; flex-wrap: wrap;
}
.spec-label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--iris-500);
}
.mg-readout {
  font-family: var(--font-mono); font-size: 1.55rem; font-weight: 700;
  color: var(--amber-500); letter-spacing: -0.01em;
  transition: color 0.25s;
}
.mg-readout.flash { color: #C26A2B; }
.spec-ruler { display: block; width: 100%; height: auto; }
.spec-cap { margin-top: 6px; }

/* ---------- the phenomenon ---------- */
.mg-trial { background: var(--sand-100); }
.watch-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
  margin-bottom: clamp(36px, 5vw, 56px);
}
.watch-card { text-align: center; padding: 34px 24px 28px; }
.watch-time {
  display: block; font-family: var(--font-mono); font-weight: 700;
  font-size: clamp(2.2rem, 4.5vw, 3.2rem); letter-spacing: -0.03em;
  color: var(--ink-900); line-height: 1;
}
.watch-time small { font-size: 0.42em; font-weight: 500; color: var(--ink-300); }
.watch-who {
  display: block; margin-top: 14px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-300);
}
.watch-odd .watch-time { color: #C26A2B; }
.trial-ask { max-width: 780px; }
.trial-q {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem); letter-spacing: -0.02em;
  margin-bottom: 18px;
}
.trial-q em { color: var(--amber-500); font-style: italic; }
.trial-a { font-size: 16.5px; line-height: 1.7; color: var(--ink-700); max-width: 68ch; }
.trial-a strong { color: var(--ink-900); }
.principle-chips { margin-top: 26px; }

/* ---------- the toolkit ---------- */
.mg-tools { background: var(--sand-50); }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.tool-card h3 { margin: 14px 0 16px; font-size: 1.18rem; }
.tool-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 46px; height: 34px; padding: 0 10px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: var(--iris-500); border: 1.5px solid rgb(91 84 214 / 0.4);
  border-radius: 10px;
}
.tool-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 7px 0; border-bottom: 1px dashed rgb(13 13 17 / 0.1);
}
.tool-row span {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-300); flex: none;
}
.tool-row strong { font-size: 13.5px; font-weight: 600; color: var(--ink-900); text-align: right; }
.tool-note {
  margin-top: 14px; font-family: var(--font-mono); font-size: 11.5px;
  line-height: 1.6; color: var(--amber-500);
}

/* ---------- precision vs accuracy ---------- */
.mg-aim { background: var(--sand-100); }
.aim-grid {
  display: grid; grid-template-columns: 0.95fr 1.05fr;
  gap: 22px; align-items: start;
}
.dart-card { padding: 26px; }
.dart-svg { display: block; width: min(100%, 340px); margin: 0 auto 18px; height: auto; }
.dart-dot { animation: pop-in 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.arm-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.arm-btn {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  padding: 12px 14px; border-radius: 14px; font: inherit;
  border: 1.5px solid rgb(13 13 17 / 0.14);
  background: #FFFDF6; color: var(--ink-900); cursor: pointer;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s, transform 0.2s;
}
.arm-btn:hover { border-color: var(--iris-500); transform: translateY(-2px); }
.arm-btn:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 2px; }
.arm-btn.active {
  border-color: var(--amber-500); background: rgb(232 112 58 / 0.08);
  box-shadow: 0 0 0 3px rgb(232 112 58 / 0.18);
}
.arm-name { font-weight: 700; font-size: 13.5px; }
.arm-tag { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em; color: var(--ink-300); }
.dart-verdict {
  margin-top: 16px; min-height: 2.6em;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55;
  color: var(--ink-500); text-align: center;
  transition: color 0.3s;
}
.dart-verdict.ok { color: #2F9E5F; }
.dart-verdict.warn { color: #C26A2B; }
.aim-copy { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.aim-def h3 { margin-bottom: 14px; }
.landing { font-size: 14.5px; line-height: 1.6; color: var(--ink-700); padding: 8px 0; }
.landing + .landing { border-top: 1px dashed rgb(13 13 17 / 0.1); }
.landing strong { color: var(--ink-900); }
.zoom-card h3 { margin-bottom: 8px; }
.zoom-svg { display: block; width: 100%; height: auto; margin: 6px 0 10px; }
.zoom-note { font-size: 14px; line-height: 1.65; color: var(--ink-700); }
.zoom-note strong { color: var(--ink-900); }

/* ---------- metric (dark band) ---------- */
.mg-metric {
  background: var(--ink-900); color: var(--sand-50);
  border-radius: clamp(24px, 4vw, 48px);
  margin: 0 clamp(10px, 2vw, 24px);
  padding: var(--section-pad) 0;
}
.eyebrow-light { color: var(--iris-300); }
.lede-light { color: rgb(250 246 235 / 0.72); }
.metric-grid {
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(36px, 5vw, 80px); align-items: start;
}
.ladder {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-top: 34px;
}
.ladder-step {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: var(--sand-50); border: 1px solid rgb(250 246 235 / 0.3);
  padding: 8px 13px; border-radius: 10px;
}
.ladder-base { border-color: var(--amber-500); color: var(--amber-300); }
.ladder i {
  font-family: var(--font-mono); font-style: normal; font-size: 10px;
  color: rgb(250 246 235 / 0.45);
}
.mnemonic {
  margin-top: 22px; font-family: var(--font-mono); font-size: 12px;
  line-height: 1.7; color: rgb(250 246 235 / 0.55); max-width: 52ch;
}
.mnemonic strong { color: var(--amber-300); }
.conv-panel { display: flex; flex-direction: column; gap: 8px; }
.builder-label {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--amber-300); margin-top: 14px;
}
.builder-select {
  appearance: none; -webkit-appearance: none;
  background: rgb(250 246 235 / 0.07);
  border: 1px solid rgb(250 246 235 / 0.18);
  color: var(--sand-50);
  font-family: var(--font-body); font-size: 15.5px; font-weight: 500;
  padding: 14px 44px 14px 16px; border-radius: 14px;
  cursor: pointer; width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23F5A05C' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  transition: border-color 0.3s;
}
.builder-select:hover, .builder-select:focus { border-color: var(--amber-500); outline: none; }
.builder-select option { background: var(--ink-900); color: var(--sand-50); }
.conv-num {
  appearance: textfield; -moz-appearance: textfield;
  background: rgb(250 246 235 / 0.07);
  border: 1px solid rgb(250 246 235 / 0.18);
  color: var(--sand-50);
  font-family: var(--font-mono); font-size: 22px; font-weight: 700;
  padding: 14px 16px; border-radius: 14px; width: 100%;
  transition: border-color 0.3s;
}
.conv-num::-webkit-outer-spin-button, .conv-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.conv-num:hover, .conv-num:focus { border-color: var(--amber-500); outline: none; }
.conv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.conv-out {
  margin-top: 26px; padding: 24px;
  border: 1px dashed rgb(245 160 92 / 0.4);
  border-radius: 18px;
}
.conv-result {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem); line-height: 1.3;
  letter-spacing: -0.01em; color: var(--sand-50);
}
.conv-result .fill { color: var(--amber-300); }
.conv-move {
  margin-top: 12px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  color: rgb(250 246 235 / 0.55);
}

/* ---------- the Time Trial Board ---------- */
.mg-avg { background: var(--sand-100); }
.tt-grid {
  display: grid; grid-template-columns: 1.12fr 0.88fr;
  gap: 22px; align-items: start;
}
.arena-top {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.arena-label {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--iris-500);
}
.tt-watch { font-size: 1.35rem !important; font-weight: 700; color: var(--ink-900) !important; }
.tt-track {
  position: relative; height: 210px; border-radius: 16px;
  background: linear-gradient(180deg, #F7EFDC 0%, #F0E5C9 100%);
  border: 1px solid rgb(13 13 17 / 0.1);
  overflow: hidden;
}
.tt-lane {
  position: absolute; left: 0; right: 0; bottom: 0; height: 42%;
  background: linear-gradient(180deg, #E8DFC7, #DCCFAE);
  border-top: 1px solid rgb(13 13 17 / 0.07);
}
.tt-start {
  position: absolute; left: 6%; bottom: 12%; width: 2px; height: 46%;
  background: var(--iris-500); opacity: 0.55;
}
.tt-finish {
  position: absolute; left: 88%; bottom: 12%; width: 2.5px; height: 52%;
  background: repeating-linear-gradient(180deg, #0D0D11 0 6px, transparent 6px 12px);
}
.tt-finish i {
  position: absolute; top: -16px; left: 2px; width: 0; height: 0;
  border-left: 14px solid var(--amber-500);
  border-top: 8px solid transparent; border-bottom: 8px solid transparent;
}
.tt-beetle {
  position: absolute; left: 3%; bottom: 14%; width: 15%; min-width: 64px;
  z-index: 2;
  transform: scaleX(-1); /* beetle symbol faces left; the dash runs right */
  transition: left 1.8s cubic-bezier(0.45, 0.05, 0.35, 1);
}
.tt-beetle svg { width: 100%; height: auto; display: block; position: relative; z-index: 1; }
.tt-beetle .beetle-shadow {
  position: absolute; bottom: -3%; left: 6%; right: 6%; height: 9%;
  background: radial-gradient(ellipse at center, rgb(13 13 17 / 0.3), transparent 68%);
  border-radius: 50%;
}
.tt-beetle .beetle-antenna { transform-origin: 11px 54px; animation: ant-wig 0.5s ease-in-out infinite; }
.tt-marks {
  position: absolute; left: 6%; right: 6%; bottom: 4%;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-300);
}
.arena-controls { margin-top: 16px; }
.run-row { display: flex; gap: 10px; margin-top: 4px; align-items: center; flex-wrap: wrap; }
.run-btn:disabled { opacity: 0.45; pointer-events: none; }
.lab-reset {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-500); background: none; border: 0; cursor: pointer;
  border-bottom: 1px dashed var(--ink-300); padding: 2px 0; margin-left: auto;
}
.lab-reset:hover { color: var(--amber-500); border-color: var(--amber-500); }
.arena-note {
  margin-top: 12px; font-family: var(--font-mono); font-size: 11px;
  line-height: 1.6; color: var(--ink-300);
}

/* time trial: data side */
.tt-data { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.lab-table-wrap { max-height: 300px; overflow: auto; }
.lab-table { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12.5px; }
.lab-table thead th {
  position: sticky; top: 0; background: #FFFDF6; z-index: 1;
  text-align: left; color: var(--ink-300); font-weight: 500;
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 8px 8px; border-bottom: 1px solid rgb(13 13 17 / 0.12);
}
.lab-table td { padding: 7px 8px; border-bottom: 1px solid rgb(13 13 17 / 0.06); color: var(--ink-700); }
.lab-table tr.fresh td { animation: row-in 0.4s ease; }
@keyframes row-in { from { opacity: 0; transform: translateY(-6px); } }
.lab-table tr.outlier td { color: #C26A2B; }
.log-empty td { color: var(--ink-300); text-align: center; padding: 22px 8px; }

.tt-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tt-stat { text-align: center; }
.tt-stat-num {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: 1.65rem; line-height: 1.05; color: var(--ink-900);
}
.tt-stat-label {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-300);
  margin-top: 5px;
}
.tt-line {
  grid-column: 1 / -1; position: relative; height: 54px; margin-top: 10px;
}
.tt-line-track {
  position: absolute; left: 0; right: 0; top: 26px; height: 6px;
  background: var(--sand-200); border-radius: 3px;
}
.tt-marker {
  position: absolute; top: 17px; width: 22px; height: 22px; margin-left: -11px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; font-weight: 700;
  color: #fff; transition: left 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.tt-marker i { font-style: normal; }
.tt-mean-m { background: var(--amber-500); }
.tt-median-m { background: var(--iris-500); top: 32px; width: 18px; height: 18px; margin-left: -9px; font-size: 9.5px; }
.tt-line-lo, .tt-line-hi {
  position: absolute; top: 42px;
  font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-300);
}
.tt-line-lo { left: 0; } .tt-line-hi { right: 0; }
.tt-line-note {
  grid-column: 1 / -1; margin-top: 4px;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.6;
  color: var(--ink-500);
}
.tt-line-note strong { color: var(--ink-900); }

.tt-verdict { margin-top: 22px; }
.tt-verdict h3 { margin: 6px 0 10px; }
.tt-verdict .step-num {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  color: var(--amber-500); display: block;
}
.concl-lock { color: var(--ink-500); font-size: 15px; max-width: 60ch; }
.concl-lock strong { color: var(--amber-500); }
.tt-report {
  font-size: 17px; line-height: 1.7; color: var(--ink-700); max-width: 66ch;
}
.tt-report strong { color: var(--ink-900); }
.tt-report .rep-good { color: #2F9E5F; }

/* ---------- graphing ---------- */
.mg-graphs { background: var(--sand-50); }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 34px; }
.check-card { display: flex; gap: 16px; align-items: flex-start; }
.check-card p { font-size: 14.5px; line-height: 1.6; color: var(--ink-700); }
.check-card strong { color: var(--ink-900); }
.check-mark {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgb(123 227 154 / 0.18); color: #2F9E5F; font-weight: 700;
}
.bestfit {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  max-width: 720px; margin: 0 auto 44px; padding: 20px;
}
.bestfit-panel svg { display: block; width: 100%; height: auto; }

.slope-teaser { max-width: 780px; margin: 40px auto 0; text-align: left; }
.slope-teaser .step-num {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.18em; color: var(--iris-500); display: block; margin-bottom: 12px;
}
.slope-teaser p { font-size: 16px; line-height: 1.65; color: var(--ink-700); }
.slope-teaser strong { color: var(--ink-900); }
.slope-teaser em { color: var(--amber-500); font-style: italic; }
.slope-teaser a { color: var(--iris-500); text-decoration: underline; text-underline-offset: 3px; }

.standards-note {
  margin-top: 44px;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7;
  color: var(--ink-300); max-width: 70ch;
}
.standards-note strong { color: var(--ink-500); }

/* ---------- sorters (shared manipulative) ---------- */
.sorter-status {
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55;
  color: var(--ink-500); min-height: 1.55em; margin-bottom: 14px;
  transition: color 0.3s;
}
.sorter-status.ok { color: #2F9E5F; }
.sorter-status.hint { color: #C26A2B; }
.sorter-bank {
  display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start;
  min-height: 96px; padding: 14px;
  border: 1.5px dashed rgb(13 13 17 / 0.2); border-radius: 18px;
  background: rgb(255 253 246 / 0.55);
}
.sort-card {
  font: inherit; font-size: 14px; line-height: 1.4; text-align: left;
  padding: 10px 14px; border-radius: 12px;
  border: 1.5px solid rgb(13 13 17 / 0.14);
  background: #FFFDF6; color: var(--ink-900);
  cursor: pointer;
  box-shadow: 0 2px 8px -4px rgb(13 13 17 / 0.18);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s, border-color 0.22s;
}
.sort-card:hover { transform: translateY(-2px); border-color: var(--iris-500); }
.sort-card:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 2px; }
.sort-card.selected {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgb(232 112 58 / 0.25), 0 10px 22px -8px rgb(13 13 17 / 0.3);
  transform: translateY(-3px) rotate(-1deg);
}
.sorter-bins { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sorter-bins.bins-3 { grid-template-columns: repeat(3, 1fr); }
.sort-bin {
  border: 1.5px dashed rgb(13 13 17 / 0.22); border-radius: 18px;
  padding: 16px; min-height: 128px; cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
}
.sort-bin:hover, .sort-bin:focus-visible { border-color: var(--iris-500); outline: none; }
.sorter.armed .sort-bin { border-style: solid; }
.sorter.armed .sort-bin:hover, .sorter.armed .sort-bin:focus-visible {
  border-color: var(--amber-500); background: rgb(232 112 58 / 0.05);
}
.bin-title { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; letter-spacing: -0.01em; }
.bin-sub { display: block; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--ink-300); margin-top: 3px; }
.bin-cards { display: flex; flex-direction: column; gap: 8px; margin-top: 13px; }
.bin-cards .sort-card {
  cursor: default; font-size: 13px;
  background: rgb(123 227 154 / 0.12);
  border-color: rgb(47 158 95 / 0.45);
  box-shadow: none;
}
.bin-cards .sort-card::before { content: "✓ "; color: #2F9E5F; font-weight: 700; }
.bin-cards .sort-card:hover { transform: none; }
.sort-card.just-placed { animation: pop-in 0.38s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.85) translateY(8px); }
}
.sort-bin.done { border-color: rgb(47 158 95 / 0.55); background: rgb(123 227 154 / 0.07); border-style: solid; }
.sort-bin.shake { animation: shake 0.42s; }
@keyframes shake {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}
.sorter-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 15px;
}
.sorter-progress { font-family: var(--font-mono); font-size: 12px; color: var(--ink-500); }
.sorter-reset {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--ink-500); background: none; border: 0; cursor: pointer;
  border-bottom: 1px dashed var(--ink-300); padding: 2px 0;
}
.sorter-reset:hover { color: var(--amber-500); border-color: var(--amber-500); }
.sorter-wide { max-width: 940px; margin-inline: auto; }
.sorter-kicker {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--amber-500); margin-bottom: 10px;
  text-align: center;
}
.sorter-wide .sorter-status { text-align: center; }

/* antenna wiggle — applies to every <use> of the beetle symbol */
.beetle-antenna { transform-origin: 11px 54px; animation: ant-wig 2.6s ease-in-out infinite; }
@keyframes ant-wig {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-7deg); }
}

/* ---------- myth flip cards ---------- */
.mg-myths { background: var(--sand-100); }
.myth-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.myth-flip {
  position: relative; min-height: 210px; padding: 0; border: 0;
  background: none; cursor: pointer; font: inherit; text-align: left;
  perspective: 1100px; border-radius: var(--radius);
}
.myth-flip:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 3px; }
.myth-face {
  position: absolute; inset: 0; border-radius: var(--radius);
  padding: 28px; display: flex; flex-direction: column; justify-content: center; gap: 12px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform 0.65s cubic-bezier(0.3, 1.3, 0.4, 1);
  font-family: var(--font-display); font-weight: 600; font-size: 1.14rem;
  line-height: 1.3; letter-spacing: -0.01em;
}
.myth-front {
  background: #FFFDF6; border: 1px solid rgb(13 13 17 / 0.08);
  box-shadow: var(--shadow-card); color: var(--ink-900);
}
.myth-tag {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber-500);
  border: 1px solid rgb(232 112 58 / 0.4); border-radius: 999px;
  padding: 4px 10px; align-self: flex-start;
}
.myth-back {
  background: var(--ink-900); color: var(--sand-50);
  font-family: var(--font-body); font-weight: 400; font-size: 0.98rem;
  line-height: 1.55; letter-spacing: 0;
  transform: rotateY(180deg);
}
.myth-back strong { color: var(--amber-300); font-family: var(--font-display); font-size: 1.15rem; display: block; margin-bottom: 4px; }
.myth-flip.flipped .myth-front { transform: rotateY(-180deg); }
.myth-flip.flipped .myth-back { transform: rotateY(0deg); }

/* ============================================================
   FLASHCARDS (spaced repetition)
   ============================================================ */
.mg-cards { background: var(--sand-50); }
.deck-wrap {
  display: grid; grid-template-columns: 300px 1fr;
  gap: 22px; align-items: start; max-width: 980px; margin-inline: auto;
}
.deck-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.deck-stat { text-align: center; }
.deck-stat-num {
  display: block; font-family: var(--font-display); font-weight: 700;
  font-size: 1.9rem; line-height: 1.05; color: var(--ink-900);
}
.deck-stat-label {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-300);
  margin-top: 5px;
}
.deck-bar {
  grid-column: 1 / -1; height: 8px; border-radius: 4px;
  background: var(--sand-200); overflow: hidden; margin-top: 6px;
}
.deck-bar-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--iris-500), var(--amber-500));
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.deck-next { grid-column: 1 / -1; margin-top: 4px; line-height: 1.6; }
.deck-stats .sorter-reset { grid-column: 1 / -1; justify-self: start; }
.deck-main { min-width: 0; }
.flashcard {
  position: relative; display: block; width: 100%; height: 270px;
  padding: 0; border: 0; background: none; cursor: pointer; font: inherit;
  perspective: 1300px; border-radius: var(--radius);
}
.flashcard:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 3px; }
.fc-face {
  position: absolute; inset: 0; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 30px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: transform 0.62s cubic-bezier(0.3, 1.25, 0.4, 1);
}
.fc-front {
  background: #FFFDF6; border: 1px solid rgb(13 13 17 / 0.08);
  box-shadow: var(--shadow-card);
}
.fc-back {
  background: var(--ink-900); color: var(--sand-50);
  transform: rotateY(180deg);
}
.flashcard.flipped .fc-front { transform: rotateY(-180deg); }
.flashcard.flipped .fc-back { transform: rotateY(0deg); }
.fc-kicker {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--iris-500);
}
.fc-back .fc-kicker { color: var(--amber-300); }
.fc-term {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -0.02em;
  color: var(--ink-900); text-align: center;
}
.fc-def {
  font-size: clamp(0.98rem, 2vw, 1.2rem); line-height: 1.55;
  color: rgb(250 246 235 / 0.88); text-align: center; max-width: 46ch;
}
.fc-hint {
  position: absolute; bottom: 18px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.1em;
  color: var(--ink-300);
}
.deck-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.grade-btn {
  font: inherit; font-weight: 700; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 10px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid; background: none;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.grade-btn small { font-family: var(--font-mono); font-weight: 400; font-size: 10px; opacity: 0.75; }
.grade-btn:hover { transform: translateY(-2px); }
.grade-btn:disabled { opacity: 0.35; pointer-events: none; }
.grade-again { border-color: var(--amber-500); color: var(--amber-500); }
.grade-again:hover { box-shadow: 0 8px 20px -8px rgb(232 112 58 / 0.5); }
.grade-good { border-color: var(--iris-500); background: var(--iris-500); color: #fff; }
.grade-good:hover { box-shadow: 0 8px 20px -8px rgb(91 84 214 / 0.6); }
.grade-easy { border-color: var(--ink-900); color: var(--ink-900); }
.grade-easy:hover { box-shadow: 0 8px 20px -8px rgb(13 13 17 / 0.4); }
.deck-status { margin-top: 14px; text-align: center; }

/* ============================================================
   EXIT TICKET
   ============================================================ */
.mg-quiz { background: var(--sand-100); }
.quiz { max-width: 780px; margin-inline: auto; }
.quiz-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; margin-bottom: 20px; flex-wrap: wrap;
}
.quiz-dots { display: flex; gap: 7px; }
.quiz-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--sand-300); transition: background 0.3s;
}
.quiz-dots i.current { background: var(--amber-500); }
.quiz-dots i.answered { background: var(--iris-500); }
.quiz-q {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1.2rem, 2.6vw, 1.55rem); line-height: 1.25;
  letter-spacing: -0.01em; margin-bottom: 20px;
}
.quiz-opts { display: grid; gap: 10px; }
.quiz-opt {
  font: inherit; font-size: 15px; text-align: left;
  padding: 13px 16px; border-radius: 14px; cursor: pointer;
  border: 1.5px solid rgb(13 13 17 / 0.14);
  background: var(--sand-50); color: var(--ink-900);
  transition: border-color 0.25s, background 0.25s, transform 0.2s, opacity 0.25s;
}
.quiz-opt:hover { border-color: var(--iris-500); transform: translateY(-1px); }
.quiz-opt:focus-visible { outline: 2px solid var(--iris-500); outline-offset: 2px; }
.quiz-opt.correct { border-color: #2F9E5F; background: rgb(123 227 154 / 0.14); }
.quiz-opt.wrong { border-color: #D64545; background: rgb(214 69 69 / 0.08); animation: shake 0.42s; }
.quiz-opt.dim { opacity: 0.45; pointer-events: none; }
.quiz-opt.locked { pointer-events: none; }
.quiz-feedback {
  min-height: 1.7em; margin-top: 14px;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6;
  color: var(--ink-500);
}
.quiz-feedback.ok { color: #2F9E5F; }
.quiz-feedback.no { color: #C26A2B; }
.quiz-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.quiz-result { text-align: center; padding-top: 10px; }
.quiz-stamp { width: 150px; margin: 0 auto 20px; color: var(--iris-500); animation: stamp-in 0.55s cubic-bezier(0.2, 1.4, 0.4, 1); }
.quiz-stamp svg { width: 100%; height: auto; display: block; }
@keyframes stamp-in {
  from { transform: rotate(-9deg) scale(2.3); opacity: 0; }
}
.quiz-score {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -0.02em;
}
.quiz-note { color: var(--ink-500); font-size: 15px; margin-top: 8px; }
.quiz-result .sorter-reset { margin-top: 18px; }

/* ---------- closer ---------- */
.mg-closer { padding: clamp(80px, 10vw, 130px) 0; text-align: center; background: var(--sand-50); }
.mg-closer .btn { margin: 6px; }
.mg-closer-big {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.2rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -0.03em;
  margin-bottom: 34px;
}

/* ---------- chapter dots ---------- */
.chapters {
  position: fixed; right: 20px; top: 50%; transform: translateY(-50%);
  z-index: 900; display: flex; flex-direction: column; gap: 13px;
}
.chapters a {
  position: relative; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--ink-500);
  box-shadow: 0 0 0 3px rgb(250 246 235 / 0.5);
  transition: background 0.3s, border-color 0.3s, transform 0.3s;
}
.chapters a:hover { transform: scale(1.35); }
.chapters a.active { background: var(--amber-500); border-color: var(--amber-500); }
.chapters a span {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; white-space: nowrap;
  background: var(--ink-900); color: var(--sand-50);
  padding: 4px 9px; border-radius: 7px;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.chapters a:hover span, .chapters a:focus-visible span { opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .chapters { display: none; }
}
@media (max-width: 1020px) {
  .mg-hero-grid { grid-template-columns: 1fr; }
  .hero-spec { margin: 10px auto 0; max-width: 400px; }
  .watch-row { grid-template-columns: 1fr; max-width: 420px; }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .aim-grid { grid-template-columns: 1fr; }
  .dart-card { max-width: 520px; }
  .metric-grid { grid-template-columns: 1fr; }
  .tt-grid { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .myth-grid { grid-template-columns: 1fr; }
  .myth-flip { min-height: 170px; }
  .deck-wrap { grid-template-columns: 1fr; }
  .deck-stats { max-width: 460px; }
}
@media (max-width: 640px) {
  .tool-grid { grid-template-columns: 1fr; }
  .arm-row { grid-template-columns: 1fr; }
  .bestfit { grid-template-columns: 1fr; }
  .sorter-bins, .sorter-bins.bins-3 { grid-template-columns: 1fr; }
  .sort-bin { min-height: 0; }
  .flashcard { height: 300px; }
  .lab-table-wrap { max-height: 240px; }
  .tt-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .beetle-antenna, .tt-beetle .beetle-antenna { animation: none !important; }
  .tt-beetle { transition: none; }
}

/* vocab ticker: full deck scrolls slow (megaloop stage 3) */
.marquee-track { animation-duration: 48s; }
