/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #eef3f0;
  --bg-2: #e3ece7;
  --card: #ffffff;
  --ink: #15211d;
  --ink-2: #4b5a55;
  --muted: #7a8984;
  --line: #d6e0db;
  --brand: #1f6f5c;
  --brand-2: #2b8a72;
  --brand-ink: #ffffff;
  --accent: #f2b632;
  --good: #1d9a5b;
  --good-bg: #e2f6ea;
  --bad: #d64545;
  --bad-bg: #fde8e6;
  --sea: #dce9ee;
  --land-1: #fbf7ec;
  --land-2: #f1e9d6;
  --land-edge: #8e8064;
  --kraj-line: #cbbfa4;
  --river: #6aa7d6;
  --area: #e8d6ad;
  --area-edge: #b49660;
  --target: #f2a922;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --shadow: 0 1px 2px rgba(16, 40, 33, .06), 0 8px 24px rgba(16, 40, 33, .08);
  --radius: 18px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0f1715;
    --bg-2: #13201c;
    --card: #18241f;
    --ink: #e9f0ed;
    --ink-2: #b4c2bd;
    --muted: #82938d;
    --line: #2a3a34;
    --brand: #3aa88a;
    --brand-2: #4cbf9f;
    --brand-ink: #062019;
    --good: #3cc47e;
    --good-bg: #173827;
    --bad: #f06a6a;
    --bad-bg: #3d1d1d;
    --sea: #12232a;
    --land-1: #2a3330;
    --land-2: #222b28;
    --land-edge: #6f7f78;
    --kraj-line: #3f4c47;
    --river: #4a8fc4;
    --area: #5a4f37;
    --area-edge: #9b8457;
    --series-1: #3987e5;
    --series-2: #d95926;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink);
  background: radial-gradient(1200px 600px at 10% -10%, var(--bg-2), transparent 60%), var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 900; font-size: 1.15rem; }
.brand svg { width: 32px; height: 32px; color: var(--brand); }
.topnav { display: flex; align-items: center; gap: 8px; }
.navlink { text-decoration: none; color: var(--ink-2); font-weight: 700; padding: 8px 12px; border-radius: 999px; }
.navlink:hover, .navlink.active { background: var(--card); color: var(--ink); }
.userchip {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 12px 6px 6px; font-weight: 700; cursor: pointer; max-width: 46vw;
}
.userchip .av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-size: .8rem; font-weight: 900; flex: none; }
.userchip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .brand span { display: none; }
}

main { max-width: 1180px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-left)) calc(32px + env(safe-area-inset-bottom)); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); font-weight: 800; cursor: pointer; text-decoration: none; color: var(--ink);
  transition: transform .12s ease, box-shadow .2s ease, background .2s;
}
.btn:hover { box-shadow: var(--shadow); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; }

/* ---------- home ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin: 8px 0 22px; }
.hero h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); line-height: 1.1; margin: 0 0 6px; font-weight: 900; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--ink-2); max-width: 46ch; }
.segmented {
  display: inline-flex; padding: 4px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.segmented button {
  border: 0; background: transparent; padding: 10px 16px; border-radius: 12px; cursor: pointer; font-weight: 800; color: var(--ink-2);
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; line-height: 1.15;
  transition: background .2s, color .2s;
}
.segmented button small { font-weight: 600; font-size: .75rem; opacity: .85; }
.segmented button.active { background: var(--brand); color: var(--brand-ink); }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 16px; }
.cat-card {
  position: relative; overflow: hidden; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .18s cubic-bezier(.2,.8,.3,1.2), box-shadow .2s;
  animation: rise .45s cubic-bezier(.2,.8,.3,1) both;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(16,40,33,.08), 0 16px 32px rgba(16,40,33,.14); }
.cat-card:active { transform: scale(.98); }
.cat-card h3 { margin: 0; font-size: 1.3rem; font-weight: 900; }
.cat-card p { margin: 4px 0 0; color: var(--ink-2); font-size: .9rem; }
.cat-card .mini {
  display: block; width: calc(100% + 36px); height: 120px; margin: -18px -18px 12px; padding: 12px 18px 6px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--sea) 80%, var(--card)), color-mix(in srgb, var(--sea) 30%, var(--card)));
  pointer-events: none; transition: transform .3s cubic-bezier(.2,.8,.3,1);
}
.cat-card:hover .mini { transform: scale(1.04); }
.cat-card .mini path.o { fill: var(--land-2); stroke: var(--land-edge); stroke-width: 3; }
.cat-card .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 800; background: var(--bg-2); color: var(--ink-2); }
.badge.best { background: color-mix(in srgb, var(--accent) 25%, var(--card)); color: var(--ink); }
.cat-card .go { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 900; transition: transform .2s; }
.cat-card:hover .go { transform: translateX(3px); }
.cat-icon { font-size: 1.2rem; margin-right: 2px; }

.guest-banner {
  margin-top: 22px; padding: 16px 18px; border-radius: var(--radius); border: 1px dashed var(--line); background: color-mix(in srgb, var(--card) 60%, transparent);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- quiz layout ---------- */
