/* ==========================================================================
   Uncle G's Pizza - Crust Academy
   Design system. Zero dependencies, zero external assets.
   Brand: ink #141414 · red #C8102E · cream #FBEDEE (from the handbook build)
   ========================================================================== */

:root {
  /* Brand */
  --red: #C8102E;
  --red-hot: #FF2D4B;
  --red-deep: #7E0A1D;
  --ink: #141414;
  --cream: #FBEDEE;

  /* Surfaces */
  --bg: #0A0A0C;
  --bg-2: #101014;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-3: rgba(255, 255, 255, 0.11);
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.18);

  /* Semantic */
  --ember: #FFB020;
  --ember-2: #FF7A18;
  --mint: #21D07A;
  --mint-dim: rgba(33, 208, 122, 0.14);
  --violet: #7C5CFF;
  --cyan: #35D6E8;

  /* Text */
  --fg: #F6F4F2;
  --fg-2: rgba(246, 244, 242, 0.72);
  --fg-3: rgba(246, 244, 242, 0.46);

  /* Geometry */
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 24px;
  --r-xl: 34px;
  --pad: clamp(16px, 3.2vw, 28px);
  --maxw: 1120px;

  /* Motion */
  --spring: cubic-bezier(.22, 1.4, .36, 1);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: 260ms;

  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .85);
  --shadow-red: 0 14px 44px -12px rgba(200, 16, 46, .55);
  --shadow-mint: 0 14px 44px -12px rgba(33, 208, 122, .45);

  --font: "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Light mode: the shop iPad is often at full brightness in daylight. */
@media (prefers-color-scheme: light) {
  :root:not([data-force-dark]) {
    --bg: #F4F1EE;
    --bg-2: #FFFFFF;
    --surface: rgba(20, 20, 20, 0.035);
    --surface-2: rgba(20, 20, 20, 0.06);
    --surface-3: rgba(20, 20, 20, 0.09);
    --line: rgba(20, 20, 20, 0.10);
    --line-2: rgba(20, 20, 20, 0.18);
    --fg: #141414;
    --fg-2: rgba(20, 20, 20, 0.68);
    --fg-3: rgba(20, 20, 20, 0.44);
    --shadow: 0 18px 50px -22px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

/* --- Animated oven-glow backdrop ---------------------------------------- */
.bg-field {
  position: fixed;
  inset: -20vmax;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(46vmax 46vmax at 12% 8%, rgba(200, 16, 46, .30), transparent 62%),
    radial-gradient(40vmax 40vmax at 88% 14%, rgba(255, 122, 24, .20), transparent 60%),
    radial-gradient(52vmax 52vmax at 72% 92%, rgba(124, 92, 255, .20), transparent 62%),
    radial-gradient(38vmax 38vmax at 20% 88%, rgba(53, 214, 232, .13), transparent 60%);
  filter: blur(20px) saturate(120%);
  animation: drift 34s var(--ease) infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2.5%, -2%, 0) scale(1.07); }
  100% { transform: translate3d(-2%, 2.5%, 0) scale(1.03); }
}

/* Fine grain so the gradients never band on a cheap screen. */
.bg-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .30;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

/* --- Layout -------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 64px;
}

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row.wrap-row { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.gap-28 { gap: 28px; }
.grow { flex: 1 1 auto; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.tc { text-align: center; }

/* --- Type ---------------------------------------------------------------- */
.display {
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: .94;
  margin: 0;
  font-size: clamp(38px, 8.4vw, 86px);
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; letter-spacing: -.022em; font-weight: 800; line-height: 1.14; }
h1 { font-size: clamp(28px, 5vw, 44px); }
h2 { font-size: clamp(22px, 3.4vw, 30px); }
h3 { font-size: clamp(17px, 2.3vw, 21px); }
p { margin: 0 0 12px; color: var(--fg-2); }
p:last-child { margin-bottom: 0; }
strong, b { color: var(--fg); font-weight: 750; }

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--fg-3);
}

.lead { font-size: clamp(16px, 2.1vw, 19px); color: var(--fg-2); }
.tiny { font-size: 12.5px; color: var(--fg-3); line-height: 1.45; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-family: var(--mono); }

