/* Easylish. One narrow column that works as a phone app and stays readable on a desktop.
   Navy hero with a gold scalloped edge (same as the PDFs), a sticky player, then the lesson. */
:root {
  --bg: #F5F8FE; --surface: #FFFFFF; --surface-2: #EBF1FC; --ink: #0F2859; --muted: #4B628E; --line: #D3DEF2;
  --navy: #0B2E6B; --blue: #1F5FBF; --blue-ink: #FFFFFF; --gold: #F2B63C; --gold-ink: #0B2E6B;
  --hl-bg: #FFE9A6; --hl-fg: #0B2E6B; --now-bg: #FFF1B8; --now-fg: #0F2859; --uw-line: #8AA2D4; --band: #0B2E6B; --band-ink: #FFFFFF; --band-muted: #B8C8EC;
  --ok: #17794D; --ok-bg: #DDF3E8; --bad: #B3261E; --bad-bg: #FBE3E1; --focus: #1F5FBF;
  --shadow: 0 1px 2px rgba(11,46,107,.08), 0 8px 22px rgba(11,46,107,.08);
  --f-ui: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-ipa: 'Noto Sans', 'Segoe UI', 'Gentium Plus', 'Doulos SIL', sans-serif;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #081430; --surface: #10224A; --surface-2: #172C59; --ink: #E8EEFF; --muted: #9DB0DA; --line: #243C6E;
    --blue: #7FA9FF; --blue-ink: #08153A; --hl-bg: rgba(242,182,60,.28); --hl-fg: #FFE9A6; --now-bg: rgba(255,214,110,.20); --now-fg: #FFF4D0; --uw-line: #6F88BE; --band: #0E2757;
    --ok: #5BD39A; --ok-bg: rgba(91,211,154,.16); --bad: #FF9A92; --bad-bg: rgba(255,154,146,.16); --focus: #9CC0FF;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #081430; --surface: #10224A; --surface-2: #172C59; --ink: #E8EEFF; --muted: #9DB0DA; --line: #243C6E;
  --blue: #7FA9FF; --blue-ink: #08153A; --hl-bg: rgba(242,182,60,.28); --hl-fg: #FFE9A6; --now-bg: rgba(255,214,110,.20); --now-fg: #FFF4D0; --uw-line: #6F88BE; --band: #0E2757;
  --ok: #5BD39A; --ok-bg: rgba(91,211,154,.16); --bad: #FF9A92; --bad-bg: rgba(255,154,146,.16); --focus: #9CC0FF;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.35); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 16px; line-height: 1.55;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  padding-block: 0 48px; overflow-x: hidden;
}
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; letter-spacing: -0.005em; }
a.btn, a.lessonrow, a.iconbtn { text-decoration: none; color: inherit; }

