/* ══ Chuleta component primitives ══
   Depends only on tokens.css. Every page composes from these.
   Accessibility is built in here so no page has to remember it. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--fb);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* visible focus everywhere, always. */
:focus-visible {
  outline: 2px solid var(--terra);
  outline-offset: 2px;
  border-radius: var(--r1);
}
:focus:not(:focus-visible) { outline: none; }

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

/* skip link — first tab stop on every page */
.skip {
  position: absolute; left: -9999px; top: var(--s2); z-index: var(--z-gate);
  background: var(--ink); color: var(--paper); padding: var(--s3) var(--s4);
  border-radius: var(--r2); font-size: 14px;
}
.skip:focus { left: var(--s2); }

/* ── layout ── */
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter) var(--s8); }
.stack > * + * { margin-top: var(--s3); }
.row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.hide { display: none !important; }

/* ── type ── */
h1 { font-family: var(--fd); font-size: 28px; font-weight: 800; letter-spacing: -.02em; line-height: 1.14; }
h2 { font-family: var(--fd); font-size: 20px; font-weight: 800; letter-spacing: -.015em; }
h3 { font-family: var(--fd); font-size: 17px; font-weight: 600; }
.lead { color: var(--text-dim); font-size: 15px; }
.small { font-size: 12.5px; color: var(--text-faint); line-height: 1.55; }
/* the accent, for a code or a word that has to be found at a glance */
.hl { color: var(--action); font-weight: 700; }
/* a person or a thing, set in the display face */
.name { font-family: var(--fd); font-size: 16.5px; font-weight: 600; }
.name.sm { font-size: 14.5px; }
.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--brand);
}

/* ── button ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  width: 100%; min-height: 48px; padding: var(--s3) var(--s5);
  border: none; border-radius: var(--r3);
  background: var(--action); color: #fff;
  font-family: var(--fb); font-size: 15.5px; font-weight: 700;
  cursor: pointer; transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover:not(:disabled) { opacity: .92; transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .32; cursor: not-allowed; transform: none; }
.btn.ghost { background: var(--card); border: 1px solid var(--rule-2); color: var(--ink-2); font-weight: 600; }
.btn.ghost:hover:not(:disabled) { border-color: var(--ink-3); color: var(--ink); }
.btn.quiet { background: none; border: none; color: var(--text-dim); font-weight: 500; font-size: 13px; width: auto; min-height: 36px; padding: var(--s2); }
.btn.quiet:hover { color: var(--ink); transform: none; }
.btn.danger { background: none; border: 1px solid rgba(232,82,47,.4); color: var(--danger); }
.btn.auto { width: auto; }

/* ── card ── */
.card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r3); padding: var(--s4); box-shadow: var(--lift-1);
}
.card.tap { cursor: pointer; transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease); text-align: left; width: 100%; font-family: inherit; color: inherit; }
.card.tap:hover { border-color: var(--rule-2); box-shadow: var(--lift-2); transform: translateY(-1px); }

/* ── chip / toggle ── */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  padding: 9px 14px; border-radius: var(--rp);
  border: 1px solid var(--rule-2); background: var(--card); color: var(--ink-2);
  font-family: var(--fb); font-size: 13.5px; cursor: pointer;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
  min-height: 38px;
}
.chip:hover:not(:disabled) { color: var(--ink); border-color: var(--ink-3); background: var(--sand); }
/* :not(:disabled) is here to match the specificity of the hover rule above,
   not because a disabled chip could be pressed. Without it the hover rule is
   one selector heavier and wins — so hovering a selected chip made it look
   unselected, on every page that uses chips. */
