/* Teen Missions: Our Space. Viva Vox navy and gold, with a sharper, younger
   voice: a grotesque for headings, chat bubbles for the group chat story and a
   "case file" look for the ghost_15 mystery. The variable names match
   course-energy so the shared lookup.css works here unchanged. */

:root {
  --color-navy: #1b2a4a;
  --color-navy-light: #2c3e6b;
  --color-gold: #d4a843;
  --color-gold-dark: #a8801f;
  --color-cream: #f5efe6;
  --color-bg: #f7f5f0;
  --color-surface: #ffffff;
  --color-text: #1b2a4a;
  --color-text-light: #56637f;
  --color-border: #e2ddd4;
  --color-ok: #2e7d5b;
  --color-no: #c0392b;
  --color-accent: #3b5bdb;
  --font-heading: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--color-bg); color: var(--color-text);
  font: 16px/1.6 var(--font-body); -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--color-accent); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ── top bar ─────────────────────────────────────────────────────── */
.lesson-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--color-navy); color: #fff;
}
.lesson-top .back { color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.lesson-top .course-name { flex: 1; font-size: 13px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-progress { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.top-progress .members { color: var(--color-gold); font-weight: 700; white-space: nowrap; }
.words-top-btn {
  color: var(--color-navy); background: var(--color-gold); text-decoration: none; font-weight: 700;
  font-size: 13px; padding: 5px 11px; border-radius: 100px; white-space: nowrap;
}
.words-count { background: var(--color-navy); color: #fff; border-radius: 100px; padding: 0 7px; margin-left: 4px; font-size: 12px; }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 16px 80px; }

/* ── lesson header ───────────────────────────────────────────────── */
.lesson-header { padding: 28px 0 12px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--color-gold-dark); }
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: clamp(34px, 7vw, 52px); margin: 8px 0 12px; }
h2 { font-size: 24px; margin: 0 0 12px; }
h3 { font-size: 18px; margin: 18px 0 8px; }
.goal { font-size: 18px; margin: 0 0 14px; color: var(--color-text-light); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; font-weight: 600; background: var(--color-surface); border: 1px solid var(--color-border); padding: 3px 10px; border-radius: 100px; }

.hero { margin: 18px 0 8px; border-radius: var(--radius); overflow: hidden; aspect-ratio: 1600 / 686; background: #dfe4ec; position: relative; }
.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero .slot { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 20px; color: var(--color-text-light); font-size: 14px; border: 2px dashed #c3cad6; border-radius: var(--radius); }

/* ── the three parts of a lesson ─────────────────────────────────── */
.tabs { position: sticky; top: 46px; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin: 18px 0 22px; padding: 8px 0; background: var(--color-bg); }
.tabs button {
  border: 1.5px solid var(--color-border); background: var(--color-surface); border-radius: 12px;
  padding: 10px 6px; font-weight: 700; font-size: 14px; line-height: 1.25; min-height: 56px;
}
.tabs button small { display: block; font-weight: 500; font-size: 12px; color: var(--color-text-light); }
.tabs button[aria-selected="true"] { background: var(--color-navy); color: #fff; border-color: var(--color-navy); }
.tabs button[aria-selected="true"] small { color: var(--color-gold); }
.tabs button .tick { color: var(--color-ok); }
.tabs button[aria-selected="true"] .tick { color: var(--color-gold); }

.block {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 16px;
}
.block-num { display: block; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--color-gold-dark); margin-bottom: 6px; }
.block > p:last-child { margin-bottom: 0; }
.muted { color: var(--color-text-light); font-size: 14px; }
.task { background: var(--color-cream); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; font-size: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  border: 1.5px solid var(--color-navy); background: var(--color-surface); color: var(--color-navy);
  border-radius: 10px; padding: 9px 16px; font-weight: 700; font-size: 15px; text-decoration: none;
}
.btn:hover { background: var(--color-cream); }
.btn.gold, .btn.primary { background: var(--color-gold); border-color: var(--color-gold); color: var(--color-navy); }
.btn.gold:hover { background: var(--color-gold-dark); color: #fff; }
.btn.navy { background: var(--color-navy); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ── audio ───────────────────────────────────────────────────────── */
.au {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%; border: none; background: var(--color-cream);
  color: var(--color-navy); display: inline-flex; align-items: center; justify-content: center;
}
.au::before { content: ''; border-left: 10px solid currentColor; border-top: 6px solid transparent; border-bottom: 6px solid transparent; margin-left: 3px; }
.au.playing { background: var(--color-gold); }
.au.playing::before { border: 0; width: 10px; height: 10px; background: currentColor; margin: 0; }
.play-all.playing { background: var(--color-navy); color: #fff; }
.speed { font-size: 13px; color: var(--color-text-light); display: inline-flex; gap: 6px; align-items: center; }

/* ── reading ─────────────────────────────────────────────────────── */
.reading { font-size: 18px; line-height: 1.8; }
.reading p { margin: 0 0 14px; }
.reading p.active, .line.active { background: rgba(212, 168, 67, .16); border-radius: 6px; }

.dialogue { display: grid; gap: 6px; margin-top: 12px; }
.line { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 8px 6px; border-bottom: 1px solid #efece6; align-items: baseline; }
.line .who { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--color-accent); }
.line .said { margin: 0; font-size: 17px; }
.line.hidden-line .said { color: transparent; background: repeating-linear-gradient(90deg, #eceae4 0 10px, #f5f3ee 10px 20px); border-radius: 6px; user-select: none; }

/* the group chat story shows its dialogue as a messenger */
.chat { background: #e9edf5; border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; margin-top: 12px; }
.chat .line { display: block; border: 0; padding: 8px 12px; max-width: 86%; border-radius: 16px; background: #fff; }
.chat .line .who { display: block; font-size: 11px; margin-bottom: 2px; }
.chat .line.me { justify-self: end; background: #d9e4ff; }
.chat .line.system { justify-self: center; background: transparent; font-size: 13px; color: var(--color-text-light); font-style: italic; }
.chat .line.system .who { display: none; }
.chat .line.media .said { font-style: italic; color: var(--color-text-light); background: #f1f3f8; border-radius: 10px; padding: 18px 12px; text-align: center; }

/* phrases */
.vocab { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vocab li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--color-border); border-radius: 10px; }
.vocab .txt { flex: 1; min-width: 0; }
.vocab .en { font-weight: 700; display: block; }
.vocab .uk { font-size: 14px; color: var(--color-text-light); }
.vocab.hide-uk .uk { visibility: hidden; }
.lk-star { border: none; background: none; font-size: 20px; color: var(--color-gold-dark); padding: 2px 4px; }

/* questions */
.q { margin: 14px 0 18px; }
.q legend { font-weight: 700; margin-bottom: 8px; }
.opts { display: grid; gap: 6px; }
.opt { text-align: left; border: 1.5px solid var(--color-border); background: var(--color-surface); border-radius: 10px; padding: 10px 12px; }
.opt.ok { border-color: var(--color-ok); background: rgba(46, 125, 91, .1); }
.opt.no { border-color: var(--color-no); background: rgba(192, 57, 43, .07); }
.fb { font-size: 14px; margin-top: 8px; min-height: 1em; }
.fb.ok { color: var(--color-ok); }
.fb.no { color: var(--color-no); }

/* drill */
.drill { display: grid; gap: 12px; counter-reset: d; }
.drill label { display: block; font-weight: 600; }
.drill label::before { counter-increment: d; content: counter(d) '. '; color: var(--color-gold-dark); }
.drill input { width: 100%; max-width: 360px; margin-top: 5px; border: 1.5px solid #b9c0cc; border-radius: 9px; padding: 9px 11px; font-size: 16px; }
.drill input.ok { border-color: var(--color-ok); background: rgba(46, 125, 91, .07); }
.drill input.no { border-color: var(--color-no); }
.drill .hint { display: block; font-size: 13px; color: var(--color-text-light); margin-top: 3px; }
.drill input.shown { border-color: var(--color-gold); background: rgba(212, 168, 67, .08); }
.drill input[readonly] { cursor: default; }
.drill-note { display: block; font-size: 13px; font-weight: 600; margin-top: 4px; }
.drill-note:empty { display: none; }
.drill-note.ok { color: var(--color-ok); }
.drill-note.no { color: var(--color-no); }
.drill-note.show { color: var(--color-gold-dark); }

textarea { width: 100%; min-height: 130px; border: 1.5px solid #b9c0cc; border-radius: 10px; padding: 11px; font-size: 16px; line-height: 1.5; resize: vertical; }
input[type=text], input[type=email] { width: 100%; border: 1.5px solid #b9c0cc; border-radius: 10px; padding: 10px 11px; font-size: 16px; }
.count { font-size: 13px; color: var(--color-text-light); margin-top: 4px; }

details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 700; color: var(--color-navy); padding: 6px 0; }
.model { background: var(--color-cream); border-radius: 10px; padding: 12px; white-space: pre-line; margin-top: 6px; }

/* grammar */
.grammar { border-left: 4px solid var(--color-gold); }
.grammar .ex { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.grammar .ex li { display: flex; gap: 10px; align-items: center; font-weight: 600; }

/* class screen */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role { background: #eef1f8; border-radius: 12px; padding: 4px 14px 12px; }
.role summary { color: var(--color-accent); }
.twist { background: var(--color-navy); color: #fff; }
.twist .block-num { color: var(--color-gold); }
.twist summary { color: var(--color-gold); }
.twist p.big { font-family: var(--font-heading); font-size: 22px; line-height: 1.3; }
.card-deck { background: var(--color-cream); border-radius: 12px; padding: 22px; text-align: center; }
.card-deck .card-text { font-family: var(--font-heading); font-size: 24px; line-height: 1.3; margin: 8px 0 16px; }
.project { border: 2px solid var(--color-gold); }
.project ul { padding-left: 20px; }

/* recorder */
.rec-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rec-btn.rec { background: var(--color-no); border-color: var(--color-no); color: #fff; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 700; }
.rec-row audio { width: 100%; max-width: 380px; }

/* recall */
.recall-card { background: var(--color-navy); color: #fff; border-radius: 12px; padding: 18px; text-align: center; }
.recall-card .say { font-size: 18px; }
.recall-card .ans { font-family: var(--font-heading); font-size: 22px; color: var(--color-gold); margin: 8px 0; }
.recall-card .btn { border-color: #fff; }

/* the ghost_15 case file */
.case { background: #111827; color: #e5e7eb; border-radius: var(--radius); padding: 20px; font-family: 'Courier New', monospace; }
.case .block-num { color: #f59e0b; }
.case h2 { color: #fff; font-family: 'Courier New', monospace; font-size: 20px; }
.case .file { border: 1px dashed #4b5563; border-radius: 8px; padding: 12px; margin-top: 10px; }
.case .locked { color: #9ca3af; }

.send-box .row > * { flex: 1 1 200px; }
.send-preview { font-size: 13px; color: var(--color-text-light); white-space: pre-line; background: var(--color-bg); border-radius: 8px; padding: 10px; margin: 10px 0; }

.done-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 24px 0 8px; }
.pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 28px; }

/* ── course map ──────────────────────────────────────────────────── */
.season-hero { background: var(--color-navy); color: #fff; padding: 36px 16px 30px; }
.season-hero .inner { max-width: 960px; margin: 0 auto; }
.season-hero h1 { color: #fff; }
.season-hero h1 em { color: var(--color-gold); font-style: normal; }
.season-hero p { max-width: 640px; opacity: .9; }
.meter { margin-top: 20px; max-width: 520px; }
.meter .bar { height: 12px; background: rgba(255, 255, 255, .15); border-radius: 100px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--color-gold); border-radius: 100px; }
.meter .lbl { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.map { max-width: 960px; margin: 0 auto; padding: 24px 16px 80px; }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 28px; }
.how div { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 12px; padding: 14px; font-size: 14px; }
.how b { display: block; font-family: var(--font-heading); font-size: 16px; }
.story { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; display: grid; grid-template-columns: 200px 1fr; }
.story .pic { background: #dfe4ec center / cover no-repeat; min-height: 150px; }
.story .body { padding: 16px 18px; }
.story h2 { font-size: 22px; margin: 2px 0 6px; }
.story .hook { font-size: 14px; color: var(--color-text-light); margin: 0 0 10px; }
.lessons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.lessons a { display: block; text-decoration: none; color: var(--color-navy); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.lessons a span { display: block; font-size: 11px; color: var(--color-text-light); font-weight: 500; }
.lessons a.done { border-color: var(--color-ok); }
.lessons a .st { font-size: 11px; color: var(--color-ok); }
.map-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }

footer.foot { text-align: center; font-size: 12px; color: var(--color-text-light); padding: 20px; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--color-navy); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 50; max-width: 90vw; }
#toast:empty { display: none; }

@media (max-width: 640px) {
  .role-grid, .how { grid-template-columns: 1fr; }
  .story { grid-template-columns: 1fr; }
  .story .pic { min-height: 140px; }
  .lessons { grid-template-columns: 1fr 1fr; }
  .block { padding: 18px 16px; }
  .tabs button { font-size: 13px; }
  .line { grid-template-columns: 52px 1fr; }
  .top-progress .members { display: none; }
}

@media print {
  .lesson-top, .tabs, .pager, .btn, .au, .done-bar, #toast { display: none !important; }
  .block { break-inside: avoid; border: 0; border-bottom: 1px solid #ccc; border-radius: 0; }
  body { background: #fff; }
}

/* the top bar is white-on-navy; a select inside it keeps its own dark text */
.lesson-top select { color: var(--color-navy); background: #fff; border: 0; max-width: 46vw; }

.btn.restart { font-size: 14px; padding: 7px 12px; min-height: 40px; border-color: var(--color-border); }

/* Browsers draw a grey frame round every fieldset; the questions do not need it. */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* ── phones: fewer frames inside frames, more width for the text ─── */
@media (max-width: 640px) {
  .wrap { padding: 0 12px 64px; }
  .block {
    margin-left: -12px; margin-right: -12px; margin-bottom: 10px;
    border-radius: 0; border-left: 0; border-right: 0; padding: 18px 14px;
  }
  .block.twist, .block.project, .case { border-radius: 0; }
  .case { margin-left: -12px; margin-right: -12px; padding: 18px 14px; }
  h2 { font-size: 21px; }
  .task { font-size: 14px; padding: 9px 11px; margin-bottom: 12px; }
  .reading { font-size: 17px; line-height: 1.7; }
  .chat { margin-left: -6px; margin-right: -6px; padding: 8px 6px; gap: 6px; }
  .chat .line { max-width: 92%; padding: 7px 10px; }
  .dialogue { gap: 2px; }
  .line { grid-template-columns: 1fr; gap: 0; padding: 7px 2px; }
  .line .who { font-size: 11px; }
  .vocab { gap: 0; }
  .vocab li { border: 0; border-bottom: 1px solid var(--color-border); border-radius: 0; padding: 9px 0; }
  .vocab li:last-child { border-bottom: 0; }
  .q { margin: 10px 0 14px; }
  .opt { padding: 9px 11px; }
  .drill input { max-width: none; }
  .role { padding: 2px 12px 10px; }
  .card-deck { padding: 16px 12px; }
  .card-deck .card-text { font-size: 21px; }
  .recall-card { padding: 14px 12px; }
  .hero { margin-left: -12px; margin-right: -12px; border-radius: 0; }
  .lesson-header { padding-top: 20px; }
  .done-bar { margin: 16px 0 6px; }
}

/* enrolment strip on the season map */
.enrol { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between;
  background: var(--color-surface); border: 1.5px solid var(--color-gold); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
.enrol b { display: block; font-family: var(--font-heading); font-size: 17px; }
.enrol span { font-size: 14px; color: var(--color-text-light); }
.enrol-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* the story book: a button on the season map, a link in every lesson's bar */
.hero-links { margin: 18px 0 0; }
.book-top-btn { color: #fff; text-decoration: none; font-weight: 700; font-size: 13px; padding: 5px 11px;
  border: 1.5px solid rgba(255, 255, 255, .45); border-radius: 100px; white-space: nowrap; }
.book-top-btn:hover { border-color: var(--color-gold); color: var(--color-gold); }
@media (max-width: 640px) { .lesson-top .course-name { display: none; } .lesson-top { justify-content: space-between; } }

/* the email gate in front of the story book */
.gate { max-width: 520px; padding-top: 24px; }
.gate-box { text-align: left; }
.gate-cover { width: 100%; border-radius: 10px; margin-bottom: 16px; }
.gate h1 { font-size: 30px; margin: 6px 0 8px; }
.gate-label { display: block; font-weight: 700; margin: 16px 0 6px; }
.gate form .btn { margin-top: 10px; width: 100%; }
.gate-note { font-size: 12px; margin-top: 10px; }
#gate-again .btn { width: 100%; }

/* ── phrase cards in gold: English and sound in front, Ukrainian behind ── */
.fcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.vocab.fcards li.fcard { position: relative; display: block; padding: 0; border: 0; border-radius: 14px; perspective: 900px; cursor: pointer; }
.fcard:focus-visible { outline: 3px solid var(--color-accent); outline-offset: 3px; }
.fcard-inner { position: relative; min-height: 118px; transition: transform .5s cubic-bezier(.2,.7,.2,1); transform-style: preserve-3d; }
.fcard.flipped .fcard-inner { transform: rotateY(180deg); }
.fcard-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 14px; padding: 16px 38px 16px 14px; display: flex; align-items: center; gap: 12px;
  color: #3a2a06; box-shadow: 0 6px 16px rgba(120, 84, 10, .25), inset 0 1px 0 rgba(255, 255, 255, .6), inset 0 -2px 6px rgba(120, 84, 10, .25);
}
.fcard-front {
  background:
    linear-gradient(115deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.45) 45%, rgba(255,255,255,0) 60%),
    linear-gradient(135deg, #fbe7a1 0%, #e8c15a 22%, #c9982f 48%, #f1d27a 72%, #b98a2a 100%);
}
.fcard-back {
  transform: rotateY(180deg); justify-content: center; text-align: center;
  background:
    linear-gradient(115deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.35) 45%, rgba(255,255,255,0) 60%),
    linear-gradient(135deg, #e9c867 0%, #c9982f 35%, #a8791f 65%, #d9b150 100%);
}
.fcard .en { display: block; font-weight: 800; font-size: 17px; line-height: 1.3; color: #2b1f04; }
.fcard .uk { display: block; font-size: 17px; font-weight: 700; line-height: 1.35; color: #2b1f04; }
.fcard .au { background: rgba(255, 255, 255, .55); color: #3a2a06; flex-shrink: 0; }
.fcard .au.playing { background: #1b2a4a; color: #f6e3a3; }
.fcard .lk-star { position: absolute; top: 6px; right: 6px; z-index: 2; color: #5a420c; font-size: 20px; }
.fcard .lk-star.saved { color: #1b2a4a; }
@media (max-width: 640px) {
  .fcards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .fcard-inner { min-height: 104px; }
  .fcard-face { padding: 12px 30px 12px 10px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .fcard-back { align-items: center; }
  .fcard .en, .fcard .uk { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) { .fcard-inner { transition: none; } }
.vocab.fcards .fcard .lk-star { color: #4a3508; opacity: 1; text-shadow: 0 1px 0 rgba(255, 255, 255, .4); }
.vocab.fcards .fcard .lk-star.saved { color: #1b2a4a; }

/* step 1 shows the lesson photo right where it asks about it */
.step-photo { width: 100%; height: auto; aspect-ratio: 1600 / 686; object-fit: cover; border-radius: 10px; margin: 4px 0 12px; }
