/* Layout: one centered column (max 1200px). The practice screen narrows to ~1000px around the text, keyboard and hands. */

/* ---------- Fonts (self-hosted, no external requests) ---------- */
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-400-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/be-vietnam-pro-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-600-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/be-vietnam-pro-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/be-vietnam-pro-vietnamese-700-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Be Vietnam Pro'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/be-vietnam-pro-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Roboto Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/roboto-mono-vietnamese-600-normal.woff2) format('woff2'); unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB; }
@font-face { font-family: 'Roboto Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url(fonts/roboto-mono-latin-600-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

/* ---------- Design tokens ---------- */
:root {
  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --surface-2: #EEF1F7;
  --ink: #1B2140;
  --muted: #555C73;
  --line: #DDE2EC;
  --accent: #2457E6;
  --accent-deep: #1A43B8;
  --accent-ink: #FFFFFF;
  --accent-soft: #DCE6FF;
  --ok: #187A4C;
  --bad: #C62828;
  --bad-soft: #FDE7E7;
  --pending: #7C8399;
  --warn-bg: #FFF4D6;
  --warn-ink: #6B4A00;
  --star: #F5A623;
  --star-off: #D5DAE6;
  --f-p: #F9C8DA;
  --f-r: #FFD6A5;
  --f-m: #FFEFA1;
  --f-i: #BDE5C6;
  --f-t: #D9D3F7;
  --palm: #EEF1F7;
  --palm-line: #C2C9D8;
  --finger-line: #9AA3B8;
  --key-edge: rgba(27, 33, 64, 0.16);
  --shadow: 0 1px 2px rgba(27, 33, 64, 0.06), 0 6px 20px rgba(27, 33, 64, 0.05);
  --backdrop: rgba(20, 24, 45, 0.45);

  --font-ui: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-key: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11142A; --surface: #1A1F38; --surface-2: #242A47; --ink: #E9ECF6; --muted: #A7AEC6; --line: #303859;
    --accent: #7097FF; --accent-deep: #4E78E8; --accent-ink: #0D1330; --accent-soft: #263463;
    --ok: #5BD08F; --bad: #FF8080; --bad-soft: #3B2030; --pending: #8C93AE; --warn-bg: #3A3016; --warn-ink: #F5D88A;
    --star: #F5B83D; --star-off: #3A4160;
    --f-p: #7A3F5C; --f-r: #7A5128; --f-m: #6E6220; --f-i: #2F6440; --f-t: #4D4589;
    --palm: #242A47; --palm-line: #3D4670; --finger-line: #5C6690;
    --key-edge: rgba(0, 0, 0, 0.45); --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --backdrop: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11142A; --surface: #1A1F38; --surface-2: #242A47; --ink: #E9ECF6; --muted: #A7AEC6; --line: #303859;
  --accent: #7097FF; --accent-deep: #4E78E8; --accent-ink: #0D1330; --accent-soft: #263463;
  --ok: #5BD08F; --bad: #FF8080; --bad-soft: #3B2030; --pending: #8C93AE; --warn-bg: #3A3016; --warn-ink: #F5D88A;
  --star: #F5B83D; --star-off: #3A4160;
  --f-p: #7A3F5C; --f-r: #7A5128; --f-m: #6E6220; --f-i: #2F6440; --f-t: #4D4589;
  --palm: #242A47; --palm-line: #3D4670; --finger-line: #5C6690;
  --key-edge: rgba(0, 0, 0, 0.45); --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --backdrop: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2 { text-wrap: balance; }
a { color: var(--accent); }
a:hover { color: var(--accent-deep); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); }
.center { text-align: center; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.app { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 2px solid transparent; font-weight: 600; font-size: 16px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 var(--accent-deep); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--accent-deep); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-big { min-height: 64px; padding: 0 32px; font-size: 20px; font-weight: 700; border-radius: 16px; }
.btn kbd { font-family: var(--font-key); font-size: 12px; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.btn-primary kbd { background: var(--accent-deep); color: var(--accent-ink); border-color: transparent; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 15px; font-weight: 600; }
.chip:hover { border-color: var(--accent); }
#learnerBtn { padding-left: 6px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.link-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent); font-weight: 600; }
.link-btn:hover { color: var(--accent-deep); text-decoration: underline; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; color: var(--ink); background: var(--f-r); }

/* ---------- Top bar ---------- */
.topbar-inner { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; padding-block: 16px; }
.brand { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 0; min-height: 44px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-key); font-weight: 600; font-size: 18px; box-shadow: 0 3px 0 var(--accent-deep); }
.brand-name { font-size: 22px; font-weight: 700; }
.top-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.notice { background: var(--warn-bg); color: var(--warn-ink); font-size: 15px; font-weight: 500; }
.notice .wrap { padding-block: 12px; }

/* ---------- Home ---------- */
/* Home: slim hero row + compact lesson cards; finished groups collapse to one line. */
#viewHome { display: flex; flex-direction: column; gap: 20px; padding-block: 4px 40px; }
.hero { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 16px 24px; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); }
.hero-text { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hero h1 { margin: 0; font-size: clamp(19px, 2.4vw, 23px); line-height: 1.3; }
.hero-sub { margin: 0; font-size: 15px; color: var(--muted); }
.hero-progress { flex: 0 1 260px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hero-cta { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hero-cta .btn { min-height: 52px; padding: 0 24px; font-size: 17px; }
.trophy-chip .ico { color: var(--star); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--accent); transition: width .25s ease; }
.groups { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px 32px; }
.group { flex: 0 1 auto; max-width: 100%; display: flex; flex-direction: column; gap: 8px; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.group-head h2 { margin: 0; font-size: 18px; }
.group-meta { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.group-head .link-btn { min-height: 0; padding: 0; font-size: 13px; margin-left: auto; }
.cards { display: grid; grid-template-columns: repeat(var(--n, 4), 154px); gap: 10px; }
.card { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-height: 0; padding: 10px 12px 12px; text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; color: var(--ink); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card.current { border-color: var(--accent); background: var(--accent-soft); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-label { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.card-label b { color: var(--accent); font-weight: 700; }
.card-keys { font-family: var(--font-key); font-size: 18px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-done { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 48px; padding: 8px 16px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); text-align: left; }
.group-done:hover { border-color: var(--accent); }
.group-done .ico { color: var(--ok); }
.gd-title { font-size: 16px; font-weight: 700; }
.gd-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gd-open { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--accent); }
.stars { display: inline-flex; gap: 2px; }
.star { width: 16px; height: 16px; fill: var(--star-off); }
.star.on { fill: var(--star); }

/* ---------- Practice ---------- */
.practice-bar { background: var(--surface); border-bottom: 1px solid var(--line); }
.practice-bar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.practice-title { margin: 0; font-size: 17px; font-weight: 700; text-align: center; }
.bar-thin { height: 6px; border-radius: 0; }
.bar-thin .bar-fill { border-radius: 0; }
#soundBtn .ico-off { display: none; }
#soundBtn[aria-pressed="false"] .ico-on { display: none; }
#soundBtn[aria-pressed="false"] .ico-off { display: block; }
/* Practice screen fits one viewport: --k (key size) scales with screen height and width. */
body.practicing .topbar, body.practicing .footer, body.practicing .notice { display: none; }
.practice-body { --k: clamp(28px, min(6vh, 4.4vw), 52px); max-width: 1240px; display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.8vh, 18px); padding-block: clamp(10px, 2vh, 22px) 40px; }
.guide { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 40px; }
.tip { margin: 0; max-width: 680px; font-size: 14px; color: var(--muted); text-align: center; }
.warn { max-width: 680px; padding: 10px 18px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); font-size: 15px; font-weight: 500; text-align: center; }
.finger-hint { margin: 0; display: inline-flex; align-items: center; gap: 10px; padding: 6px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; }
.finger-hint .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--finger-line); }
.finger-hint b { font-family: var(--font-key); font-size: 17px; }
.text-box { width: 100%; max-width: 900px; padding: clamp(10px, 2vh, 18px) 24px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); font-family: var(--font-key); font-weight: 600; font-size: clamp(22px, min(4.4vw, 5.2vh), 42px); line-height: 1.45; }
.source { margin: 0; max-width: 900px; font-size: 15px; line-height: 1.4; color: var(--ink); text-align: center; }
.source span { color: var(--muted); font-weight: 600; margin-right: 6px; }
.text-lines { position: relative; height: calc(2 * 1.45em); overflow: hidden; text-align: center; outline: none; }
.word { display: inline-block; white-space: nowrap; }
.ch { display: inline-block; white-space: pre; padding: 0 1px; border-radius: 5px; color: var(--pending); border-bottom: 4px solid transparent; }
.ch.ok { color: var(--ok); }
.ch.bad { color: var(--bad); background: var(--bad-soft); }
.ch.cur { color: var(--ink); background: var(--accent-soft); border-bottom-color: var(--accent); }
.ch.flash { animation: shake .22s; background: var(--bad-soft); border-bottom-color: var(--bad); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.live-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.live-stats strong { color: var(--ink); }
.kb-area { width: 100%; display: flex; align-items: center; justify-content: center; gap: clamp(8px, 1.5vw, 20px); }
.kb-wrap { max-width: 100%; overflow-x: auto; padding: 4px; }
.hand-slot { flex: none; }
.kb { --g: calc(var(--k) * 0.15); display: inline-flex; flex-direction: column; gap: var(--g); padding: calc(var(--k) * 0.32); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.kb-row { display: flex; gap: var(--g); }
.kb-row.r1 { padding-left: calc(var(--k) * 0.5); }
.kb-row.r2 { padding-left: calc(var(--k) * 0.75); }
.kb-row.sp { justify-content: center; }
.key.wide { width: calc(var(--k) * 1.25 - var(--g)); font-size: calc(var(--k) * 0.26); font-weight: 500; }
.key { position: relative; width: var(--k); height: var(--k); border-radius: calc(var(--k) * 0.2); display: flex; align-items: center; justify-content: center; font-size: calc(var(--k) * 0.35); font-weight: 600; color: var(--ink); box-shadow: 0 2px 0 var(--key-edge); transition: transform .08s, opacity .15s, outline-color .1s; }
.key.space { width: calc(var(--k) * 6.2); height: calc(var(--k) * 0.9); font-size: calc(var(--k) * 0.28); font-weight: 500; }
.key.dim { opacity: .35; }
.key.next { outline: 3px solid var(--accent); outline-offset: 2px; transform: translateY(-3px); opacity: 1; }
.key .bump { position: absolute; bottom: 14%; left: 50%; width: 27%; height: 3px; transform: translateX(-50%); border-radius: 2px; background: var(--ink); opacity: .45; }
.f-p { background: var(--f-p); }
.f-r { background: var(--f-r); }
.f-m { background: var(--f-m); }
.f-i { background: var(--f-i); }
.f-t { background: var(--f-t); }
.hand { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; color: var(--muted); }
.hand svg { width: calc(var(--k) * 3.9); height: auto; display: block; }
@media (max-width: 860px) {
  .kb-area { flex-wrap: wrap; }
  .kb-wrap { order: -1; flex-basis: 100%; display: flex; justify-content: center; }
}
.hand .palm { fill: var(--palm); stroke: var(--palm-line); stroke-width: 2; }
.hand .fg { stroke: var(--finger-line); stroke-width: 1.5; opacity: .5; transition: opacity .15s; }
.hand .fg.p { fill: var(--f-p); } .hand .fg.r { fill: var(--f-r); } .hand .fg.m { fill: var(--f-m); } .hand .fg.i { fill: var(--f-i); } .hand .fg.t { fill: var(--f-t); }
.hand .fg.on { opacity: 1; stroke: var(--accent); stroke-width: 4; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- Result ---------- */
.result-wrap { display: flex; justify-content: center; padding-block: 40px 56px; }
.result-card { width: 100%; max-width: 580px; display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 36px 32px; border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.stars-big { display: flex; align-items: flex-end; gap: 8px; }
.stars-big .star { width: 56px; height: 56px; }
.stars-big .star:nth-child(2) { width: 72px; height: 72px; }
.result-head h1 { margin: 0; font-size: 30px; }
.result-head p { margin: 6px 0 0; }
.result-stats { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.result-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 14px 6px; border-radius: 16px; background: var(--surface-2); font-size: 13px; }
.result-stats .big { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.weak { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.weak-title { font-size: 14px; font-weight: 600; color: var(--muted); }
.weak-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.weak-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 12px; border: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.weak-item .key { width: 40px; height: 40px; font-family: var(--font-key); font-size: 16px; }
.weak-item .key.wide { width: auto; padding: 0 10px; font-family: var(--font-ui); font-size: 13px; }
#rsNote { margin: 0; }
.result-actions { width: 100%; display: flex; flex-wrap: wrap; gap: 12px; }
.result-actions .btn { flex: 1 1 200px; min-height: 56px; font-size: 17px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 32px; align-items: center; justify-content: space-between; padding-block: 18px; font-size: 14px; color: var(--muted); }

/* ---------- Dialogs ---------- */
dialog { width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: var(--backdrop); }
.dlg { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-head h2 { margin: 0; font-size: 22px; }
.dlg p { margin: 0; }
.dlg hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row input { flex: 1 1 200px; min-width: 0; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); }
.row input:focus { border-color: var(--accent); outline: none; }
.row-form { display: flex; flex-direction: column; gap: 6px; }
.row-form label { font-size: 14px; font-weight: 600; }
.learner-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.learner-item { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); text-align: left; font-weight: 600; }
.learner-item:hover { border-color: var(--accent); }
.learner-item.active { border-color: var(--accent); background: var(--accent-soft); }
.learner-item .meta { margin-left: auto; font-size: 13px; font-weight: 500; color: var(--muted); }
.code-out { padding: 16px; border-radius: 14px; background: var(--surface-2); font-family: var(--font-key); font-size: clamp(18px, 4.5vw, 24px); font-weight: 600; letter-spacing: 1px; text-align: center; user-select: all; overflow-wrap: anywhere; }
.confirm { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--warn-bg); color: var(--warn-ink); }
#restoreMsg.err { color: var(--bad); }
#restoreMsg.ok { color: var(--ok); }
.qr { align-self: center; width: 220px; max-width: 100%; aspect-ratio: 1; border-radius: 16px; border: 2px dashed var(--line); display: flex; align-items: center; justify-content: center; text-align: center; padding: 16px; color: var(--muted); font-size: 14px; overflow: hidden; }
.qr img { width: 100%; height: 100%; object-fit: contain; }
.qr.has-img { width: 260px; aspect-ratio: auto; padding: 0; border: 0; border-radius: 14px; background: #FFFFFF; }
.qr.has-img img { height: auto; display: block; }
.bank { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.bank div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.bank dt { color: var(--muted); font-size: 14px; }
.bank dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; user-select: all; }

/* ---------- Trophy ---------- */
.trophy-dlg { overflow: hidden; }
.trophy-body { position: relative; align-items: center; text-align: center; gap: 12px; padding: 28px 28px 24px; }
.trophy-body h2 { margin: 0; font-size: 24px; line-height: 1.3; }
.trophy-body p { max-width: 420px; }
.trophy-body .btn { min-width: 180px; }
.trophy { width: 120px; height: 120px; animation: trophy-in .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.trophy .cup { fill: var(--star); }
.trophy .cup-base { fill: var(--accent); }
.trophy .cup-handle { fill: none; stroke: var(--star); stroke-width: 7; stroke-linecap: round; }
.trophy .cup-shine { fill: none; stroke: #FFFFFF; stroke-width: 4; stroke-linecap: round; opacity: .55; }
.trophy .cup-star { fill: #FFFFFF; opacity: .9; }
@keyframes trophy-in { 0% { transform: scale(.3) translateY(30px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; opacity: 0; animation-name: confetti-fall; animation-timing-function: ease-in; animation-fill-mode: forwards; }
@keyframes confetti-fall { 0% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 520px; rotate: 540deg; } }

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  .group { flex-basis: 100%; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 640px) {
  .hero { padding: 22px; }
  .hero-cta { width: 100%; }
  .hero-cta .btn-big { width: 100%; }
  .text-box { padding: 18px 14px; }
  .result-card { padding: 28px 18px; }
  .result-stats .big { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
