:root {
  --bg: #f6efe4; --surface: #fffaf1; --ink: #2b2118; --muted: #7d6e5e; --line: #e6d9c5;
  --accent: #c8783c; --accent-ink: #fff; --blue: #2f5d7c;
  --r1: #b8453a; --r2: #c98a2b; --r3: #2e9d5e; --r4: #2f5d7c;
  --k1: var(--r1); --k2: var(--r2); --k3: var(--r3); --k4: var(--r4); --k5: #6fbf9a; --k6: #7a5bb0;   /* rating-button colors for the progress bar and legend */
  --shadow: 0 10px 30px rgba(80, 50, 20, .14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17120d; --surface: #241c14; --ink: #f1e6d4; --muted: #a39482; --line: #3a2e22;
    --accent: #e0914f; --accent-ink: #1b1209; --blue: #7fb0d0; --shadow: 0 10px 30px rgba(0,0,0,.5);
    --k1: #a8453b; --k2: #a87420; --k3: #3aa366; --k4: #3a6786; --k5: #8fd6b3; --k6: #a98be0; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, system-ui, "Segoe UI", sans-serif; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { min-height: 100%; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 0; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; max-width: 980px; width: 100%; margin: 0 auto; }
.brand { font: 700 20px var(--serif); display: flex; align-items: center; gap: 10px; letter-spacing: .02em; }
.sun { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd89a, var(--accent)); box-shadow: 0 0 14px var(--accent); }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tabs button { padding: 7px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 15px; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); }

main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 0 20px calc(28px + env(safe-area-inset-bottom)); }
.tab { display: none; } .tab.on { display: block; }
.panel { --px: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 28px; max-width: 560px; margin: 12px auto; box-shadow: var(--shadow); }
.panel.wide { max-width: 720px; }
h1 { font: 700 30px/1.15 var(--serif); margin: 0 0 18px; }
.muted { color: var(--muted); } .small { font-size: 13px; }

.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.counters div { background: var(--bg); border-radius: 16px; padding: 14px 8px; text-align: center; }
.counters b { display: block; font: 700 32px var(--serif); }
.counters span { font-size: 13px; color: var(--muted); }

.primary { background: var(--accent); color: var(--accent-ink); border-radius: 16px; padding: 13px 22px; font-weight: 700; }
.primary.big { width: 100%; padding: 17px; font-size: 18px; }
.primary:active { transform: scale(.98); }
.secondary { display: block; width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; font-weight: 600; background: var(--bg); }
.danger { display: block; width: 100%; padding: 13px; border-radius: 14px; color: var(--r1); border: 1px solid var(--r1); font-weight: 600; margin-top: 18px; }
.link { color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; padding: 10px; display: block; margin: 6px auto 0; text-align: center; }
.known { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 6px; padding: 13px;
  border: 1.5px solid var(--r3); color: var(--r3); border-radius: 16px; font-weight: 700; background: transparent; }
.known span { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--r3); color: #fff; font-size: 13px; }
.known:active { transform: scale(.98); background: color-mix(in srgb, var(--r3) 14%, transparent); }
.ghost { width: 40px; height: 40px; border-radius: 50%; font-size: 20px; color: var(--muted); }
.ghost:disabled { opacity: .3; }
kbd { font: 12px ui-monospace, monospace; opacity: .6; border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; margin-left: 6px; }

.progress { margin-top: 24px; }
.bar { height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; transition: width .5s; }
#bar-new { background: var(--muted); opacity: .35; } #bar-g1 { background: var(--k1); } #bar-g2 { background: var(--k2); } #bar-g3 { background: var(--k4); } #bar-g4 { background: var(--k3); } #bar-skipped { background: var(--k5); } #bar-known { background: var(--k6); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.legend i.u { background: var(--muted); opacity: .45; } .legend i.g1 { background: var(--k1); } .legend i.g2 { background: var(--k2); } .legend i.g3 { background: var(--k4); } .legend i.g4 { background: var(--k3); } .legend i.s { background: var(--k5); } .legend i.k6 { background: var(--k6); }
.learned-note { margin: 8px 0 0; } .learned-note b { color: var(--ink); }
.legend b { color: var(--ink); margin-right: 3px; }

