/* ════════════════════════════════════════════════════════════
   Přijmix — „Sešit a tabule“
   Světlý vzhled je linkovaný sešit (papír, tužka, modrá propiska, červené
   pero učitele, žlutý zvýrazňovač). Tmavý vzhled je školní tabule a křída.
   ════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Atkinson Next'; font-weight: 400 800; font-display: swap; src: url('../fonts/atkinson-hyperlegible-next-02-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Atkinson Next'; font-weight: 400 800; font-display: swap; src: url('../fonts/atkinson-hyperlegible-next-03-latin.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: 'Kalam'; font-weight: 400; font-display: swap; src: url('../fonts/kalam-04-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Kalam'; font-weight: 400; font-display: swap; src: url('../fonts/kalam-05-latin.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; }

/* ── barvy ───────────────────────────────────────────────── */
:root {
  --paper: #FAFBF8;
  --paper2: #F0F2ED;
  --ink: #2B2F36;          /* tužka: text a obrysy */
  --muted: #5B6470;
  --rule: #D5DEEA;         /* linky sešitu */
  --margin: #E9A9A4;       /* svislá linka okraje */
  --accent: #1F3A8A;       /* propiska */
  --on-accent: #FAFBF8;
  --accent-soft: #E1E8F8;
  --ok: #1E6B45;
  --ok-bg: #DDF0E4;
  --bad: #C8261C;          /* červené pero */
  --bad-bg: #FBE4E1;
  --marker: #FFE45C;       /* zvýrazňovač */
  --marker-ink: #2B2F36;
  --gold: #B97A00;
  --flame: #D9620A;
  --heart: #D8352A;
  --off: #C9CFD6;
  --font: 'Atkinson Next', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --hand: 'Kalam', 'Segoe Print', 'Bradley Hand', cursive;
  --r: 16px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
[data-ink="teal"] { --accent: #0C6470; --accent-soft: #D9EEF0; }
[data-ink="violet"] { --accent: #5A3A9C; --accent-soft: #E9E1F7; }
[data-ink="brick"] { --accent: #A8401A; --accent-soft: #F7E3D9; }

[data-theme="dark"] {
  --paper: #16211C;        /* tabule */
  --paper2: #1D2A24;
  --ink: #ECEFE6;          /* křída */
  --muted: #9FB0A6;
  --rule: #26362E;
  --margin: #4A3B38;
  --accent: #8FB8FF;
  --on-accent: #16211C;
  --accent-soft: #22324A;
  --ok: #7FD1A6;
  --ok-bg: #1D3A2C;
  --bad: #FF8A7A;
  --bad-bg: #43231F;
  --marker: #FFD166;
  --marker-ink: #1B241F;
  --gold: #FFD166;
  --flame: #FFA45C;
  --heart: #FF7B6E;
  --off: #3A4A42;
  color-scheme: dark;
}
[data-theme="dark"][data-ink="teal"] { --accent: #7FD6DF; --accent-soft: #1C3A3E; }
[data-theme="dark"][data-ink="violet"] { --accent: #C3A6FF; --accent-soft: #33294D; }
[data-theme="dark"][data-ink="brick"] { --accent: #FFAE8A; --accent-soft: #46291D; }

/* ── základ ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 16px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.in-lesson { overflow: hidden; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
input { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.hand { font-family: var(--hand); font-weight: 400; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic .fill { fill: currentColor; stroke: none; }
.ic .cut { stroke: var(--paper); stroke-width: 1.8; }
.ic-coin { color: var(--gold); }
.ic-heart { color: var(--heart); }
.ic-flame { color: var(--flame); }
.ic-star .fill { fill: var(--off); }
.ic-star.on .fill { fill: var(--gold); }
[data-theme="light"] .ic-coin .cut { stroke: #FFF6D6; }

/* ── stránka ─────────────────────────────────────────────── */
.view {
  overflow-x: clip;
  max-width: 560px; margin: 0 auto; min-height: 100dvh;
  padding: calc(14px + var(--safe-t)) 16px calc(var(--tab-h) + var(--safe-b) + 28px);
}
.v-home { background: linear-gradient(var(--rule) 1px, transparent 1px) 0 6px / 100% 32px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 10px; margin-bottom: 14px; min-height: 44px; }
.page-head h1 { font-size: 1.9rem; line-height: 1.1; }
.page-head p { width: 100%; font-size: .88rem; }
.brand { display: flex; align-items: center; gap: 6px; }
.brand b { font-size: 1.7rem; line-height: 1; padding-top: 6px; }
.sub { font-size: 1.45rem; margin: 26px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.sub-n { font: 700 .85rem var(--font); color: var(--muted); }

.card { background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: 0 3px 0 var(--ink); }

.stats-row { display: flex; gap: 6px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px; border-radius: 999px; background: var(--paper); border: 2px solid var(--ink); font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.chip .ic { width: 18px; height: 18px; }
.c-streak:not(.on) .ic { color: var(--off); }
.c-boost { background: var(--marker); color: var(--marker-ink); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--paper); }

/* ── tlačítka ────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 10px 18px;
  border: 2px solid var(--ink); border-radius: 14px; font-weight: 800; font-size: 1.02rem; text-align: center;
  background: var(--paper); box-shadow: 0 4px 0 var(--ink); transition: transform .06s, box-shadow .06s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary .ic:not(.ic-coin) { color: currentColor; }
.btn-primary .ic-coin { color: var(--marker); }
.btn-primary .ic-coin .cut { stroke: var(--accent); }
.btn-ok { background: var(--ok); color: var(--paper); }
.btn-bad { background: var(--bad); color: var(--paper); }
.btn-gold { background: var(--marker); color: var(--marker-ink); }
.btn-gold .ic-coin { color: #8A5A00; }
.btn-gold .ic-coin .cut { stroke: var(--marker); }
.btn-ghost { box-shadow: none; border-color: transparent; color: var(--accent); min-height: 44px; }
.btn-danger { box-shadow: none; color: var(--bad); border-color: var(--bad); }
.btn-off { background: var(--paper2); color: var(--muted); box-shadow: none; border-color: var(--off); }
.btn:disabled { background: var(--paper2); color: var(--muted); border-color: var(--off); box-shadow: 0 4px 0 var(--off); cursor: default; }
.btn-small { width: auto; min-height: 40px; padding: 6px 12px; font-size: .92rem; box-shadow: 0 3px 0 var(--ink); border-radius: 12px; flex: none; }

.bar { display: block; height: 10px; border-radius: 999px; background: var(--paper2); border: 1.5px solid var(--ink); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s; }
.bar.ok i { background: var(--ok); }

/* ── cesta ───────────────────────────────────────────────── */
.hero { padding: 14px; display: grid; gap: 12px; margin-bottom: 22px; }
.hero-main { display: flex; gap: 14px; align-items: stretch; }
.hero-count { flex: none; min-width: 98px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 8px 10px; background: var(--marker); color: var(--marker-ink); border: 2px solid var(--ink); border-radius: 12px; transform: rotate(-2deg); }
.hero-count span { font-size: .72rem; font-weight: 700; line-height: 1.15; }
.hero-count b { font: 400 2.6rem/1 var(--hand); padding-top: 6px; }
.hero-count b.small { font-size: 1.6rem; }
.hero-goal { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.hero-say { font-size: 1.12rem; line-height: 1.25; color: var(--accent); }
.goal-line { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.goal-line b { color: var(--ink); }

.sec { margin-bottom: 8px; }
.sec-head { position: relative; padding: 12px 16px 12px 22px; background: var(--accent); color: var(--on-accent); border: 2px solid var(--ink); border-radius: var(--r); box-shadow: 0 3px 0 var(--ink); }
.sec-head::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; border-left: 2px solid var(--margin); opacity: .9; }
.sec-n { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.sec-head h2 { font-size: 1.7rem; line-height: 1.1; padding-top: 4px; }
.sec-head p { font-size: .88rem; opacity: .92; }

.unit { margin-top: 18px; }
.unit-head { display: flex; align-items: center; gap: 12px; padding: 0 2px; }
.unit-head h3 { font-size: 1.05rem; font-weight: 800; }
.unit-head p { font-size: .84rem; color: var(--muted); line-height: 1.3; }
.unit-ico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; font: 400 1.05rem/1 var(--hand); color: var(--accent); padding-top: 4px; transform: rotate(-3deg); }

.nodes { position: relative; padding: 4px 0; }
.path-line { position: absolute; left: 50%; top: 4px; overflow: visible; pointer-events: none; }
.path-line path { fill: none; stroke: var(--muted); stroke-width: 3; stroke-dasharray: 2 9; stroke-linecap: round; opacity: .55; }
.node-row { height: 110px; display: flex; align-items: center; justify-content: center; }
.node-in { position: relative; display: grid; transform: translateX(var(--dx)); }
.node {
  position: relative; width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 5px 0 var(--ink); transition: transform .06s, box-shadow .06s;
}
.node .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.node:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.node.done { background: var(--marker); color: var(--marker-ink); }
.node.cur { background: var(--accent); color: var(--on-accent); }
.node.cur::after { content: ''; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--accent); opacity: .5; animation: pulse 1.8s ease-out infinite; }
.node.locked { background: var(--paper2); color: var(--muted); border-color: var(--off); border-style: dashed; box-shadow: none; }
.node.test { border-radius: 20px; width: 72px; height: 72px; }
.node.test.cur::after { border-radius: 26px; }
.node-stars { position: absolute; z-index: 1; top: calc(100% - 9px); left: 50%; transform: translateX(-50%); display: flex; gap: 0; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 999px; padding: 1px 5px; }
.node-stars .ic { width: 13px; height: 13px; }
.node-bubble { position: absolute; bottom: calc(100% - 2px); left: 50%; transform: translateX(-50%) rotate(-3deg); background: var(--marker); color: var(--marker-ink); border: 2px solid var(--ink); border-radius: 10px; padding: 3px 10px 0; font-size: 1rem; white-space: nowrap; z-index: 2; animation: bob 2.2s ease-in-out infinite; }
.node-pet { position: absolute; left: calc(100% + 8px); top: 6px; animation: bob 2.6s ease-in-out infinite; }
.node-row.pet-left .node-pet { left: auto; right: calc(100% + 8px); }
.test-nodes { margin-top: 6px; }
.foot-note { margin-top: 28px; font-size: .8rem; color: var(--muted); text-align: center; }

@keyframes pulse { 0% { transform: scale(.92); opacity: .6; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -5px; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }

/* ── Kaňka ───────────────────────────────────────────────── */
.kanka { display: block; }
.k-body { fill: var(--accent); }
.k-eye { fill: #fff; }
.k-pupil { fill: #1B1F26; }
.k-face path { stroke: var(--on-accent); stroke-width: 4; stroke-linecap: round; }
.k-face .k-mouth { fill: var(--on-accent); stroke: none; }

/* ── trénink ─────────────────────────────────────────────── */
.modes { display: grid; gap: 12px; }
.mode { display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; width: 100%; transition: transform .06s, box-shadow .06s; }
.mode:active, .topic:active, .ink:active, .onb-goal:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.mode-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; border: 2px solid var(--ink); background: var(--accent-soft); color: var(--accent); }
.mode-ico .ic { width: 26px; height: 26px; }
.m-blitz .mode-ico { background: var(--marker); color: var(--marker-ink); }
.m-review .mode-ico { background: var(--bad-bg); color: var(--bad); }
.mode-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.mode-txt b { font-size: 1.08rem; }
.mode-txt small { color: var(--muted); font-size: .85rem; }
.mode-txt .perk { color: var(--ink); font-weight: 600; }
.mode-txt .perk .ic { width: 15px; height: 15px; }
.count { flex: none; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--bad); color: var(--paper); font-weight: 800; display: grid; place-items: center; }
.topic-sec { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 2px 8px; }
.topics { display: grid; gap: 10px; }
.topic { display: flex; align-items: center; gap: 12px; padding: 10px 12px; width: 100%; text-align: left; transition: transform .06s, box-shadow .06s; }
.topic .unit-ico { width: 40px; height: 40px; font-size: .95rem; }
.topic-txt { flex: 1; min-width: 0; display: grid; gap: 6px; }
.topic-pct { flex: none; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

/* ── úkoly a odznaky ─────────────────────────────────────── */
.quests { display: grid; gap: 12px; }
.quest, .chest { display: flex; align-items: center; gap: 12px; padding: 14px; }
.quest-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.quest-main small { color: var(--muted); font-size: .8rem; }
.quest-reward { flex: none; font-weight: 800; color: var(--muted); }
.quest-done { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--ok); color: var(--paper); display: grid; place-items: center; }
.quest.ready, .chest.ready { background: var(--accent-soft); }
.quest.claimed, .chest.claimed { box-shadow: none; border-color: var(--off); }
.quest.claimed b, .chest.claimed b { color: var(--muted); }
.chest > div { flex: 1; min-width: 0; display: grid; }
.chest small { color: var(--muted); font-size: .85rem; }
.chest-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--ink); background: var(--marker); color: var(--marker-ink); display: grid; place-items: center; }
.chest-ico .ic { width: 28px; height: 28px; }
.chest.ready .chest-ico { animation: bob 1.2s ease-in-out infinite; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border: 2px dashed var(--off); border-radius: var(--r); color: var(--muted); text-align: center; }
.badge b { font-size: .78rem; line-height: 1.2; }
.badge-ico { width: 52px; height: 52px; display: grid; place-items: center; font-size: 1.7rem; border-radius: 50%; background: var(--paper2); }
.badge.got { border: 2px solid var(--ink); color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.badge.got .badge-ico { background: var(--marker); border: 2px solid var(--ink); }

/* ── obchod ──────────────────────────────────────────────── */
.shop-list { display: grid; gap: 12px; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 14px; }
.shop-item > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.shop-item small { color: var(--muted); font-size: .85rem; line-height: 1.3; }
.shop-ico { flex: none; width: 48px; height: 48px; border-radius: 14px; border: 2px solid var(--ink); display: grid; place-items: center; background: var(--paper2); }
.shop-ico .ic { width: 26px; height: 26px; }
.i-freeze { color: var(--accent); background: var(--accent-soft); }
.i-boost { background: var(--marker); color: var(--marker-ink); }
.i-hearts { background: var(--bad-bg); }
.inks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ink { display: grid; gap: 2px; padding: 12px; text-align: left; transition: transform .06s, box-shadow .06s; }
.ink b { font-size: .95rem; }
.ink small { color: var(--muted); font-size: .85rem; }
.ink small .ic { width: 15px; height: 15px; }
.ink-dot { width: 100%; height: 12px; border-radius: 999px; border: 2px solid var(--ink); margin-bottom: 6px; }
.ink-blue .ink-dot { background: #1F3A8A; } .ink-teal .ink-dot { background: #0C6470; } .ink-violet .ink-dot { background: #5A3A9C; } .ink-brick .ink-dot { background: #A8401A; }
[data-theme="dark"] .ink-blue .ink-dot { background: #8FB8FF; } [data-theme="dark"] .ink-teal .ink-dot { background: #7FD6DF; } [data-theme="dark"] .ink-violet .ink-dot { background: #C3A6FF; } [data-theme="dark"] .ink-brick .ink-dot { background: #FFAE8A; }
.ink.on { background: var(--accent-soft); }
.avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.avatar-opt { position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: var(--r); background: var(--paper); }
.avatar-opt span { font-size: 2rem; line-height: 1; }
.avatar-opt.on { background: var(--marker); box-shadow: 0 3px 0 var(--ink); }
.avatar-opt.locked { border-style: dashed; border-color: var(--off); }
.avatar-opt.locked span { filter: grayscale(1); opacity: .55; }
.avatar-opt small { position: absolute; bottom: 3px; left: 0; right: 0; text-align: center; font-size: .72rem; font-weight: 800; }
.avatar-opt small .ic { width: 12px; height: 12px; }

/* ── profil ──────────────────────────────────────────────── */
.me { display: flex; gap: 14px; align-items: center; padding: 14px; }
.me-avatar { flex: none; width: 76px; height: 76px; border-radius: 50%; border: 2px solid var(--ink); background: var(--marker); font-size: 2.6rem; display: grid; place-items: center; line-height: 1; }
.me-info { flex: 1; min-width: 0; display: grid; gap: 4px; }
.me-name { font-size: 1.3rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-title { color: var(--accent); font-weight: 700; font-size: .92rem; }
.me-info small { color: var(--muted); font-size: .8rem; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.tile { display: grid; justify-items: center; gap: 2px; padding: 12px 6px; border: 2px solid var(--ink); border-radius: var(--r); text-align: center; background: var(--paper); }
.tile b { font-size: 1.3rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile span { font-size: .74rem; color: var(--muted); line-height: 1.2; }
.tile .ic { width: 22px; height: 22px; }
.tile .ic-star .fill { fill: var(--gold); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; padding: 12px; height: 168px; }
.week-col { display: grid; grid-template-rows: 16px 1fr 20px; justify-items: center; gap: 4px; min-width: 0; }
.week-col small { font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.week-col b { font-size: .78rem; color: var(--muted); }
.week-col.today b { color: var(--ink); }
.week-bar { width: 100%; max-width: 30px; height: 100%; display: flex; align-items: flex-end; background: var(--paper2); border-radius: 6px; overflow: hidden; }
.week-bar i { width: 100%; background: var(--accent); border-radius: 6px 6px 0 0; min-height: 0; }
.readiness { padding: 14px; display: grid; gap: 10px; }
.ready-row { display: grid; grid-template-columns: minmax(0, 1.1fr) 1fr 52px; gap: 10px; align-items: center; font-size: .9rem; }
.ready-row b { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }

/* ── spodní navigace ─────────────────────────────────────── */
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; background: var(--paper); border-top: 2px solid var(--ink); padding-bottom: var(--safe-b); }
body.in-lesson #tabbar { display: none; }
.tab { position: relative; flex: 1; max-width: 112px; height: var(--tab-h); display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.tab .ic { width: 26px; height: 26px; }
.tab.on { color: var(--accent); }
.tab.on::before { content: ''; position: absolute; top: -2px; left: 22%; right: 22%; height: 4px; background: var(--accent); border-radius: 0 0 4px 4px; }
.dot { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: var(--paper); font: 800 .7rem/18px var(--font); text-align: center; }

/* ── listy a toast ───────────────────────────────────────── */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(20, 24, 30, .5); opacity: 0; transition: opacity .2s; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--paper); border: 2px solid var(--ink); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 26px 18px calc(18px + var(--safe-b)); display: grid; gap: 12px; transform: translateY(100%); transition: transform .22s ease-out; }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.center .sheet { text-align: center; }
.sheet h2 { font-size: 1.35rem; line-height: 1.2; padding-right: 36px; }
.sheet-wrap.center h2 { padding: 0; }
.sheet-x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); }
.sheet-hero { display: grid; place-items: center; }
.sheet-ico, .sheet-badge { width: 64px; height: 64px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.sheet-ico .ic { width: 30px; height: 30px; }
.sheet-ico.done { background: var(--marker); color: var(--marker-ink); }
.sheet-ico.locked, .sheet-badge { background: var(--paper2); color: var(--muted); border-style: dashed; border-color: var(--off); }
.sheet-badge { margin: 0 auto; font-size: 2rem; width: 84px; height: 84px; }
.sheet-badge.got { background: var(--marker); border: 2.5px solid var(--ink); }
.sheet-stars { display: flex; align-items: center; gap: 2px; font-size: .9rem; color: var(--muted); }
.sheet-stars span { margin-left: 8px; }
.sheet-hearts { display: flex; justify-content: center; gap: 6px; }
.sheet-hearts .ic { width: 34px; height: 34px; color: var(--off); }
.sheet-hearts .ic.on { color: var(--heart); }
.note { background: var(--paper2); border-radius: 12px; padding: 10px 12px; font-size: .9rem; }
.prize { font: 400 2.4rem var(--hand); }
.prize .ic { width: 30px; height: 30px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: .8rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field input, .onb-input, .type-in { width: 100%; min-height: 50px; padding: 10px 14px; background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; font-size: 1.05rem; }
.seg { display: flex; border: 2px solid var(--ink); border-radius: 12px; overflow: hidden; }
.seg button { flex: 1; min-height: 44px; padding: 6px 4px; font-weight: 700; font-size: .9rem; }
.seg button + button { border-left: 2px solid var(--ink); }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); z-index: 80; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; max-width: min(92vw, 480px); padding: 10px 16px; background: var(--ink); color: var(--paper); border-radius: 12px; font-weight: 700; font-size: .92rem; text-align: center; transition: transform .2s, opacity .2s; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
body.in-lesson #toast { bottom: 110px; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 90; pointer-events: none; }

/* ── úvodní průvodce ─────────────────────────────────────── */
.onb { position: fixed; inset: 0; z-index: 50; background: var(--paper) linear-gradient(var(--rule) 1px, transparent 1px) 0 6px / 100% 32px; overflow-y: auto; padding: calc(18px + var(--safe-t)) 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; }
.onb-dots { display: flex; gap: 6px; }
.onb-dots i { width: 28px; height: 6px; border-radius: 3px; background: var(--off); }
.onb-dots i.on { background: var(--accent); }
.onb-step { width: 100%; max-width: 440px; margin: auto 0; padding: 20px 0; display: grid; gap: 14px; text-align: center; }
.onb-step h1 { font-size: 2.1rem; line-height: 1.15; }
.onb-step p { font-size: 1.05rem; }
.onb-hero { display: grid; place-items: center; animation: bob 3s ease-in-out infinite; }
.onb-av { max-width: 320px; margin: 0 auto; width: 100%; }
.onb-goals { display: grid; gap: 10px; }
.onb-goal { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; text-align: left; transition: transform .06s, box-shadow .06s; }
.onb-goal b { font-size: 1.1rem; }
.onb-goal small { color: var(--muted); }
.onb-goal.on { background: var(--marker); color: var(--marker-ink); }
.onb-goal.on small { color: var(--marker-ink); }

/* ── lekce ───────────────────────────────────────────────── */
.lesson { position: fixed; inset: 0; z-index: 40; background: var(--paper); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; }
.l-top { display: flex; align-items: center; gap: 10px; max-width: 640px; width: 100%; margin: 0 auto; padding: calc(8px + var(--safe-t)) 12px 6px; }
.l-quit { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); flex: none; }
.l-quit .ic { width: 26px; height: 26px; }
.l-bar { flex: 1; height: 16px; border-radius: 999px; background: var(--paper2); border: 2px solid var(--ink); overflow: hidden; }
.l-bar i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 999px; transition: width .35s; }
.blitz .l-bar i { background: var(--accent); transition: width 1s linear; }
.blitz.hurry .l-bar i { background: var(--bad); }
.l-meter { flex: none; display: flex; align-items: center; gap: 4px; min-width: 52px; justify-content: flex-end; font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.l-meter .ic { width: 24px; height: 24px; }
.l-meter.hit { animation: shake .45s; }
.l-combo { height: 26px; display: flex; justify-content: center; align-items: center; gap: 4px; font-weight: 800; font-size: .88rem; color: var(--flame); opacity: 0; }
.l-combo .ic { width: 16px; height: 16px; }
.l-combo.on { opacity: 1; }
.l-combo.pop { animation: pop .3s; }
.l-body { min-height: 0; overflow-y: auto; padding: 4px 16px 24px; }
.q-wrap { max-width: 608px; margin: 0 auto; display: grid; gap: 14px; }
.q-label { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.q-retry { color: var(--bad); }
.q-text { font-size: 1.28rem; font-weight: 700; line-height: 1.3; text-wrap: pretty; }
.passage {
  position: relative; border-left: 3px solid var(--margin); border-radius: 0 12px 12px 0; padding: 26px 14px 12px; font-size: 1rem; line-height: 1.55; max-height: 36dvh; overflow-y: auto;
  /* stín nahoře/dole napoví, že se dá text posouvat */
  background:
    linear-gradient(var(--paper2) 40%, transparent) top / 100% 28px no-repeat local,
    linear-gradient(transparent, var(--paper2) 60%) bottom / 100% 28px no-repeat local,
    linear-gradient(rgba(0, 0, 0, .22), transparent) top / 100% 9px no-repeat scroll,
    linear-gradient(transparent, rgba(0, 0, 0, .22)) bottom / 100% 9px no-repeat scroll,
    var(--paper2);
}
.passage.verse { font-family: var(--hand); font-size: 1.2rem; line-height: 1.5; }
.passage-tag { position: absolute; top: 7px; left: 14px; font: 800 .68rem var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.l-foot { max-width: 640px; width: 100%; margin: 0 auto; padding: 10px 16px calc(14px + var(--safe-b)); }
.l-check[hidden] { display: none; }

.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 12px 14px; text-align: left; font-size: 1.05rem; line-height: 1.3; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); transition: transform .06s, box-shadow .06s; }
.opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.opt-key { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 1.5px solid var(--off); color: var(--muted); font-size: .8rem; font-weight: 800; display: grid; place-items: center; }
@media (hover: none) { .opt-key { display: none; } }
.opt.sel { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 3px 0 var(--accent); }
.opt.sel .opt-key { border-color: var(--accent); color: var(--accent); }
.opt.ok { background: var(--ok-bg); border-color: var(--ok); box-shadow: 0 3px 0 var(--ok); }
.opt.bad { background: var(--bad-bg); border-color: var(--bad); box-shadow: 0 3px 0 var(--bad); }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tf-btn { justify-content: center; min-height: 72px; font-size: 1.25rem; }

.fill-s, .tap-s { font-size: 1.3rem; line-height: 2.5; }
.gap { display: inline-flex; vertical-align: middle; border: 2px solid var(--ink); border-radius: 10px; overflow: hidden; margin: 0 2px; background: var(--paper); box-shadow: 0 2px 0 var(--ink); }
.gap-o { min-width: 40px; height: 42px; padding: 0 9px; font-weight: 800; font-size: 1.2rem; line-height: 1; }
.gap-o + .gap-o { border-left: 2px solid var(--ink); }
.gap-o.sel { background: var(--accent); color: var(--on-accent); }
.gap.ok { border-color: var(--ok); box-shadow: 0 2px 0 var(--ok); }
.gap.ok .gap-o.sel { background: var(--ok); color: var(--paper); }
.gap.bad { border-color: var(--bad); box-shadow: 0 2px 0 var(--bad); }
.gap.bad .gap-o.sel { background: var(--bad); color: var(--paper); }
.nw { white-space: nowrap; }
.gap.bad .gap-o.right { background: var(--ok-bg); color: var(--ok); }

.tap-s { line-height: 2.7; }
.tok { position: relative; padding: 5px 9px; border: 2px solid var(--off); border-radius: 10px; font-size: 1.2rem; line-height: 1.3; background: var(--paper); }
.tok.sel { background: var(--marker); color: var(--marker-ink); border-color: var(--ink); }
.comma .tok.sel::after { content: ','; position: absolute; right: -9px; bottom: -6px; font: 800 2rem/1 var(--font); color: var(--bad); }
.tok.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.tok.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); text-decoration: line-through; }
.tok.miss { border-color: var(--ok); border-style: dashed; color: var(--ok); }
.comma .tok.ok::after, .comma .tok.miss::after { content: ','; position: absolute; right: -9px; bottom: -6px; font: 800 2rem/1 var(--font); color: var(--ok); }
.hint { font-size: .85rem; color: var(--muted); }

.ord-seq { list-style: none; counter-reset: o; margin: 0; padding: 0; display: grid; gap: 8px; }
.ord-seq li { counter-increment: o; display: flex; gap: 8px; align-items: stretch; }
.ord-seq li::before { content: counter(o); flex: none; width: 28px; display: grid; place-items: center; font: 400 1.3rem var(--hand); color: var(--accent); padding-top: 4px; }
.ord-slot { color: var(--muted); font-size: .92rem; border: 2px dashed var(--off); border-radius: 12px; padding: 12px; align-items: center !important; }
.ord-slot::before { margin-left: -4px; }
.ord-pool { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--rule); }
.ord-pool:empty { display: none; }
.ord-it { flex: 1; width: 100%; text-align: left; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 0 2px 0 var(--ink); font-size: .98rem; line-height: 1.35; }
.ord-seq .ord-it { background: var(--accent-soft); }
.ord-it.ok { background: var(--ok-bg); border-color: var(--ok); box-shadow: 0 2px 0 var(--ok); }
.ord-it.bad { background: var(--bad-bg); border-color: var(--bad); box-shadow: 0 2px 0 var(--bad); }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-col { display: grid; gap: 10px; align-content: start; }
.m-it { min-height: 58px; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 0 3px 0 var(--ink); font-size: .96rem; line-height: 1.25; text-align: center; hyphens: auto; overflow-wrap: anywhere; }
.m-it.sel { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 3px 0 var(--accent); }
.m-it.done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); box-shadow: none; opacity: .75; }
.m-it.shake { animation: shake .45s; background: var(--bad-bg); border-color: var(--bad); }
.type-in.ok { border-color: var(--ok); background: var(--ok-bg); }
.type-in.bad { border-color: var(--bad); background: var(--bad-bg); }

.l-fb { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: none; border-top: 2px solid var(--ink); }
.l-fb.show { display: block; animation: rise .2s ease-out; }
.l-fb.ok { background: var(--ok-bg); }
.l-fb.bad { background: var(--bad-bg); }
.fb-in { max-width: 640px; margin: 0 auto; padding: 14px 16px calc(14px + var(--safe-b)); display: grid; gap: 8px; max-height: 62dvh; overflow-y: auto; }
.fb-head { display: flex; align-items: center; gap: 8px; }
.fb-head b { font: 400 1.6rem/1.1 var(--hand); padding-top: 5px; }
.l-fb.ok .fb-head { color: var(--ok); } .l-fb.bad .fb-head { color: var(--bad); }
.fb-ic { width: 30px; height: 30px; stroke-width: 3; }
.fb-xp { margin-left: auto; font-weight: 800; background: var(--marker); color: var(--marker-ink); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 10px; font-size: .88rem; }
.fb-ans { font-weight: 700; font-size: 1.02rem; }
.fb-ans span { display: block; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--bad); }
.fb-ans u { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.fb-ol { margin: 4px 0 0; padding-left: 20px; font-weight: 400; font-size: .9rem; display: grid; gap: 3px; }
.fb-exp { font-size: .95rem; line-height: 1.4; }
.l-fb.mini { top: auto; padding: 14px 16px calc(18px + var(--safe-b)); text-align: center; font-size: 1.1rem; }
.l-fb.mini.ok { color: var(--ok); } .l-fb.mini.bad { color: var(--bad); }
.blitz .l-foot { min-height: 20px; }

.lesson.done { grid-template-rows: minmax(0, 1fr) auto; }
.res { overflow-y: auto; padding: calc(28px + var(--safe-t)) 20px 16px; display: grid; gap: 12px; justify-items: center; align-content: center; text-align: center; }
.res h1 { font-size: 2.2rem; line-height: 1.1; }
.res-hero { animation: pop .5s; }
.res-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 440px; margin-top: 6px; }
.res-tiles .tile { padding: 12px 4px; box-shadow: 0 3px 0 var(--ink); }
.res-tiles .tile span { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.res-tiles .tile em { font-style: normal; font-size: .72rem; font-weight: 800; color: var(--flame); }
.t-xp { background: var(--marker); color: var(--marker-ink); }
.t-xp span { color: var(--marker-ink) !important; }
.res-list { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; width: 100%; max-width: 440px; text-align: left; }
.res-list li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--paper2); border-radius: 12px; font-size: .95rem; }
.res-list li.hl { background: var(--accent-soft); border: 2px solid var(--accent); }
.res-list .ic { width: 20px; height: 20px; }
.res-list .ic-star .fill { fill: var(--gold); }
.emo { font-size: 1.2rem; }

@media (min-width: 700px) {
  .view { padding-top: 28px; }
  .q-text { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