.grad-red {
  background: linear-gradient(102deg, var(--red-hot), var(--ember) 62%, var(--ember-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --- Buttons ------------------------------------------------------------- */
.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--fg);
  font: inherit;
  font-weight: 750;
  letter-spacing: -.01em;
  padding: 13px 22px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 160ms var(--spring), background 160ms var(--ease),
              box-shadow 200ms var(--ease), border-color 160ms var(--ease), opacity 160ms;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:hover { background: var(--surface-3); transform: translateY(-1.5px); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.btn[disabled] { opacity: .38; pointer-events: none; }

.btn-primary {
  background: linear-gradient(140deg, var(--red-hot), var(--red) 55%, var(--red-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-red);
}
.btn-primary:hover { background: linear-gradient(140deg, #FF4560, var(--red-hot) 55%, var(--red)); }

.btn-ember {
  background: linear-gradient(140deg, var(--ember), var(--ember-2));
  border-color: transparent;
  color: #26160A;
  box-shadow: 0 14px 40px -14px rgba(255, 154, 24, .6);
}

.btn-ghost { background: transparent; }
/* Buttons inside a .stack would otherwise stretch to the column width. */
.stack > .btn { align-self: flex-start; }
.stack > .btn-block { align-self: stretch; }
.btn-lg { padding: 17px 34px; font-size: 17px; }
.btn-sm { padding: 8px 15px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 10px; width: 42px; height: 42px; border-radius: 50%; }

/* Sheen sweep on primary CTAs. */
.btn-primary::after, .btn-ember::after {
  content: "";
  position: absolute;
  top: 0; left: -140%;
  width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-18deg);
  animation: sheen 4.6s var(--ease) infinite;
}
@keyframes sheen {
  0%, 62% { left: -140%; }
  92%, 100% { left: 190%; }
}

/* --- Cards --------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(18px, 3vw, 28px);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow);
  position: relative;
}

.card-tight { padding: 16px 18px; border-radius: var(--r); }

.card-hl {
  border-color: rgba(255, 176, 32, .34);
  background: linear-gradient(160deg, rgba(255, 176, 32, .11), var(--surface) 62%);
}

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: 10px 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.brandmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-transform: uppercase;
  font-size: 15px;
  cursor: pointer;
  background: none;
  border: 0;
  color: var(--fg);
  padding: 0;
  font-family: inherit;
}
.brandmark .dot {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--red-hot), var(--red-deep));
  display: grid;
  place-items: center;
  font-size: 14px;
  box-shadow: var(--shadow-red);
}
.brandmark small { color: var(--fg-3); font-weight: 700; letter-spacing: .12em; font-size: 10px; display: block; }
.brandmark > span:last-child { white-space: nowrap; }

/* On a phone the wordmark and the XP meter fight for the same 375px.
   The pizza dot carries the branding; the XP meter is the useful part. */
@media (max-width: 560px) {
  .brandmark > span:last-child { display: none; }
  .topbar .xpwrap { min-width: 0; flex: 1 1 auto; }
  .topbar .btn-icon { width: 38px; height: 38px; padding: 8px; }
}

/* --- XP bar / level chip ------------------------------------------------- */
.xpwrap { min-width: 128px; }
.xpbar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
}
.xpbar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--violet), var(--cyan) 55%, var(--mint));
  width: 0%;
  transition: width 900ms var(--spring);
  box-shadow: 0 0 16px rgba(124, 92, 255, .7);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .01em;
  white-space: nowrap;
}
.chip-ember { background: rgba(255, 176, 32, .15); border-color: rgba(255, 176, 32, .38); color: var(--ember); }
.chip-mint  { background: var(--mint-dim); border-color: rgba(33, 208, 122, .38); color: var(--mint); }
.chip-red   { background: rgba(200, 16, 46, .17); border-color: rgba(200, 16, 46, .44); color: #FF7A90; }
.chip-violet{ background: rgba(124, 92, 255, .17); border-color: rgba(124, 92, 255, .42); color: #B9A6FF; }

/* --- Hero ---------------------------------------------------------------- */
.hero { padding: clamp(28px, 6vw, 60px) 0 clamp(20px, 4vw, 34px); }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid rgba(255, 176, 32, .4);
  background: rgba(255, 176, 32, .11);
  color: var(--ember);
  font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase;
}

/* --- Language gate -------------------------------------------------------
   Half the crew reads Spanish first. This is the first screen, before the name
   gate, and it is deliberately the biggest thing on it. */
.langpick {
  display: grid;
  gap: 16px;
  width: min(100%, 560px);
  grid-template-columns: 1fr;
}
@media (min-width: 560px) { .langpick { grid-template-columns: 1fr 1fr; } }

.langbtn {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 6vw, 44px) 20px;
  border-radius: var(--r-xl);
  border: 2px solid var(--line-2);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
  display: grid;
  gap: 8px;
  place-items: center;
  transition: transform 260ms var(--spring), border-color 200ms, background 200ms, box-shadow 260ms;
  -webkit-tap-highlight-color: transparent;
}
.langbtn:hover { transform: translateY(-6px) scale(1.02); border-color: var(--red-hot); box-shadow: var(--shadow-red); }
.langbtn:active { transform: translateY(-1px) scale(.99); }
.langbtn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
.langbtn .flag { font-size: clamp(40px, 9vw, 60px); line-height: 1; }
.langbtn .word {
  font-size: clamp(24px, 5vw, 34px);
  font-weight: 850;
  letter-spacing: -.03em;
}
.langbtn .sub { font-size: 13px; color: var(--fg-3); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.langbtn[aria-pressed="true"] {
  border-color: var(--mint);
  background: linear-gradient(160deg, rgba(33, 208, 122, .14), var(--surface) 60%);
}

/* The switcher that rides on top of the sign-in screen. Bigger than the one in
   Settings on purpose: somebody who cannot read the form needs it immediately. */
.langbar {
  display: inline-flex;
  padding: 5px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1.5px solid var(--line-2);
  gap: 4px;
}
.langbar button {
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-family: inherit;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.01em;
  padding: 10px 22px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 200ms, color 200ms, transform 160ms var(--spring);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.langbar button:hover { color: var(--fg); }
.langbar button[aria-pressed="true"] {
  background: linear-gradient(140deg, var(--red-hot), var(--red) 60%, var(--red-deep));
  color: #fff;
  box-shadow: var(--shadow-red);
}
.langbar button:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }

/* --- Track picker -------------------------------------------------------- */
.tracks { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 780px) { .tracks { grid-template-columns: 1fr 1fr; } }

.track {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  padding: clamp(22px, 3.4vw, 34px);
  border: 1px solid var(--line-2);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  color: var(--fg);
  font-family: inherit;
  transition: transform 320ms var(--spring), box-shadow 320ms var(--ease), border-color 220ms;
  display: block;
  width: 100%;
}
.track:hover { transform: translateY(-6px) scale(1.012); box-shadow: 0 34px 70px -28px rgba(0, 0, 0, .9); }
.track:focus-visible { outline: 3px solid var(--cyan); outline-offset: 4px; }
.track::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 82% 6%, var(--glow, rgba(200,16,46,.34)), transparent 66%);
  opacity: .9;
  transition: opacity 320ms;
}
.track:hover::before { opacity: 1; }
.track > * { position: relative; }
.track-foh  { --glow: rgba(53, 214, 232, .30); }
.track-cook { --glow: rgba(255, 122, 24, .34); }