.stats { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.stats h3 { margin: 0 0 10px; font: 700 18px var(--serif); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tiles div { background: var(--bg); border-radius: 14px; padding: 12px; }
.tiles.one { grid-template-columns: 1fr; }
.chartcard { background: var(--bg); border-radius: 14px; padding: 12px; margin-top: 10px; }
.chead { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.chead b { display: block; font: 700 26px var(--serif); }
.chead span, .chead small { font-size: 12px; color: var(--muted); }
.tiles b { display: block; font: 700 26px var(--serif); }
.tiles span { font-size: 12px; color: var(--muted); }
.chart14 { display: flex; align-items: flex-end; gap: 3px; margin-top: 10px; }
.chart14 .d { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; }
.chart14 b { font-size: 10px; line-height: 12px; height: 12px; font-weight: 600; color: var(--muted); }
.chart14 i { width: 100%; max-width: 22px; background: var(--accent); border-radius: 4px 4px 0 0; opacity: .5; }
.chart14 i.zero { background: var(--line); opacity: 1; }
.chart14 span { font-size: 10px; line-height: 16px; padding: 0 5px; border-radius: 8px; color: var(--muted); }
.chart14 .today b { color: var(--ink); font-size: 12px; }
.chart14 .today i { opacity: 1; box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 55%, transparent); }
.chart14 .today span { background: var(--accent); color: #1a120a; font-weight: 700; }

.nudge { position: relative; margin: 0 0 14px; border: 1.5px solid var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--accent) 9%, transparent); }
.nudge[hidden] { display: none; }
.nudge summary { list-style: none; cursor: pointer; padding: 14px 44px 14px 14px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nudge summary::-webkit-details-marker { display: none; }
.nudge summary::after { content: ''; width: 8px; height: 8px; margin: 0 4px 0 auto; border: solid var(--accent); border-width: 0 2px 2px 0; transform: translateY(-3px) rotate(45deg); transition: transform .2s ease; flex: none; }
.nudge[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.nudge p { margin: 0 14px 10px; font-size: 14px; color: var(--muted); }
.nudge .primary { margin: 0 14px 14px; padding: 9px 14px; font-size: 14px; }
.nudge .nx { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; font-size: 22px; color: var(--muted); }
.more { margin: 14px 0 0; text-align: center; }
.morebtns { display: flex; gap: 8px; justify-content: center; }
.morebtns button { flex: 1; max-width: 110px; min-width: 0; padding: 11px 0; border: 1.5px solid var(--accent); color: var(--accent); border-radius: 14px; font-weight: 700; font-size: 16px; }
.morebtns button:active { transform: scale(.96); background: color-mix(in srgb, var(--accent) 14%, transparent); }

.forecast { margin-top: 14px; display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 15px; }
.forecast span { color: var(--muted); } .forecast b { text-align: right; font-weight: 700; }
.forecast .note { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.ahead { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; background: color-mix(in srgb, var(--r3) 16%, transparent); color: var(--r3); }
.ahead.behind { background: color-mix(in srgb, var(--r2) 16%, transparent); color: var(--r2); }

/* study */
.study { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.study-top { display: flex; align-items: center; gap: 10px; }
.session-bar { flex: 1; height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; }
.session-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.scene { perspective: 1400px; height: min(52vh, 420px); min-height: 300px; cursor: pointer; }
.card { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3, .8, .3, 1); }
.card.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--surface);
  border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); padding: 26px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: 10px; overflow: auto; }
.face.back { transform: rotateY(180deg); }
.tag { position: absolute; top: 16px; left: 18px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.tag.new { color: var(--blue); }
.word { font: 700 clamp(34px, 9vw, 52px)/1.1 var(--serif); overflow-wrap: anywhere; }
.pos { color: var(--muted); font-style: italic; }
.hint { position: absolute; bottom: 16px; font-size: 13px; color: var(--muted); }
.sub { font: 600 20px var(--serif); color: var(--muted); }
.note { text-align: left; background: color-mix(in srgb, var(--accent) 13%, transparent); border-radius: 12px; padding: 10px 12px; font-size: 14px; line-height: 1.45; width: 100%; margin-top: 6px; }
.note b { font-weight: 700; }
.nt { cursor: pointer; font-size: 15px; padding: 4px; }
.wordlist li { flex-wrap: wrap; }
.wordlist .ntx { flex: 0 0 100%; margin: 2px 0 4px; }
.ex { margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line); width: 100%; }
.ex p { margin: 0 0 4px; font-size: 16px; } .ex p.uk { color: var(--muted); font-size: 15px; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; padding: 0 3px; border-radius: 4px; }
.say { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); font-size: 18px; }
.say:active { transform: scale(.92); }