.quiz { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.quiz-head { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
.quiz-head .back { border: 1px solid var(--line); background: var(--card); width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 1.1rem; flex: none; }
.quiz-head h2 { margin: 0; font-size: 1.15rem; font-weight: 900; }
.quiz-head .sub { color: var(--muted); font-size: .85rem; font-weight: 700; }
.quiz-head .counter { margin-left: auto; font-weight: 900; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.quiz-head .counter small { color: var(--muted); font-size: .95rem; }
.dots { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.dots i { height: 6px; border-radius: 3px; background: var(--line); transition: background .3s; }
.dots i.cur { background: var(--accent); }
.dots i.ok { background: var(--good); }
.dots i.ko { background: var(--bad); }

.map-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--sea) 70%, var(--card)), var(--sea));
  border: 1px solid var(--line); box-shadow: var(--shadow);
  aspect-ratio: 1000 / 600; touch-action: none; user-select: none; -webkit-user-select: none;
}
.blindmap { display: block; width: 100%; height: 100%; }
.map-controls { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.map-controls button {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
  background: color-mix(in srgb, var(--card) 88%, transparent); font-size: 1.1rem; font-weight: 900; box-shadow: var(--shadow);
}
.map-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translate(-50%, 8px); opacity: 0;
  background: color-mix(in srgb, var(--ink) 85%, transparent); color: var(--card); padding: 6px 12px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; pointer-events: none; transition: opacity .25s, transform .25s; white-space: nowrap;
}
.map-hint.show { opacity: 1; transform: translate(-50%, 0); }