.track-art {
  font-size: clamp(42px, 7vw, 62px);
  line-height: 1;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .55));
}

/* --- Progress ring ------------------------------------------------------- */
.ring { display: block; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-linecap: round; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: url(#ringGrad); transition: stroke-dashoffset 1s var(--spring); }
.ringwrap { position: relative; display: inline-grid; place-items: center; }
.ringwrap .val {
  position: absolute;
  font-weight: 800;
  letter-spacing: -.04em;
  font-variant-numeric: tabular-nums;
}

/* --- Module map ---------------------------------------------------------- */
/* The map is a sequence, so it stays one column at every width. Reads as a path. */
.map { display: grid; gap: 14px; }

.node {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 15px;
  align-items: center;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  color: var(--fg);
  font-family: inherit;
  width: 100%;
  transition: transform 220ms var(--spring), border-color 200ms, background 200ms;
  position: relative;
  overflow: hidden;
}
.node:hover { transform: translateX(4px); border-color: var(--line-2); background: var(--surface-2); }
.node:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.node[data-locked="1"] { opacity: .46; cursor: not-allowed; }
.node[data-locked="1"]:hover { transform: none; }
.node[data-done="1"] { border-color: rgba(33, 208, 122, .38); }
.node[data-done="1"]::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(33, 208, 122, .10), transparent 46%);
  pointer-events: none;
}
.node-icon {
  width: 54px; height: 54px;
  border-radius: 16px;
  display: grid; place-items: center;
  font-size: 25px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.node[data-done="1"] .node-icon { background: var(--mint-dim); border-color: rgba(33, 208, 122, .4); }
.node-title { font-weight: 780; letter-spacing: -.015em; font-size: 16.5px; }
.node-meta { font-size: 12.5px; color: var(--fg-3); margin-top: 2px; }

.node-final {
  grid-column: 1 / -1;
  border-color: rgba(255, 176, 32, .42);
  background: linear-gradient(120deg, rgba(255, 176, 32, .13), var(--surface) 58%);
}

/* --- Lesson player ------------------------------------------------------- */
.player { max-width: 780px; margin: 0 auto; width: 100%; }

.pbar {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.pbar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--red-hot), var(--ember));
  width: 0;
  border-radius: 99px;
  transition: width 460ms var(--spring);
}