.actions { display: flex; flex-direction: column; gap: 6px; }
.rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rates button { border-radius: 16px; padding: 12px 4px; color: #fff; display: flex; flex-direction: column; gap: 2px; align-items: center; font-weight: 700; }
.rates small { font-weight: 500; opacity: .85; font-size: 12px; }
.rates kbd { display: none; margin: 4px 0 0; color: #fff; }
@media (hover: hover) and (pointer: fine) { .rates kbd { display: inline-block; } }
.r1 { background: var(--r1); } .r2 { background: var(--r2); } .r3 { background: var(--r3); } .r4 { background: var(--r4); }
.rates button:active { transform: scale(.96); }
@media (prefers-color-scheme: dark) { .r1 { background: #a8453b; } .r2 { background: #a87420; } .r3 { background: #3aa366; } .r4 { background: #3a6786; } }

.selftest { align-self: center; color: var(--muted); font-size: 14px; padding: 8px 14px; border: 1px dashed var(--line); border-radius: 99px; }
.typeform { display: flex; flex-direction: column; gap: 8px; }
.typerow { display: flex; gap: 8px; }
.typerow input { flex: 1; min-width: 0; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 20px; }
.mic { width: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 22px; flex: none; }
.mic.rec { background: var(--r1); border-color: var(--r1); animation: pulse 1s infinite; }
.mic.rec { position: relative; }
.mic.rec::before { content: ''; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 4px; background: #fff; }
.mic.busy { color: transparent; position: relative; pointer-events: none; }
.mic.busy::before, .mic.busy::after { content: ''; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; box-sizing: border-box; border: 3px solid var(--line); border-radius: 50%; }
.mic.busy::after { border-color: transparent; border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--r1) 25%, transparent); } }
.result { margin: 0; padding: 11px 14px; border-radius: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); }
.result small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.result.ok { border-color: var(--r3); color: var(--r3); } .result.near { border-color: var(--r2); color: var(--r2); } .result.wrong { border-color: var(--r1); color: var(--r1); }
.rates button.sug { outline: 3px solid var(--ink); outline-offset: 2px; }

.overlay.tri-overlay { z-index: 60; }
.tri { max-width: 520px; text-align: center; }
.tri-top { display: flex; align-items: center; gap: 10px; }
.tri-word { font: 700 clamp(38px, 11vw, 58px)/1.1 var(--serif); margin: 34px 0 6px; overflow-wrap: anywhere; min-height: 1.2em; }
.tri-tr { color: var(--muted); font-size: 20px; min-height: 1.6em; margin-bottom: 24px; }
.tri-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tri-tip button + button { margin-top: 12px; }
.tri-btns button { padding: 20px 0; border-radius: 18px; font: 700 20px inherit; color: #fff; }
.tri-btns .no { background: var(--r1); } .tri-btns .yes { background: var(--r3); }
.tri-btns button:active { transform: scale(.97); }
#triage-btn { margin-bottom: 8px; border-color: var(--accent); color: var(--accent); }

/* words */
input[type=search], input[type=number], select { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.filters button { padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.filters button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
/* two rows of filters (status, level): status stays on one line (scrolls sideways on a phone), a clear gap before the level row */
#filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 5px; margin-bottom: 22px; }
#filters::-webkit-scrollbar { display: none; }
#filters button, #level-filters button { flex: none; white-space: nowrap; padding: 6px 11px; font-size: 13.5px; }
#level-filters { margin-top: 0; gap: 5px; }
.wordlist { list-style: none; margin: 0; padding: 0; }
.wordlist li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.wordlist .wc { display: flex; flex-direction: column; flex: 0 1 40%; min-width: 0; }
.wordlist li { overflow: hidden; transition: opacity .25s ease, transform .25s ease, max-height .25s ease .03s, padding .25s ease .03s; }
.wordlist li.out { opacity: 0; transform: translateX(24px); max-height: 0 !important; padding-top: 0; padding-bottom: 0; border-bottom-color: transparent; pointer-events: none; }
.wordlist .w { font: 700 18px var(--serif); overflow-wrap: anywhere; line-height: 1.2; }
.wordlist .w.long { font-size: 15px; }
.wordlist .u { color: var(--muted); font-size: 15px; flex: 1 1 0; min-width: 0; overflow-wrap: break-word; hyphens: manual; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--line); }
.dot.new { background: var(--muted); opacity: .45; } .dot.g1 { background: var(--k1); } .dot.g2 { background: var(--k2); } .dot.g3 { background: var(--k4); } .dot.g4 { background: var(--k3); } .dot.skipped { background: var(--k5); } .dot.known { background: var(--k6); }
.wordlist button { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; flex: none; }

/* help */
.prose { line-height: 1.6; }
.prose h1 { margin-bottom: 12px; }
.prose h2 { font: 700 21px var(--serif); margin: 28px 0 8px; }
.prose p, .prose li { font-size: 16px; }
.prose ol, .prose ul { padding-left: 22px; margin: 8px 0; }
.prose li { margin: 6px 0; }
.prose ul.btns { list-style: none; padding: 0; }
.prose ul.btns li { padding-left: 0; }
.prose ul.btns b { display: inline-block; min-width: 82px; text-align: center; padding: 2px 10px; border-radius: 9px; color: #fff; margin-right: 6px; font-size: 14px; }
.c1 { background: var(--r1); } .c2 { background: var(--r2); } .c3 { background: var(--r3); } .c4 { background: var(--r4); }
.prose kbd { margin: 0 2px; opacity: .8; }
figure { margin: 18px 0; }
figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }
#curve svg { width: 100%; height: auto; display: block; background: var(--bg); border-radius: 14px; }
#curve text { fill: var(--muted); font: 11px -apple-system, system-ui, sans-serif; }

/* accounts & leaderboard: a table, a column header sorts by it; the player column stays put when the numbers scroll sideways */
.lbwrap { margin: 14px -6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lbt { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 0; }
.lbt th, .lbt td { padding: 11px 6px; border-bottom: 1px solid var(--line); background: var(--surface); }
.lbt thead th { padding: 4px 2px 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; white-space: nowrap; }
.lbt thead th.nmc { text-align: left; padding-left: 6px; }
.lbt thead th button { padding: 6px 6px; border-radius: 8px; font: inherit; color: inherit; }
.lbt thead th button:focus, .lbt thead th button:focus-visible { outline: none; }          /* the sorted column already shows in colour with an arrow; a ring stayed around it after a click */
.lbt thead th button:active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lbt thead th.on { color: var(--accent); }
.lbt .arr { margin-left: 2px; }
.lbt .nmc { position: sticky; left: 0; z-index: 1; }
.lbt .nmw { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lbt .pl { width: 28px; text-align: center; font: 700 17px var(--serif); flex: none; }
.lbt .nm { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbt .val { text-align: right; padding-right: 8px; color: var(--muted); } .lbt .val b { font: 700 19px var(--serif); color: var(--ink); }
.lbt .val.on { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); } .lbt .val.on b { color: var(--accent); }
.lbt tr.me td { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.lbt tr.me td.val.on { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.lbt tr.lbstat td { padding: 8px 10px 14px; }
.lbt tr.lbstat .lbstat-in { position: sticky; left: 10px; width: min(640px, calc(100vw - 90px)); }
.lbt small { color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  /* a phone: a player is a card, the name on its own full-width line, the five numbers under the sortable column titles */
  .lbwrap { margin: 14px -18px; }
  .lbt, .lbt thead, .lbt tbody { display: block; }
  .lbt tr { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
  .lbt th, .lbt td { border-bottom: 0; padding: 0; }
  .lbt thead th.nmc { display: none; }
  .lbt thead th { padding: 2px 0 8px; font-size: 11px; text-align: center; } .lbt thead th button { padding: 6px 2px; }
  .lbt td.nmc { grid-column: 1 / -1; position: static; padding: 8px 18px 0; }
  .lbt .lbinfo { width: 22px; height: 22px; } .lbt .lbinfo svg { width: 14px; height: 14px; }
  .lbt .nmw { gap: 8px; } .lbt .pl { width: 26px; font-size: 18px; } .lbt .nm { font-size: 16px; }
  .lbt td.val { text-align: center; padding: 2px 0 10px; } .lbt .val b { font-size: 18px; }
  .lbt tr.lbstat td, .lbt td[colspan] { grid-column: 1 / -1; padding: 8px 18px 14px; }
  .lbt tr.lbstat .lbstat-in { position: static; width: auto; }
}
.brandrow { display: flex; align-items: center; gap: 12px; }
.who { padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 13px; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who.off { border-style: dashed; }
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow: auto; display: flex; padding: 20px; -webkit-overflow-scrolling: touch; }
.overlay .panel { width: 100%; margin: auto; }
#login-mode { margin: 4px 0 8px; }
.overlay input[type=text], .overlay input[type=email], .overlay input[type=password] { width: 100%; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 20px; margin: 12px 0 4px; }
.err { color: var(--r1); min-height: 1.4em; margin: 4px 0 10px; font-size: 14px; }
.recent { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.recent button { padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; }

.overlay.gender-overlay { z-index: 55; }
.gbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }

/* onboarding */
.onb { max-width: 560px; }
.dots { display: flex; gap: 8px; justify-content: center; margin-bottom: 18px; }
.dots i { width: 28px; height: 5px; border-radius: 9px; background: var(--line); }
.dots i.on { background: var(--accent); } .dots i.done { background: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.onb h1 { font-size: 26px; }
.onb-list { padding-left: 20px; } .onb-list li { margin: 10px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; max-height: 40vh; overflow: auto; }
.chip { padding: 8px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; font-size: 15px; }
.chip.on { background: var(--r3); border-color: var(--r3); color: #fff; }
.chips.all { max-height: none; }
.chip.kp { background: transparent; border-color: var(--accent); color: var(--accent); }
.chips.quick .chip { font-weight: 500; }
.onb-actions { display: flex; gap: 10px; margin-top: 18px; }
.onb-actions button { flex: 1; padding: 14px; border-radius: 14px; font-weight: 700; }
.onb-actions .secondary { margin: 0; width: auto; }
.onb label.line { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.onb label.line input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
.onb .field { width: 100%; margin: 8px 0; }

.levels { margin-top: 0; }
.lvl { font-size: 11px; letter-spacing: 1px; color: var(--accent); flex: none; white-space: nowrap; }
.bulk { margin: 4px 0 10px; } .bulk .secondary { margin: 0; border-color: var(--r3); color: var(--r3); font-size: 14px; padding: 11px; }
.bulk-msg { background: var(--bg); border-radius: 12px; padding: 10px 14px; margin: 0 0 10px; font-size: 14px; }
.bulk-msg button { color: var(--accent); font-weight: 700; margin-left: 8px; text-decoration: underline; }
.onb .tier { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.onb .tier button { flex: 1; min-width: 140px; padding: 10px; border: 1.5px solid var(--r3); color: var(--r3); border-radius: 12px; font-weight: 600; font-size: 14px; }
.onb .tier button:disabled { opacity: .4; }

.lb-legend { line-height: 1.6; } .lb-legend b { color: var(--ink); }

/* settings */
.plan-title { font-weight: 700; margin-bottom: 8px; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 9px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.row small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
.pace { background: var(--bg); border-radius: 12px; padding: 12px 14px; margin: 10px 0 0; font-size: 14px; }
.pace.warn { border: 1px solid var(--r2); }
input:disabled { opacity: .45; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row input[type=number], .row select, .row input[type=date] { width: 150px; flex: none; }
input[type=date] { padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
.row input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); flex: none; }
hr { border: 0; margin: 14px 0; }

@media (max-width: 600px) {
  .top { flex-direction: column; gap: 10px; padding: 12px 14px 6px; }
  .brandrow { width: 100%; justify-content: center; }
  main { padding: 0 14px calc(24px + env(safe-area-inset-bottom)); }
  .panel { --px: 18px; padding: 22px 18px; }
  .tabs { width: 100%; gap: 1px; } .tabs button { flex: 1 1 auto; padding: 8px 4px; font-size: 12.5px; white-space: nowrap; }
  .scene { height: 48vh; }
}
@media (min-width: 900px) { .study { max-width: 640px; } .scene { height: 440px; } }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
.ratehint { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 4px 2px 8px; font-size: 13px; color: var(--muted); text-align: left; }
.ratehint[hidden], .ratehelp[hidden] { display: none; }
.qm { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 14px; line-height: 1; }
.ratehelp { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); font-size: 14px; }
.rh { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; }
.ratehelp .rh { margin: 0; }
.rh li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; }
.rh i { flex: none; width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; background: var(--r1); }
.rh i.r2 { background: var(--r2); } .rh i.r3 { background: var(--r3); } .rh i.r4 { background: var(--r4); } .rh i.kn { background: transparent; border: 2px solid var(--r3); }
.ghost.stop { width: auto; height: 36px; padding: 0 12px; border-radius: 18px; font-size: 14px; font-weight: 600; flex: none; }
.toast { position: fixed; left: 16px; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 12px); max-width: 420px; margin: 0 auto; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14px; text-align: center; box-shadow: var(--shadow); opacity: 0; transform: translateY(-12px); pointer-events: none; transition: opacity .25s, transform .25s; z-index: 80; }
.toast.on { opacity: 1; transform: none; }
.rh em { display: block; margin-top: 2px; font-style: normal; font-size: 13px; color: var(--muted); }
.overlay .onb-actions { position: sticky; bottom: -20px; z-index: 1; margin-top: 12px; padding: 12px 20px; }
.overlay .onb-actions::before { content: ''; position: absolute; z-index: -1; top: 0; bottom: 0; left: calc(-1 * var(--px)); right: calc(-1 * var(--px));
  border-top: 1px solid var(--line); background: transparent; -webkit-backdrop-filter: blur(2px) saturate(1.5); backdrop-filter: blur(2px) saturate(1.5); }
.ghost svg { display: block; margin: auto; }
.tabs::-webkit-scrollbar { display: none; }
.suggest { display: flex; gap: 8px; margin-top: 8px; }
.suggest input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; }
.suggest .primary { padding: 0 16px; border-radius: 12px; font-weight: 700; }
#suggest-open { display: block; margin: 10px auto 0; font-size: 13px; }
#suggest-open[hidden], .suggest[hidden] { display: none; }

.lbt .lbinfo { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); border: 0; background: transparent; transition: background .2s, color .2s; }
.lbt .lbinfo[aria-expanded="true"] { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.lbstat-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; font-weight: 600; margin-bottom: 8px; font-size: 14px; }
.lbstat-h .pillbtn { margin: 0; padding: 4px 10px; font-size: 12px; white-space: nowrap; flex: none; }
.lbstat-in .bar { height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; display: flex; }
.lbstat-in .bar i { display: block; height: 100%; }
.lbstat-in .legend { font-size: 12px; margin-top: 8px; gap: 4px 12px; }

.legend .passed { flex-basis: 100%; margin-top: 2px; }
.legend .passed b { margin-right: 0; }
.passed-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; margin-bottom: 8px; font-size: 15px; color: var(--muted); }
.passed-line > span { white-space: nowrap; }
.passed-line b { color: var(--ink); font: 700 22px var(--serif); }
.passed-line b#n-pct { font-family: inherit; font-size: 15px; font-weight: 600; }
.dot-learned { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--k6); margin-right: 6px; }
.passed-line .pillbtn { margin: 0; padding: 5px 11px; font-size: 12px; white-space: nowrap; flex: none; }
.pillbtn { display: inline-block; margin-top: 10px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; }
.pillbtn:active { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.pillbtn[hidden] { display: none; }

/* film packs */
.pkbox .row.pk:last-of-type { border-bottom: 0; }
.pkqueue { list-style: none; margin: 8px 0 0; padding: 0; }
.pkqueue li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 8px 12px; background: var(--bg); border-radius: 12px; margin-bottom: 6px; font-size: 14px; }
.pksearch { margin: 10px 0 4px; }
.pksearch .field { width: 100%; margin: 0; }
.pkadd { width: auto; flex: none; padding: 8px 16px; font-size: 15px; }
.pksearch .field { padding: 11px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); color: var(--ink); font-size: 16px; }
.row.pk { gap: 14px; }
.pkcover { width: 72px; height: 106px; border-radius: 6px; object-fit: cover; flex: none; background: var(--bg); border: 1px solid var(--line); }
.pkt { flex: 1; min-width: 0; }
.pkmembers { margin: 0 0 6px 14px; padding-left: 10px; border-left: 2px solid var(--line); }
.pkmembers[hidden] { display: none; }
.pkopen { text-align: left; background: none; border: 0; color: inherit; font: inherit; padding: 0; cursor: pointer; }
.pkchev { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pkchev svg { transition: transform .2s; }
.pkchev.open svg { transform: rotate(180deg); }
.pkhead { margin-bottom: 0; }
.row.pkm .pkcover { width: 56px; height: 82px; }
.pkbar { display: block; height: 6px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.pkbar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .6s ease; }
.pkbar.wait i { width: 35% !important; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: pkslide 1.4s ease-in-out infinite; }
@keyframes pkslide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.pkcover.sk { background: linear-gradient(100deg, var(--line) 30%, var(--bg) 50%, var(--line) 70%); background-size: 200% 100%; animation: pkshimmer 1.3s linear infinite; }
@keyframes pkshimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.row.skel { opacity: .92; }
@media (prefers-reduced-motion: reduce) { .pkbar.wait i, .pkcover.sk { animation: none; } }
.pkcover.stack { background: repeating-linear-gradient(135deg, var(--line) 0 6px, var(--bg) 6px 12px); }
.rvcard { border: 1px solid var(--accent); border-radius: 16px; padding: 12px 14px 14px; margin: 10px 0; background: var(--bg); }
.rvbtns { display: flex; gap: 10px; margin-top: 12px; }
.rvbtns button { flex: 1; margin: 0; }
.row.pk .pkt { font-size: 19px; font-weight: 600; line-height: 1.25; }
.row.pk .pkt small { font-size: 14.5px; font-weight: 400; line-height: 1.35; margin-top: 4px; }
.row.pkm .pkt { font-size: 17px; }
.row.pkm .pkt small { font-size: 14px; }
.row.pk .pkt .st { color: var(--ink); opacity: .75; }
.tri-card { position: relative; z-index: 1; margin: 0; padding: 30px 18px 26px; min-height: 230px; display: flex; flex-direction: column; justify-content: center; text-align: center;
  background: var(--surface); border: 2px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); touch-action: pan-y; transition: transform .16s ease-out, border-color .12s; will-change: transform; }
.tri-card.drag { transition: border-color .12s; }
.tri-card .tri-word { margin: 0 0 6px; }
.tri-stamp { position: absolute; top: 14px; padding: 4px 12px; border: 3px solid; border-radius: 10px; font: 800 18px var(--sans, inherit); text-transform: uppercase; letter-spacing: .04em; opacity: 0; transition: opacity .1s; pointer-events: none; }
.tri-stamp.yes { left: 14px; color: var(--r3); transform: rotate(-8deg); }
.tri-stamp.no { right: 14px; color: var(--r1); transform: rotate(8deg); }
#triage.swr .tri-card { border-color: var(--r3); } #triage.swr .tri-stamp.yes { opacity: 1; }
#triage.swl .tri-card { border-color: var(--r1); } #triage.swl .tri-stamp.no { opacity: 1; }
.tri-flip { display: grid; transform-style: preserve-3d; transition: transform .45s cubic-bezier(.3, .7, .3, 1); cursor: pointer; }
.tri-flip.noanim { transition: none; }
.tri-flip.flipped { transform: rotateY(180deg); }
.tri-face { grid-area: 1 / 1; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; flex-direction: column; justify-content: center; }
.tri-face.back { transform: rotateY(180deg); }
.tri-card { perspective: 1000px; }
.tri-card .tri-tr { margin: 0; font: 600 clamp(28px, 8vw, 40px)/1.2 var(--serif); color: var(--ink); }
.tri-msg { color: var(--muted); font-size: 18px; }
.tri-deck { position: relative; margin: 18px 0 26px; }
.tri-under { position: absolute; inset: 0; border-radius: 26px; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); transform: translateY(14px) scale(.93); transition: opacity .25s; }
.tri-deck.last .tri-under { opacity: 0; }
/* the next card was lying under this one: it rises into place (not in from a side) */
.tri-card.entering { animation: tri-in .42s cubic-bezier(.2, .8, .25, 1); }
@keyframes tri-in { from { transform: translateY(14px) scale(.93); } to { transform: none; } }
.tri-card.ghost { position: fixed; margin: 0; z-index: 90; pointer-events: none; animation: none; will-change: transform, opacity; }
.tri-card.ghost-yes { border-color: var(--r3); } .tri-card.ghost-yes .tri-stamp.yes { opacity: 1; }
.tri-card.ghost-no { border-color: var(--r1); } .tri-card.ghost-no .tri-stamp.no { opacity: 1; }
.chips.sample { max-height: none; }
.chip.st { cursor: default; pointer-events: none; user-select: none; -webkit-user-select: none; }
.onb-q { margin: 18px 0 8px; font-size: 17px; }
.onb-opt { border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 10px; margin: 10px 0; background: var(--bg); }
.onb-opt.yes { border-color: var(--accent); }
.onb-opt button { width: 100%; margin: 8px 0 2px; }
.onb-opt .tier { margin: 0; }
.onb-opt p { margin: 4px 0 6px; }
.chip.st { background: var(--bg); border-color: transparent; font-weight: 500; color: var(--muted); }
.tri-deck { --p: 0; }
.tri-under { display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
  transform: translateY(calc(14px * (1 - var(--p)))) scale(calc(0.93 + 0.07 * var(--p))); opacity: calc(0.65 + 0.35 * var(--p)); transition: transform .3s, opacity .3s; }
.tri-deck.dragging .tri-under { transition: none; }
.tri-under .tri-word { margin: 0; color: var(--ink); opacity: calc(0.25 + 0.75 * var(--p)); }
.tri-card.reset, .tri-card.reset .tri-stamp { transition: none !important; }
.tri-under { padding: 30px 18px 26px; box-sizing: border-box; }
.ipa { color: var(--muted); font: 400 21px/1.3 "Noto Sans", "Lucida Sans Unicode", "Segoe UI", system-ui, sans-serif; letter-spacing: .02em; margin: 2px 0 6px; }
.tri-card .ipa { margin: 0 0 8px; }
.tri-pron { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 6px; }
.tri-pron .ipa { margin: 0; }
.tri-say { width: 38px; height: 38px; font-size: 16px; flex: none; }
.tri-say[hidden], .ipa[hidden], .tri-pron[hidden] { display: none; }
#tri-mute { font-size: 20px; }
.tri-pos { margin: 0 0 6px; }
.tri-pos[hidden] { display: none; }
.pkseries { padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.pkseries .row.pk { border-bottom: 0; padding-bottom: 4px; }
.chips.seasons { margin: 2px 0 8px; }
.chips.seasons .chip { min-width: 40px; text-align: center; }
.chip.on[disabled] { opacity: .45; }
.chip.busy[disabled] { background: transparent; border: 1.5px dashed var(--accent); color: var(--accent); opacity: 1; }
.chip.on.pick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pkadd.wide { width: 100%; margin: 0; }

/* accounts: login form extras, the profile block in settings, the banner on the home screen */
.overlay input[hidden] { display: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 14px 0 10px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
#g-btn { display: flex; justify-content: center; min-height: 44px; }
#login-form .link { display: block; margin: 6px auto 0; }
#acct { margin: 6px 0 10px; }
#acct .arow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
#acct .arow > div { min-width: 0; }
#acct .arow small { display: block; color: var(--muted); overflow-wrap: anywhere; }
#acct .arow b { overflow-wrap: anywhere; }
#acct .arow button { flex: none; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-weight: 600; }
#acct .badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; margin-left: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
#acct .badge.ok { color: #2e9c66; border-color: #2e9c66; }
#acct .badge.warn { color: var(--r1); border-color: var(--r1); }
#acct form { display: grid; gap: 8px; padding: 12px 0; }
#acct form input { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; }
#acct form .btns { display: flex; gap: 8px; }
#acct .aerr { color: var(--r1); font-size: 14px; min-height: 1.2em; }
#acct .ginline { margin: 10px 0 2px; }
.acct-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin: 0 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); font-size: 14px; }
.acct-banner span { flex: 1 1 200px; }
.acct-banner button { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.acct-banner button.x { border: 0; padding: 4px 8px; color: var(--muted); }

.a2hs { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 45; max-width: 460px; margin: 0 auto; padding: 16px 18px 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); animation: a2hs-in .35s ease; }
.a2hs b { display: block; padding-right: 28px; font-size: 17px; }
.a2hs p { margin: 6px 0 0; font-size: 14px; line-height: 1.45; }
.a2hs ol { margin: 10px 0 8px; padding-left: 22px; font-size: 15px; line-height: 1.5; }
.a2hs li b { display: inline; padding: 0; font-size: inherit; }
.a2hs-ico { display: inline-flex; vertical-align: -5px; color: var(--blue); }
.a2hs .primary { width: 100%; margin-top: 10px; }
.a2hs-x { position: absolute; top: 6px; right: 8px; width: 36px; height: 36px; font-size: 24px; line-height: 1; color: var(--muted); }
@keyframes a2hs-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
#acct .arow button.link { border: 0; background: none; padding: 0; margin-left: 6px; text-decoration: underline; font-weight: 500; color: var(--muted); }
.a2hs[data-os=ios] .a2hs-and, .a2hs[data-os=android] .a2hs-ios { display: none; }
.a2hs.native ol, .a2hs.native .a2hs-note { display: none; }
.a2hs.native #a2hs-ok { background: none; color: var(--muted); font-weight: 600; margin-top: 2px; }
.a2hs { max-height: calc(100vh - 24px); overflow: auto; }
.a2hs-vid { display: block; width: 100%; max-height: 38vh; object-fit: contain; margin: 10px 0 0; border-radius: 12px; background: var(--bg); }
