/* Fixa – čtverečkovaný sešit + zvýrazňovač */
:root {
  --paper: #EEF2F6;
  --grid: #DCE4ED;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --ink: #1B2A41;
  --ink-soft: #56657A;
  --line: #CBD5E1;
  --marker: #FFE94D;
  --marker-ink: #1B2A41;
  --red: #D7263D;
  --red-bg: #FDECEE;
  --green: #1F8A4C;
  --green-bg: #E6F5EC;
  --focus: #2F6FED;
  --radius: 14px;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-body);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111A27; --grid: #172334; --surface: #182334; --surface-2: #1E2B3E;
    --ink: #E7EDF5; --ink-soft: #9AA9BD; --line: #2C3B52;
    --marker: #FFE24A; --red: #FF6B7C; --red-bg: #3A1D25; --green: #4CC38A; --green-bg: #173226;
    --focus: #7EA6FF; color-scheme: dark; --brand-hl: 100%;
  }
}
:root[data-theme="dark"] {
  --paper: #111A27; --grid: #172334; --surface: #182334; --surface-2: #1E2B3E;
  --ink: #E7EDF5; --ink-soft: #9AA9BD; --line: #2C3B52;
  --marker: #FFE24A; --red: #FF6B7C; --red-bg: #3A1D25; --green: #4CC38A; --green-bg: #173226;
  --focus: #7EA6FF; color-scheme: dark; --brand-hl: 100%;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 17px/1.55 var(--font-body);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -0.01em; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 800; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 .8em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* --- rozvržení --- */
#view {
  max-width: 680px;
  margin: 0 auto;
  padding: 20px 16px calc(96px + env(safe-area-inset-bottom));
  outline: none;
}
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--ink-soft); }
.small { font-size: .9rem; }

/* --- navigace: dole na mobilu, vlevo na počítači --- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1.5px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.nav-brand { display: none; }
.nav a:not(.nav-brand) {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; font-size: .78rem; color: var(--ink-soft);
  padding: 6px 2px; border-radius: 10px;
}
.nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a.active { color: var(--ink); font-weight: 700; }
.nav a.active svg { stroke-width: 2.3; }
.nav a.active span { background: var(--marker); color: var(--marker-ink); padding: 0 5px; border-radius: 3px 6px 3px 7px; }
.nav-badge {
  position: absolute; top: 2px; left: calc(50% + 8px);
  background: var(--red); color: #fff; font-size: .7rem; line-height: 1;
  padding: 3px 6px; border-radius: 99px;
}
@media (min-width: 960px) {
  .nav {
    top: 0; right: auto; width: 200px; border-top: 0; border-right: 1.5px solid var(--line);
    display: flex; flex-direction: column; gap: 4px; padding: 24px 14px;
  }
  .nav-brand { display: block; margin: 0 6px 22px; text-decoration: none; }
  .nav a:not(.nav-brand) { flex-direction: row; gap: 12px; font-size: 1rem; padding: 10px 12px; }
  .nav-badge { position: static; margin-left: auto; }
  #view { padding: 40px 32px 60px; margin-left: max(200px, calc(50vw - 340px)); }
}

/* --- značka --- */
.brand-mark {
  font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; letter-spacing: -0.02em;
  background: linear-gradient(100deg, transparent 2%, var(--marker) 4%, var(--marker) 94%, transparent 97%);
  background-size: 100% var(--brand-hl, 62%); background-position: 0 85%; background-repeat: no-repeat;
  color: var(--marker-ink); padding: 0 6px;
}

/* --- zvýrazňovač: jediný výrazný prvek --- */
.hl {
  background: linear-gradient(100deg, transparent 1%, var(--marker) 2.5%, var(--marker) 96%, transparent 99%);
  background-size: 100% var(--brand-hl, 70%); background-position: 0 80%; background-repeat: no-repeat;
  color: var(--marker-ink); padding: 0 .12em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.meter { height: 12px; background: var(--surface-2); border-radius: 3px 8px 4px 9px; overflow: hidden; border: 1px solid var(--line); }
.meter > i {
  display: block; height: 100%; width: 0;
  background: var(--marker);
  border-radius: 2px 10px 3px 12px;
  transform: skewX(-8deg); transform-origin: left;
  transition: width .5s ease;
}
.meter.low > i { background: #FFB4BE; }
.meter.mid > i { background: var(--marker); }
.meter.high > i { background: #9BE3B8; }

/* --- karty a prvky --- */
.card {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}
.card.flat { background: var(--surface-2); }
.card.callout { border-color: var(--ink); border-width: 2px; }
.card h2 { margin-bottom: .3em; }
.chip {
  display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 9px;
  border-radius: 99px; border: 1.5px solid var(--line); color: var(--ink-soft); background: var(--surface);
}
.level-chip { border-color: var(--ink); color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 12px;
  border: 2px solid var(--ink); background: var(--surface); color: var(--ink);
  font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-marker { background: var(--marker); color: var(--marker-ink); border-color: var(--marker-ink); }
.btn-ghost { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; min-height: 40px; padding: 6px 8px; }
.btn-block { width: 100%; }
.btn-small { min-height: 38px; padding: 6px 12px; font-size: .92rem; border-radius: 10px; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; flex: none;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

label.field { display: block; font-weight: 700; margin: 0 0 6px; }
.input, select.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--surface); color: var(--ink);
}
.input:focus { border-color: var(--ink); outline: none; }
.hint { font-size: .88rem; color: var(--ink-soft); margin-top: 6px; }
form .field-wrap + .field-wrap { margin-top: 14px; }

/* --- přihlášení --- */
.auth { max-width: 420px; margin: 6vh auto 0; }
.auth .brand-mark { font-size: 3rem; }
.tabs { display: flex; gap: 6px; margin: 18px 0; }
.tabs button { flex: 1; min-height: 44px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; }
.tabs button[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }

/* --- domovská stránka --- */
.greet { margin-bottom: 4px; }
.level-big { font-family: var(--font-display); font-weight: 800; font-size: 4.2rem; line-height: 1; letter-spacing: -0.03em; }
.stat-line { display: flex; gap: 18px; flex-wrap: wrap; }
.stat-line div { min-width: 90px; }
.stat-line strong { display: block; font-family: var(--font-display); font-size: 1.6rem; line-height: 1.1; }
.topic-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface);
  cursor: pointer; color: var(--ink);
}
.topic-btn:hover { border-color: var(--ink); }
.topic-btn .t-main { flex: 1; min-width: 0; }
.topic-btn .t-name { font-weight: 700; display: block; }
.topic-btn .meter { margin-top: 6px; height: 9px; }
.topic-list > * + * { margin-top: 8px; }
.level-group h3 { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 10px; }

/* --- test a cvičení --- */
.progress-top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress-top .meter { flex: 1; }
.passage {
  background: var(--surface-2); border-left: 4px solid var(--marker); border-radius: 4px 12px 12px 4px;
  padding: 14px 16px; font-size: 1.02rem;
}
.q-text { font-size: 1.3rem; font-weight: 700; line-height: 1.4; margin: 6px 0 18px; }
.gap { display: inline-block; min-width: 3.2em; border-bottom: 2.5px solid var(--ink); margin: 0 3px; }
.options { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 56px; padding: 12px 16px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.05rem; color: var(--ink);
}
.opt .key { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; border: 1.5px solid var(--line); font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.opt:hover { border-color: var(--ink-soft); }
.opt[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt[aria-pressed="true"] .key { background: var(--marker); border-color: var(--marker-ink); color: var(--marker-ink); }
.opt.is-right { border-color: var(--green); background: var(--green-bg); }
.opt.is-wrong { border-color: var(--red); background: var(--red-bg); }
.opt:disabled { cursor: default; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

.answer-input { font-size: 1.15rem; }
.word-bank, .word-line { display: flex; flex-wrap: wrap; gap: 8px; }
.word-line { min-height: 60px; padding: 10px; border-radius: 12px; border: 2px dashed var(--line); margin-bottom: 14px; align-items: center; }
.word {
  padding: 8px 12px; border-radius: 10px; border: 2px solid var(--ink); background: var(--surface);
  cursor: pointer; font-size: 1.05rem; font-weight: 700; color: var(--ink);
}
.word:disabled { opacity: .25; cursor: default; }
.word-line .word { background: var(--marker); color: var(--marker-ink); border-color: var(--marker-ink); }

/* --- zpětná vazba: zelená = správně, červená fixa učitele = chyba --- */
.feedback { margin-top: 18px; border-radius: var(--radius); padding: 16px; border: 2px solid; }
.feedback.good { border-color: var(--green); background: var(--green-bg); }
.feedback.bad { border-color: var(--red); background: var(--red-bg); }
.feedback h3 { margin: 0 0 6px; }
.feedback.good h3 { color: var(--green); }
.feedback.bad h3 { color: var(--red); }
.struck { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2.5px; color: var(--ink-soft); }
.right-ans { font-weight: 700; border-bottom: 2.5px solid var(--green); }
.feedback .row { margin-top: 12px; }

.md p:last-child { margin-bottom: 0; }
.md ul { margin: .2em 0 .8em; padding-left: 1.2em; }
.md li { margin: .2em 0; }
.md strong { font-weight: 700; }
.md code { background: var(--surface-2); padding: 0 4px; border-radius: 4px; }

/* --- výsledky --- */
.result-hero { text-align: left; }
.skill-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.skill-row + .skill-row { margin-top: 14px; }
.skill-row .meter { grid-column: 1 / -1; }
.mistake { border-top: 1.5px solid var(--line); padding: 14px 0; }
.mistake:first-child { border-top: 0; }
details summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.two-col { display: grid; gap: 16px; }
@media (min-width: 640px) { .two-col { grid-template-columns: 1fr 1fr; } }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- slovíčka --- */
.flash { text-align: center; padding: 28px 18px; }
.flash .big-word { font-family: var(--font-display); font-weight: 800; font-size: 2.4rem; line-height: 1.1; word-break: break-word; }
.flash .example { font-style: italic; margin-top: 12px; }
.vocab-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1.5px solid var(--line); }
.vocab-row:first-child { border-top: 0; }
.vocab-row .w { flex: 1; min-width: 0; }
.vocab-row .w strong { display: block; }
.new-words { display: grid; gap: 10px; }

/* --- chat / vysvětlení --- */
.sheet {
  width: min(680px, 100%); max-height: 88vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink);
  display: flex; flex-direction: column;
}
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: rgba(10, 18, 30, .55); }
@media (min-width: 720px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.sheet-head h2 { margin: 0; }
.sheet-body { overflow-y: auto; padding: 4px 18px 12px; flex: 1; }
.sheet-ask { display: flex; gap: 8px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1.5px solid var(--line); }
.sheet-ask input { flex: 1; min-width: 0; min-height: 46px; padding: 8px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); }
.bubble { padding: 12px 14px; border-radius: 14px; margin: 10px 0; }
.bubble.ai { background: var(--surface-2); border: 1.5px solid var(--line); }
.bubble.me { background: var(--ink); color: var(--paper); margin-left: 15%; }

/* --- načítání, toast --- */
.loading { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 50px 10px; text-align: center; }
.scribble { width: 84px; height: 14px; border-radius: 3px 9px 4px 10px; background: var(--marker); transform-origin: left; animation: scribble 1.1s ease-in-out infinite; }
@keyframes scribble { 0% { transform: scaleX(.1) skewX(-8deg); } 50% { transform: scaleX(1) skewX(-8deg); } 100% { transform: scaleX(.1) skewX(-8deg); transform-origin: right; } }
.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%);
  z-index: 50; max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--paper); font-weight: 700; box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.toast.err { background: var(--red); color: #fff; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 10px 0; }
.steps li { counter-increment: s; position: relative; padding-left: 38px; margin: 10px 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; background: var(--marker); color: var(--marker-ink); display: grid; place-items: center; font-weight: 700; font-size: .9rem; }

/* ---------- fáze 2: motivace, plán, pokrok ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.streak {
  display: inline-flex; align-items: center; gap: 4px; flex: none; text-decoration: none;
  padding: 6px 12px 6px 8px; border-radius: 99px; border: 2px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-family: var(--font-display); font-size: 1.25rem;
}
.streak svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.streak.on { border-color: var(--marker-ink); background: var(--marker); color: var(--marker-ink); }
.streak.on svg { fill: #FF8A3D; stroke: var(--marker-ink); }
.goal-card .meter { height: 16px; margin-top: 12px; }
.goal-meter.high > i, .goal-meter > i { background: var(--marker); }
.xp-chip { font-weight: 700; font-size: .85rem; padding: 2px 8px; border-radius: 99px; background: var(--marker); color: var(--marker-ink); }

.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1.5px solid var(--line); }
.tasks li:first-child { border-top: 0; padding-top: 4px; }
.tasks .t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tasks .check { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 700; }
.tasks li.done .check { background: var(--green); border-color: var(--green); color: #fff; }
.tasks li.done strong { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--ink-soft); }

.plan-card { display: block; text-decoration: none; color: var(--ink); border-width: 2px; border-color: var(--ink); }
.plan-card:hover { background: var(--surface-2); }
.link-more { display: inline-block; margin-top: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.weeks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.week.current { border-color: var(--ink); border-width: 2px; }
.week.past { opacity: .7; }

.stat-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 720px) { .stat-tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; }
.tile strong { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.tile .meter { height: 8px; margin: 4px 0 2px; }

/* sloupcový graf (HTML, ať se text neškáluje) */
.bars { position: relative; height: 170px; display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; align-items: end; border-bottom: 1.5px solid var(--line); margin-top: 14px; }
.bar-col { height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: default; outline-offset: 0; }
.bar { width: min(70%, 26px); background: var(--ink); border-radius: 4px 4px 0 0; }
.bar-col.hover .bar, .bar-col:focus-visible .bar { background: var(--marker); box-shadow: inset 0 0 0 2px var(--marker-ink); }
.goal-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--ink-soft); pointer-events: none; z-index: 1; }
.goal-line span { position: absolute; right: 0; top: -20px; font-size: .75rem; color: var(--ink-soft); background: var(--surface); padding: 0 4px; }
.bar-labels { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; font-size: .75rem; color: var(--ink-soft); text-align: center; margin-top: 4px; }
.table-toggle { margin-top: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 8px; }
table.data th, table.data td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--ink-soft); font-weight: 700; }