.chip[aria-pressed="true"]:not(:disabled) { background: var(--action); border-color: transparent; color: #fff; font-weight: 700; }
.chip:disabled { opacity: .35; cursor: not-allowed; }

/* ── field ── */
.field { display: block; }
.field > .lbl {
  display: block; font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: var(--s2);
}
.input {
  width: 100%; min-height: 48px; padding: var(--s3) var(--s4);
  border-radius: var(--r2); border: 1px solid var(--rule-2);
  background: var(--card); color: var(--ink);
  font-family: var(--fb); font-size: 16px;  /* 16px stops iOS zooming on focus */
  outline: none; transition: border-color var(--fast) var(--ease);
}
.input:focus { border-color: var(--terra); box-shadow: 0 0 0 3px rgba(193,69,43,.11); }
.input:disabled { opacity: .7; }
.input.centre { text-align: center; }
.err { color: var(--danger); font-size: 13px; margin-top: var(--s2); min-height: 18px; }

/* ── word-state dot: colour AND shape, never colour alone ── */
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.new     { background: var(--st-new); }
.dot.seen    { background: var(--st-seen); }
.dot.shaky   { background: var(--st-shaky); box-shadow: 0 0 8px rgba(245,183,49,.45); }
.dot.owned   { background: var(--st-owned); box-shadow: 0 0 8px rgba(74,186,106,.45); }
.dot.cooling { background: var(--st-cooling); opacity: .75; }

/* ── pill ── */
.pill { font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: var(--rp); white-space: nowrap; }
.pill.ok   { background: rgba(31,111,92,.11); color: var(--ok); }
.pill.warn { background: rgba(180,83,9,.11); color: var(--warn); }
.pill.bad  { background: rgba(193,69,43,.10); color: var(--danger); }
.pill.idle { background: var(--paper-2); color: var(--text-dim); }

/* ── stat strip ── */
.stats { display: flex; gap: var(--s5); padding: var(--s4); background: var(--card); border: 1px solid var(--rule); border-radius: var(--r3); box-shadow: var(--lift-1); }
.stats > div { flex: 1; }
.stats .n { font-family: var(--fd); font-size: 24px; font-weight: 800; line-height: 1; }
.stats .l { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; }

/* ── progress pips ── */
.pips { display: flex; gap: 4px; }
.pips i { flex: 1; height: 3px; border-radius: var(--rp); background: var(--rule-2); }
.pips i.ok { background: var(--olive); }
.pips i.no { background: var(--ink-4); }
.pips i.now { background: var(--terra); }

/* ── empty state ── */
.empty { text-align: center; color: var(--text-faint); font-size: 13.5px; padding: var(--s6) var(--s4); line-height: 1.6; }
.empty strong { display: block; color: var(--text-dim); font-size: 15px; margin-bottom: var(--s2); }

/* ── audio button ── */
.speaker {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--rule-2); color: var(--terra);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  position: relative; transition: border-color var(--med) var(--ease), box-shadow var(--med) var(--ease);
  box-shadow: var(--lift-1);
}
.speaker:hover { border-color: var(--terra); }
.speaker[data-playing="true"] { border-color: var(--terra); box-shadow: 0 0 0 7px rgba(193,69,43,.08); }
.speaker svg { width: 34px; height: 34px; }
.speaker .rip { position: absolute; inset: -1px; border-radius: 50%; border: 1px solid var(--terra); opacity: 0; pointer-events: none; }
.speaker[data-playing="true"] .rip { animation: rip 1.5s ease-out infinite; }
@keyframes rip { 0% { transform: scale(1); opacity: .5 } 100% { transform: scale(1.5); opacity: 0 } }

/* ── feedback panel ── */
.fb { padding: var(--s4); border-radius: var(--r3); border: 1px solid var(--rule); background: var(--card); box-shadow: var(--lift-1); }
.fb.ok { border-color: rgba(31,111,92,.35); background: rgba(31,111,92,.04); }
.fb .ttl { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin-bottom: var(--s2); }
.fb.ok .ttl { color: var(--ok); }
.fb.no .ttl { color: var(--text-dim); }   /* neutral, never a buzzer */
.fb .word { font-family: var(--fd); font-size: 25px; font-weight: 800; }
.fb .gloss { color: var(--text-dim); font-size: 14px; margin-top: 2px; }
/* the sound to fix. Named in full ink so it's the thing the eye lands on. */
.fb .tip { margin-top: var(--s2); }
.fb .tip b { color: var(--ink); font-family: var(--fd); }

/* ── sound chip ── */
.sc { display: inline-block; padding: 3px 9px; border-radius: var(--r1); font-size: 12px; font-weight: 700; margin: var(--s2) var(--s1) 0 0; font-family: var(--fd); }
.sc.risk { background: rgba(180,83,9,.10); color: var(--ochre); border: 1px solid rgba(180,83,9,.28); }
.sc.calm { background: var(--paper-2); color: var(--text-dim); border: 1px solid var(--rule); }

/* ── nav ── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-nav);
  height: var(--nav-h); display: flex; align-items: center; gap: 2px;
  padding: 0 var(--s3); background: rgba(251,248,243,.94); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule); overflow-x: auto;
}
.nav a { flex-shrink: 0; font-size: 12.5px; font-weight: 500; color: var(--text-dim); text-decoration: none; padding: 6px 11px; border-radius: var(--r2); white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--terra); background: rgba(193,69,43,.08); font-weight: 600; }
.nav .brand { font-family: var(--fd); font-size: 16px; font-weight: 700; color: var(--ink); padding: 0 var(--s3) 0 var(--s1); text-decoration: none; }
.nav .brand span { color: var(--terra); }
body.has-nav { padding-top: var(--nav-h); }

/* ── toast, for confirmations that shouldn't interrupt ── */
.toast {
  position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); border-radius: var(--rp);
  padding: var(--s3) var(--s5); font-size: 13.5px; z-index: var(--z-sheet); box-shadow: var(--lift-2);
  animation: rise var(--med) var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px) } to { opacity: 1; transform: translate(-50%, 0) } }