.slide { animation: slideIn 420ms var(--spring) both; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(26px) scale(.985); }
  to { opacity: 1; transform: none; }
}
.slide-out { animation: slideOut 200ms var(--ease) both; }
@keyframes slideOut {
  to { opacity: 0; transform: translateY(-18px) scale(.99); }
}

/* Lesson content blocks */
.lc { margin-top: 18px; }
.lc:first-child { margin-top: 0; }
.lc-text { font-size: clamp(15.5px, 2vw, 17.5px); color: var(--fg-2); line-height: 1.62; }
.lc-text strong { color: var(--fg); }

.callout {
  border-radius: var(--r);
  padding: 15px 17px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
}
.callout .ico { font-size: 21px; line-height: 1.2; }
.callout .body { font-size: 15px; color: var(--fg-2); }
.callout .body b, .callout .body strong { color: var(--fg); }
.callout-hot  { border-color: rgba(200, 16, 46, .5); background: rgba(200, 16, 46, .12); }
.callout-warn { border-color: rgba(255, 176, 32, .48); background: rgba(255, 176, 32, .11); }
.callout-good { border-color: rgba(33, 208, 122, .42); background: rgba(33, 208, 122, .10); }
.callout-key  { border-color: rgba(124, 92, 255, .45); background: rgba(124, 92, 255, .12); }