/* map styling */
.blindmap .land { fill: url(#landGrad); }
.blindmap .border { fill: none; stroke: var(--land-edge); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.blindmap .bg-kraje path { fill: none; stroke: var(--kraj-line); stroke-width: .9; vector-effect: non-scaling-stroke; stroke-dasharray: 4 3; }
.blindmap .bg-rivers path { fill: none; stroke: var(--river); stroke-width: 1.1; vector-effect: non-scaling-stroke; opacity: .55; stroke-linecap: round; stroke-linejoin: round; }
.blindmap .bg-pohori path { fill: var(--area); opacity: .45; stroke: none; }
.blindmap .item { transition: fill .25s, stroke .25s, opacity .25s, fill-opacity .25s; }
.blindmap .item.area { fill: var(--area); fill-opacity: .55; stroke: var(--area-edge); stroke-width: 1; vector-effect: non-scaling-stroke; }
.blindmap[data-cat="kraje"] .item.area { fill: var(--land-1); fill-opacity: 1; stroke: var(--land-edge); stroke-width: 1.1; }
.blindmap .item.line { fill: none; stroke: var(--river); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.blindmap .item.pt { fill: var(--card); stroke: var(--ink-2); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.blindmap .item.peak { fill: #8a6a3d; stroke: var(--card); }
.blindmap[data-cat="hrady"] .item.pt { fill: #8d4d8c; stroke: var(--card); }
.blindmap .item.hover { stroke: var(--brand); stroke-width: 3; }
.blindmap[data-cat] .item.area.hover { fill: color-mix(in srgb, var(--brand) 30%, var(--area)); fill-opacity: .8; }
.blindmap[data-cat="kraje"] .item.area.hover { fill: color-mix(in srgb, var(--brand) 18%, var(--land-1)); }
.blindmap .item.line.hover { stroke: var(--brand); stroke-width: 4; }
.blindmap[data-cat] .item.target.area { fill: var(--target); fill-opacity: .9; }
.blindmap[data-cat] .item.correct.area { fill: var(--good); fill-opacity: .75; }
.blindmap[data-cat] .item.wrong.area { fill: var(--bad); fill-opacity: .7; }
.blindmap[data-cat] .item.correct.line { stroke: var(--good); stroke-width: 4.5; }
.blindmap[data-cat] .item.wrong.line { stroke: var(--bad); stroke-width: 4.5; }
.blindmap[data-cat] .item.correct.pt { fill: var(--good); stroke: #fff; }
.blindmap[data-cat] .item.wrong.pt { fill: var(--bad); stroke: #fff; }
.blindmap[data-cat] .item.target.pt { fill: var(--target); stroke: #fff; }

.blindmap .area-target { fill: none; stroke: #fff; stroke-width: 2.5; vector-effect: non-scaling-stroke; animation: dash 1.2s ease-in-out infinite alternate; stroke-dasharray: 6 5; }
.blindmap .line-glow { fill: none; stroke: var(--target); stroke-width: 12; opacity: .35; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; animation: glow 1.4s ease-in-out infinite alternate; }
.blindmap .line-draw { fill: none; stroke: var(--target); stroke-width: 4.5; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .9s ease-out forwards; }
.blindmap .line-mark { fill: none; stroke-width: 10; opacity: .25; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.blindmap .line-mark.correct { stroke: var(--good); }
.blindmap .line-mark.wrong { stroke: var(--bad); }
.blindmap .pulse-ring { fill: none; stroke: var(--target); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: ping 1.6s cubic-bezier(0,.6,.4,1) infinite; }
.blindmap .pulse-ring.delay { animation-delay: .8s; }
.blindmap .pulse-dot { fill: var(--target); stroke: #fff; stroke-width: 2.5; }
.blindmap .pin circle { fill: none; stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: pop .45s cubic-bezier(.2,.8,.3,1.4) both; }
.blindmap .pin.correct circle { stroke: var(--good); }
.blindmap .pin.wrong circle { stroke: var(--bad); }
.blindmap .map-label {
  font-family: var(--font); font-weight: 900; text-anchor: middle; fill: var(--ink); paint-order: stroke; stroke: var(--card); stroke-linejoin: round;
  animation: fadein .3s ease both; pointer-events: none;
}
.blindmap .map-label.correct { fill: color-mix(in srgb, var(--good) 75%, var(--ink)); }
.blindmap .map-label.wrong { fill: color-mix(in srgb, var(--bad) 80%, var(--ink)); }
.blindmap .map-label.soft { font-weight: 700; fill: var(--ink-2); }
.blindmap .ripple { fill: none; stroke: var(--muted); stroke-width: 2; vector-effect: non-scaling-stroke; transform-box: fill-box; transform-origin: center; animation: ripple .55s ease-out forwards; }
.blindmap.picking { cursor: crosshair; }

@keyframes ping { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes pop { 0% { transform: scale(.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes glow { from { opacity: .15; } to { opacity: .45; } }
@keyframes dash { to { stroke-dashoffset: 22; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }

/* side panel */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 84px;
}
.prompt { font-weight: 800; color: var(--ink-2); font-size: .95rem; margin: 0; }
.prompt-name { font-size: 1.7rem; line-height: 1.15; font-weight: 900; margin: 0; animation: rise .35s cubic-bezier(.2,.8,.3,1) both; }
.photo { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--bg-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fadein .4s ease both; }
.photo a { position: absolute; right: 6px; bottom: 6px; font-size: .7rem; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; text-decoration: none; }
.options { display: grid; gap: 10px; }
.opt {
  position: relative; text-align: left; padding: 14px 16px 14px 48px; border-radius: 14px; border: 2px solid var(--line); background: var(--card);
  font-weight: 800; font-size: 1.05rem; cursor: pointer; transition: transform .12s, border-color .2s, background .2s;
  animation: rise .35s cubic-bezier(.2,.8,.3,1) both;
}
.opt:nth-child(2) { animation-delay: .05s; }
.opt:nth-child(3) { animation-delay: .1s; }
.opt .k { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-2); color: var(--ink-2); font-size: .8rem; }
.opt:hover:not(:disabled) { border-color: var(--brand); }
.opt:active:not(:disabled) { transform: scale(.98); }
.opt:disabled { cursor: default; }
.opt.correct { border-color: var(--good); background: var(--good-bg); }
.opt.correct .k { background: var(--good); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); animation: shake .4s ease; }
.opt.wrong .k { background: var(--bad); color: #fff; }
.opt.faded { opacity: .55; }
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

.feedback { border-radius: 14px; padding: 12px 14px; animation: rise .3s cubic-bezier(.2,.8,.3,1) both; }
.feedback.ok { background: var(--good-bg); }
.feedback.ko { background: var(--bad-bg); }
.feedback .fb-title { font-weight: 900; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.feedback .fb-info { color: var(--ink-2); font-size: .9rem; margin-top: 2px; }
.next-row { display: flex; gap: 10px; }
.kbd-hint { font-size: .75rem; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  main.playing { padding-top: 10px; }
  .quiz { grid-template-columns: 1fr; gap: 12px; }
  .panel { position: static; padding: 14px; gap: 10px; }
  .prompt-name { font-size: 1.4rem; }
  .map-wrap { aspect-ratio: auto; height: min(62vw, 56vh); min-height: 220px; }
  .quiz.castle .panel { display: grid; grid-template-columns: 1fr; }
  .photo { aspect-ratio: 16 / 9; }
  .kbd-hint { display: none; }
}
@media (max-width: 900px) and (orientation: portrait) {
  .map-wrap { height: auto; aspect-ratio: 1000 / 620; }
}

/* ---------- results ---------- */
.results { max-width: 640px; margin: 0 auto; text-align: center; }
.score-ring { width: 180px; height: 180px; margin: 10px auto 6px; position: relative; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring .trk { fill: none; stroke: var(--line); stroke-width: 12; }
.score-ring .val { fill: none; stroke: var(--brand); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.3,1); }
.score-ring .num { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 3rem; }
.score-ring .num small { display: block; font-size: 1rem; color: var(--muted); margin-top: -6px; }
.results h2 { font-size: 1.6rem; margin: 6px 0 4px; font-weight: 900; }
.pct-card { margin: 18px 0; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pct-card .big { font-size: 1.25rem; font-weight: 900; }
.pct-bar { position: relative; height: 12px; border-radius: 6px; background: var(--bg-2); margin: 12px 4px 4px; overflow: hidden; }
.pct-bar span { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 6px; transition: width 1.2s cubic-bezier(.2,.8,.3,1) .2s; }
.answers-list { list-style: none; margin: 0; padding: 0; text-align: left; display: grid; gap: 6px; }
.answers-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); animation: rise .35s both; }
.answers-list .ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: .8rem; font-weight: 900; flex: none; }
.answers-list .ic.ok { background: var(--good); }
.answers-list .ic.ko { background: var(--bad); }
.answers-list .you { margin-left: auto; color: var(--muted); font-size: .85rem; text-align: right; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0; }

/* ---------- stats ---------- */
.stats h1 { font-size: 1.8rem; margin: 6px 0 16px; font-weight: 900; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .lbl { color: var(--ink-2); font-size: .85rem; font-weight: 700; }
.tile .v { font-size: 1.9rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--muted); font-size: .8rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h3 { margin: 0 0 4px; font-size: 1.1rem; font-weight: 900; }
.card .desc { margin: 0 0 12px; color: var(--muted); font-size: .85rem; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--ink-2); }
.chip.active { background: var(--ink); color: var(--card); border-color: var(--ink); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .series-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-line.mode-b { stroke: var(--series-2); }
.chart .dot { fill: var(--series-1); stroke: var(--card); stroke-width: 2; }
.chart .dot.mode-b { fill: var(--series-2); }
.chart .xhair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--card); border-radius: 10px; padding: 6px 10px; font-size: .8rem; font-weight: 700;
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; opacity: 0; transition: opacity .15s; z-index: 5;
}
.tooltip.show { opacity: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-2); font-weight: 700; margin-bottom: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; }
.bar-row .nm { font-weight: 800; font-size: .9rem; }
.bar-pair { display: grid; gap: 4px; }
.bar { position: relative; height: 16px; border-radius: 4px; background: var(--bg-2); }
.bar span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; transition: width .9s cubic-bezier(.2,.8,.3,1); }
.bar.a span { background: var(--series-1); }
.bar.b span { background: var(--series-2); }
.bar em { position: absolute; left: calc(100% + 6px); top: 50%; transform: translateY(-50%); font-style: normal; font-size: .75rem; font-weight: 800; color: var(--ink-2); white-space: nowrap; }
.bar { margin-right: 44px; }
.bar .gm { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; border-radius: 1px; }
.missed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.missed li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); font-size: .9rem; }
.missed b { font-weight: 800; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } .bar-row { grid-template-columns: 92px 1fr; } }
.empty { text-align: center; padding: 40px 16px; }
.empty .big-ic { font-size: 3rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th, table.data td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
details summary { cursor: pointer; color: var(--ink-2); font-weight: 700; font-size: .85rem; margin-top: 8px; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(8, 20, 16, .45); backdrop-filter: blur(3px); animation: fadein .2s both; }
.modal-card {
  position: relative; width: min(420px, 100%); background: var(--card); border-radius: 22px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
  display: grid; gap: 12px; animation: pop .3s cubic-bezier(.2,.8,.3,1.2) both;
}
.modal-x { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 4px; border-radius: 14px; }
.tab { flex: 1; border: 0; background: none; padding: 9px; border-radius: 10px; font-weight: 800; cursor: pointer; color: var(--ink-2); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.modal-card label { display: grid; gap: 4px; font-weight: 800; font-size: .9rem; }
.modal-card input { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); }
.modal-card input:focus { outline: none; border-color: var(--brand); }
.form-error { margin: 0; color: var(--bad); font-weight: 700; font-size: .9rem; }
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--card); padding: 10px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow); animation: rise .25s both;
}
.menu { position: absolute; right: 16px; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: grid; min-width: 180px; animation: rise .2s both; }
.menu button { text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 700; }
.menu button:hover { background: var(--bg-2); }
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--muted); font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