@media (max-width: 400px) { h1 { font-size: 25px; } }

/* ── dialog ── native <dialog>, so focus trapping and Esc come free ── */
.dlg {
  /* A native modal is centred by the UA's `dialog { margin: auto }`. The
     universal `margin: 0` reset at the top of this file silently killed it,
     pinning every dialog to the top-left. Restore it explicitly. */
  margin: auto;
  border: 1px solid var(--rule-2); border-radius: var(--r4); background: var(--card);
  color: var(--text); padding: var(--s5); max-width: 360px; width: calc(100% - var(--s5));
  box-shadow: 0 12px 40px rgba(34,31,26,.18);
  font-family: var(--fb);
}
.dlg::backdrop { background: rgba(34,31,26,.42); backdrop-filter: blur(3px); }
.dlg h3 { margin-bottom: var(--s2); }
.dlg p { color: var(--text-dim); font-size: 14px; margin-bottom: var(--s4); }
.dlg .acts { display: flex; gap: var(--s2); margin-top: var(--s4); }
.dlg .acts .btn { flex: 1; }


/* ══ reveal — words illuminate as they are spoken ══
   The single most distinctive thing in the product. Upcoming words sit faded,
   the current word is full ink, spoken words stay readable. */
.rv { font-family: var(--fd); font-size: 21px; line-height: 1.5; letter-spacing: -.01em; }
.rv-w {
  color: var(--ink-4);
  transition: color var(--med) var(--ease), opacity var(--med) var(--ease);
  opacity: .45;
}
.rv-w.is-past { color: var(--ink-2); opacity: 1; }
.rv-w.is-now  { color: var(--ink);   opacity: 1; }
/* the word we want noticed — a highlighter, not a red pen */
.rv-w.rv-focus {
  background: linear-gradient(transparent 62%, rgba(180,83,9,.30) 62%);
  padding: 0 2px; border-radius: 2px;
}
.rv-w.rv-trap {
  background: linear-gradient(transparent 62%, rgba(193,69,43,.26) 62%);
  padding: 0 2px; border-radius: 2px;
}
.rv.sm { font-size: 17px; }
.rv.lg { font-size: 26px; }

/* on a dark panel, invert the ink */
.on-ink .rv-w { color: rgba(251,248,243,.34); }
.on-ink .rv-w.is-past { color: rgba(251,248,243,.72); }
.on-ink .rv-w.is-now  { color: #FBF8F3; }

/* ══ ink panel — for the one or two moments that want weight ══ */
.panel-ink {
  background: #1D3A32; color: var(--paper);
  border-radius: var(--r4); padding: var(--s5);
}
.panel-ink .small, .panel-ink .lead { color: rgba(251,248,243,.66); }

/* ══ sound zoom — take the word apart and hear the pieces ══ */
.word.zoom { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px; }
.syl {
  font: inherit; color: inherit; background: none; cursor: pointer;
  border: none; border-bottom: 2px dashed var(--rule-2);
  padding: 0 3px; border-radius: var(--r1) var(--r1) 0 0;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.syl:hover { background: var(--sand); border-bottom-color: var(--ink-4); }
.syl.on { background: rgba(180,83,9,.14); border-bottom: 2px solid var(--ochre); }
.syl-dot { color: var(--ink-4); font-size: .6em; padding: 0 1px; }
.zoom-hint { margin-top: var(--s2); }
.zoom-out:not(:empty) {
  margin-top: var(--s3); padding: var(--s3); border-radius: var(--r2);
  background: var(--paper-2); border: 1px solid var(--line);
}
.zoom-out b { color: var(--ink); font-family: var(--fd); }

/* ══ the word doing a job in a real sentence ══ */
.in-ctx { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--line); }
.ctx-es { font-family: var(--fd); font-size: 16px; line-height: 1.45; margin-top: var(--s2); }
/* a highlighter, not a red pen — the same treatment as .rv-focus */
.ctx-es .hit {
  background: linear-gradient(transparent 60%, rgba(180,83,9,.32) 60%);
  padding: 0 2px; font-weight: 700;
}

/* what the student typed, under the answer they were given */
.said { font-size: 12px; color: var(--text-faint); padding: 0 0 6px; font-style: italic; }

/* ══ setting row ══ label + explanation on the left, control on the right ══ */
.setting { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); align-items: flex-start; padding: var(--s3) 0; }
.setting + .setting { border-top: 1px solid var(--line-soft); }
/* A basis rather than flex:1 — a wide control (a group of chips) drops to its
   own line instead of squeezing the label into one word per row. */