.speclist { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.speclist li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 11px;
  align-items: start;
  font-size: 15.5px;
  color: var(--fg-2);
  padding: 10px 13px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.speclist li b { color: var(--fg); }
.speclist .k {
  width: 22px; height: 22px; border-radius: 7px;
  background: linear-gradient(140deg, var(--red-hot), var(--red-deep));
  color: #fff; font-size: 11.5px; font-weight: 800;
  display: grid; place-items: center;
  font-variant-numeric: tabular-nums;
}

.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
.stat {
  padding: 15px 16px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-align: center;
}
.stat .v {
  font-size: clamp(23px, 4.2vw, 32px);
  font-weight: 850;
  letter-spacing: -.045em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.stat .l { font-size: 11.5px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .1em; font-weight: 800; margin-top: 5px; }

.vs { display: grid; gap: 12px; }
@media (min-width: 620px) { .vs { grid-template-columns: 1fr 1fr; } }
.vs-col { padding: 15px 17px; border-radius: var(--r); border: 1px solid var(--line); }
.vs-yes { border-color: rgba(33, 208, 122, .4); background: rgba(33, 208, 122, .085); }
.vs-no  { border-color: rgba(200, 16, 46, .45); background: rgba(200, 16, 46, .09); }
.vs-col h4 { margin: 0 0 9px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.vs-yes h4 { color: var(--mint); }
.vs-no h4 { color: #FF7A90; }
.vs-col ul { margin: 0; padding-left: 17px; font-size: 14.6px; color: var(--fg-2); }
.vs-col li { margin-bottom: 5px; }

.quote {
  border-left: 3px solid var(--red);
  padding: 4px 0 4px 16px;
  font-size: clamp(17px, 2.6vw, 21px);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--fg);
  line-height: 1.32;
}

.diagram { display: block; width: 100%; height: auto; border-radius: var(--r); }
.figure {
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.figure figcaption { font-size: 12.5px; color: var(--fg-3); margin-top: 9px; text-align: center; }

/* Spanish inline block */
.es-block {
  border-left: 3px solid rgba(200, 16, 46, .45);
  padding-left: 13px;
  margin-top: 10px;
  font-size: 14.6px;
  color: var(--fg-3);
  font-style: italic;
}

/* --- Quiz ---------------------------------------------------------------- */
.qhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.combo {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 850; font-size: 13px;
  padding: 5px 12px; border-radius: 999px;
  background: linear-gradient(120deg, rgba(255, 122, 24, .25), rgba(255, 176, 32, .18));
  border: 1px solid rgba(255, 176, 32, .5);
  color: var(--ember);
  transition: transform 260ms var(--spring);
}
.combo.pop { transform: scale(1.22); }

.timer-ring { --p: 100; }

.qstem {
  font-size: clamp(19px, 3.1vw, 27px);
  font-weight: 800;
  letter-spacing: -.028em;
  line-height: 1.22;
}

.opts { display: grid; gap: 11px; margin-top: 20px; }

.opt {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 13px;
  align-items: center;
  text-align: left;
  padding: 15px 17px;
  border-radius: var(--r);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: transform 180ms var(--spring), border-color 160ms, background 160ms, box-shadow 200ms;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { transform: translateX(4px); border-color: var(--line-2); background: var(--surface-2); }
.opt:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.opt .key {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-weight: 800; font-size: 14px;
  flex: none;
}
.opt .mark { font-size: 19px; opacity: 0; transition: opacity 160ms; }

.opt[data-sel="1"] { border-color: var(--cyan); background: rgba(53, 214, 232, .10); }
.opt[data-sel="1"] .key { background: var(--cyan); color: #04222A; border-color: transparent; }

.opt[data-state="right"] {
  border-color: var(--mint);
  background: rgba(33, 208, 122, .14);
  box-shadow: var(--shadow-mint);
  animation: popRight 460ms var(--spring);
}
.opt[data-state="right"] .key { background: var(--mint); color: #05230F; border-color: transparent; }
.opt[data-state="right"] .mark { opacity: 1; }

.opt[data-state="wrong"] {
  border-color: var(--red-hot);
  background: rgba(255, 45, 75, .13);
  animation: shake 420ms var(--ease);
}
.opt[data-state="wrong"] .key { background: var(--red-hot); color: #fff; border-color: transparent; }
.opt[data-state="wrong"] .mark { opacity: 1; }

.opt[data-state="missed"] { border-color: rgba(255, 176, 32, .7); background: rgba(255, 176, 32, .10); }
.opt[data-state="missed"] .mark { opacity: 1; }
.opt[data-locked="1"] { pointer-events: none; }
.opt[data-dim="1"] { opacity: .42; }

@keyframes popRight {
  0% { transform: scale(1); }
  42% { transform: scale(1.035); }
  100% { transform: scale(1); }
}
@keyframes shake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(6px); }
  30%, 50%, 70% { transform: translateX(-9px); }
  40%, 60% { transform: translateX(9px); }
}

/* True / false big tap targets */
.tf-grid { display: grid; gap: 13px; grid-template-columns: 1fr 1fr; margin-top: 22px; }
.tf-btn {
  padding: clamp(22px, 5vw, 40px) 14px;
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  font-weight: 850;
  font-size: clamp(17px, 3vw, 22px);
  letter-spacing: -.02em;
  cursor: pointer;
  display: grid;
  gap: 9px;
  place-items: center;
  transition: transform 200ms var(--spring), border-color 160ms, background 160ms;
  text-transform: uppercase;
}
.tf-btn .big { font-size: clamp(32px, 7vw, 46px); line-height: 1; }
.tf-btn:hover { transform: translateY(-4px); background: var(--surface-2); }
.tf-btn[data-state="right"] { border-color: var(--mint); background: rgba(33, 208, 122, .15); box-shadow: var(--shadow-mint); }
.tf-btn[data-state="wrong"] { border-color: var(--red-hot); background: rgba(255, 45, 75, .14); animation: shake 420ms; }
.tf-btn[data-state="missed"] { border-color: rgba(255, 176, 32, .7); }

/* Order / sequence */
.seq-slots { display: grid; gap: 9px; margin-top: 16px; }
.seq-slot {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 11px 15px;
  border-radius: var(--r);
  border: 1.5px dashed var(--line-2);
  background: var(--surface);
  font-size: 15.4px;
}
.seq-slot .n {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 850; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.seq-slot[data-filled="1"] { border-style: solid; background: var(--surface-2); animation: dropIn 380ms var(--spring); }
.seq-slot[data-filled="1"] .n { background: linear-gradient(140deg, var(--violet), var(--cyan)); color: #fff; border-color: transparent; }
.seq-slot[data-state="right"] { border-color: var(--mint); background: rgba(33, 208, 122, .12); }
.seq-slot[data-state="wrong"] { border-color: var(--red-hot); background: rgba(255, 45, 75, .11); }
.seq-slot .undo {
  background: none; border: 0; color: var(--fg-3); cursor: pointer;
  font-size: 17px; padding: 4px 6px; border-radius: 8px; font-family: inherit;
}
.seq-slot .undo:hover { color: var(--fg); background: var(--surface-3); }
@keyframes dropIn {
  from { transform: scale(.94) translateY(-8px); opacity: .4; }
  to { transform: none; opacity: 1; }
}

.seq-pool { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.tok {
  padding: 11px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  color: var(--fg);
  font-family: inherit;
  font-size: 14.6px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 180ms var(--spring), background 160ms, opacity 200ms;
  -webkit-tap-highlight-color: transparent;
}
.tok:hover { transform: translateY(-3px) scale(1.03); background: var(--surface-3); }
.tok:active { transform: scale(.95); }
.tok[data-used="1"] { opacity: .22; pointer-events: none; transform: scale(.9); }
.tok[data-sel="1"] { border-color: var(--cyan); background: rgba(53, 214, 232, .16); box-shadow: 0 0 0 3px rgba(53, 214, 232, .18); }

/* Buckets */
.buckets { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 640px) { .buckets[data-n="2"] { grid-template-columns: 1fr 1fr; } }
@media (min-width: 760px) { .buckets[data-n="3"] { grid-template-columns: repeat(3, 1fr); } }
.bucket {
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--line-2);
  background: var(--surface);
  padding: 14px;
  min-height: 118px;
  cursor: pointer;
  transition: border-color 180ms, background 180ms, transform 180ms var(--spring);
  font-family: inherit;
  color: var(--fg);
  text-align: left;
  width: 100%;
}
.bucket:hover, .bucket[data-armed="1"] { border-color: var(--cyan); background: rgba(53, 214, 232, .08); transform: translateY(-3px); }
.bucket h4 { margin: 0 0 4px; font-size: 14.6px; letter-spacing: -.01em; }
.bucket .hint { font-size: 11.5px; color: var(--fg-3); text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.bucket-items { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.bucket-items .pill {
  font-size: 13px; padding: 6px 11px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line);
  animation: dropIn 340ms var(--spring);
}
.bucket-items .pill[data-state="right"] { background: rgba(33, 208, 122, .18); border-color: rgba(33, 208, 122, .5); }
.bucket-items .pill[data-state="wrong"] { background: rgba(255, 45, 75, .17); border-color: rgba(255, 45, 75, .55); text-decoration: line-through; }

/* Matching */
.match-grid { display: grid; gap: 12px; margin-top: 16px; }
@media (min-width: 640px) { .match-grid { grid-template-columns: 1fr 1fr; } }
.match-col { display: grid; gap: 9px; align-content: start; }

/* Number entry */
.numpad { margin-top: 20px; display: grid; gap: 14px; justify-items: center; }
.numdisp {
  font-size: clamp(46px, 12vw, 84px);
  font-weight: 850;
  letter-spacing: -.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  padding: 6px 22px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1.5px solid var(--line-2);
  min-width: 190px;
  text-align: center;
}
.numdisp[data-state="right"] { border-color: var(--mint); color: var(--mint); box-shadow: var(--shadow-mint); }
.numdisp[data-state="wrong"] { border-color: var(--red-hot); color: #FF7A90; animation: shake 420ms; }
.numdisp .unit { font-size: .38em; color: var(--fg-3); font-weight: 750; letter-spacing: 0; margin-left: 4px; }

.slider {
  -webkit-appearance: none; appearance: none;
  width: min(100%, 420px); height: 40px; background: transparent; cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 12px; border-radius: 99px;
  background: linear-gradient(90deg, var(--violet), var(--cyan), var(--ember));
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 34px; height: 34px; border-radius: 50%; margin-top: -11px;
  background: #fff; border: 3px solid var(--ink);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
.slider::-moz-range-track { height: 12px; border-radius: 99px; background: linear-gradient(90deg, var(--violet), var(--cyan), var(--ember)); }
.slider::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); }

.steppers { display: flex; gap: 10px; }

/* Text entry */
.textin {
  width: min(100%, 460px);
  padding: 15px 19px;
  font-family: inherit;
  font-size: 19px;
  font-weight: 700;
  border-radius: var(--r);
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  color: var(--fg);
  text-align: center;
}
.textin:focus { outline: 3px solid var(--cyan); outline-offset: 2px; }
.textin[data-state="right"] { border-color: var(--mint); }
.textin[data-state="wrong"] { border-color: var(--red-hot); animation: shake 420ms; }

/* Hotspot */
.hotwrap { position: relative; margin-top: 16px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.hotspot {
  cursor: pointer;
  transition: fill 200ms, stroke 200ms;
}
.hotspot:hover { stroke: var(--cyan); stroke-width: 3; }
.hotspot[data-state="right"] { fill: rgba(33, 208, 122, .4); stroke: var(--mint); stroke-width: 3; }
.hotspot[data-state="wrong"] { fill: rgba(255, 45, 75, .4); stroke: var(--red-hot); stroke-width: 3; }
.hotspot[data-state="missed"] { fill: rgba(255, 176, 32, .32); stroke: var(--ember); stroke-width: 3; stroke-dasharray: 6 5; }

/* Feedback panel */
.fb {
  margin-top: 18px;
  border-radius: var(--r-lg);
  padding: 17px 19px;
  border: 1.5px solid var(--line-2);
  background: var(--surface-2);
  animation: slideIn 340ms var(--spring) both;
}
.fb-right { border-color: rgba(33, 208, 122, .5); background: rgba(33, 208, 122, .10); }
.fb-wrong { border-color: rgba(255, 45, 75, .5); background: rgba(255, 45, 75, .09); }
.fb h4 { margin: 0 0 7px; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.fb p { font-size: 14.8px; margin: 0; }
.fb .cite {
  margin-top: 10px; font-size: 12px; color: var(--fg-3);
  display: inline-flex; align-items: center; gap: 6px;
  border-top: 1px solid var(--line); padding-top: 9px; width: 100%;
}

/* --- Results ------------------------------------------------------------- */
.scoreboard { display: grid; gap: 22px; place-items: center; text-align: center; padding: 22px 0; }
.bigscore {
  font-size: clamp(64px, 17vw, 132px);
  font-weight: 850;
  letter-spacing: -.06em;
  line-height: .9;
  font-variant-numeric: tabular-nums;
}

.badgegrid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.badge {
  padding: 16px 12px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
  transition: transform 220ms var(--spring);
}
.badge:hover { transform: translateY(-4px); }
.badge .ico { font-size: 30px; line-height: 1; filter: grayscale(1) opacity(.28); }
.badge[data-earned="1"] { border-color: rgba(255, 176, 32, .45); background: linear-gradient(160deg, rgba(255, 176, 32, .13), var(--surface) 62%); }
.badge[data-earned="1"] .ico { filter: none; animation: badgePop 620ms var(--spring); }
.badge .nm { font-size: 13px; font-weight: 780; margin-top: 8px; letter-spacing: -.01em; }
.badge .ds { font-size: 11.5px; color: var(--fg-3); margin-top: 3px; line-height: 1.35; }
@keyframes badgePop {
  0% { transform: scale(.4) rotate(-18deg); opacity: 0; }
  60% { transform: scale(1.18) rotate(6deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* --- Certificate --------------------------------------------------------- */
.cert {
  background: var(--cream);
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: clamp(26px, 5vw, 48px);
  border: 3px solid var(--red);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.cert::before {
  content: "";
  position: absolute; inset: 10px;
  border: 1px solid rgba(200, 16, 46, .34);
  border-radius: 14px;
  pointer-events: none;
}
.cert h2 { color: var(--ink); }
.cert .who {
  font-size: clamp(28px, 6vw, 46px);
  font-weight: 850;
  letter-spacing: -.035em;
  border-bottom: 3px solid var(--red);
  display: inline-block;
  padding-bottom: 6px;
  margin: 14px 0;
}
.cert .meta { color: #555; font-size: 13.5px; }
.cert .seal {
  width: 92px; height: 92px; border-radius: 50%;
  background: linear-gradient(140deg, var(--red-hot), var(--red-deep));
  color: #fff; display: grid; place-items: center; text-align: center;
  font-weight: 850; font-size: 11px; letter-spacing: .06em; line-height: 1.2;
  box-shadow: var(--shadow-red);
  text-transform: uppercase;
}
.cert .code { font-family: var(--mono); font-size: 12.5px; letter-spacing: .08em; color: #7a7a7a; }

/* --- Toasts / level up --------------------------------------------------- */
.toasts {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: 9px;
  justify-items: center;
  pointer-events: none;
  width: min(94vw, 460px);
}
.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(18, 18, 22, .93);
  border: 1px solid var(--line-2);
  color: #fff;
  font-weight: 750;
  font-size: 14.5px;
  box-shadow: 0 18px 44px -14px rgba(0, 0, 0, .9);
  backdrop-filter: blur(14px);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 460ms var(--spring) both;
}
.toast.out { animation: toastOut 300ms var(--ease) both; }
.toast-xp { border-color: rgba(124, 92, 255, .6); }
.toast-badge { border-color: rgba(255, 176, 32, .65); }
@keyframes toastIn { from { opacity: 0; transform: translateY(26px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-14px) scale(.95); } }

/* Level up overlay */
.levelup {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center;
  background: rgba(6, 6, 8, .72);
  backdrop-filter: blur(10px);
  animation: fadeIn 260ms both;
}
.levelup .inner { text-align: center; animation: badgePop 720ms var(--spring) both; }
.levelup .rank {
  font-size: clamp(38px, 9vw, 74px);
  font-weight: 850; letter-spacing: -.05em; text-transform: uppercase;
}
@keyframes fadeIn { from { opacity: 0; } }

/* Confetti canvas */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 250; }

/* Screen flashes */
.flash {
  position: fixed; inset: 0; z-index: 210; pointer-events: none;
  animation: flashOut 480ms var(--ease) both;
}
.flash-good { background: radial-gradient(60% 60% at 50% 50%, rgba(33, 208, 122, .28), transparent 70%); }
.flash-bad  { background: radial-gradient(60% 60% at 50% 50%, rgba(255, 45, 75, .30), transparent 70%); }
@keyframes flashOut { from { opacity: 1; } to { opacity: 0; } }

.shakescreen { animation: shake 340ms var(--ease); }

/* --- Misc ---------------------------------------------------------------- */
.divider { height: 1px; background: var(--line); margin: 26px 0; border: 0; }

.kbd {
  font-family: var(--mono); font-size: 11.5px;
  padding: 2px 6px; border-radius: 6px;
  background: var(--surface-3); border: 1px solid var(--line);
  color: var(--fg-3);
}

.switch {
  display: inline-flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 14.5px; font-weight: 650;
}
.switch input { display: none; }
.switch .track-sw {
  width: 48px; height: 28px; border-radius: 99px;
  background: var(--surface-3); border: 1px solid var(--line);
  position: relative; transition: background 200ms;
}
.switch .track-sw::after {
  content: ""; position: absolute;
  top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--fg-2); transition: transform 240ms var(--spring), background 200ms;
}
.switch input:checked + .track-sw { background: var(--mint); border-color: transparent; }
.switch input:checked + .track-sw::after { transform: translateX(20px); background: #05230F; }

.seg {
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.seg button {
  border: 0; background: transparent; color: var(--fg-3);
  font-family: inherit; font-weight: 780; font-size: 13px;
  padding: 7px 15px; border-radius: 999px; cursor: pointer;
  transition: background 180ms, color 180ms;
}
.seg button[aria-pressed="true"] { background: var(--red); color: #fff; }

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skipnav {
  position: absolute; left: -999px; top: 8px; z-index: 999;
  background: var(--red); color: #fff; padding: 10px 16px; border-radius: 8px;
}
.skipnav:focus { left: 12px; }

/* --- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .bg-field { animation: none; }
}

:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after {
  animation-duration: .01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .01ms !important;
}
:root[data-motion="off"] .bg-field { animation: none; }

/* --- Print (certificate) ------------------------------------------------- */
@media print {
  body { background: #fff; color: #000; }
  .bg-field, .bg-grain, .topbar, .noprint, #fx, .toasts { display: none !important; }
  .cert { border-color: #C8102E; box-shadow: none; }
  .screen { min-height: auto; padding: 0; }
}
