:root {
  --bg: #fbf3e6; --bg2: #f6e6cf; --card: #ffffff; --card2: #fff8ef; --ink: #3a2418; --muted: #8a7566; --grid: #f0e4d4; --line: #ead9c3;
  --coffee: #6b3e26; --caramel: #d9883b; --caramel-d: #b86a22; --mint: #2bb3a3; --mint-d: #1f8f82; --berry: #e2557a; --berry-d: #c43d61;
  --gold: #f5b82e; --sky: #5b6ee1; --good: #1e9e6a; --bad: #d64545; --warn: #e08a1e;
  --r: 18px; --sh: 0 2px 0 rgba(107, 62, 38, .08), 0 8px 24px rgba(107, 62, 38, .08);
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #ffe7c7 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #e3f5f1 0%, transparent 55%), var(--bg);
  color: var(--ink); font: 600 14px/1.45 Nunito, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
h1, h2, h3, h4, b.big, .fred { font-family: Fredoka, Nunito, sans-serif; font-weight: 600; letter-spacing: .1px; }
h2 { font-size: 19px; margin: 4px 0 10px; }
h3 { font-size: 16px; margin: 0 0 8px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }

/* ---------- header ---------- */
#top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: linear-gradient(180deg, #7a4a2f, #5e3520); color: #fff; box-shadow: 0 3px 14px rgba(60, 30, 10, .25);
  padding-top: max(8px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo { font-size: 26px; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .14); animation: wob 4s ease-in-out infinite; }
@keyframes wob { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 17px; white-space: nowrap; }
.brand-txt small { color: #f3d9c2; font-size: 11.5px; white-space: nowrap; }
.hstats { display: flex; gap: 8px; flex: 1; justify-content: center; min-width: 0; }
.hs { background: rgba(255, 255, 255, .12); border-radius: 12px; padding: 4px 12px; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.hs small { color: #f0d2b8; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; }
.hs b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 18px; white-space: nowrap; }
.hs-cash b { color: #ffe08a; }
.hs-econ { justify-content: center; font-size: 13px; font-weight: 800; cursor: help; }
.hctrl { display: flex; align-items: center; gap: 6px; }
.ibtn { position: relative; width: 38px; height: 38px; border-radius: 12px; background: rgba(255, 255, 255, .14); font-size: 18px; display: grid; place-items: center; transition: transform .12s; }
.ibtn:active { transform: scale(.92); }
.badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; border-radius: 10px; background: var(--berry); color: #fff; font-size: 11px; font-weight: 800; display: none; place-items: center; padding: 0 5px; box-shadow: 0 0 0 2px #6b3e26; }
.badge.on { display: grid; animation: pop .5s; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }
.speed { display: flex; background: rgba(0, 0, 0, .2); border-radius: 12px; padding: 3px; }
.speed button { padding: 5px 8px; border-radius: 9px; color: #f3d9c2; font-weight: 800; font-size: 12.5px; }
.speed button.on { background: #fff; color: var(--coffee); }

/* ---------- ticker ---------- */
#ticker { display: flex; align-items: center; gap: 8px; background: #fff6e6; border-bottom: 1px solid var(--line); height: 30px; overflow: hidden; font-size: 12.5px; }
.ticker-label { padding: 0 6px 0 14px; }
.ticker-track { flex: 1; overflow: hidden; white-space: nowrap; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
#ticker-inner { display: inline-block; white-space: nowrap; animation: tick 60s linear infinite; padding-left: 100%; }
#ticker-inner span { margin-right: 46px; }
#ticker-inner span.bad { color: var(--bad); } #ticker-inner span.good { color: var(--good); } #ticker-inner span.warn { color: var(--warn); } #ticker-inner span.trend { color: var(--sky); }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ---------- layout ---------- */
#layout { display: flex; max-width: 1280px; margin: 0 auto; }
#nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 25; height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(107, 62, 38, .08);
}
#nav button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--muted); position: relative; font-size: 11px; font-weight: 800; transition: color .15s; }
#nav button span { font-size: 22px; transition: transform .2s; }
#nav button em { font-style: normal; }
#nav button.active { color: var(--coffee); }
#nav button.active span { transform: translateY(-3px) scale(1.12); }
#nav button.active::after { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--caramel); }
.dot { position: absolute; top: 8px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: var(--berry); display: none; }
.dot.on { display: block; }
#main { flex: 1; min-width: 0; padding: 14px 14px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.tab { display: none; animation: fade .25s; }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (min-width: 960px) {
  #nav { position: sticky; top: 92px; flex-direction: column; width: 108px; height: auto; align-self: flex-start; margin: 14px 0 0 14px; border-radius: var(--r); border: 1px solid var(--line); padding: 8px 0; box-shadow: var(--sh); }
  #nav button { padding: 12px 0; }
  #nav button.active::after { top: 20%; bottom: 20%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  #main { padding-bottom: 40px; }
}
@media (max-width: 720px) {
  #top { flex-wrap: wrap; padding: 8px 10px; gap: 6px; }
  .brand { flex: 1; } .brand-txt b { font-size: 15px; }
  .hstats { order: 3; flex-basis: 100%; justify-content: stretch; gap: 6px; }
  .hs { flex: 1; padding: 3px 8px; } .hs b { font-size: 15px; }
  .hs-econ { flex: 0 0 auto; font-size: 12px; }
  .speed button { padding: 5px 6px; }
  #main { padding: 10px 10px calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
}

/* ---------- karty ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 14px; margin-bottom: 14px; border: 1px solid #f3e7d8; }
.card.tight { padding: 10px 12px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.card-h h3 { margin: 0; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cols { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .cols { grid-template-columns: 1fr 1fr; } }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; background: var(--bg2); font-size: 12px; font-weight: 800; color: var(--coffee); white-space: nowrap; }
.pill.mint { background: #dcf4f0; color: var(--mint-d); } .pill.berry { background: #fde3ea; color: var(--berry-d); } .pill.gold { background: #fff0c9; color: #9a6a00; } .pill.sky { background: #e3e7fd; color: #3b4bb8; } .pill.grey { background: #eee; color: #777; }

/* ---------- tlačítka ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 14px; border-radius: 13px; font-weight: 800; background: var(--caramel); color: #fff; box-shadow: 0 3px 0 var(--caramel-d); transition: transform .08s, box-shadow .08s, filter .15s; white-space: nowrap; line-height: 1.15; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--caramel-d); }
.btn.mint { background: var(--mint); box-shadow: 0 3px 0 var(--mint-d); }
.btn.berry { background: var(--berry); box-shadow: 0 3px 0 var(--berry-d); }
.btn.ghost { background: var(--bg2); color: var(--coffee); box-shadow: 0 3px 0 #e6cfb0; }
.btn.dark { background: var(--coffee); box-shadow: 0 3px 0 #3f2213; }
.btn.gold { background: linear-gradient(180deg, #ffd25e, #f5a623); color: #5a3800; box-shadow: 0 3px 0 #c98200; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 10px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 8px; box-shadow: 0 2px 0 var(--caramel-d); }
.btn.ghost.xs { box-shadow: 0 2px 0 #e6cfb0; }
.btn.block { width: 100%; }
.btn small { color: inherit; opacity: .85; font-weight: 700; }
.btn.cant { filter: grayscale(.85) opacity(.55); }
.btn[disabled] { filter: grayscale(1) opacity(.45); cursor: default; }
.seg { display: inline-flex; background: var(--bg2); padding: 3px; border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.seg button { padding: 6px 11px; border-radius: 9px; font-weight: 800; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--coffee); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }

/* ---------- quest ---------- */
.quest { background: linear-gradient(135deg, #fff3dc, #ffe4c4); border: 1px solid #f6d3a5; position: relative; overflow: hidden; }
.quest::after { content: '☕'; position: absolute; right: -8px; bottom: -22px; font-size: 90px; opacity: .08; transform: rotate(-12deg); }
.quest-t { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.quest-t b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 16px; }
.goals { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.goal { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.goal i { font-style: normal; width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; background: #fff; border: 2px solid #f0c48c; font-size: 11px; }
.goal.done { color: var(--good); text-decoration: line-through; text-decoration-color: rgba(30, 158, 106, .4); }
.goal.done i { background: var(--good); border-color: var(--good); color: #fff; }

/* ---------- město a scéna ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-weight: 800; font-size: 13px; box-shadow: 0 2px 0 rgba(107, 62, 38, .06); }
.chip.on { background: var(--coffee); color: #fff; border-color: var(--coffee); }
.chip .n { background: rgba(0, 0, 0, .08); border-radius: 99px; padding: 0 7px; font-size: 11px; }
.chip.on .n { background: rgba(255, 255, 255, .2); }
.chip.add { color: var(--caramel-d); border-style: dashed; }
.scene-card { padding: 0; overflow: hidden; position: relative; }
#scene { display: block; width: 100%; height: 230px; cursor: pointer; touch-action: manipulation; }
@media (max-width: 720px) { #scene { height: 190px; } }
.scene-hud { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.scene-hud .pill { background: rgba(255, 255, 255, .88); backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); }
.scene-hint { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: rgba(58, 36, 24, .78); color: #fff; padding: 5px 12px; border-radius: 99px; font-size: 12px; pointer-events: none; animation: bob 1.6s ease-in-out infinite; white-space: nowrap; }
.scene-hint.hide { display: none; }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }

.citybar { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { background: var(--card2); border: 1px solid #f3e4d1; border-radius: 14px; padding: 9px 11px; min-width: 0; }
.kpi small { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 800; }
.kpi b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 19px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi em { font-style: normal; font-size: 11.5px; font-weight: 700; }
.kpi.big b { font-size: 23px; }
.stars { color: #f5b82e; letter-spacing: -1px; }

.pricebox { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 12px; border-radius: 14px; background: linear-gradient(135deg, #f2fbf9, #e9f6ff); border: 1px solid #d6efea; }
.pricebox .pv { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 26px; min-width: 92px; text-align: center; }
.pricebox input[type=range] { flex: 1; min-width: 160px; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--caramel), var(--berry)); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 3px solid var(--coffee); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); cursor: grab; }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--coffee); cursor: grab; }
.curve { width: 100%; height: 120px; display: block; margin-top: 8px; }

/* pobočky */
.loc { position: relative; border-radius: 16px; background: #fff; border: 1px solid #f0e2cf; padding: 12px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 8px; }
.loc.fr { background: linear-gradient(180deg, #fffaf1, #fff); border-style: dashed; }
.loc-h { display: flex; align-items: center; gap: 10px; }
.loc-ic { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; background: var(--bg2); border-radius: 13px; flex: 0 0 auto; }
.loc-h b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 15px; display: block; line-height: 1.15; }
.lv { display: inline-flex; gap: 2px; }
.lv i { width: 7px; height: 7px; border-radius: 2px; background: #eadcca; display: inline-block; }
.lv i.on { background: var(--caramel); }
.bar { height: 9px; background: #f2e6d6; border-radius: 99px; overflow: hidden; position: relative; }
.bar > div { height: 100%; border-radius: 99px; background: var(--mint); transition: width .4s; }
.bar.hot > div { background: var(--berry); }
.bar.cold > div { background: #b6a99b; }
.loc-m { display: flex; justify-content: space-between; font-size: 12.5px; gap: 6px; }
.loc-m b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 14px; }
.staff { display: flex; align-items: center; gap: 6px; }
.staff .sb { width: 30px; height: 30px; border-radius: 10px; background: var(--bg2); font-weight: 800; font-size: 17px; color: var(--coffee); box-shadow: 0 2px 0 #e6cfb0; }
.staff .sb:active { transform: translateY(2px); box-shadow: none; }
.staff-n { min-width: 54px; text-align: center; font-weight: 800; }
.loc-a { display: flex; gap: 6px; flex-wrap: wrap; }
.down { position: absolute; top: 8px; right: 8px; }
.newloc { border: 2px dashed #e7c9a2; background: #fffaf2; box-shadow: none; justify-content: center; }
.newloc select { font: inherit; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line); background: #fff; width: 100%; }

/* upgrady */
.up { border-radius: 16px; border: 1px solid #f0e2cf; padding: 12px; background: #fff; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--sh); }
.up.owned { background: linear-gradient(180deg, #f0fbf7, #fff); border-color: #c9ece2; }
.up.locked { opacity: .65; }
.up-h { display: flex; gap: 10px; align-items: center; }
.up-ic { font-size: 24px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--bg2); border-radius: 12px; flex: 0 0 auto; }
.up-h b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 15px; line-height: 1.15; display: block; }
.up p { margin: 0; font-size: 12.5px; color: #6c5546; font-weight: 600; }
.opt { border-radius: 14px; border: 2px solid var(--line); padding: 10px; background: #fff; text-align: left; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, transform .1s; }
.opt:active { transform: scale(.98); }
.opt.on { border-color: var(--caramel); background: #fff7ec; box-shadow: 0 0 0 3px rgba(217, 136, 59, .15); }
.opt b { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 15px; }
.opt p { margin: 0; font-size: 12px; color: #6c5546; font-weight: 600; }

/* tabulky */
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 800; padding: 6px 6px; border-bottom: 2px solid var(--grid); }
table.t td { padding: 7px 6px; border-bottom: 1px solid var(--grid); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.sum td { font-weight: 800; border-top: 2px solid var(--line); background: var(--card2); }
table.t tr.sub td { color: var(--muted); font-size: 12px; }
.tablewrap { overflow-x: auto; }
canvas.chart { width: 100%; height: 190px; display: block; }
canvas.chart.sm { height: 140px; }

.ins { display: flex; flex-direction: column; gap: 6px; }
.ins div { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--card2); font-size: 13px; }
.ins div.bad { background: #fde8e8; color: #9b2a2a; } .ins div.warn { background: #fff1dc; color: #8a5100; } .ins div.good { background: #e3f6ee; color: #146c48; } .ins div.tip { background: #eef1fe; color: #303f9f; }

/* úspěchy, lekce */
.ach { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: #fff; border: 1px solid #f0e2cf; }
.ach .ai { font-size: 22px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #fff0c9; flex: 0 0 auto; }
.ach.locked { opacity: .5; } .ach.locked .ai { background: #eee; filter: grayscale(1); }
.ach b { font-family: Fredoka, Nunito, system-ui, sans-serif; display: block; font-size: 14px; }
.ach small { font-size: 12px; }
.lesson-b { text-align: left; width: 100%; }
.lesson-b.locked { opacity: .45; cursor: default; }

/* modály */
#modal-root { position: fixed; inset: 0; z-index: 100; display: none; }
#modal-root.on { display: grid; place-items: center; }
.mback { position: absolute; inset: 0; background: rgba(40, 22, 12, .5); backdrop-filter: blur(3px); animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; } }
.modal { position: relative; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto; background: #fffdf9; border-radius: 22px; padding: 20px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: up .28s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes up { from { transform: translateY(30px) scale(.96); opacity: 0; } }
.modal h2 { margin-top: 0; }
.modal .x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 10px; background: var(--bg2); font-size: 16px; }
.ev-from { font-size: 12px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }
.ev-ic { font-size: 40px; line-height: 1; }
.ev-text { font-size: 14.5px; margin: 10px 0 14px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { text-align: left; padding: 12px 14px; border-radius: 14px; background: #fff; border: 2px solid var(--line); transition: border-color .15s, transform .08s; }
.choice:hover { border-color: var(--caramel); }
.choice:active { transform: scale(.985); }
.choice b { display: block; font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 15px; }
.choice small { font-size: 12.5px; }
.choice .ai { float: right; }
.dlg { display: flex; gap: 14px; align-items: flex-start; }
.dlg .av { font-size: 44px; width: 70px; height: 70px; border-radius: 22px; display: grid; place-items: center; flex: 0 0 auto; }
.dlg .bubble { background: #fff; border: 2px solid var(--line); border-radius: 4px 18px 18px 18px; padding: 12px 14px; font-size: 15px; flex: 1; }
.dlg .who { font-family: Fredoka, Nunito, system-ui, sans-serif; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.lesson-card { background: linear-gradient(135deg, #eef1fe, #fdf3ff); border-radius: 16px; padding: 14px; border: 1px solid #dfe3fb; }
.lesson-card .tip { margin-top: 10px; padding: 10px 12px; background: #fff; border-radius: 12px; font-size: 13px; }
.inbox-item { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: #fff; border: 1px solid var(--line); width: 100%; text-align: left; margin-bottom: 8px; }
.inbox-item .ii { font-size: 26px; }
textarea.save { width: 100%; height: 90px; border-radius: 12px; border: 1px solid var(--line); padding: 8px; font: 12px monospace; }

/* toasty */
#toasts { position: fixed; z-index: 120; right: 14px; bottom: 18px; display: flex; flex-direction: column-reverse; gap: 8px; width: min(360px, calc(100vw - 28px)); pointer-events: none; }
@media (max-width: 959px) { #toasts { bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); } }
.toast { pointer-events: auto; background: #fff; border-radius: 14px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(60, 30, 10, .2); border-left: 5px solid var(--caramel); font-size: 13px; animation: tin .3s cubic-bezier(.2, 1.4, .4, 1); }
.toast.good { border-color: var(--good); } .toast.bad { border-color: var(--bad); } .toast.gold { border-color: var(--gold); background: linear-gradient(90deg, #fff8e0, #fff); } .toast.lesson { border-color: var(--sky); cursor: pointer; }
.toast.out { animation: tout .3s forwards; }
@keyframes tin { from { transform: translateX(40px); opacity: 0; } }
@keyframes tout { to { transform: translateX(40px); opacity: 0; } }

.flash-up { animation: flup .6s; } .flash-dn { animation: fldn .6s; }
@keyframes flup { 30% { color: #9dffcf; } } @keyframes fldn { 30% { color: #ffb3b3; } }
.econ-badge { display: inline-flex; align-items: center; gap: 4px; }
.skill { position: relative; }
.lp { font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 28px; color: #9a6a00; }
.hero { background: linear-gradient(135deg, #3a2418, #6b3e26 60%, #a0612f); color: #fff; border: 0; }
.hero small, .hero .muted { color: #f0d2b8; }
.hero .kpi { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .15); }
.hero .kpi small { color: #f0d2b8; }
.sect-title { display: flex; align-items: center; gap: 8px; margin: 18px 2px 10px; font-family: Fredoka, Nunito, system-ui, sans-serif; font-size: 18px; }
.sect-title:first-child { margin-top: 2px; }
.sect-title small { font-family: Nunito; font-size: 12.5px; font-weight: 700; }
.note { font-size: 12.5px; color: #6c5546; background: var(--card2); border-radius: 12px; padding: 8px 10px; margin-top: 8px; }
.fxlist { display: flex; gap: 6px; flex-wrap: wrap; }
.brand-txt { min-width: 0; overflow: hidden; }
.brand-txt b, .brand-txt small { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) {
  .brand { min-width: 0; }
  .logo { width: 34px; height: 34px; font-size: 21px; }
  .hctrl { gap: 4px; }
  .ibtn { width: 34px; height: 34px; font-size: 16px; }
  .quest-t { flex-wrap: wrap; }
  .citybar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) { .brand-txt b { font-size: 14px; } .speed button { padding: 4px 5px; font-size: 11.5px; } }
.prow { display: flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 0; }
.prow input[type=range] { min-width: 0; }

/* ---------- jazyky ---------- */
.flag { display: inline-block; vertical-align: middle; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); flex: 0 0 auto; }
.langs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; background: #2a2420; padding: 8px; border-radius: 16px; }
.lang { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: #f3e6d8; font-weight: 800; text-transform: uppercase; font-size: 13px; letter-spacing: .3px; text-align: start; }
.lang:hover { background: rgba(255, 255, 255, .08); }
.lang.on { background: rgba(255, 255, 255, .16); color: #fff; }
.lang span { font-family: Nunito, 'Noto Sans JP', 'Noto Sans Arabic', system-ui, sans-serif; }
html[lang=ja] body, html[lang=ar] body { font-family: system-ui, 'Noto Sans JP', 'Noto Sans Arabic', 'Segoe UI', sans-serif; }
html[lang=ja] h1, html[lang=ja] h2, html[lang=ja] h3, html[lang=ar] h1, html[lang=ar] h2, html[lang=ar] h3 { font-family: system-ui, 'Segoe UI', sans-serif; font-weight: 800; }

/* ---------- RTL (arabština) ---------- */
[dir=rtl] #toasts { right: auto; left: 14px; }
[dir=rtl] .toast { border-left: 0; border-right: 5px solid var(--caramel); }
[dir=rtl] .toast.good { border-color: var(--good); } [dir=rtl] .toast.bad { border-color: var(--bad); } [dir=rtl] .toast.gold { border-color: var(--gold); } [dir=rtl] .toast.lesson { border-color: var(--sky); }
[dir=rtl] .modal .x { right: auto; left: 10px; }
[dir=rtl] .quest::after { right: auto; left: -8px; }
[dir=rtl] table.t th, [dir=rtl] .choice { text-align: right; }
[dir=rtl] .scene-hud { left: auto; right: 10px; }
[dir=rtl] .down { right: auto; left: 8px; }
[dir=rtl] #ticker-inner { animation-name: tick-rtl; padding-left: 0; padding-right: 100%; }
@keyframes tick-rtl { from { transform: translateX(0); } to { transform: translateX(100%); } }
[dir=rtl] .dlg .bubble { border-radius: 18px 4px 18px 18px; }
[dir=rtl] .choice .ai { float: left; }

/* ---------- navigace se skupinami a podstránkami ---------- */
#nav .subs { display: none; }
.subnav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
@media (min-width: 960px) {
  #nav { width: 216px; padding: 10px 8px; gap: 2px; max-height: calc(100vh - 110px); overflow-y: auto; }
  #nav .grp { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; color: var(--ink); text-align: start; margin-top: 6px; }
  #nav .grp:first-child { margin-top: 0; }
  #nav .grp span { font-size: 20px; }
  #nav .grp.active { background: #fff3e2; color: var(--coffee); }
  #nav .grp.active span { transform: none; }
  #nav .grp.active::after { display: none; }
  #nav .grp .dot { top: 10px; right: 10px; }
  #nav .subs { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px 18px; padding-inline-start: 10px; border-inline-start: 2px solid var(--grid); }
  #nav .subi { flex-direction: row; justify-content: flex-start; gap: 8px; padding: 6px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: start; }
  #nav .subi span { font-size: 15px; }
  #nav .subi em { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #nav .subi:hover, #nav .grp:hover { background: var(--card2); color: var(--coffee); }
  #nav .subi.active { background: var(--coffee); color: #fff; }
  #nav .subi.active::after { display: none; }
  #nav .subi.active span { transform: none; }
  .subnav { display: none; }
}

/* ---------- široké okno: nová hra / exit ---------- */
.modal.wide { width: min(1180px, calc(100vw - 24px)); padding: 18px 22px; }
.modal.wide h2 { margin-bottom: 4px; }
.modal.wide h3 { margin: 10px 0 6px; font-size: 15px; }
.diffgrid { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); }
.diffgrid .opt { padding: 10px 12px; gap: 3px; }
.diffgrid .opt p { font-size: 12px; line-height: 1.35; }
.chalgrid { display: grid; gap: 6px; grid-template-columns: repeat(5, 1fr); }
.chalcard { padding: 8px 10px; gap: 3px; cursor: pointer; }
.chalcard .row { gap: 6px; flex-wrap: nowrap; }
.chalcard b { font-size: 13px; line-height: 1.2; }
.chalcard .chi { font-size: 18px; }
.chalcard .pill { font-size: 11px; padding: 2px 6px; }
.chalcard p { font-size: 11.5px; line-height: 1.3; }
.chalcard:has(input:checked) { border-color: var(--caramel); background: #fff7ec; }
.setup-foot { margin-top: 12px; gap: 8px; }
.setup-foot .pill { font-size: 13px; padding: 6px 12px; }
@media (max-width: 900px) { .chalgrid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .diffgrid { grid-template-columns: 1fr; } .chalgrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .modal.wide { padding: 14px; } .diffgrid .opt { padding: 8px 10px; } .chalcard .chi { display: none; } .chalcard b { font-size: 12px; } .chalcard p { font-size: 11px; } }
@media (max-height: 700px) and (min-width: 761px) { .diffgrid .opt p, .chalcard p { font-size: 11px; } .modal.wide { padding: 12px 18px; } }
@media (max-width: 760px) {
  .diffgrid .opt { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; }
  .diffgrid .opt p { grid-column: 1 / -1; }
  .diffgrid .opt small.pill { grid-row: 1; grid-column: 2; }
  .modal.wide h3 { margin: 8px 0 5px; }
}

/* ---------- upozornění: lepivá, s křížkem ---------- */
.toast { position: relative; padding-inline-end: 34px; }
.toast .tx { position: absolute; top: 6px; inset-inline-end: 6px; width: 22px; height: 22px; border-radius: 7px; font-size: 11px; color: var(--muted); background: transparent; }
.toast .tx:hover { background: var(--bg2); color: var(--ink); }
.toast.warn { border-color: var(--warn); background: linear-gradient(90deg, #fff4e0, #fff); }
.toast.mail { border-color: var(--sky); }
.toast.sticky { box-shadow: 0 10px 30px rgba(60, 30, 10, .25), 0 0 0 2px rgba(224, 138, 30, .35); }
[dir=rtl] .toast.warn { border-color: var(--warn); } [dir=rtl] .toast.mail { border-color: var(--sky); }