.setting > label, .setting > .lhs { flex: 1 1 210px; min-width: 0; cursor: pointer; }
.setting .t { font-weight: 600; font-size: 14.5px; display: block; }
.setting .small { margin-top: 3px; }
.setting .ctl { flex-shrink: 0; }
.setting input[type="checkbox"] {
  width: 22px; height: 22px; accent-color: var(--action); margin-top: 2px; cursor: pointer;
}
.setting .ctl:has(.chips) { flex: 1 1 auto; }
.setting .chips { justify-content: flex-start; }
.setting-note {
  border-top: 1px solid var(--line); padding-top: var(--s3); margin-top: var(--s3);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.55;
}
.setting-note b { color: var(--ok); }

/* ══ mute toggle ══ */
.mute { background: none; border: none; cursor: pointer; color: var(--ink-4); padding: var(--s2); }
.mute:hover { color: var(--ink-2); }
.mute[aria-pressed="true"] { color: var(--terra); }

/* a real gap between words in the sound zoom, not a syllable dot */
.syl-gap { display: inline-block; width: .4em; }

/* ══ the season — what replaces a streak ══
   Three numbers, none of which can be lost. Weeks-left counts down on its own,
   words-spoken only rises, owned is a high-water mark. */
.season {
  display: flex; gap: var(--s4); padding: var(--s4);
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r3);
  box-shadow: var(--lift-1); text-align: center;
}
.season > div { flex: 1; min-width: 0; }
.season .n { font-family: var(--fd); font-size: 22px; font-weight: 800; line-height: 1.05; }
.season .n .of { font-size: 14px; color: var(--text-faint); font-weight: 600; }
.season .l { font-size: 10.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.3; }
/* cooling is reported, never punished — indigo, not the warning colour */
.cooling-note {
  text-align: center; margin-top: var(--s2); color: var(--st-cooling);
}

/* word-of-the-day family row */
.fam-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.fam-row .chip b { font-family: var(--fd); }

/* ══ a list of word/phrase pairs — "worth another look", the preview list ══
   Was page-local in tutor2 until the cheat sheet needed it too and rendered
   Spanish and English jammed together. Second user, so it belongs here. */
.prev { background: var(--paper-2); border-radius: var(--r2); padding: var(--s3); margin-top: var(--s2); }
.prev .w {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--s4); padding: 6px 0; font-size: 13.5px;
  border-bottom: 1px solid var(--line-soft);
}
.prev .w:last-child { border: none; }
.prev .w b { font-family: var(--fd); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.prev .w > span { color: var(--text-dim); text-align: right; }   /* direct child: the b holds a status dot span too */

/* ══ accent row ══ the characters a UK keyboard hides ══
   Sits under the field it serves. Buttons are 40px so a thumb hits them
   first time, and tabindex=-1 keeps them out of the tab order — they are a
   shortcut, not a step in the form. */
/* Nine fixed columns rather than a wrapping row: wrapping put ¿ and ¡ on a
   second line at 390px, which reads as two groups of characters instead of one
   keyboard. The columns cap at 44px on a wide screen and shrink on a narrow
   one, so the row stays one row on every phone. */
.accents {
  display: none; margin-top: var(--s2); gap: 5px;
  grid-template-columns: repeat(9, minmax(0, 44px)); justify-content: center;
}
.accents.on { display: grid; }
.acc {
  min-width: 0; min-height: 44px; padding: 0;
  border: 1px solid var(--rule-2); border-radius: var(--r2);
  background: var(--card); color: var(--ink);
  font-family: var(--fd); font-size: 19px; line-height: 1; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.acc:hover  { background: var(--sand); border-color: var(--ink-3); }
.acc:active { background: var(--terra); border-color: transparent; color: #fff; }

/* ══ Evidence bands ══
   Pearson grade the connectives themselves, bottom band to top. Showing that
   as a ranked list is the single most persuasive thing on either landing page,
   so it lives here rather than in one page's <style> — the student page and
   the teacher page show the same evidence, and it can only say one thing. */
.proof {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r3);
  padding: var(--s4); margin: var(--s5) 0; text-align: left;
}
.proof .band {
  display: flex; align-items: baseline; gap: var(--s3); padding: 6px 0;
  border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.proof .band:last-child { border: none; }
.proof .band b {
  font-family: var(--fd); min-width: 5.5rem; font-size: 12px; letter-spacing: .05em;
  text-transform: uppercase;
}
.proof .band.low b { color: var(--ink-4); }
.proof .band.top b { color: var(--olive); }
.proof .band span { font-family: var(--fd); font-size: 15px; }