.band {
  margin-left: calc(-1 * max(var(--gutter), env(safe-area-inset-left, 0px))); margin-right: calc(-1 * max(var(--gutter), env(safe-area-inset-right, 0px)));
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.col { width: 100%; max-width: 720px; margin-inline: auto; }

.hero { background: var(--band); color: var(--band-ink); padding-top: calc(env(safe-area-inset-top, 0px) + 14px); padding-bottom: 34px; position: relative; margin-bottom: 22px; }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -13px; height: 14px;
  background: radial-gradient(circle at 12px 0, var(--band) 12px, transparent 12.5px) 0 0 / 24px 14px repeat-x;
  filter: drop-shadow(0 2px 0 var(--gold));
}
.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img { flex: none; }
.brand img.lockup { height: 38px; width: auto; max-width: 100%; border: 0; border-radius: 0; background: none; }
.brand b { display: block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); line-height: 1.2; }
.brand span { display: block; font-size: .78rem; color: var(--band-muted); line-height: 1.2; }
.iconbtn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid transparent; background: transparent; padding: 0; }
.iconbtn svg { width: 22px; height: 22px; pointer-events: none; }
.topbar .iconbtn { color: var(--band-ink); border-color: rgba(255,255,255,.28); }
.topbar .iconbtn:hover { background: rgba(255,255,255,.12); }
.hero h1 { font-size: clamp(1.45rem, 5.4vw, 2rem); line-height: 1.2; font-weight: 700; margin-top: 18px; }
.hero .meta { margin-top: 8px; color: var(--band-muted); font-size: .88rem; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.daybadge { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; background: var(--gold); color: var(--gold-ink); border-radius: 12px; padding: 6px 14px; font-weight: 700; line-height: 1.1; flex: none; }
.daybadge small { font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.daybadge span { font-size: 1.15rem; }
.herorow { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.herorow h1 { margin: 0; }

.seasoncard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.seasoncard h2 { font-size: 1.15rem; }
.seasoncard p { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 14px; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 99px; transition: width .3s; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: .78rem; font-weight: 500; background: var(--surface-2); color: var(--muted); }
.chip svg { width: 14px; height: 14px; }
.chip.gold { background: var(--hl-bg); color: var(--hl-fg); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: 12px; border: 2px solid var(--blue); background: var(--blue); color: var(--blue-ink); font-weight: 600; font-size: .95rem; }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .85rem; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; }
.lessons { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.lessonrow { width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 10px 14px 10px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); min-height: 60px; }
.lessonrow .n { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lessonrow .n svg { width: 20px; height: 20px; }
.lessonrow.open .n { background: var(--gold); color: var(--gold-ink); }
.lessonrow.done .n { background: var(--ok); color: #fff; }
.lessonrow .t { font-weight: 600; font-size: .95rem; line-height: 1.3; min-width: 0; }
.lessonrow .s { display: block; font-weight: 400; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.lessonrow.locked { opacity: .62; }
.sectionlabel { margin: 26px 0 0; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.settings { margin-top: 28px; display: grid; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.settings h2 { font-size: 1rem; }
.settings p { font-size: .85rem; color: var(--muted); }

.player { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 12px 14px 14px; margin-bottom: 14px; }
.controls { display: flex; align-items: center; justify-content: center; gap: 6px; }
.controls .iconbtn { border-color: var(--line); color: var(--ink); background: var(--surface-2); }
.controls .iconbtn:hover { border-color: var(--blue); }
.controls .play { width: 58px; height: 58px; background: var(--blue); color: var(--blue-ink); border-color: var(--blue); }
.controls .play svg { width: 28px; height: 28px; }
.seekrow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-top: 8px; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.seekrow .count { grid-column: 1 / -1; display: flex; justify-content: space-between; }
input[type=range] { width: 100%; accent-color: var(--blue); height: 28px; background: transparent; }
.speedrow { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: .82rem; color: var(--muted); margin-top: 2px; }
.speedrow output { font-weight: 600; color: var(--ink); min-width: 3.2em; text-align: right; font-variant-numeric: tabular-nums; }
.gapbar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.gapbar i { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: left; animation: gapfill linear forwards; }
.gaplabel { font-size: .85rem; font-weight: 600; color: var(--ink); margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.gaplabel svg { width: 20px; height: 20px; flex: none; color: var(--blue); }
@keyframes gapfill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 14px; }
.modes button { border: 0; background: transparent; border-radius: 10px; padding: 8px 4px; font-size: .78rem; font-weight: 600; color: var(--muted); min-height: 44px; line-height: 1.2; }
.modes button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.modehelp { font-size: .86rem; color: var(--muted); margin: 10px 2px 0; }
.toolrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 8px; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 5px 10px; font-size: .78rem; color: var(--muted); min-height: 32px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.text { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px; display: grid; gap: 14px; font-size: 1.06rem; line-height: 1.8; }
.s { cursor: pointer; border-radius: 6px; padding: 1px 0; transition: background .15s; -webkit-tap-highlight-color: transparent; }
.s.on { background: var(--now-bg); color: var(--now-fg); padding: 2px 4px; margin: 0 -4px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.s.on .tw { background: #F2C14E; color: #0B2E6B; }
.s.on .uw { border-bottom-color: #8A6A00; }
.tw { background: var(--hl-bg); color: var(--hl-fg); font-weight: 600; border-radius: 5px; padding: 0 3px; cursor: help; }
.uw { border-bottom: 2px dotted var(--uw-line); cursor: help; }
.text.hide .s:not(.peek) { filter: blur(7px); user-select: none; }
.text.hide .s.peek { filter: none; }
@media (hover: hover) { .text.hide .s:hover { filter: none; } }
.text.hide .tw { background: transparent; }

section.block { margin-top: 30px; }
section.block > h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }
section.block > h2 .num { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: var(--blue-ink); display: grid; place-items: center; font-size: .85rem; flex: none; }
section.block > .lead { color: var(--muted); font-size: .9rem; margin-top: 4px; }
.cards { display: grid; gap: 12px; margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.card .head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.card .word { font-size: 1.25rem; font-weight: 700; }
.card .pos { font-size: .78rem; color: var(--muted); font-style: italic; }
.ipa { font-family: var(--f-ipa); font-size: .9rem; color: var(--blue); }
.card .def { margin-top: 6px; font-weight: 500; }
.card ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: .92rem; }
.card .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.card.compact .word { font-size: 1.05rem; }
details.more { margin-top: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
details.more > summary { padding: 14px 16px; font-weight: 600; cursor: pointer; min-height: 48px; display: flex; align-items: center; }
details.more > .cards { padding: 0 12px 12px; margin-top: 0; }

.q { margin-top: 14px; }
.q label.t { display: block; font-weight: 600; margin-bottom: 6px; }
.q .think { display: inline-flex; vertical-align: middle; margin-left: 6px; color: var(--blue); }
.q .think svg { width: 16px; height: 16px; }
textarea { width: 100%; min-height: 76px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); line-height: 1.5; }
details.sample { margin-top: 6px; }
details.sample summary { cursor: pointer; color: var(--blue); font-weight: 600; font-size: .88rem; min-height: 32px; display: flex; align-items: center; }
details.sample p { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: .92rem; margin-top: 4px; }

.bank { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bank span { padding: 6px 12px; border-radius: 99px; background: var(--hl-bg); color: var(--hl-fg); font-weight: 600; font-size: .9rem; }
.gaplist { display: grid; gap: 12px; margin: 14px 0 0; padding: 0; list-style: none; counter-reset: g; }
.gaplist li { counter-increment: g; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; line-height: 2.1; }
.gaplist li::before { content: counter(g) "."; font-weight: 700; color: var(--blue); margin-right: 8px; }
select.gap { padding: 6px 28px 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface-2); min-height: 38px; max-width: 100%; font-weight: 600; }
select.gap.ok { border-color: var(--ok); background: var(--ok-bg); }
select.gap.bad { border-color: var(--bad); background: var(--bad-bg); }
.score { margin-top: 12px; font-weight: 600; color: var(--muted); font-size: .9rem; }
.tf { display: grid; gap: 10px; margin-top: 14px; }
.tfitem { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tfitem .btns { display: flex; gap: 8px; margin-top: 10px; }
.tfitem .btns button { flex: 1; min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface-2); font-weight: 600; }
.tfitem .btns button.picked.ok { border-color: var(--ok); background: var(--ok-bg); }
.tfitem .btns button.picked.bad { border-color: var(--bad); background: var(--bad-bg); }
.tfitem .why { margin-top: 8px; font-size: .88rem; color: var(--muted); }
.speakbox { background: var(--hl-bg); color: var(--hl-fg); border-radius: 16px; padding: 16px; margin-top: 14px; }
.speakbox p { font-weight: 500; }
.speakbox .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.speakbox .btn { background: var(--navy); border-color: var(--navy); color: #fff; }
.speakbox audio { width: 100%; margin-top: 10px; }
.note { font-size: .84rem; color: var(--muted); margin-top: 8px; }
.saved { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.saved li { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.saved li button { border: 0; background: transparent; color: var(--muted); min-width: 36px; min-height: 36px; }
.saved li button svg { width: 16px; height: 16px; }
.row2 { display: grid; gap: 10px; grid-template-columns: 1fr; margin-top: 12px; }
select.plain { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); min-height: 44px; }

.song { background: var(--band); color: var(--band-ink); border-radius: 20px; padding: 18px; margin-top: 14px; }
.song h3 { font-size: 1.15rem; color: var(--gold); }
.song .sub { color: var(--band-muted); font-size: .84rem; }
.song .controls { justify-content: flex-start; margin-top: 12px; }
.song .controls .play { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.song input[type=range] { accent-color: var(--gold); }
.song .speedrow, .song .seekrow { color: var(--band-muted); }
.song .speedrow output { color: #fff; }
.lyrics { margin-top: 16px; display: grid; gap: 14px; font-size: 1rem; line-height: 1.7; }
.lyrics h4 { margin: 0; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.lyrics .tw { background: rgba(242,182,60,.28); color: #FFE9A6; }

.sheetwrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; background: rgba(5,12,30,.5); }
.sheet { width: 100%; max-width: 560px; background: var(--surface); color: var(--ink); border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 30px rgba(0,0,0,.25); max-height: 82vh; overflow: auto; }
.sheet .x { float: right; border-color: var(--line); }
.sheet .word { font-size: 1.5rem; font-weight: 700; }
.sheet .def { margin-top: 8px; font-weight: 500; }
.sheet .ex { margin-top: 8px; color: var(--muted); font-size: .94rem; }
.sheet .acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.finish { text-align: center; margin-top: 34px; padding: 22px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.finish h2 { font-size: 1.15rem; }
.finish p { color: var(--muted); margin: 6px 0 14px; font-size: .92rem; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 80; font-size: .88rem; max-width: 92vw; box-shadow: var(--shadow); }
.foot { margin-top: 40px; text-align: center; color: var(--muted); font-size: .78rem; }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 2fr; } .modes button { font-size: .86rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: .01ms !important; scroll-behavior: auto !important; } }

/* bottom mini-player: stays visible while the song plays */
#mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: min(560px, calc(100% - 24px)); z-index: 60; display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--band); color: var(--band-ink); border-radius: 999px; box-shadow: 0 10px 30px rgba(11, 46, 107, .35); }
#mini[hidden] { display: none; }
#mini .play { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); flex: none; }
#mini .mtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
#mini .mtitle small { color: var(--gold); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
#mini .mtitle b { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mini #mt { font-size: .8rem; color: var(--band-muted); }
#mini .iconbtn:not(.play) { background: transparent; border-color: rgba(255,255,255,.3); color: #fff; }
body.hasmini { padding-bottom: 84px; }

/* Easylish update: My Words review and unhighlighted-but-tappable repeats */
.wordtap { cursor: pointer; border-bottom: 1px dotted var(--uw-line); }
.mywords { margin-top: 20px; }
.mywordlist { display: grid; gap: 8px; margin: 12px 0; }
.myworditem { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.myworditem b { color: var(--ink); }
.myworditem span, .myworditem small { grid-column: 1; color: var(--muted); font-size: .82rem; }
.myworditem button { grid-column: 2; grid-row: 1 / span 3; }
#mini { padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
@media (max-width: 420px) {
  .myworditem { grid-template-columns: 1fr; }
  .myworditem button { grid-column: 1; grid-row: auto; justify-self: start; }
  .controls { gap: 3px; }
  .controls .btn.small { padding: 5px 9px; min-width: 36px; }
}

/* word order: tap-to-build chips */
.chipline { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 10px; border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-2); margin-bottom: 10px; align-items: center; }
.chipline .ph { color: var(--muted); font-size: .88rem; }
.chipbtn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 9px 14px; font: inherit; font-size: .95rem; cursor: pointer; min-height: 42px; }
.chipbtn.on { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); font-weight: 600; }
.speakbox .acts { margin: 8px 0; flex-wrap: wrap; }

/* conversation lessons: one turn per speaker */
.text p.turn { padding: 8px 10px 8px 12px; border-left: 3px solid var(--line); border-radius: 4px 12px 12px 4px; margin: 6px 0; }
.text p.turn.nick { border-left-color: var(--blue); }
.text p.turn.other { border-left-color: var(--gold); background: var(--surface-2); }
.text .who { display: block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.text p.turn.nick .who { color: var(--blue); }
.text p.turn.other .who { color: #B07A00; }

/* side menu */
.menuwrap { position: fixed; inset: 0; z-index: 70; background: rgba(5,12,30,.5); display: flex; }
.menu { width: min(340px, 88vw); height: 100%; background: var(--surface); color: var(--ink); display: flex; flex-direction: column; box-shadow: 10px 0 30px rgba(0,0,0,.25); animation: menuin .18s ease-out; }
@keyframes menuin { from { transform: translateX(-24px); opacity: .6; } to { transform: none; opacity: 1; } }
.menuhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; background: var(--band); color: var(--band-ink); }
.menuhead .x { border-color: rgba(255,255,255,.3); color: #fff; background: transparent; }
.menubody { overflow: auto; padding: 8px 12px calc(20px + env(safe-area-inset-bottom, 0px)); flex: 1; }
.menubody .sectionlabel { margin: 16px 6px 6px; }
.mrow { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; color: inherit; text-decoration: none; min-height: 44px; }
.mrow svg { width: 22px; height: 22px; flex: none; }
.mrow .n { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface-2); font-weight: 700; font-size: .85rem; flex: none; }
.mrow .n svg { width: 16px; height: 16px; }
.mrow .t { flex: 1; font-size: .93rem; line-height: 1.3; }
.mrow:hover, .mrow:focus-visible { background: var(--surface-2); }
.mrow.here { background: var(--hl-bg); color: var(--hl-fg); }
.mrow.here .n { background: var(--gold); color: var(--gold-ink); }
.mrow.locked { opacity: .55; }
.mset { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 6px; font-size: .92rem; }
.mset.col { flex-direction: column; align-items: stretch; }
.mnote { color: var(--muted); font-size: .8rem; margin: 14px 6px 0; }
body.nomenuscroll { overflow: hidden; }
.topbar .iconbtn#menubtn { margin-right: 4px; }

/* ---------- lesson tabs, goals, writing, can-do ---------- */
.tabs { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 14px 0 12px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.tabs button { border: 0; background: transparent; border-radius: 11px; padding: 9px 2px; min-height: 44px; font: inherit; font-size: .8rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--navy); color: #fff; }
.panel[hidden] { display: none; }
.nextrow { display: flex; justify-content: flex-end; margin-top: 26px; }
.goals { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--gold); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.goals summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: baseline; font-size: .9rem; }
.goals summary::-webkit-details-marker { display: none; }
.goals .gl { font-weight: 700; color: var(--ink); }
.goals .gs { color: var(--muted); }
.goals[open] .gs { display: none; }
.goals ul { margin: 10px 0 2px 1.1em; padding: 0; color: var(--ink); font-size: .93rem; line-height: 1.5; }
.goals li { margin: 4px 0; }
.essay { width: 100%; min-height: 150px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.wcount { margin-top: 6px; font-size: .85rem; color: var(--muted); }
.wcount.ok { color: var(--ok); font-weight: 600; }
.cando .cd { padding: 12px 0; border-bottom: 1px solid var(--line); }
.cando .cd p { margin-bottom: 8px; font-weight: 500; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg3 button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px; padding: 9px 4px; min-height: 42px; font: inherit; font-size: .88rem; cursor: pointer; }
.seg3 button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.cdhint { margin-top: 8px; font-size: .86rem; color: var(--muted); }
.linkbtn { border: 0; background: none; color: var(--blue); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }

/* layout switch: classic = one long page */
.viewrow { display: flex; justify-content: flex-end; margin: 10px 0 0; }
.viewrow .linkbtn { font-size: .8rem; font-weight: 500; }
.classic .tabs, .classic .nextrow { display: none; }
.classic .panel { margin-top: 0; }
.classic .panel + .panel { margin-top: 8px; }

.goals .goalnote { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: rgba(242,183,5,.16); font-size: .92em; line-height: 1.45; }

/* Grammar tab */
.tabs button { padding-left: 1px; padding-right: 1px; }
.tabs[style*="repeat(6"] button { font-size: .72rem; }
.grammar .gtitle { font-size: 1.05rem; margin-top: 10px; color: var(--ink); }
.grammar .gsub { font-size: .95rem; margin-top: 22px; }
.gpat { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.gpat .grow { display: grid; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.gpat .grow:last-child { border-bottom: 0; }
.gpat .grow b { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gpat .gform { font-weight: 600; color: var(--blue); }
.gpat .gsample { font-size: .92rem; font-style: italic; }
.gexlist, .gspeak { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.gspeak { list-style: disc; padding-left: 20px; gap: 6px; }
.gex { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; min-height: 44px; }
.gex svg { flex: none; width: 18px; height: 18px; margin-top: 3px; color: var(--blue); }
mark.gm { background: var(--hl-bg); color: var(--hl-fg); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.gcare { margin-top: 20px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.gcare b { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.gcare p { margin-top: 6px; }
.gwrong { color: var(--bad); text-decoration: line-through; text-decoration-thickness: 1px; }
.gright { color: var(--ok); font-weight: 600; }
.gwhy { font-size: .88rem; color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Stars */
.starrow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; }
.starrow .starline { font-size: 1.35rem; letter-spacing: 3px; }
.starnote { font-size: .8rem; color: var(--band-muted); }
.starline .on { color: var(--gold); }
.starline .off { color: var(--muted); opacity: .35; }
.starrow .starline .off { color: var(--band-muted); opacity: .45; }
.lessonrow .starline { display: block; font-size: .85rem; letter-spacing: 2px; line-height: 1.2; margin-top: 2px; }
.tabs button { position: relative; }
.tabs button .ts { display: none; position: absolute; top: 1px; right: 3px; font-size: .6rem; color: var(--gold); }
.tabs button.got .ts { display: inline; }

.picgroup { margin: 14px 0 6px; font-size: 1rem; color: var(--muted); }
.picgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pic { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; text-align: center; }
.pic img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.pic figcaption { padding: 6px 4px 9px; font-weight: 700; font-size: .95rem; color: #0f2a5c; background: #fff; }
.card.haspic { position: relative; }
.card .cardpic { float: right; width: 84px; height: 84px; margin: 0 0 6px 10px; border-radius: 12px; background: #fff; border: 1px solid var(--line); object-fit: cover; }
.card.haspic .acts { clear: both; }
@media (min-width: 640px) { .picgrid { grid-template-columns: repeat(6, 1fr); } }

.picgrid.wide { grid-template-columns: repeat(2, 1fr); }
.picgrid.wide .pic img { aspect-ratio: 4 / 3; object-fit: contain; }
@media (min-width: 640px) { .picgrid.wide { grid-template-columns: repeat(3, 1fr); } }

/* curtain header */
.curtain { position: fixed; top: 0; left: 0; right: 0; z-index: 40; background: var(--band); color: var(--band-ink); padding: calc(env(safe-area-inset-top, 0px) + 6px) max(var(--gutter), env(safe-area-inset-left, 0px)) 8px; transform: translateY(-115%); transition: transform .7s cubic-bezier(.22, 1, .36, 1); box-shadow: 0 6px 18px rgba(0,0,0,.18); pointer-events: none; }
.curtain.open { transform: translateY(0); pointer-events: auto; }
.curtain::after { content: ""; position: absolute; left: 0; right: 0; bottom: -11px; height: 12px; background: radial-gradient(circle at 10px 0, var(--band) 10px, transparent 10.5px) 0 0 / 20px 12px repeat-x; filter: drop-shadow(0 2px 0 var(--gold)); }
.curtainrow { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.curtain .iconbtn { color: var(--band-ink); border-color: rgba(255,255,255,.28); width: 40px; height: 40px; flex: none; }
.curtaintitle { flex: 1; min-width: 0; text-align: center; color: var(--band-ink); text-decoration: none; font-weight: 600; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media print { .curtain { display: none; } }

/* ---------- Break time: memory pairs ---------- */
.gamebox { gap: 14px; }
.gamehead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.gamectl { gap: 10px; flex-wrap: wrap; }
.gsel { min-height: 40px; max-width: 100%; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: .9rem; }
.gamebox .seg button:disabled { opacity: .45; }
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (min-width: 640px) { .mgrid { grid-template-columns: repeat(4, 1fr); } }
.mcard { position: relative; aspect-ratio: 1 / 1.08; padding: 0; border: 0; background: none; border-radius: 16px; perspective: 700px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mcard:disabled { cursor: default; }
.mface { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; transition: transform .35s ease; box-shadow: var(--shadow); }
.mback { background: var(--blue); border: 2px solid var(--blue); transform: rotateY(0); }
.mback img { width: 46%; height: auto; opacity: .95; }
.mfront { background: var(--surface); border: 2px solid var(--line); transform: rotateY(180deg); padding: 6px; }
.mcard.up .mback, .mcard.done .mback { transform: rotateY(-180deg); }
.mcard.up .mfront, .mcard.done .mfront { transform: rotateY(0); }
.mfront img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; background: #fff; }
.mtxt { font-weight: 600; text-align: center; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }
.mtxt.word { font-size: clamp(1rem, 4.4vw, 1.3rem); }
.mtxt.def { font-size: clamp(.68rem, 2.7vw, .85rem); font-weight: 500; }
.mcard.done .mfront { border-color: var(--ok); background: var(--ok-bg); }
.mcard:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.gdone { display: grid; gap: 8px; justify-items: start; padding: 14px 16px; border-radius: 14px; background: var(--ok-bg); border: 1px solid var(--ok); color: var(--ink); }
.gdone span { font-size: .9rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .mface { transition: none; } }
.gamebox, .gamebox > * { min-width: 0; }
.gamectl { align-items: stretch; }
.gamectl .gsel { flex: 1 1 100%; width: 100%; min-width: 0; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }

/* ---------- Break time: game picker, sentence builder, picture quiz ---------- */
.gamepick { margin: 4px 0 12px; display: flex; flex-wrap: wrap; }
.gamepick button { flex: 1 1 auto; }
.sbline { min-height: 64px; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border: 2px dashed var(--line); border-radius: 14px; background: var(--surface-2); align-items: center; }
.sbhint { color: var(--muted); font-size: .85rem; }
.sbbank { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; }
.sbchip { min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--blue); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 1rem; cursor: pointer; }
.sbchip.placed { background: var(--blue); color: var(--blue-ink); }
.gdone.bad { background: var(--bad-bg); border-color: var(--bad); }
.qpic { display: flex; justify-content: center; }
.qpic img { width: min(100%, 220px); aspect-ratio: 1 / 1; object-fit: contain; background: #fff; border-radius: 18px; border: 2px solid var(--line); box-shadow: var(--shadow); }
.qopts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qopt { min-height: 52px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 1rem; cursor: pointer; }
.qopt.good { border-color: var(--ok); background: var(--ok-bg); }
.qopt.badpick { border-color: var(--bad); background: var(--bad-bg); }
.qopt:disabled { cursor: default; }

.seenstar { background: none; border: 0; color: var(--gold); font-size: 1.05rem; line-height: 1; padding: 2px 6px; margin-left: 2px; cursor: pointer; }
.seennote { margin: 4px 0 6px; font-size: .86rem; color: var(--muted); }
.seennote a { color: inherit; font-weight: 600; }
.songnotes { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line, rgba(128,128,128,.25)); }
.songnotes h4 { margin: 0 0 6px; }
.songnotes p { margin: 0 0 6px; font-size: .92rem; }
.mabout { padding: 2px 4px 8px; font-size: .88rem; color: var(--muted); }
.mabout p { margin: 0 0 8px; }
.mabout .gold { color: var(--gold); }

/* v46 picture badges */
.lessonrow .n.pic { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--surface-2); overflow: visible; display: block; }
.lessonrow .n.pic i { position: absolute; inset: 0; border-radius: 50%; background-size: cover; background-position: center; background-color: #fff; box-shadow: 0 0 0 3px var(--c); }
.lessonrow .n.pic b { position: absolute; right: -7px; bottom: -5px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--c); color: #fff; font-size: .78rem; line-height: 1; display: grid; place-items: center; border: 2.5px solid var(--surface); }
.lessonrow.open .n.pic, .lessonrow.done .n.pic { background: none; color: inherit; }
.lessonrow.done .n.pic b { background: var(--ok); }
.lessonrow.done .n.pic b svg { width: 12px; height: 12px; }
.lessonrow:has(.n.pic) { grid-template-columns: 52px 1fr auto; gap: 14px; }
.hero.picd { background-size: cover; background-position: center 35%; min-height: 250px; display: flex; flex-direction: column; justify-content: space-between; }
.hero.picd::before { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, var(--band) 6%, rgba(11,46,107,.62) 52%, rgba(11,46,107,.35) 100%); pointer-events: none; }
.hero.picd > .col { position: relative; z-index: 1; }
.hero.picd::after { z-index: 1; }
.daytag { display: inline-block; flex: none; background: var(--c); color: #fff; font-weight: 700; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; padding: 5px 12px; border-radius: 9px; transform: rotate(-3deg); align-self: flex-start; box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.hero.picd .herorow { flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 36px; }

/* compact lesson header */
.hero.picd, .hero.heroB { padding-bottom: 22px; margin-bottom: 18px; }
.hero.picd { min-height: 0; }
.hero.picd .herorow { margin-top: 20px; gap: 6px; }
.hero.picd h1, .hero.heroB h1 { font-size: clamp(1.25rem, 5vw, 1.6rem); }
.hero.picd .meta, .hero.heroB .meta { margin-top: 6px; font-size: .8rem; gap: 2px 12px; }
.hero.picd .meta span:nth-child(4), .hero.heroB .meta span:nth-child(4) { display: none; }
.hero.picd .starrow, .hero.heroB .starrow { margin-top: 6px; gap: 2px 10px; }
.hero.picd .starrow .starline, .hero.heroB .starrow .starline { font-size: 1.1rem; letter-spacing: 2px; }
.hero.heroB { padding-top: calc(env(safe-area-inset-top, 0px) + 18px); }
.hero.heroB .herorow { margin-top: 8px; gap: 12px; }
.hero.heroB .htile { width: 68px; height: 68px; }
.hero.heroB .htile i { inset: 4px; }
.hero.heroB .shp1 .hfr, .hero.heroB .shp1 i { border-radius: 16px; }

/* v46 header: sharp picture circle instead of stretched background */
.hero.picd { background: linear-gradient(120deg, var(--c) -40%, var(--band) 62%); }
.hero.picd::before { display: none; }
.hero.picd .herorow { flex-direction: row; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; }
.hero.picd .htxt { min-width: 0; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hero.picd .herorow h1 { margin: 0; }
.hpic { flex: none; width: 96px; height: 96px; border-radius: 50%; background-size: cover; background-position: center; background-color: #fff; border: 4px solid #fff; box-shadow: 0 0 0 3px var(--c), 0 6px 16px rgba(0,0,0,.35); }
/* v46: colored line on top of the lesson header (day color) */
.hero.picd { padding-top: calc(env(safe-area-inset-top, 0px) + 22px); }
.hero.picd::before { display: block; content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: auto; height: 10px; inset: 0 0 auto 0; background: var(--c); }

.picgrid.solo { grid-template-columns: minmax(0, 340px); }
.picgrid.solo .pic img { aspect-ratio: 1 / 1; object-fit: contain; }

/* writing checker */
.wcheckrow { margin-top: 10px; }
.wresult { margin-top: 12px; }
.wsum { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; }
.wissue { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.wissue.good { border-color: var(--ok); background: var(--ok-bg); }
.wsnip { font-size: .88rem; color: var(--muted); line-height: 1.5; }
.wsnip mark { background: var(--bad-bg); color: var(--bad); padding: 0 3px; border-radius: 4px; font-weight: 600; }
.wfix { margin-top: 6px; font-size: 1rem; }
.wold { color: var(--bad); text-decoration: line-through; }
.wnew { color: var(--ok); }
.wtip { margin: 6px 0 10px; font-size: .88rem; color: var(--muted); line-height: 1.45; }
.wissue .btn { margin-top: 2px; }
.wnote { font-size: .8rem; color: var(--muted); margin-top: 6px; }
