:root {
  --bg: #fff8ec;
  --ink: #2b2140;
  --muted: #6d6480;
  --card: #ffffff;
  --line: #2b2140;
  --primary: #ff6b4a;
  --primary-ink: #ffffff;
  --ok: #2fb36d;
  --bad: #e0435a;
  --chip: #ffe7a8;
  --shadow: 0 4px 0 var(--line);
  font-family: "Nunito", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #1d1830; --ink: #f6f0ff; --muted: #b3a9c9; --card: #2a2342; --line: #0e0b18; --chip: #4b3d1a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1830; --ink: #f6f0ff; --muted: #b3a9c9; --card: #2a2342; --line: #0e0b18; --chip: #4b3d1a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; }
kbd { font-size: .72em; opacity: .7; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 4px; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 12px; }
.brand { font-weight: 900; font-size: 1.25rem; letter-spacing: -.01em; background: none; border: 0; padding: 0; color: inherit; }
.season { font-size: .9em; margin-left: -4px; }
.logo { display: inline-block; transform: rotate(-8deg); }
.nav { display: flex; gap: 6px; }
.nav button { background: var(--card); border: 3px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px 14px; font-weight: 800; }
.nav button:active { transform: translateY(3px); box-shadow: none; }

.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; padding: 0 16px 24px; max-width: 1200px; margin: 0 auto; }
@media (max-width: 900px) { .wrap { grid-template-columns: 1fr; } }

.stage { position: relative; background: var(--card); border: 3px solid var(--line); border-radius: 26px; box-shadow: 0 6px 0 var(--line); overflow: hidden; }
#scene { display: block; width: 100%; height: auto; aspect-ratio: 1; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
#scene.zoomed { touch-action: none; cursor: grab; }
.toast { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-weight: 800; }