/* spojnicový graf */
.line-chart { position: relative; height: 170px; margin: 14px 0 0 40px; }
.line-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.line-chart path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grid-y span { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.grid-y i { position: absolute; left: -42px; top: -9px; width: 36px; text-align: right; font-style: normal; font-size: .72rem; color: var(--ink-soft); }
.dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--surface); }
.dot::after { content: ""; position: absolute; inset: -12px; } /* větší cíl pro prst */
.dot.hover, .dot:focus-visible { background: var(--marker); box-shadow: 0 0 0 2px var(--marker-ink); }
.line-labels { margin-left: 40px; }

/* kalendář */
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; max-width: 520px; }
.heat-label { font-size: .7rem; color: var(--ink-soft); line-height: 1; align-self: center; padding-right: 6px; }
.hc { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.hc.empty { visibility: hidden; }
.hc.l1 { background: color-mix(in srgb, var(--ink) 22%, var(--surface)); border-color: transparent; }
.hc.l2 { background: color-mix(in srgb, var(--ink) 45%, var(--surface)); border-color: transparent; }
.hc.l3 { background: color-mix(in srgb, var(--ink) 72%, var(--surface)); border-color: transparent; }
.hc.l4 { background: var(--ink); border-color: transparent; }
.hc.hover, .hc:focus-visible { outline: 2px solid var(--marker-ink); background-image: linear-gradient(var(--marker), var(--marker)); }
.heat-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.heat-legend .hc { width: 14px; }

.trend-list { list-style: none; margin: 0; padding: 0; }
.trend-list li { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-top: 1.5px solid var(--line); }
.trend-list li:first-child { border-top: 0; }
.trend-list .t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.slope { display: grid; gap: 3px; margin-top: 6px; }
.meter.thin { height: 6px; }
.delta { flex: none; font-weight: 700; font-size: .9rem; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }

.tip {
  position: absolute; z-index: 60; pointer-events: none; max-width: 260px;
  background: var(--ink); color: var(--paper); font-size: .85rem; font-weight: 700;
  padding: 6px 10px; border-radius: 8px;
}

/* ---------- fáze 3: učebnice a testy ---------- */
.unit-list { margin-top: 12px; }
.unit-list > * + * { margin-top: 8px; }
a.topic-btn { text-decoration: none; }
.upload-btn { cursor: pointer; }
.upload-list { list-style: none; margin: 0; padding: 0; }
.upload-list li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1.5px solid var(--line); font-size: .95rem; }
.upload-list li:first-child { border-top: 0; }
.small-scribble { width: 26px; height: 9px; flex: none; }
.ok-mark, .err-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .8rem; }
.ok-mark { background: var(--green); }
.err-mark { background: var(--red); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.thumb { margin: 0; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.thumb.error { border-color: var(--red); }
.thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--grid); }
.thumb figcaption { padding: 8px 10px; }
.grammar + .grammar { border-top: 1.5px solid var(--line); margin-top: 14px; padding-top: 14px; }
.examples { margin: 6px 0 10px; padding-left: 1.2em; font-style: italic; }
.unit-pick { border: 0; padding: 0; margin: 8px 0 0; }
.unit-pick legend { padding: 0; margin-bottom: 4px; }
.check-row { display: flex; gap: 12px; align-items: center; min-height: 48px; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.check-row + .check-row { margin-top: 8px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--ink); flex: none; }
.check-row:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.grade { display: inline-grid; place-items: center; width: 1.4em; border-radius: 12px; border: 3px solid; }
.grade.g1, .grade.g2 { color: var(--green); }
.grade.g3 { color: var(--ink); }
.grade.g4, .grade.g5 { color: var(--red); }
.test-soon .chip { font-size: .85rem; }