.panel { background: var(--card); border: 3px solid var(--line); border-radius: 26px; box-shadow: 0 6px 0 var(--line); padding: 18px; align-self: start; }
.cat { display: inline-block; background: var(--chip); border: 2px solid var(--line); border-radius: 999px; padding: 2px 12px; font-weight: 800; font-size: .85rem; }
h1 { font-size: 1.3rem; margin: 12px 0 6px; line-height: 1.25; }
.hint { color: var(--muted); margin: 0 0 12px; font-size: .95rem; }
.order { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; margin-bottom: 12px; }
.slot { width: 44px; height: 44px; border-radius: 14px; border: 3px dashed var(--muted); display: grid; place-items: center; font-weight: 900; font-size: 1.2rem; }
.slot.filled { border-style: solid; border-color: var(--line); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.primary, .ghost { border: 3px solid var(--line); border-radius: 14px; padding: 9px 14px; font-weight: 800; box-shadow: var(--shadow); }
.primary { background: var(--primary); color: var(--primary-ink); }
.ghost { background: var(--card); }
.primary:disabled { opacity: .45; cursor: default; }
.primary:active:not(:disabled), .ghost:active { transform: translateY(3px); box-shadow: none; }
.result { border: 3px solid var(--line); border-radius: 18px; padding: 12px 14px; margin: 10px 0; }
.result.ok { background: color-mix(in srgb, var(--ok) 18%, var(--card)); }
.result.bad { background: color-mix(in srgb, var(--bad) 16%, var(--card)); }
.result h2 { margin: 0 0 6px; font-size: 1.1rem; }
.result ol, .result ul { margin: 6px 0; padding-left: 20px; }
.result li { margin: 3px 0; }
.score { color: var(--muted); font-size: .85rem; margin-top: 8px; }

dialog { border: 3px solid var(--line); border-radius: 22px; background: var(--card); color: var(--ink); width: min(900px, 94vw); max-height: 86vh; padding: 0; }
dialog::backdrop { background: rgba(20, 12, 40, .45); }
.picker-head { display: flex; gap: 10px; align-items: center; padding: 14px; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: var(--card); flex-wrap: wrap; }
.picker-head strong { flex: 1; }
.picker-head select { font: inherit; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; padding: 14px; overflow: auto; }
.grid button { border: 2px solid var(--line); border-radius: 12px; background: var(--card); padding: 8px 0; font-weight: 800; }
.grid button.done { background: color-mix(in srgb, var(--ok) 30%, var(--card)); }
.grid button.miss { background: color-mix(in srgb, var(--bad) 25%, var(--card)); }

/* scéna */
.veh { cursor: pointer; }
.veh .body { transition: filter .15s; }
.veh:hover .body { filter: brightness(1.08); }
.blink { animation: blink .7s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.beacon-a { animation: beacon .5s steps(1) infinite; }
.beacon-b { animation: beacon .5s steps(1) infinite reverse; animation-delay: .25s; }
@keyframes beacon { 50% { opacity: .15; } }
.wiggle { animation: wiggle 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes wiggle { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
.pick-badge { animation: pop .25s ease-out; transform-box: fill-box; transform-origin: center; }
@keyframes pop { from { transform: scale(.2); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .wiggle, .blink, .beacon-a, .beacon-b { animation: none; } }

/* značky: vyskočí, kývou se na sloupku, při vysvětlení zablikají */
.sign { transform-box: fill-box; transform-origin: 50% 100%; animation: sign-pop .55s cubic-bezier(.34,1.7,.5,1) both, sign-sway 3.2s ease-in-out infinite; }
@keyframes sign-pop { from { transform: scale(0) rotate(-14deg); } to { transform: scale(1) rotate(0); } }
@keyframes sign-sway { 0%,100% { rotate: -2.5deg; } 50% { rotate: 2.5deg; } }
.sign .face { transform-box: fill-box; transform-origin: 50% 50%; }
.sign .face.ping { animation: sign-ping .45s ease-in-out 3; }
@keyframes sign-ping { 0%,100% { transform: scale(1); } 50% { transform: scale(1.28); filter: drop-shadow(0 0 6px #fff36b); } }
@media (prefers-reduced-motion: reduce) { .sign { animation: none; } .sign .face.ping { animation: none; } }

/* vozidla: při jízdě se pohupují, při čekání svítí brzdová světla */
.veh .ride { transform-box: fill-box; transform-origin: 50% 50%; }
.veh.moving .ride { animation: ride .32s ease-in-out infinite alternate; }
@keyframes ride { from { transform: scale(1, 1); } to { transform: scale(1.025, .985); } }
.veh .tail { filter: drop-shadow(0 0 3px #ff4d5e); }
.veh.moving .tail { filter: none; opacity: .6; }
@media (prefers-reduced-motion: reduce) { .veh.moving .ride { animation: none; } }

/* promo režim: jen scéna přes celou plochu */
body.promo { background: transparent; }
body.promo .top, body.promo .panel { display: none; }
body.promo .wrap { display: block; padding: 0; max-width: none; }
body.promo .stage { border: 0; border-radius: 0; box-shadow: none; }
body.promo .draw-btn, body.promo .drawbar, body.promo .zoom-reset, body.promo .hud, body.promo .chalbar { display: none !important; }

/* návěstidla, přejezd, policista */
.lamp.lit, .rwl.lit { filter: drop-shadow(0 0 5px rgba(255, 240, 160, .9)); }
.barrier { transition: transform .8s ease-in-out; }
#train { pointer-events: none; }

/* účet, oblíbené / problémové, náhodné, čekání */
.top { flex-wrap: wrap; padding-top: max(12px, env(safe-area-inset-top)); }
@media (max-width: 560px) { .brand-t { display: none; } .nav button { padding: 6px 11px; } }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.marks { display: flex; gap: 6px; }
.mark { width: 40px; height: 40px; border: 3px solid var(--line); border-radius: 12px; background: var(--card); font-size: 1.2rem; font-weight: 900; box-shadow: 0 3px 0 var(--line); line-height: 1; }
.mark.on { background: var(--chip); }
#hardBtn.on { background: color-mix(in srgb, var(--bad) 30%, var(--card)); }
.mark:active { transform: translateY(3px); box-shadow: none; }
.wait { border: 3px solid var(--line); border-radius: 14px; padding: 9px 14px; font-weight: 800; box-shadow: var(--shadow); background: #ffe27a; color: #2b2140; }
.wait:disabled { opacity: .6; }
.wait.nudge { animation: nudge .45s ease-in-out 2; }
@keyframes nudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.lock { position: absolute; inset: 0; display: grid; place-items: center; background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--chip) 60%, var(--card)) 0 18px, var(--card) 18px 36px); }
.lock-in { text-align: center; background: var(--card); border: 3px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 20px; max-width: 360px; margin: 16px; }
.lock-ico { font-size: 2.4rem; }
.lock h2 { margin: 6px 0; font-size: 1.15rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--bad); font-weight: 800; margin: 4px 0; }
.picker-rnd { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px 0; }
.grid.rnd { padding-bottom: 0; }
.grid button.locked { opacity: .45; }
.grid button.locked::after { content: '🔒'; font-size: .6rem; margin-left: 2px; }
.grid button.fav { box-shadow: inset 0 -4px 0 #ffc83a; }
.grid button.hard { outline: 3px solid var(--bad); outline-offset: -5px; }
#account { width: min(460px, 94vw); }
.acc-head { display: flex; justify-content: space-between; align-items: center; padding: 14px; border-bottom: 2px solid var(--line); }
.acc-body { padding: 14px 16px 18px; }
.auth { display: grid; gap: 10px; }
.auth label { display: grid; gap: 4px; font-weight: 800; font-size: .9rem; }
.auth input { font: inherit; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); }
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; border: 2px solid var(--line); border-radius: 12px; background: var(--card); padding: 8px; font-weight: 800; }
.tab.on { background: var(--chip); }
.plan { background: var(--chip); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
.stats { display: flex; gap: 14px; font-weight: 800; margin: 8px 0 12px; }
details { margin: 10px 0; }
summary { cursor: pointer; font-weight: 800; }
details .auth { margin-top: 10px; }
.danger { color: var(--bad); }
.adv { border-top: 2px dashed var(--muted); padding-top: 10px; }
code { font-size: .85em; background: var(--bg); padding: 1px 5px; border-radius: 6px; }
.offline { max-width: 520px; margin: 40px auto; }
.toast { width: max-content; max-width: calc(100% - 28px); text-align: center; border-radius: 16px; line-height: 1.3; }
@media (pointer: coarse) { kbd { display: none; } }

/* přiblížení */
.zoom-reset { position: absolute; right: 12px; top: 12px; z-index: 3; width: 44px; height: 44px; border: 3px solid var(--line); border-radius: 14px; background: var(--card); font-size: 1.3rem; font-weight: 900; box-shadow: var(--shadow); }
.hud { display: none; }

/* mobil na šířku: křižovatka přes celý displej, vysvětlení pod ní */
@media (orientation: landscape) and (max-height: 560px) {
  .top { position: absolute; top: 0; left: 0; right: 0; z-index: 4; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); pointer-events: none; justify-content: flex-end; }
  .top .brand { display: none; }
  .top .nav { pointer-events: auto; }
  .nav button { padding: 4px 11px; border-width: 2px; box-shadow: 0 3px 0 var(--line); }
  .wrap { display: block; padding: 0 0 16px; max-width: none; }
  .stage { height: 100vh; height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  #scene { height: 100%; aspect-ratio: auto; }
  .panel { margin: 14px max(14px, env(safe-area-inset-left)) 0; }
  .zoom-reset { top: auto; bottom: 74px; right: max(12px, env(safe-area-inset-right)); }
  .toast { top: 56px; }
  .hud { display: flex; position: absolute; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); z-index: 3; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; pointer-events: none; }
  .hud > * { pointer-events: auto; }
  .hud .order.mini { margin: 0 auto 0 0; min-height: 0; gap: 6px; background: color-mix(in srgb, var(--card) 88%, transparent); border: 2px solid var(--line); border-radius: 14px; padding: 5px; }
  .hud .order.mini .slot { width: 36px; height: 36px; border-radius: 10px; font-size: 1rem; border-width: 2px; }
  .hud button { padding: 8px 12px; }
}

/* režimy: křižovatka dne, výzva, opakování */
.modes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip-btn { border: 2px solid var(--line); border-radius: 999px; background: var(--card); padding: 5px 11px; font-weight: 800; font-size: .85rem; box-shadow: 0 2px 0 var(--line); }
.chip-btn:active { transform: translateY(2px); box-shadow: none; }
.chip-btn.rev { background: color-mix(in srgb, var(--bad) 22%, var(--card)); }
.chip-btn.done { background: color-mix(in srgb, var(--ok) 25%, var(--card)); }
.hintbox { border: 2px dashed var(--line); background: color-mix(in srgb, #ffe27a 35%, var(--card)); border-radius: 14px; padding: 8px 12px; margin: 0 0 10px; font-size: .95rem; }
.hintbox p { margin: 4px 0; }
.chalbar { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 3; height: 40px; border: 3px solid var(--line); border-radius: 999px; background: var(--card); overflow: hidden; display: flex; align-items: center; box-shadow: var(--shadow); }
.chal-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--ok) 45%, var(--card)); transition: width .2s linear; }
.chalbar span { position: relative; flex: 1; text-align: center; font-weight: 900; }
.chalbar button { position: relative; border: 0; background: none; font-weight: 900; font-size: 1.1rem; padding: 0 14px; }
body.challenge #hintBtn, body.challenge .modes, body.challenge #after { display: none !important; }
.flash { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9rem; pointer-events: none; z-index: 4; animation: flash .65s ease-out both; }
@keyframes flash { from { transform: scale(.4); opacity: 0; } 30% { transform: scale(1.1); opacity: 1; } to { transform: scale(1); opacity: 0; } }
@media (orientation: landscape) and (max-height: 560px) { .chalbar { top: 52px; } }

/* vozidla: chyba (zatřese se), nápověda (záře) */
.veh.nope { animation: nope .42s ease-in-out; }
@keyframes nope { 0%,100% { translate: 0 0; } 20% { translate: -5px 0; } 40% { translate: 5px 0; } 60% { translate: -4px 0; } 80% { translate: 3px 0; } }
.veh.hint-glow { filter: drop-shadow(0 0 7px #fff36b) drop-shadow(0 0 3px #ffc21a); animation: glow .8s ease-in-out infinite alternate; }
@keyframes glow { to { filter: drop-shadow(0 0 13px #fff36b) drop-shadow(0 0 5px #ffc21a); } }
.ped.moving .walk { animation: ride .28s ease-in-out infinite alternate; }

/* tvary štítků pro barvoslepé */
.badge-shape { display: none; }
body.shapes .badge-shape { display: inline; }
body.shapes .badge-circle { display: none; }

/* nastavení */
.settings { border-top: 2px dashed var(--muted); margin-top: 12px; padding-top: 8px; }
.settings h3 { margin: 4px 0 8px; font-size: 1rem; }
.sw { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; cursor: pointer; }
.sw input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--primary); flex: none; margin-top: 1px; }
.sw select { font: inherit; padding: 4px 8px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); margin-left: auto; }

/* přístupnost */
html.big { font-size: 118%; }
body.calm *, body.calm *::before, body.calm *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; }
:focus-visible { outline: 3px solid #3f9cff; outline-offset: 2px; }

/* počasí a noc */
.wxnote { display: inline-block; margin: 8px 0 0; font-size: .82rem; font-weight: 800; color: var(--muted); }
.rain { animation: rain .5s linear infinite; }
@keyframes rain { from { transform: translate(0, 0); } to { transform: translate(-10px, 60px); } }
.fog { animation: fog 14s ease-in-out infinite alternate; }
@keyframes fog { to { transform: translate(60px, 0); } }
.smoke { animation: smoke 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes smoke { 50% { transform: translate(-4px, -6px) scale(1.25); opacity: .4; } }
svg.night .veh .tail { filter: drop-shadow(0 0 5px #ff4d5e); }
svg.night .lamp.lit, svg.night .rwl.lit { filter: drop-shadow(0 0 8px rgba(255, 240, 160, 1)); }
/* výkon: animované prvky na vlastní vrstvě */
.veh, .ped .walk, #train { will-change: transform; }

/* maskot Blikálek, úroveň a XP */
.buddy { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#buddySvg { width: 58px; height: 82px; flex: none; overflow: visible; }
.buddy-info { flex: 1; }
.buddy-info b { font-size: 1rem; }
.xpbar { height: 10px; border: 2px solid var(--line); border-radius: 999px; background: var(--bg); overflow: hidden; margin: 3px 0; }
#xpFill { height: 100%; background: linear-gradient(90deg, #ffc83a, #ff6b4a); width: 0; transition: width .6s ease; }
#buddySvg .bl { transform-origin: 0 40px; transform-box: view-box; }
#buddySvg .bl.happy { animation: hop .5s ease-out 2; }
#buddySvg .bl.sad { animation: droop .8s ease-in-out 1; }
#buddySvg .bl.lvlup { animation: spin 1s ease-in-out 1; }
@keyframes hop { 50% { transform: translateY(-10px) scale(1.05, .95); } }
@keyframes droop { 50% { transform: rotate(-6deg) scale(.96); } }
@keyframes spin { 50% { transform: scale(1.25) rotate(8deg); } }

/* krokování, vztahy */
.stepbox, .relbox { border: 3px solid var(--line); border-radius: 18px; padding: 10px 14px; margin: 10px 0; background: color-mix(in srgb, #3f9cff 12%, var(--card)); }
.relbox { background: color-mix(in srgb, #ffc83a 16%, var(--card)); }
.stepbox ul, .relbox ul { margin: 6px 0; padding-left: 20px; }
.speed { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: .9rem; }
.speed select { font: inherit; border: 2px solid var(--line); border-radius: 10px; padding: 4px 6px; background: var(--card); color: var(--ink); }
.rel-arrow { pointer-events: none; }

/* dovednosti a garáž */
.skill { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; margin: 10px 0; align-items: center; }
.skill .bar { grid-column: 1 / -1; height: 12px; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--bg); }
.skill .bar i { display: block; height: 100%; }
.skill button { grid-column: 2; grid-row: 1; }
.garage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.gitem { border: 3px solid var(--line); border-radius: 16px; padding: 8px; text-align: center; background: var(--card); font-weight: 800; position: relative; }
.gitem.on { background: color-mix(in srgb, var(--ok) 25%, var(--card)); }
.gitem.locked { opacity: .5; }
.gitem svg { width: 100%; height: 70px; }
.swatches { display: flex; justify-content: center; gap: 4px; margin: 6px 0; }
.swatches i { width: 18px; height: 18px; border-radius: 6px; border: 2px solid var(--line); }
textarea { font: inherit; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); resize: vertical; }

/* kreslení */
.draw-btn { position: absolute; left: 12px; bottom: 12px; z-index: 3; width: 44px; height: 44px; border: 3px solid var(--line); border-radius: 14px; background: var(--card); font-size: 1.2rem; box-shadow: var(--shadow); }
.drawbar { position: absolute; left: 12px; bottom: 12px; z-index: 4; display: flex; gap: 6px; padding: 6px; border: 3px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: var(--shadow); }
.drawbar button { width: 34px; height: 34px; border: 2px solid var(--line); border-radius: 10px; background: var(--card); font-weight: 900; }
.drawbar .pen.on { outline: 3px solid var(--ink); outline-offset: 1px; }
.drawbar .done { background: var(--ok); color: #fff; }
#scene.drawing { touch-action: none; cursor: crosshair; }
@media (orientation: landscape) and (max-height: 560px) { .draw-btn, .drawbar { bottom: 74px; } }
body.challenge .draw-btn { display: none; }

/* domovská obrazovka */
.home { max-width: 1000px; margin: 0 auto; padding: 0 16px 28px; }
.home-hero { display: flex; gap: 16px; align-items: center; background: var(--card); border: 3px solid var(--line); border-radius: 26px; box-shadow: 0 6px 0 var(--line); padding: 16px 20px; }
#homeBuddy { width: 86px; height: 120px; flex: none; overflow: visible; }
.home-hero h1 { margin: 0 0 4px; }
.home-hero > div { flex: 1; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin: 16px 0; }
.hcard { text-align: left; display: grid; gap: 2px; padding: 14px 16px; border: 3px solid var(--line); border-radius: 20px; background: var(--card); box-shadow: 0 5px 0 var(--line); font: inherit; color: inherit; }
.hcard:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.hcard .hi { font-size: 1.6rem; }
.hcard small { color: var(--muted); }
.hcard.big { background: var(--primary); color: #fff; grid-column: span 2; }
.hcard.big small { color: rgba(255,255,255,.85); }
@media (max-width: 480px) { .hcard.big { grid-column: auto; } }
.home-week { background: var(--card); border: 3px solid var(--line); border-radius: 22px; padding: 12px 16px; }
.home-week h3 { margin: 0 0 8px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 110px; }
.week div { display: grid; align-content: end; justify-items: center; gap: 4px; height: 100%; font-size: .78rem; font-weight: 800; color: var(--muted); }
.week i { width: 70%; border: 2px solid var(--line); border-radius: 8px 8px 4px 4px; background: linear-gradient(#ffc83a, #ff6b4a); min-height: 4px; }
.week .today { color: var(--ink); }

/* průvodce */
.tour { position: fixed; inset: 0; z-index: 50; }
.tour-spot { position: absolute; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(20, 12, 40, .62); transition: all .3s ease; pointer-events: none; outline: 3px solid #ffc83a; }
.tour-bubble { position: absolute; left: 16px; right: 16px; max-width: 460px; margin: 0 auto; display: flex; gap: 10px; align-items: center; background: var(--card); border: 3px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding: 12px 14px; transition: top .3s ease; }
#tourBuddy { width: 54px; height: 76px; flex: none; overflow: visible; }
.tour-bubble p { margin: 0 0 8px; font-weight: 700; }

/* přechody mezi křižovatkami */
#scene.leave-next { animation: leaveL .16s ease-in both; }
#scene.leave-prev { animation: leaveR .16s ease-in both; }
#scene.enter-next { animation: enterR .28s cubic-bezier(.2,.8,.3,1) both; }
#scene.enter-prev { animation: enterL .28s cubic-bezier(.2,.8,.3,1) both; }
@keyframes leaveL { to { transform: translateX(-14%); opacity: 0; } }
@keyframes leaveR { to { transform: translateX(14%); opacity: 0; } }
@keyframes enterR { from { transform: translateX(14%); opacity: 0; } }
@keyframes enterL { from { transform: translateX(-14%); opacity: 0; } }

/* odměny: konfety, +XP, poskočení štítků */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti { position: absolute; width: 10px; height: 14px; border-radius: 3px; animation: conf 1.1s cubic-bezier(.2,.7,.4,1) forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }
.xpfloat { position: absolute; font-weight: 900; font-size: 1.3rem; color: #ff6b4a; -webkit-text-stroke: 1px var(--line); animation: xpf 1.2s ease-out forwards; }
@keyframes xpf { from { transform: translate(-50%, 0) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -10px) scale(1.15); opacity: 1; } to { transform: translate(-50%, -70px) scale(1); opacity: 0; } }
.slot.filled { animation: slotpop .28s cubic-bezier(.34,1.7,.5,1); }
@keyframes slotpop { from { transform: scale(.4); } }

/* mikrolekce */
.lesson { border: 3px dashed var(--line); border-radius: 18px; padding: 10px 12px; margin: 10px 0; background: color-mix(in srgb, #3f9cff 10%, var(--card)); }
.lesson h3 { margin: 0 0 6px; font-size: 1rem; }
.lesson svg { width: 100%; max-width: 260px; height: auto; display: block; margin: 4px auto 8px; border-radius: 12px; border: 2px solid var(--line); }
.lesson ul { margin: 4px 0 8px; padding-left: 20px; }
.lesson .actions { margin-bottom: 0; }
.lesson a { font-weight: 800; color: inherit; }
.lcar { animation: lgo 3.2s ease-in-out infinite; }
@keyframes lgo { 0%, 25% { transform: translate(0, 0); } 70%, 100% { transform: translate(var(--lx), var(--ly)); opacity: 1; } }
.lwait { animation: lwait 3.2s ease-in-out infinite; }
@keyframes lwait { 0%, 70% { transform: translate(0, 0); } 100% { transform: translate(var(--lx), var(--ly)); } }

/* řidiči v autech */
.drv .pupil { transition: transform .4s ease; }

/* tablet a počítač: scéna vlevo, vysvětlení a krokování vpravo současně */
@media (min-width: 1100px) {
  .wrap { grid-template-columns: minmax(0, 1fr) 430px; max-width: 1400px; }
  .stage { position: sticky; top: 12px; align-self: start; }
  .panel { max-height: calc(100vh - 90px); max-height: calc(100dvh - 90px); overflow: auto; }
}
@media (min-width: 760px) and (max-width: 1099px) and (min-height: 600px) and (orientation: landscape) {
  .wrap { grid-template-columns: minmax(0, 1fr) 340px; }
  .stage { position: sticky; top: 12px; align-self: start; }
  .panel { max-height: calc(100dvh - 90px); overflow: auto; }
}
@media (min-width: 640px) and (max-width: 1099px) and (orientation: portrait) {
  .stage { max-width: 760px; width: 100%; margin: 0 auto; }
  .panel { max-width: 760px; width: 100%; margin: 0 auto; }
}

/* ================= mobil na výšku: herní ovládání ================= */
.mbar { display: none; }
body.mobile .mbar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 3px solid var(--line); border-radius: 24px 24px 0 0; box-shadow: 0 -6px 0 rgba(43, 33, 64, .08), 0 -10px 30px rgba(43, 33, 64, .12); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
body.mobile .top { padding: max(6px, env(safe-area-inset-top)) 10px 6px; }
body.mobile #prev, body.mobile #next { display: none; }
body.mobile .nav button { padding: 5px 12px; }
body.mobile .wrap { display: block; padding: 0 0 210px; }
body.mobile .stage { margin: 0 8px; height: calc(100vh - 58px - 196px); height: calc(100dvh - 58px - 196px); min-height: 300px; border-radius: 24px; }
body.mobile #scene { height: 100%; aspect-ratio: auto; }
body.mobile .panel { margin: 12px 8px 0; border-radius: 22px; }
body.mobile .panel > .buddy, body.mobile .panel > .modes, body.mobile #q, body.mobile #hint, body.mobile #waitBox, body.mobile #order,
body.mobile .panel > .actions, body.mobile #after, body.mobile .score, body.mobile #hintBox { display: none !important; }
body.mobile:not(.answered):not(.stepping) .panel { display: none; }
/* kategorie a ☆ ⚑ 📤 jako lišta přes horní okraj scény */
body.mobile .stage > .panel-top { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 3; pointer-events: none; }
body.mobile .stage > .panel-top > * { pointer-events: auto; }
body.mobile .stage > .panel-top .cat { font-size: .74rem; max-width: 52%; box-shadow: 0 2px 0 var(--line); background: color-mix(in srgb, var(--chip) 92%, transparent); }
body.mobile .stage > .panel-top .mark { width: 36px; height: 36px; font-size: 1rem; border-width: 2px; }
body.mobile .toast { top: 56px; }
body.mobile.challenge .stage > .panel-top { display: none; }
body.mobile .chalbar { top: 8px; }
body.mobile .draw-btn, body.mobile .drawbar { bottom: 10px; }
body.mobile .zoom-reset { top: auto; bottom: 10px; }
body.mobile .stage .wxnote { display: none; }
.mb-msg { font-weight: 800; text-align: center; font-size: .98rem; line-height: 1.25; min-height: 1.25em; margin: 0 0 8px; }
.mb-msg small { display: block; font-weight: 700; color: var(--muted); font-size: .82rem; }
.mb-msg.pop { animation: mbpop .45s cubic-bezier(.34, 1.7, .5, 1); }
@keyframes mbpop { from { transform: scale(.6); opacity: 0; } }
.mb-slots { display: flex; justify-content: center; align-items: center; gap: 8px; min-height: 56px; margin-bottom: 10px; flex-wrap: wrap; }
.mb-slot { width: 54px; height: 54px; border-radius: 18px; border: 3px dashed var(--muted); display: grid; place-items: center; font-weight: 900; font-size: 1.5rem; color: var(--muted); background: var(--bg); position: relative; }
.mb-slot.filled { border-style: solid; border-color: var(--line); color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .25); box-shadow: 0 4px 0 var(--line); animation: slotpop .3s cubic-bezier(.34, 1.7, .5, 1); }
.mb-slot.filled::after { content: '×'; position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; background: var(--card); color: var(--ink); border: 2px solid var(--line); font-size: .8rem; display: grid; place-items: center; text-shadow: none; }
.mb-slot.next { border-color: var(--primary); color: var(--primary); animation: nextslot 1.1s ease-in-out infinite; }
@keyframes nextslot { 50% { transform: translateY(-3px); } }
.mb-group { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: color-mix(in srgb, var(--ok) 18%, var(--card)); border: 2px dashed var(--ok); }
.mb-arrow { font-weight: 900; color: var(--muted); }
.mb-chip { width: 42px; height: 42px; border-radius: 14px; border: 3px solid var(--line); display: grid; place-items: center; font-weight: 900; font-size: 1.15rem; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.25); animation: slotpop .35s cubic-bezier(.34,1.7,.5,1) both; }
.mb-chip.ped { background: var(--card); color: var(--ink); font-size: 1rem; text-shadow: none; }
.mb-row { display: flex; gap: 8px; align-items: center; }
.mb-ic { width: 50px; height: 54px; flex: none; border: 3px solid var(--line); border-radius: 16px; background: var(--card); font-size: 1.35rem; box-shadow: 0 4px 0 var(--line); }
.mb-ic:active, .mb-main:active { transform: translateY(4px); box-shadow: none; }
.mb-ic:disabled { opacity: .4; }
.mb-main { flex: 1; height: 54px; border: 3px solid var(--line); border-radius: 18px; background: var(--card); color: var(--muted); font: inherit; font-weight: 900; font-size: 1.1rem; box-shadow: 0 4px 0 var(--line); }
.mb-main.ready { background: var(--primary); color: #fff; animation: ready 1s ease-in-out infinite; }
.mb-main.go { background: var(--ok); color: #fff; }
.mb-main.wait { background: #ffe27a; color: #2b2140; }
@keyframes ready { 50% { transform: scale(1.04); } }
.veh.picked .ride { animation: pickb .38s cubic-bezier(.34, 1.7, .5, 1); }
@keyframes pickb { 40% { transform: scale(1.22); } }
.combo { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #ff6b4a; color: #fff; font-size: .82rem; animation: mbpop .45s cubic-bezier(.34,1.7,.5,1); }

/* reakce vozidel: zablikání světly při chybě, rychlejší majáky po klepnutí */
.veh.flash .hl { animation: hlflash .18s steps(1) 4; }
@keyframes hlflash { 50% { fill: #fffbe0; filter: drop-shadow(0 0 6px #fff36b); } }
.veh.alarm .beacon-a, .veh.alarm .beacon-b { animation-duration: .18s; }
.tiny { padding: 3px 9px !important; font-size: .8rem; border-width: 2px !important; box-shadow: 0 2px 0 var(--line) !important; }
body.mobile #scene { touch-action: none; }

/* účet: ověření e-mailu, předplatné */
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; font-weight: 700; padding: 4px 0; justify-self: start; }
.verify { background: color-mix(in srgb, #ffc83a 22%, var(--card)); border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px; margin: 8px 0; font-size: .9rem; }
.pay { display: grid; gap: 8px; margin: 8px 0 12px; }
.pay .primary, .pay .ghost { width: 100%; padding: 12px; font-size: 1rem; }
.pay .trial { background: var(--ok); color: #fff; }

/* domov: bez herní lišty; dovednosti na úzkém displeji pod sebou */
body.at-home .mbar { display: none !important; }
body.mobile .home { padding-bottom: 24px; }
@media (max-width: 480px) {
  .skill { grid-template-columns: 1fr; }
  .skill > span:nth-of-type(2) { grid-column: 1; grid-row: auto; display: flex; gap: 6px; justify-content: flex-start; }
  .skill .bar { grid-row: auto; }
}