/* ---------- fáze 4: poslech, psaní, mluvení ---------- */
.skill-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.skill-cards.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .skill-cards { grid-template-columns: 1fr; } .skill-cards.two { grid-template-columns: 1fr; } }
.skill-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); padding: 14px; }
.skill-card:hover { border-color: var(--ink); }
.skill-card .meter { margin-top: 6px; height: 8px; }
.skill-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--marker); display: grid; place-items: center; margin-bottom: 4px; }
.skill-ico svg { width: 24px; height: 24px; fill: none; stroke: var(--marker-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.audio { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.audio.compact { margin-bottom: 16px; position: sticky; top: 8px; z-index: 5; }
.audio-main { flex: 1; min-width: 0; }
.audio-meter { height: 8px; margin-top: 6px; }
.audio-meter > i { background: var(--marker); }
.play-btn { width: 52px; height: 52px; flex: none; border-radius: 50%; border: 2px solid var(--marker-ink); background: var(--marker); display: grid; place-items: center; cursor: pointer; }
.play-btn svg { width: 24px; height: 24px; fill: var(--marker-ink); }
.transcript p { margin: 0 0 8px; }

.writing-area { min-height: 260px; font-size: 1.05rem; line-height: 1.6; resize: vertical; }
.writing-text { white-space: pre-wrap; margin-top: 10px; line-height: 1.6; }
.ok-text { color: var(--green); font-weight: 700; }
.warn-text { color: var(--red); font-weight: 700; }

.say-text { font-family: var(--font-display); font-size: 1.6rem; font-weight: 600; line-height: 1.35; }
.w-good { border-bottom: 3px solid var(--green); }
.w-bad { color: var(--red); text-decoration: underline wavy var(--red); text-underline-offset: 5px; }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 22px 0 6px; text-align: center; }
.mic-btn { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--ink); background: var(--surface); display: grid; place-items: center; cursor: pointer; flex: none; }
.mic-btn svg { width: 36px; height: 36px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; }
.mic-btn.small { width: 48px; height: 48px; border-width: 2px; }
.mic-btn.small svg { width: 22px; height: 22px; }
.mic-btn.rec { background: var(--red); border-color: var(--red); animation: pulse 1.2s ease-in-out infinite; }
.mic-btn.rec svg { stroke: #fff; }
.mic-btn:disabled { opacity: .4; cursor: not-allowed; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(215, 38, 61, .45); } 50% { box-shadow: 0 0 0 14px rgba(215, 38, 61, 0); } }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.chip-btn { border: 2px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 6px 12px; font-weight: 700; cursor: pointer; min-height: 40px; }
.chip-btn.on { border-color: var(--marker-ink); background: var(--marker); color: var(--marker-ink); }
.conv { display: flex; flex-direction: column; gap: 10px; }
.conv-log { min-height: 40vh; }
.conv-note { margin: -4px 0 10px 15%; padding: 8px 12px; border-left: 3px solid var(--green); background: var(--green-bg); border-radius: 4px 10px 10px 4px; }
.conv-input { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: center; background: var(--paper); padding: 8px 0; }
.conv-input .input { flex: 1; min-width: 0; }
@media (min-width: 960px) { .conv-input { bottom: 0; } }
.speak-inline { border: 0; background: transparent; cursor: pointer; vertical-align: middle; padding: 0 2px; color: inherit; }
.speak-inline svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- matika a přepínač předmětů ---------- */
.subj-switch { display: inline-grid; grid-template-columns: repeat(3, auto); gap: 4px; padding: 4px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
.subj-switch button { min-height: 38px; padding: 6px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-soft); font-weight: 700; cursor: pointer; }
.subj-switch button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.nav-subj { display: none; }
@media (min-width: 960px) {
  .nav-subj { display: block; margin: -8px 4px 18px; }
  .nav-subj .subj-switch { width: 100%; }
  .subj-mobile { display: none; }
}
.num-row { display: flex; align-items: center; gap: 10px; }
.num-row .input { flex: 1; min-width: 0; }
.unit { font-weight: 700; font-size: 1.1rem; }
.katex { font-size: 1.08em; }
.q-text .katex { font-size: 1.12em; }
.opt .katex { font-size: 1.1em; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.problem { font-size: 1.15rem; }
.hint-box { border-left: 4px solid var(--marker); background: var(--surface-2); border-radius: 4px 12px 12px 4px; padding: 10px 14px; }
.sol-steps { margin: 0; padding-left: 1.3em; }
.sol-steps li { margin: 0 0 12px; }
.answer-box { border: 2px solid var(--green); background: var(--green-bg); border-radius: 12px; padding: 10px 14px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- maturita a písemky ---------- */
button.plan-card { width: 100%; text-align: left; font: inherit; cursor: pointer; }
.tf-list { display: grid; gap: 10px; }
.tf-row, .match-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); }
.match-row + .match-row { margin-top: 10px; }
.tf-row.is-right, .match-row.is-right { border-color: var(--green); background: var(--green-bg); }
.tf-row.is-wrong, .match-row.is-wrong { border-color: var(--red); background: var(--red-bg); }
.tf-text { flex: 1 1 220px; min-width: 0; }
.tf-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.tf-btn { min-width: 48px; min-height: 42px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; }
.tf-btn[aria-pressed="true"] { background: var(--marker); border-color: var(--marker-ink); color: var(--marker-ink); }
.tf-btn:disabled { cursor: default; }
.match-opts { display: grid; gap: 6px; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.exam-bar { display: flex; justify-content: space-between; align-items: center; margin: -6px 0 14px; font-weight: 700; color: var(--ink-soft); }
.timer { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); padding: 2px 10px; border-radius: 8px; background: var(--surface); border: 1.5px solid var(--line); font-variant-numeric: tabular-nums; }
.timer.low { color: #fff; background: var(--red); border-color: var(--red); }
.verdict { font-weight: 700; padding: 10px 14px; border-radius: 12px; }
.verdict.ok { background: var(--green-bg); color: var(--green); border: 2px solid var(--green); }
.verdict.bad { background: var(--red-bg); color: var(--red); border: 2px solid var(--red); }
.formula + .formula { border-top: 1.5px solid var(--line); margin-top: 8px; padding-top: 8px; }
.bars.mini { height: 120px; grid-template-columns: repeat(10, 1fr); }
.bar.fail { background: var(--red); }
details.mistake summary { font-weight: 700; }

/* ---------- opakování chyb, kontrola postupu, žebříček ---------- */
.review-card { align-items: center; gap: 12px; }
.work-steps { margin: 0; padding-left: 1.3em; }
.work-steps li { margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; border-left: 4px solid var(--green); background: var(--green-bg); }
.work-steps li.bad { border-left-color: var(--red); background: var(--red-bg); }
.leaderboard { list-style: none; margin: 10px 0 0; padding: 0; }
.leaderboard li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; }
.leaderboard li + li { border-top: 1.5px solid var(--line); border-radius: 0; }
.leaderboard li.me { background: var(--marker); color: var(--marker-ink); border-radius: 10px; }
.lb-rank { width: 2em; font-weight: 700; }
.lb-name { flex: 1; min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --- správa appky --- */
.btn-danger { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.chip-ink { border-color: var(--ink); color: var(--ink); }
.chip-warn { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.admin-link { text-decoration: none; align-items: center; }
.admin-link:hover { border-color: var(--ink); }
.invite-code {
  font: 700 1.05rem/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--marker); color: var(--marker-ink); padding: 4px 10px; border-radius: 8px;
  word-break: break-all; user-select: all;
}
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
.admin-stats div { min-width: 0; }
.admin-stats dt { font-size: .78rem; color: var(--ink-soft); }
.admin-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.callout-note { border: 2px dashed var(--ink); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }

/* --- v8: čeština, motivace, zabezpečení --- */
.nav-subj .subj-switch { grid-template-columns: 1fr; }
.subj-switch button { padding: 6px 12px; }
@media (max-width: 360px) { .subj-switch button { padding: 6px 8px; font-size: .9rem; } }
.freeze { display: inline-flex; align-items: center; gap: 2px; padding: 4px 8px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); font-size: .9rem; }
.week-card { border-color: var(--ink); border-width: 2px; }
.week-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.week-stats div { display: flex; flex-direction: column; }
.week-stats strong { font: 800 1.5rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.week-stats span { font-size: .8rem; color: var(--ink-soft); }
.week-stats em { font-style: normal; font-weight: 700; }
.week-stats em.up { color: var(--green); }
.week-stats em.down { color: var(--red); }
@media (max-width: 420px) { .week-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.badge-pop {
  position: fixed; left: 50%; top: 18px; transform: translate(-50%, 0); z-index: 70;
  display: flex; gap: 12px; align-items: center; max-width: min(92vw, 420px);
  padding: 12px 16px; border-radius: 14px; background: var(--marker); color: var(--marker-ink);
  border: 2px solid var(--marker-ink); box-shadow: 0 8px 24px rgba(0,0,0,.18);
  animation: badgeIn .35s cubic-bezier(.2,.9,.3,1.2);
}
.badge-pop.out { opacity: 0; transform: translate(-50%, -12px); transition: opacity .3s, transform .3s; }
@keyframes badgeIn { from { opacity: 0; transform: translate(-50%, -20px) scale(.95); } }
@media (prefers-reduced-motion: reduce) { .badge-pop { animation: none; } .badge-pop.out { transition: none; } }
.badge-ico { font-size: 1.8rem; line-height: 1; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); border: 1.5px dashed var(--line); background: var(--surface); opacity: .55; filter: grayscale(1); }
.badge-card.on { opacity: 1; filter: none; border-style: solid; border-color: var(--ink); }
.badges-link, .admin-link { text-decoration: none; align-items: center; }
.opt.is-hidden { opacity: .25; text-decoration: line-through; }
details.source { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--line); }
details.source[open] { border-color: var(--ink); }
details.source summary { font-weight: 700; cursor: pointer; }
.source-body { max-height: 55vh; overflow: auto; margin-top: 8px; font-size: .97rem; line-height: 1.6; }
.source-body p { margin: 0 0 .7em; }
.usage { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .92rem; }
.usage strong { font-variant-numeric: tabular-nums; }
.qr-box { display: flex; justify-content: center; }
.qr-box svg { width: 200px; height: 200px; border-radius: 8px; border: 1.5px solid var(--line); }
.backup-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.backup-codes code { font: 700 1rem ui-monospace, Menlo, Consolas, monospace; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1.5px solid var(--line); text-align: center; }
.code-input { font: 700 1.6rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .2em; text-align: center; }
.book-row { gap: 8px; }
.chat { display: flex; flex-direction: column; }

/* =====================================================================
   Doučovač v9 – hravý vzhled (výchozí) + nové prvky
   Klidný vzhled = původní sešit (html[data-style="calm"]).
   ===================================================================== */
:root { --accent: #6C4CF5; --accent-ink: #FFFFFF; --accent-soft: #EEE9FF; --subj: var(--accent); --shadow: rgba(35, 32, 74, .14); }
:root[data-subject="en"] { --subj: #2E86F5; --subj-soft: #E4F0FF; }
:root[data-subject="math"] { --subj: #F07A12; --subj-soft: #FFEEDD; }
:root[data-subject="cs"] { --subj: #E63E78; --subj-soft: #FDE6EF; }

:root[data-style="play"] {
  --paper: #F4F1FF; --grid: transparent; --surface: #FFFFFF; --surface-2: #F8F6FF;
  --ink: #23204A; --ink-soft: #625E86; --line: #DFD8FB;
  --marker: #FFD43B; --marker-ink: #23204A;
  --red: #E5304F; --red-bg: #FFE9EE; --green: #18A058; --green-bg: #E3F8EC;
  --focus: #6C4CF5; --radius: 20px; --brand-hl: 62%;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="play"]:not([data-theme="light"]) {
    --paper: #15132B; --grid: transparent; --surface: #1F1C3D; --surface-2: #262249;
    --ink: #EEEBFF; --ink-soft: #ABA6D6; --line: #383370;
    --marker: #FFD43B; --marker-ink: #23204A; --accent: #8F78FF; --accent-soft: #2C2760;
    --red: #FF6B85; --red-bg: #3B1E2C; --green: #4CD38A; --green-bg: #173226; --focus: #A795FF; --shadow: rgba(0, 0, 0, .4);
  }
}
:root[data-style="play"] body {
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 8% 4%, color-mix(in srgb, var(--accent) 16%, transparent) 0 180px, transparent 181px),
    radial-gradient(circle at 96% 30%, color-mix(in srgb, var(--subj) 13%, transparent) 0 140px, transparent 141px),
    radial-gradient(circle at 20% 92%, color-mix(in srgb, var(--marker) 22%, transparent) 0 120px, transparent 121px);
  background-size: auto; background-attachment: fixed;
}
:root[data-style="play"] h1 { font-size: 2.15rem; }
:root[data-style="play"] .card { border-width: 2px; border-radius: var(--radius); box-shadow: 0 4px 0 var(--line); }
:root[data-style="play"] .card.flat { box-shadow: none; }
:root[data-style="play"] .card.callout { border-color: var(--accent); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 45%, var(--line)); }
:root[data-style="play"] .btn { border-radius: 16px; box-shadow: 0 4px 0 var(--shadow); transition: transform .08s ease, box-shadow .08s ease; }
:root[data-style="play"] .btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--shadow); }
:root[data-style="play"] .btn-ink { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 60%, #000); }
:root[data-style="play"] .btn-marker { box-shadow: 0 4px 0 #C99A00; }
:root[data-style="play"] .btn-ghost { box-shadow: none; }
:root[data-style="play"] .btn-big { min-height: 56px; font-size: 1.1rem; padding: 12px 24px; }
:root[data-style="play"] .opt { border-radius: 16px; box-shadow: 0 3px 0 var(--line); }
:root[data-style="play"] .opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 50%, var(--line)), inset 0 0 0 1px var(--accent); }
:root[data-style="play"] .opt.is-right { animation: pop .35s ease; }
:root[data-style="play"] .opt.is-wrong { animation: shake .35s ease; }
:root[data-style="play"] .topic-btn { border-width: 2px; border-radius: 16px; box-shadow: 0 3px 0 var(--line); border-left: 6px solid var(--subj); }
:root[data-style="play"] .topic-btn:hover { border-color: var(--subj); }
:root[data-style="play"] .input { border-radius: 14px; }
:root[data-style="play"] .input:focus { border-color: var(--accent); }
:root[data-style="play"] .chip.level-chip { border-color: var(--subj); color: var(--subj); }
:root[data-style="play"] .level-big .hl { background: none; color: var(--subj); }
:root[data-style="play"] .nav { border-radius: 22px 22px 0 0; box-shadow: 0 -4px 20px var(--shadow); border-top: 0; }
:root[data-style="play"] .nav a.active { color: var(--accent); }
:root[data-style="play"] .nav a.active span { background: var(--accent-soft); color: var(--accent); padding: 0 8px; border-radius: 99px; }
@media (min-width: 960px) {
  :root[data-style="play"] .nav { border-radius: 0 26px 26px 0; box-shadow: 4px 0 24px var(--shadow); }
  :root[data-style="play"] .nav a.active { background: var(--accent-soft); }
  :root[data-style="play"] .nav a.active span { background: none; padding: 0; }
}
:root[data-style="play"] .meter { border-radius: 99px; height: 14px; }
:root[data-style="play"] .meter > i { border-radius: 99px; transform: none; background: var(--subj); }
:root[data-style="play"] .meter.low > i { background: #FF8DA1; }
:root[data-style="play"] .meter.high > i { background: var(--green); }
:root[data-style="play"] .goal-meter > i { background: linear-gradient(90deg, var(--marker), #FFB020); }
:root[data-style="play"] .feedback { border-radius: var(--radius); }
:root[data-style="play"] .feedback.good { animation: pop .35s ease; }
:root[data-style="play"] .subj-switch button[aria-selected="true"] { background: var(--subj); border-color: var(--subj); color: #fff; }
:root[data-style="play"] .bubble.me { background: var(--accent); color: #fff; }
:root[data-style="play"] .plan-card { border-color: var(--line); }
:root[data-style="play"] .plan-card:hover { border-color: var(--subj); }
:root[data-style="play"] .link-more { color: var(--subj); }
:root[data-style="play"] .streak.on svg { fill: #FF8A3D; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* --- maskot Douček (v klidném vzhledu skrytý) --- */
.mascot { flex: none; display: block; overflow: visible; }
:root[data-style="calm"] .mascot { display: none; }
:root[data-style="play"] .mascot-happy, :root[data-style="play"] .mascot-cheer { animation: bob 3.2s ease-in-out infinite; }
:root[data-style="play"] .loading .mascot { animation: tilt 1.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes tilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .mascot, .opt, .feedback { animation: none !important; } }
.logo { display: inline-flex; align-items: center; gap: 8px; }
.logo .mascot { width: 34px; height: 34px; }
.logo .brand-mark { font-size: 1.45rem; }
:root[data-style="play"] .brand-mark { background: none; color: var(--accent); padding: 0; }
:root[data-style="calm"] .logo .mascot { display: none; }
.greet-wrap { display: flex; align-items: center; gap: 12px; }
.auth-head, .auth-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.center-stack { text-align: center; display: flex; flex-direction: column; align-items: center; }
.center-stack > * { max-width: 460px; }
.center-stack .btn-block { width: 100%; }

/* --- vlastní téma --- */
.custom-card { border-color: var(--accent) !important; }
:root[data-style="calm"] .custom-card { border-color: var(--ink) !important; }
.custom-form .input { flex: 1; min-width: 0; }
.chips-row { gap: 8px; }
.chip-btn { cursor: pointer; font-size: .85rem; padding: 6px 12px; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }

/* --- AI štítek a nahlášení --- */
.ai-tag { color: var(--ink-soft); margin: 14px 0 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }
.linkish:hover { color: var(--red); }
.report-quote { border-left: 3px solid var(--line); margin: 0; padding: 4px 10px; white-space: pre-wrap; }
.report { border-top: 1.5px solid var(--line); padding-top: 12px; }
.report:first-of-type { border-top: 0; padding-top: 0; }
.help-card { text-align: center; align-items: center; }
.help-card .mascot { margin: 0 auto; }

/* --- vzhled v profilu --- */
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-opt input { position: absolute; opacity: 0; }
.theme-opt > span { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; border: 2px solid var(--line); border-radius: 16px; cursor: pointer; text-align: center; min-height: 120px; justify-content: center; }
.theme-opt input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.theme-opt small { color: var(--ink-soft); }
:root[data-style="calm"] .theme-opt .mascot { display: block; }
.calm-swatch { width: 40px; height: 40px; border-radius: 8px; border: 1.5px solid #CBD5E1; background-color: #EEF2F6;
  background-image: linear-gradient(#DCE4ED 1px, transparent 1px), linear-gradient(90deg, #DCE4ED 1px, transparent 1px); background-size: 8px 8px; }

/* --- předplatné --- */
.paywall-card { display: block; text-decoration: none; color: inherit; border-color: var(--marker-ink) !important; background: linear-gradient(135deg, color-mix(in srgb, var(--marker) 35%, var(--surface)), var(--surface)); }
.price-hero { display: flex; gap: 16px; align-items: center; }
.price-card { border-color: var(--accent) !important; }
.price { display: flex; align-items: center; gap: 8px; }
.price strong { font-family: var(--font-display); font-weight: 800; font-size: 3.4rem; line-height: 1; color: var(--accent); }
:root[data-style="calm"] .price strong { color: var(--ink); }
.price span { font-weight: 700; line-height: 1.15; color: var(--ink-soft); }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ticks li { padding-left: 30px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--green-bg); color: var(--green); display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.check-row.consent { align-items: flex-start; padding: 12px; border: 2px dashed var(--line); border-radius: 14px; }
.check-row.consent input { width: 22px; height: 22px; flex: none; margin-top: 2px; accent-color: var(--accent); }

/* --- úvodní stránka --- */
.welcome { max-width: 1000px; margin: 0 auto; }
#view:has(.welcome) { max-width: 1040px; margin-left: auto !important; }
.w-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.logo-link { text-decoration: none; color: inherit; }
.w-hero { display: grid; gap: 20px; align-items: center; padding: 10px 0 30px; }
@media (min-width: 760px) { .w-hero { grid-template-columns: 1.3fr 1fr; } }
.w-hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.05; margin: 6px 0 14px; }
.w-kicker { font-weight: 700; color: var(--accent); margin: 0; letter-spacing: .02em; }
.w-lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 34em; }
.w-hero-art { position: relative; display: flex; flex-direction: column; align-items: center; }
.w-hero-art .mascot { width: min(190px, 46vw); height: auto; }
.w-bubble { background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 10px 14px; font-weight: 700; box-shadow: 0 4px 0 var(--line); margin-bottom: 8px; max-width: 260px; text-align: center; }
.w-subjects { display: grid; gap: 14px; margin: 10px 0 30px; }
@media (min-width: 700px) { .w-subjects { grid-template-columns: repeat(3, 1fr); } }
.w-subj { border-radius: 20px; padding: 18px; color: #fff; }
.w-subj h3 { margin: 10px 0 4px; font-size: 1.25rem; }
.w-subj p { margin: 0; opacity: .95; }
.w-subj.en { background: #2E86F5; } .w-subj.math { background: #F07A12; } .w-subj.cs { background: #E63E78; }
.w-ico { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: rgba(255, 255, 255, .22); font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.w-steps ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: w; }
@media (min-width: 700px) { .w-steps ol { grid-template-columns: repeat(3, 1fr); } }
.w-steps li { counter-increment: w; background: var(--surface); border: 2px solid var(--line); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.w-steps li::before { content: counter(w); width: 34px; height: 34px; border-radius: 50%; background: var(--marker); color: var(--marker-ink); display: grid; place-items: center; font-weight: 800; margin-bottom: 4px; }
.w-steps li span { color: var(--ink-soft); font-size: .95rem; }
.w-features { display: grid; gap: 12px; margin: 30px 0; }
@media (min-width: 640px) { .w-features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .w-features { grid-template-columns: repeat(3, 1fr); } }
.w-feat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 18px; background: var(--surface-2); border: 1.5px solid var(--line); }
.w-feat span { color: var(--ink-soft); font-size: .95rem; }
.w-price { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; margin: 10px 0 30px; border-color: var(--accent) !important; }
.w-faq details { border-top: 1.5px solid var(--line); padding: 8px 0; }
.w-faq details p { color: var(--ink-soft); margin: 4px 0 8px; }
.w-foot { display: flex; flex-wrap: wrap; gap: 16px; padding: 30px 0 10px; border-top: 1.5px solid var(--line); margin-top: 30px; }
.w-steps h2, .w-faq h2 { margin-top: 10px; }
.beta-chip { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 99px; background: var(--marker); color: var(--marker-ink); align-self: flex-start; margin-top: 2px; }

/* ===== v10: e-mail, škola, výzvy, Douček, třídy, diktát, obrázky, správa ===== */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.school-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.school-grid .chip-btn { min-width: 74px; justify-content: center; }

.challenges .challenge { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: calc(var(--radius) - 6px); background: var(--surface-2); }
.challenge.done { border-color: var(--green); background: var(--green-bg); }
.challenge strong { font-family: var(--font-display); }

.dousek-link { display: inline-flex; border-radius: 50%; transition: transform .15s ease; }
.dousek-link:hover { transform: rotate(-6deg) scale(1.04); }
.dousek-stage { display: flex; justify-content: center; padding: 18px 0 6px; background: radial-gradient(circle, var(--accent-soft, var(--surface-2)) 0 55%, transparent 56%); border-radius: var(--radius); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 2px solid var(--line); border-radius: calc(var(--radius) - 6px); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; }
.pick small { color: var(--ink-soft); font-size: 12px; }
.pick.on { border-color: var(--accent, var(--focus)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent, var(--focus)) 25%, transparent); }
.pick:disabled { opacity: .55; cursor: not-allowed; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(0,0,0,.12); }

.class-row { color: inherit; text-decoration: none; }
.class-row:hover { border-color: var(--accent, var(--focus)); }
.leaderboard li.me { font-weight: 700; }

/* diktát */
.dict-card { border-left: 5px solid var(--subj, var(--accent)); }
.dict-play { gap: 8px; align-items: center; }
textarea.answer-input { resize: vertical; min-height: 84px; font-size: 18px; line-height: 1.5; }
.dict-diff { font-size: 18px; line-height: 2; margin: 0; }
.d-ok { color: var(--ink); }
.d-bad, .d-miss { border-radius: 6px; padding: 1px 4px; background: var(--red-bg); }
.d-bad s { color: var(--red); text-decoration-thickness: 2px; }
.d-bad ins, .d-miss ins { color: var(--green); text-decoration: none; font-weight: 700; }
.d-miss { background: color-mix(in srgb, var(--green-bg) 70%, transparent); outline: 1.5px dashed var(--green); }

/* obrázky k matice */
.figure { margin: 12px auto 4px; max-width: 360px; background: var(--surface); border: 1.5px solid var(--line); border-radius: calc(var(--radius) - 6px); padding: 6px; }
.figure svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-body); }
.fg-grid { stroke: var(--line); stroke-width: .6; opacity: .7; }
.fg-axis { stroke: var(--ink-soft); stroke-width: 1.4; }
.fg-arrow { fill: var(--ink-soft); }
.fg-tick { fill: var(--ink-soft); font-size: 10px; }
.fg-tick, .fg-lab, .fg-side, .fg-flab { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.fg-lab { fill: var(--ink); font-size: 13px; font-weight: 700; }
.fg-side { fill: var(--subj, var(--accent)); font-size: 12px; font-weight: 700; }
.fg-flab { font-size: 12px; font-weight: 700; }
.fg-fn { fill: none; stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.fg-c0 { stroke: var(--subj, #F07A12); } .fg-t0 { fill: var(--subj, #F07A12); }
.fg-c1 { stroke: #2E86F5; } .fg-t1 { fill: #2E86F5; }
.fg-c2 { stroke: var(--green); } .fg-t2 { fill: var(--green); }
.fg-pt, .fg-dot { fill: var(--ink); }
.fg-open { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.fg-shape { fill: color-mix(in srgb, var(--subj, var(--accent)) 12%, transparent); stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.fg-right { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.fg-radius { stroke: var(--subj, var(--accent)); stroke-width: 2; stroke-dasharray: 5 4; }
.fg-interval { stroke: var(--subj, var(--accent)); stroke-width: 5; stroke-linecap: round; opacity: .8; }

/* správa: používání, chyby */
.usage-bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; align-items: end; height: 140px; padding-top: 4px; }
.ub { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; min-width: 0; }
.ub-n { font-size: 11px; color: var(--ink-soft); }
.ub-bar { position: relative; width: 100%; max-width: 26px; background: color-mix(in srgb, var(--accent, var(--focus)) 35%, transparent); border-radius: 5px 5px 2px 2px; display: flex; align-items: flex-end; overflow: hidden; }
.ub-new { width: 100%; background: var(--accent, var(--focus)); }
.ub-d { font-size: 9.5px; color: var(--ink-soft); white-space: nowrap; }
.feat-list { display: grid; gap: 6px; }
.feat { display: grid; grid-template-columns: minmax(110px, 1.2fr) 2fr 36px; gap: 10px; align-items: center; font-size: 14px; }
.feat strong { text-align: right; font-variant-numeric: tabular-nums; }
.feat-bar { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.feat-bar span { display: block; height: 100%; background: var(--subj, var(--accent, var(--focus))); border-radius: 6px; }
.err-row { padding: 8px 10px; border-radius: 10px; background: var(--red-bg); }
.err-row code { font-size: 12px; }
a.callout-note { display: block; color: inherit; }
@media (max-width: 420px) { .ub-d { display: none; } .feat { grid-template-columns: 1fr 1.2fr 30px; } }

/* ===== v10.1: aplikace na plochu, stěhování, ruch na úvodní obrazovce ===== */
.w-cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 8px; }
.btn-install { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.w-install { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
@media (max-width: 560px) { .w-install { grid-template-columns: auto 1fr; } .w-install .btn { grid-column: 1 / -1; } .w-cta .btn { flex: 1 1 100%; justify-content: center; } }

.info-dlg { border: none; border-radius: var(--radius); padding: 20px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px var(--shadow, rgba(0,0,0,.25)); }
.info-dlg::backdrop { background: rgba(20, 16, 50, .45); }
.install-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.install-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent, var(--focus)); color: #fff; display: grid; place-items: center; font-weight: 700; }
.kbd { display: inline-block; padding: 0 6px; border: 1.5px solid var(--line); border-radius: 6px; font-size: 13px; }
.install-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.move-view { max-width: 460px; margin: 6vh auto 0; }

.doucek-say { position: relative; margin: 4px 0 0; padding: 6px 10px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; line-height: 1.35; max-width: 34ch; animation: say-in .4s ease-out both; }
.doucek-say::before { content: ""; position: absolute; left: -7px; top: 10px; width: 10px; height: 10px; background: var(--surface); border-left: 1.5px solid var(--line); border-bottom: 1.5px solid var(--line); transform: rotate(45deg); }
@keyframes say-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.dousek-link .mascot { animation: bob 3.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }

.pulse-line { display: flex; align-items: center; gap: 8px; margin: -4px 0 0; color: var(--ink-soft); }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.chest-note { margin: 8px 0 0; }
.chest-card { display: flex; gap: 14px; align-items: center; border: 2px solid #E8B13A; background: linear-gradient(135deg, #FFF6D6, var(--surface) 70%); }
:root[data-theme="dark"] .chest-card { background: var(--surface); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chest-card { background: var(--surface); } }
.chest-btn { background: none; border: none; padding: 0; cursor: pointer; }
.chest-svg { width: 72px; height: 63px; display: block; overflow: visible; }
.chest-card.ready .chest-svg { animation: wiggle 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.chest-card.opening .chest-svg { animation: shake .3s linear infinite; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-8deg); } 80% { transform: rotate(7deg); } 85% { transform: rotate(-5deg); } 90% { transform: rotate(3deg); } }
@keyframes shake { 0% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-3px) rotate(-4deg); } 75% { transform: translateX(3px) rotate(4deg); } }
.chest-win { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0; }
.chest-open .chest-svg { width: 96px; height: 84px; }
.chest-open .chest-lid { transform-box: fill-box; transform-origin: 0% 100%; animation: lid-open .6s cubic-bezier(.2,.9,.3,1.3) forwards; }
@keyframes lid-open { to { transform: translate(-3px, -14px) rotate(-16deg); } }
.chest-xp { font-family: var(--font-display); font-size: 40px; color: #D08A00; animation: pop .5s cubic-bezier(.2,.9,.3,1.4) .25s both; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.unlock-card { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.unlock-preview { position: relative; flex: none; }
.unlock-preview .lock { position: absolute; right: -4px; bottom: -2px; font-size: 16px; }
.unlock-text { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }

.combo-chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: #FFE3C2; color: #8A3B00; font-weight: 700; font-size: 14px; animation: pop .4s cubic-bezier(.2,.9,.3,1.4) both; white-space: nowrap; }
.combo-chip.big { background: #FFD43B; color: #23204A; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .doucek-say, .dousek-link .mascot, .pulse-dot, .chest-card.ready .chest-svg, .chest-card.opening .chest-svg, .chest-open .chest-lid, .chest-xp, .combo-chip { animation: none !important; }
}
.link-btn { background: none; border: none; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

/* ===== v10.4: čekání na AI a nové motivy ===== */
.ai-loading { gap: 10px; max-width: 460px; margin: 0 auto; }
.ai-pct { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; line-height: 1; color: var(--accent, var(--ink)); font-variant-numeric: tabular-nums; }
.ai-meter { width: 100%; max-width: 360px; }
.ai-meter > i { transition: width .2s linear; }
.fun-card { width: 100%; margin-top: 8px; padding: 14px 16px; text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); min-height: 108px; opacity: 0; transform: translateY(6px); }
.fun-card.in { animation: fun-in .45s ease-out forwards; }
.fun-card p { margin: 6px 0 0; line-height: 1.45; }
.fun-kind { font-weight: 700; font-size: 14px; color: var(--subj, var(--accent)); }
@keyframes fun-in { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .fun-card, .fun-card.in { animation: none; opacity: 1; transform: none; } }

.theme-pick { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.theme-swatch { width: 56px; height: 42px; border-radius: 12px; display: grid; place-items: center; border: 1.5px solid rgba(0,0,0,.08); }
.theme-swatch .mascot { display: block !important; }
.sw-play { background: linear-gradient(135deg, #F4F1FF 50%, #6C4CF5 50%); }
.sw-space { background: radial-gradient(circle at 20% 30%, #fff 0 1px, transparent 2px), radial-gradient(circle at 70% 60%, #fff 0 1px, transparent 2px), linear-gradient(135deg, #0B1026, #2A1D6B); }
.sw-forest { background: linear-gradient(135deg, #EEF6EC 50%, #2F8F5B 50%); }
.sw-sunset { background: linear-gradient(135deg, #FFD08A, #F2742B 55%, #C2255C); }

/* Vesmír – vždy tmavý, hvězdná obloha */
:root[data-style="play"][data-palette="space"] {
  --paper: #0B1026; --grid: transparent; --surface: #141B3A; --surface-2: #1B2450;
  --ink: #EEF1FF; --ink-soft: #A9B1D8; --line: #2D3770;
  --accent: #8B7BFF; --accent-ink: #FFFFFF; --accent-soft: #252B63;
  --marker: #FFD43B; --marker-ink: #1A1640;
  --red: #FF6B85; --red-bg: #3A1D33; --green: #4CD38A; --green-bg: #13322A;
  --focus: #A99CFF; --shadow: rgba(0, 0, 0, .5); color-scheme: dark;
}
:root[data-style="play"][data-palette="space"] body {
  background-color: var(--paper);
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 72%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 34%, #cfd6ff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 82%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 88% 14%, #ffe9a8 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 6%, #fff 50%, transparent 51%),
    radial-gradient(circle at 85% 105%, rgba(139, 123, 255, .28) 0 260px, transparent 261px),
    radial-gradient(circle at 0% 0%, rgba(46, 134, 245, .18) 0 220px, transparent 221px);
  background-size: 420px 420px, 380px 380px, 520px 520px, 460px 460px, 600px 600px, 300px 300px, auto, auto;
  background-attachment: fixed;
}

/* Les – zelený, ve tmě noční les */
:root[data-style="play"][data-palette="forest"] {
  --paper: #EEF6EC; --surface: #FFFFFF; --surface-2: #F4FAF2;
  --ink: #1E3A2B; --ink-soft: #557264; --line: #CFE3D3;
  --accent: #2F8F5B; --accent-ink: #FFFFFF; --accent-soft: #DDF1E4;
  --marker: #FFD43B; --marker-ink: #1E3A2B; --focus: #2F8F5B; --shadow: rgba(30, 58, 43, .14);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="play"][data-palette="forest"]:not([data-theme="light"]) {
    --paper: #0F1F17; --surface: #17291F; --surface-2: #1D3327;
    --ink: #E6F4EA; --ink-soft: #9DBBA8; --line: #2C4A39;
    --accent: #55C489; --accent-ink: #0F1F17; --accent-soft: #1F3B2C; --focus: #6FD69F; --shadow: rgba(0, 0, 0, .45);
  }
}

/* Západ slunce – teplé barvy */
:root[data-style="play"][data-palette="sunset"] {
  --paper: #FFF3EA; --surface: #FFFFFF; --surface-2: #FFF8F2;
  --ink: #3A1F2B; --ink-soft: #7A5560; --line: #F6D5C4;
  --accent: #E8590C; --accent-ink: #FFFFFF; --accent-soft: #FFE4D4;
  --marker: #FFC83D; --marker-ink: #3A1F2B; --focus: #E8590C; --shadow: rgba(122, 52, 20, .16);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="play"][data-palette="sunset"]:not([data-theme="light"]) {
    --paper: #24131B; --surface: #311A24; --surface-2: #3A1F2B;
    --ink: #FFEDE3; --ink-soft: #D6AFA6; --line: #553040;
    --accent: #FF8A4C; --accent-ink: #24131B; --accent-soft: #4A2632; --focus: #FFA06A; --shadow: rgba(0, 0, 0, .45);
  }
}
:root[data-style="play"][data-palette="sunset"] body {
  background-image:
    radial-gradient(circle at 92% 2%, rgba(255, 200, 61, .35) 0 200px, transparent 201px),
    radial-gradient(circle at 4% 96%, rgba(194, 37, 92, .14) 0 220px, transparent 221px);
}
:root[data-style="play"][data-palette="forest"] body {
  background-image:
    radial-gradient(circle at 6% 6%, color-mix(in srgb, var(--accent) 16%, transparent) 0 180px, transparent 181px),
    radial-gradient(circle at 96% 90%, rgba(255, 212, 59, .18) 0 160px, transparent 161px);
}
.ai-meter.meter > i { background: linear-gradient(90deg, var(--accent), var(--subj, var(--accent))) !important; }

/* ===== v10.5: Jednorožec, Robot, Dospělý ===== */
.sw-unicorn { background: radial-gradient(circle at 25% 30%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 75% 70%, #fff 0 1.5px, transparent 2.5px), linear-gradient(135deg, #FFD6EC, #E7C6FF 60%, #B9E6FF); }
.sw-robot { background-color: #EAF2FF; background-image: linear-gradient(#BFD5FF 1px, transparent 1px), linear-gradient(90deg, #BFD5FF 1px, transparent 1px); background-size: 8px 8px; }
.sw-adult { background: #F3F5F8; color: #1F3A5F; font: 700 18px/1 Georgia, "Times New Roman", serif; }

/* Jednorožec – růžová a fialová, třpytky */
:root[data-style="play"][data-palette="unicorn"] {
  --paper: #FFF0F8; --surface: #FFFFFF; --surface-2: #FFF6FB;
  --ink: #3D1F3A; --ink-soft: #7D5679; --line: #F5D2EA;
  --accent: #E0539A; --accent-ink: #FFFFFF; --accent-soft: #FFE0F0;
  --marker: #FFD43B; --marker-ink: #3D1F3A; --focus: #C23F86; --shadow: rgba(140, 40, 100, .14);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="play"][data-palette="unicorn"]:not([data-theme="light"]) {
    --paper: #24122A; --surface: #321A39; --surface-2: #3B2043;
    --ink: #FFEAF6; --ink-soft: #D6AACB; --line: #57305F;
    --accent: #FF7DBD; --accent-ink: #24122A; --accent-soft: #4C2650; --focus: #FF9ACB; --shadow: rgba(0, 0, 0, .45);
  }
}
:root[data-style="play"][data-palette="unicorn"] body {
  background-image:
    radial-gradient(2px 2px at 14% 22%, #FFD43B 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 12%, #E0539A 50%, transparent 51%),
    radial-gradient(2px 2px at 84% 58%, #9D7BFF 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 36% 80%, #E0539A 50%, transparent 51%),
    radial-gradient(circle at 96% 4%, rgba(185, 230, 255, .55) 0 200px, transparent 201px),
    radial-gradient(circle at 4% 96%, rgba(231, 198, 255, .55) 0 220px, transparent 221px);
  background-size: 360px 360px, 420px 420px, 480px 480px, 300px 300px, auto, auto;
  background-attachment: fixed;
}

/* Robot – modrý technický výkres */
:root[data-style="play"][data-palette="robot"] {
  --paper: #EAF2FF; --surface: #FFFFFF; --surface-2: #F3F8FF;
  --ink: #0F2547; --ink-soft: #4A6283; --line: #C6D8F5;
  --accent: #1E6FFF; --accent-ink: #FFFFFF; --accent-soft: #DCE8FF;
  --marker: #B5F23D; --marker-ink: #0F2547; --focus: #1E6FFF; --shadow: rgba(15, 37, 71, .15);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="play"][data-palette="robot"]:not([data-theme="light"]) {
    --paper: #0A1730; --surface: #11234A; --surface-2: #162C5A;
    --ink: #E6EFFF; --ink-soft: #9FB4D8; --line: #24407A;
    --accent: #4D8DFF; --accent-ink: #FFFFFF; --accent-soft: #1A3366; --focus: #7AA9FF; --shadow: rgba(0, 0, 0, .45);
  }
}
:root[data-style="play"][data-palette="robot"] body {
  background-image:
    linear-gradient(color-mix(in srgb, var(--accent) 9%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent) 1px, transparent 1px);
  background-size: 28px 28px; background-attachment: fixed;
}
:root[data-style="play"][data-palette="robot"] .btn-marker { box-shadow: 0 4px 0 #6FA80F; }
:root[data-style="play"][data-palette="robot"] h1, :root[data-style="play"][data-palette="robot"] h2 { letter-spacing: .01em; }

/* Dospělý – střízlivý a úsporný, bez maskota a bez skákání */
:root[data-style="play"][data-palette="adult"] {
  --paper: #F3F5F8; --surface: #FFFFFF; --surface-2: #F8F9FB;
  --ink: #1B2533; --ink-soft: #5B6676; --line: #DCE1E8;
  --accent: #1F3A5F; --accent-ink: #FFFFFF; --accent-soft: #E3EAF3;
  --marker: #F2C14E; --marker-ink: #1B2533; --focus: #2D5A8C; --radius: 12px; --shadow: rgba(27, 37, 51, .08);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="play"][data-palette="adult"]:not([data-theme="light"]) {
    --paper: #12161C; --surface: #1A2028; --surface-2: #202833;
    --ink: #E7ECF2; --ink-soft: #9AA6B5; --line: #2E3946;
    --accent: #7FA7D6; --accent-ink: #12161C; --accent-soft: #24303E; --focus: #9DBCE2; --shadow: rgba(0, 0, 0, .4);
  }
}
:root[data-style="play"][data-palette="adult"] body { background-image: none; }
:root[data-style="play"][data-palette="adult"] h1 { font-size: 1.8rem; }
:root[data-style="play"][data-palette="adult"] .mascot { display: none; }
:root[data-style="play"][data-palette="adult"] .theme-opt .mascot { display: block; }
:root[data-style="play"][data-palette="adult"] .card { border-width: 1px; box-shadow: 0 1px 3px var(--shadow); }
:root[data-style="play"][data-palette="adult"] .btn { border-radius: 10px; box-shadow: none; }
:root[data-style="play"][data-palette="adult"] .btn-marker { box-shadow: none; }
:root[data-style="play"][data-palette="adult"] .opt, :root[data-style="play"][data-palette="adult"] .topic-btn { box-shadow: none; border-radius: 10px; }
:root[data-style="play"][data-palette="adult"] .doucek-say { border: none; background: none; padding: 0; color: var(--ink-soft); }
:root[data-style="play"][data-palette="adult"] .doucek-say::before { display: none; }
:root[data-style="play"][data-palette="adult"] .chest-card.ready .chest-svg,
:root[data-style="play"][data-palette="adult"] .opt.is-right, :root[data-style="play"][data-palette="adult"] .opt.is-wrong,
:root[data-style="play"][data-palette="adult"] .feedback.good { animation: none; }
@media (prefers-color-scheme: dark) {
  :root[data-style="play"][data-palette="unicorn"]:not([data-theme="light"]) body {
    background-image:
      radial-gradient(2px 2px at 14% 22%, #FFD43B 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 64% 12%, #FF7DBD 50%, transparent 51%),
      radial-gradient(2px 2px at 84% 58%, #B49CFF 50%, transparent 51%),
      radial-gradient(1.5px 1.5px at 36% 80%, #FF7DBD 50%, transparent 51%),
      radial-gradient(circle at 96% 4%, rgba(255, 125, 189, .14) 0 200px, transparent 201px),
      radial-gradient(circle at 4% 96%, rgba(157, 123, 255, .16) 0 220px, transparent 221px);
  }
}

/* přihlášení přes Google / Microsoft */
.oauth-box { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.oauth-or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 14px; }
.oauth-or::before, .oauth-or::after { content: ""; flex: 1; height: 1.5px; background: var(--line); }
.btn-oauth { display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-oauth svg { flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.form-grid .field-wrap { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.warn-text { color: var(--red); }

/* hesla: oko a kontrola shody */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap .input { width: 100%; padding-right: 48px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; background: none; border: 0; border-radius: 10px; color: var(--ink-soft); cursor: pointer; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }
.pw-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hint.pw-ok { color: var(--green); font-weight: 700; }
.hint.pw-bad { color: var(--red); }

/* --- v10.8: návod k instalaci (iPhone, Android, prohlížeč v aplikaci) --- */
.info-dlg { max-height: calc(100dvh - 32px); overflow: auto; }
.install-steps li > span:last-child { line-height: 1.55; }
.ui-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 5px; margin: 1px 0; border: 1.5px solid var(--line); border-radius: 999px; background: var(--bg, #f3f4f8); color: #0A84FF; font-weight: 700; vertical-align: middle; white-space: normal; max-width: 100%; }
.ui-chip span { color: var(--ink); }
.ui-chip svg { flex: none; }
.ios-mock { position: relative; margin: 2px 0 6px; padding: 10px 10px 30px; border-radius: 18px; background: linear-gradient(#e9ecf3, #dfe3ec); }
.ios-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: 999px; background: rgba(255,255,255,.92); box-shadow: 0 2px 10px rgba(0,0,0,.12); color: #0A84FF; font-size: 20px; }
.ios-url { flex: 1; text-align: center; font-size: 14px; color: #1c1c1e; background: rgba(120,120,128,.12); border-radius: 999px; padding: 5px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-url.wide { margin-bottom: 8px; background: rgba(255,255,255,.92); }
.ios-btn { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 50%; }
.ios-btn.hot { background: #0A84FF; color: #fff; box-shadow: 0 0 0 0 rgba(10,132,255,.6); animation: iosPulse 1.6s infinite; }
.ios-tip { position: absolute; right: 14px; bottom: 6px; font-size: 13px; font-weight: 700; color: #0A84FF; }
.ios-tip.center { right: 50%; transform: translateX(50%); }
@keyframes iosPulse { 0% { box-shadow: 0 0 0 0 rgba(10,132,255,.6); } 70% { box-shadow: 0 0 0 12px rgba(10,132,255,0); } 100% { box-shadow: 0 0 0 0 rgba(10,132,255,0); } }
.ios-pointer { position: fixed; z-index: 9999; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 12px; border-radius: 16px; background: #0A84FF; color: #fff; font-weight: 800; box-shadow: 0 8px 24px rgba(10,132,255,.45); animation: iosBounce 1s ease-in-out infinite; cursor: pointer; }
.ios-pointer span { font-size: 30px; line-height: 1; }
.ios-pointer small { font-size: 13px; }
.ios-pointer.center { left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); margin-left: -48px; width: 96px; }
.ios-pointer.right { right: 10px; bottom: calc(14px + env(safe-area-inset-bottom)); }
.ios-pointer.top { right: 70px; top: 10px; }
@keyframes iosBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
.ios-pointer.top { animation-name: iosBounceUp; }
@keyframes iosBounceUp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .ios-btn.hot, .ios-pointer { animation: none; } }

/* --- v10.9: průvodce pro nováčky --- */
.push-nudge { border: 2px solid var(--accent, var(--focus)); background: linear-gradient(135deg, color-mix(in srgb, var(--accent, #6C4CF5) 12%, var(--surface)), var(--surface)); }
.push-nudge .bell { font-size: 34px; line-height: 1; }
.push-nudge .bell.ring { display: inline-block; transform-origin: 50% 0; animation: bellRing 2.4s ease-in-out infinite; }
@keyframes bellRing { 0%, 60%, 100% { transform: rotate(0); } 65% { transform: rotate(14deg); } 72% { transform: rotate(-12deg); } 79% { transform: rotate(8deg); } 86% { transform: rotate(-5deg); } }
.push-nudge .btn-big { flex: 1 1 auto; }
.time-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.onboard-card .ob-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ob-list li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--line); }
.ob-list li.next { border-color: var(--ink); background: color-mix(in srgb, var(--accent, #6C4CF5) 8%, transparent); }
.ob-list li.done { opacity: .7; }
.ob-list li.done strong { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.ob-list .check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.ob-list li.done .check { background: var(--good, #2bb673); border-color: var(--good, #2bb673); color: #fff; }
.ob-list .ob-txt { display: flex; flex-direction: column; min-width: 0; }
.ob-pulse { animation: obPulse 1s ease-in-out 3; }
@keyframes obPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent, #6C4CF5) 35%, transparent); } }
.page-hint { border-left: 5px solid var(--accent, var(--focus)); display: grid; gap: 10px; }
.page-hint ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.page-hint .btn { justify-self: start; }
.tour-layer { position: fixed; inset: 0; z-index: 9000; }
.tour-layer.centered { background: rgba(15, 12, 40, .6); display: grid; place-items: center; padding: 16px; }
.tour-hole { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(15, 12, 40, .6); outline: 3px solid #FFD43B; outline-offset: 2px; transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-pop { position: fixed; background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 16px; display: grid; gap: 8px; box-shadow: 0 16px 50px rgba(0,0,0,.35); max-width: calc(100vw - 24px); }
.tour-layer.centered .tour-pop { position: static; width: min(380px, 100%); }
.tour-count { margin: 0; }
@media (prefers-reduced-motion: reduce) { .push-nudge .bell.ring, .ob-pulse { animation: none; } .tour-hole { transition: none; } }
.onboard-meter i { background: var(--accent, #6C4CF5) !important; }

/* --- v10.10: papír na počítání (matematika) --- */
.scratch-fab { position: fixed; right: 0; top: 46%; z-index: 60; width: 48px; height: 66px; border-radius: 16px 0 0 16px; border: 2px solid var(--ink); border-right: 0; background: var(--marker, #FFD43B); color: var(--marker-ink, #23204A); display: grid; place-items: center; align-content: center; gap: 0; font-weight: 800; font-size: 11px; line-height: 1; box-shadow: -4px 4px 14px rgba(0,0,0,.16); cursor: pointer; padding: 0 0 0 2px; }
.scratch-fab svg { width: 22px; height: 22px; margin-bottom: 3px; }
.scratch-fab[hidden] { display: none; }
.scratch-fab.on { opacity: 0; pointer-events: none; }
@media (min-width: 900px) { .scratch-fab { top: auto; bottom: 24px; right: 24px; width: 62px; height: 62px; border-radius: 50%; border-right: 2px solid var(--ink); } }
.scratch-tip { position: fixed; right: 58px; top: calc(46% + 2px); z-index: 61; max-width: 240px; padding: 10px 12px; border-radius: 14px; background: var(--ink); color: var(--paper, #fff); font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.scratch-tip::after { content: ''; position: absolute; right: -7px; top: 22px; border: 7px solid transparent; border-right: 0; border-left-color: var(--ink); }
@media (min-width: 900px) { .scratch-tip { top: auto; bottom: 34px; right: 98px; } }
.scratch { position: fixed; left: 0; right: 0; bottom: 0; height: 56dvh; z-index: 80; display: flex; flex-direction: column; background: var(--surface); border-top: 2px solid var(--ink); border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.2); padding-bottom: env(safe-area-inset-bottom); overscroll-behavior: contain; }
.scratch[hidden] { display: none; }
.scratch.full { top: 0; height: auto; border-radius: 0; }
@media (min-width: 900px) { .scratch { left: auto; right: 24px; bottom: 24px; width: min(620px, calc(100vw - 48px)); height: min(560px, 70vh); border: 2px solid var(--ink); border-radius: 20px; padding-bottom: 0; } .scratch.full { top: 24px; left: 24px; width: auto; height: auto; } }
.scr-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1.5px solid var(--line); }
.scr-bar > .scr-tools { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); padding-right: 18px; }
.scr-bar > .scr-tools::-webkit-scrollbar { display: none; }
.scr-sep { flex: none; width: 1.5px; height: 24px; background: var(--line); margin: 0 4px; }
.scr-tools { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.scr-btn { flex: none; min-width: 36px; height: 38px; padding: 0 6px; border-radius: 10px; border: 1.5px solid transparent; background: transparent; color: var(--ink); display: inline-grid; place-items: center; font-size: 22px; font-weight: 700; cursor: pointer; }
.scr-btn:disabled { opacity: .3; cursor: default; }
.scr-btn.active { border-color: var(--ink); background: var(--accent-soft, #EEE9FF); }
.scr-btn.armed { background: #d6331a; color: #fff; }
.scr-color i { width: 18px; height: 18px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px rgba(0,0,0,.15); }
.scr-close { font-size: 15px; background: var(--ink); color: var(--surface); padding: 0 14px; flex: none; }
.scr-page { min-width: 30px; text-align: center; }
.scr-paper { position: relative; flex: 1; min-height: 0; margin: 8px; border-radius: 12px; background-color: #fffdf6; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.scr-paper canvas { position: absolute; inset: 0; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.scratch-open, html.scratch-open body { overscroll-behavior: none; }
@media (max-width: 899px) { html.scratch-open #view { padding-bottom: 58dvh; } }
@media (min-width: 900px) { .scr-bar > .scr-tools { -webkit-mask-image: none; mask-image: none; padding-right: 0; } }
.scr-paper.hand canvas { cursor: grab; }
.scr-paper.hand canvas:active { cursor: grabbing; }
.scr-zoom { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(255,255,255,.92); box-shadow: 0 2px 10px rgba(0,0,0,.15); color: #23204A; }
.scr-zoom .scr-btn { height: 34px; min-width: 34px; color: #23204A; font-size: 20px; }
.scr-zoom .scr-zlabel { font-size: 12px; min-width: 50px; font-variant-numeric: tabular-nums; }
.scr-help { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); padding: 7px 12px; border-radius: 10px; background: rgba(35,32,74,.88); color: #fff; text-align: center; pointer-events: none; }
.scr-help[hidden] { display: none; }

/* --- v10.13: Růst a statistiky (správa) --- */
.g-bars { display: grid; gap: 2px; align-items: end; height: 150px; padding-top: 4px; }
.gb { height: 100%; display: flex; align-items: flex-end; }
.gb-bar { position: relative; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent-soft, #EEE9FF); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #6C4CF5) 35%, transparent); display: flex; align-items: flex-end; overflow: hidden; }
.gb-in { width: 100%; background: var(--accent, #6C4CF5); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
.g-table { min-width: 640px; }
.g-table td, .g-table th { white-space: nowrap; font-variant-numeric: tabular-nums; }
.g-table td:first-child { white-space: normal; min-width: 150px; }
.g-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 2px; align-items: end; height: 100px; }
.g-hours div { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; }
.g-hours span { display: block; background: var(--accent, #6C4CF5); border-radius: 3px 3px 0 0; opacity: .85; }
.g-hours small { font-size: 10px; color: var(--ink-soft); text-align: center; height: 13px; line-height: 13px; }
.g-week { grid-template-columns: repeat(7, minmax(0, 1fr)); height: 80px; }
.g-item.is-off { opacity: .6; }
.promo-field { margin-top: 12px; }
.promo-field summary { cursor: pointer; color: var(--ink-soft); }
.growth .tabs { flex-wrap: wrap; }
.funnel .feat { grid-template-columns: minmax(120px, 1.2fr) 2fr 78px; }
.funnel .feat strong { text-align: right; white-space: nowrap; }
