/* ===== Hlasovačka POI — design tokeny zděděné z hlavního webu ===== */
:root {
  --ink: #22262e;
  --ink-mute: #6b7280;
  --paper: #eef3f1;
  --card: #ffffff;
  --line: #d7dfdc;
  --line-strong: #b8c4bf;
  --pine: #1f4d3a;
  --pine-deep: #143326;
  --rail: #1b6ca8;
  --bus: #2f7d4f;
  --stamp: #b3261e;
  --est: #9a6200;
  --gold: #8a6d1d;
  --r-lg: 14px;
  --r-xl: 22px;
  --r-pill: 999px;
  --shadow-md: 0 6px 24px -10px rgba(20, 40, 35, .25);
  --shadow-2xl: 0 24px 60px -18px rgba(10, 20, 16, .4);
  --font: 'Inter', 'IBM Plex Sans', -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-jp: 'IBM Plex Sans JP', var(--font);
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
body.locked { overflow: hidden; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.err { color: var(--stamp); font-size: .85rem; }
.hint { color: var(--ink-mute); font-size: .72rem; }

/* ===== screens ===== */
.screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.2rem; }
.gate-card {
  width: min(420px, 100%); background: var(--card); border-radius: var(--r-xl);
  border: 1px solid var(--line); box-shadow: var(--shadow-md); padding: 2rem 1.6rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.gate-kicker { margin: 0; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .18em; text-transform: uppercase; color: var(--pine); }
.gate-card h1 { margin: 0; font-size: 2.1rem; line-height: 1.12; letter-spacing: -.02em; }
.gate-card h2 { margin: 0; font-size: 1.4rem; }
.gate-sub { margin: 0; color: var(--ink-mute); font-size: .92rem; line-height: 1.5; }
.gate-actions { display: flex; flex-direction: column; gap: .6rem; margin-top: .6rem; }

/* ===== buttons ===== */
.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink);
  border-radius: var(--r-pill); padding: .65rem 1.2rem; font: inherit; font-weight: 600; font-size: .9rem;
  min-height: 46px; cursor: pointer; transition: transform .12s, background .18s, box-shadow .18s;
}
.btn:active { transform: scale(.97); }
.btn.big { width: 100%; min-height: 52px; font-size: 1rem; }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
.btn.ghost { background: transparent; }
.field { display: flex; flex-direction: column; gap: .3rem; font-size: .82rem; color: var(--ink-mute); }
.field input {
  font: inherit; color: var(--ink); padding: .7rem .85rem; min-height: 46px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
}
.field input:focus { outline: 2px solid var(--pine); outline-offset: 1px; }

/* ===== topbar ===== */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: flex; align-items: center; gap: .6rem;
  padding: calc(.45rem + env(safe-area-inset-top, 0px)) .8rem .45rem;
  background: var(--pine-deep); color: #fff; font-size: .78rem;
}
#top-progress { font-size: .72rem; opacity: .9; }
#top-room { margin-left: auto; margin-right: .3rem; opacity: .75; font-size: .68rem; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff;
  border-radius: var(--r-pill); padding: .35rem .7rem; font: inherit; font-size: .75rem; min-height: 34px; cursor: pointer;
}
#btn-zone { min-height: 44px; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot.ok { background: #79d99b; }
.dot.wait { background: #ffd166; }
.dot.off { background: #ff6b6b; }

/* ===== tabs (spodek) ===== */
#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.t {
  appearance: none; border: none; background: none; color: var(--ink-mute);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .12rem;
  min-height: 54px; font: inherit; font-size: .64rem; cursor: pointer; position: relative;
}
.t.active { color: var(--pine); font-weight: 700; }
.t.active::before { content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 30px; height: 3px; border-radius: 0 0 4px 4px; background: var(--stamp); }
.t-ico { font-size: 1.15rem; line-height: 1; }

/* ===== main ===== */
#main { padding: calc(52px + env(safe-area-inset-top, 0px)) .8rem calc(var(--nav-h) + var(--safe-b) + 10px); max-width: 520px; margin: 0 auto; }
.tab { display: none; min-height: calc(100dvh - 120px); }
.tab.active { display: block; }
.tab h2 { font-size: 1.25rem; margin: .6rem 0 .8rem; }

/* ===== DECK / karta ===== */
#deck { position: relative; height: min(62dvh, 560px); }
.card {
  position: absolute; inset: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-md); overflow: hidden;
  display: flex; flex-direction: column; will-change: transform;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.card.dragging { transition: none; }
.card.fly { transition: transform .22s cubic-bezier(.3,.8,.4,1), opacity .22s; }
.card-top { position: relative; flex: 0 0 46%; background: var(--paper); }
.card-top img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--pine); opacity: .55; }
.card-badge {
  position: absolute; top: .7rem; right: .7rem; font-family: var(--font-mono); font-size: .62rem;
  letter-spacing: .08em; padding: .28rem .55rem; border-radius: var(--r-pill);
  background: rgba(255,255,255,.92); color: var(--ink); border: 1px solid var(--line);
}
.card-badge.biz { color: var(--stamp); }
.card-badge.hid { color: var(--bus); }
.card-badge.log { color: var(--est); }
.card-credit { position: absolute; left: .6rem; bottom: .45rem; font-size: .55rem; color: #fff; opacity: .85; text-shadow: 0 1px 2px rgba(0,0,0,.8); max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swipe-glyph { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 3rem; opacity: 0; pointer-events: none; transition: opacity .1s; }
.card-body { flex: 1; padding: .9rem 1.05rem .8rem; display: flex; flex-direction: column; gap: .35rem; overflow: hidden; }
.card-title { margin: 0; font-size: 1.18rem; line-height: 1.22; letter-spacing: -.01em; }
.card-jp { font-family: var(--font-jp); font-size: .82rem; color: var(--ink-mute); }
.card-proc { font-size: .82rem; line-height: 1.45; color: var(--ink); overflow: hidden; }
.card-proc.expanded { overflow: visible; }
/* praktická varování z dat webu — dvě řádky, ťuknutím se rozbalí */
.card-warn {
  margin: 0; font-size: .72rem; line-height: 1.4; color: var(--est);
  border-left: 2px solid var(--est); padding-left: .5rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.card-warn.expanded { -webkit-line-clamp: unset; overflow: visible; }
.card-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; }
.card-chips .c {
  font-family: var(--font-mono); font-size: .62rem; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); padding: .22rem .5rem; background: var(--paper);
}
.card-chips .c.warn { color: var(--est); border-color: var(--est); }
.card-jp-big { appearance: none; position: absolute; top: .6rem; left: .6rem; min-width: 48px; min-height: 48px; border-radius: 12px; border: 1px solid rgba(255,255,255,.4); background: rgba(20,51,38,.72); color: #fff; font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; }
.deck-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; text-align: center; color: var(--ink-mute); }
.deck-empty h3 { color: var(--pine); margin: 0; }

/* vote controls */
.vote-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .8rem; }
.vbtn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--card); border-radius: var(--r-lg);
  min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  font: inherit; cursor: pointer; transition: transform .1s;
}
.vbtn:active { transform: scale(.94); }
.vbtn .ico { font-size: 1.25rem; line-height: 1; }
.vbtn .lbl { font-size: .62rem; font-weight: 700; letter-spacing: .04em; }
.v-skip { color: var(--stamp); border-color: color-mix(in srgb, var(--stamp) 35%, var(--line)); }
.v-maybe { color: var(--ink-mute); }
.v-want  { color: var(--pine); border-color: color-mix(in srgb, var(--pine) 30%, var(--line)); }
.v-super { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: color-mix(in srgb, var(--gold) 6%, var(--card)); }
.vote-meta { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; }
#btn-undo { border-color: var(--line-strong); background: var(--card); color: var(--ink); min-height: 44px; }

/* ===== results ===== */
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.toggle { font-size: .72rem; color: var(--ink-mute); display: flex; gap: .3rem; align-items: center; min-height: 44px; }
.rrow {
  display: grid; grid-template-columns: 34px 1fr auto; gap: .6rem; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: .6rem .7rem; margin-bottom: .5rem;
}
.rrow img { grid-row: span 2; width: 52px; height: 52px; object-fit: cover; border-radius: 10px; }
.rrow .ph { grid-row: span 2; width: 52px; height: 52px; border-radius: 10px; background: var(--paper); display: flex; align-items: center; justify-content: center; color: var(--pine); }
.r-name { font-weight: 600; font-size: .88rem; }
.r-name .jp { font-family: var(--font-jp); font-weight: 400; color: var(--ink-mute); font-size: .72rem; }
.r-tags { font-size: .66rem; color: var(--ink-mute); display: flex; gap: .4rem; flex-wrap: wrap; }
.r-score { font-family: var(--font-mono); font-size: .95rem; font-weight: 600; text-align: right; }
.r-score small { display: block; font-weight: 400; font-size: .58rem; color: var(--ink-mute); }
.r-mark { font-size: .68rem; }
.mark-unanim { color: var(--bus); font-weight: 700; }
.mark-conflict { color: var(--est); font-weight: 700; }
.r-add { appearance: none; border: 1px solid var(--pine); background: none; color: var(--pine); border-radius: var(--r-pill); min-width: 46px; min-height: 46px; cursor: pointer; font-weight: 700; }

/* plan */
#plan-box { margin: 1rem 0; }
.plan-card { background: var(--pine-deep); color: #fff; border-radius: var(--r-xl); padding: 1rem 1.1rem; }
.plan-card h3 { margin: 0 0 .4rem; font-size: .95rem; }
.plan-card li { font-size: .82rem; margin: .3rem 0; line-height: 1.35; }
.plan-card .pl-score { font-family: var(--font-mono); opacity: .7; font-size: .68rem; margin-left: .3rem; }
.plan-total { font-size: .7rem; opacity: .75; margin-top: .5rem; }

/* program tab */
#prog-days { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.daybtn { appearance: none; border: 1px solid var(--line-strong); background: var(--card); border-radius: 10px; min-height: 46px; min-width: 56px; font: inherit; font-size: .78rem; cursor: pointer; font-weight: 600; }
.daybtn.active { background: var(--pine); color: #fff; border-color: var(--pine); }
#prog-detail ol { padding-left: 1.2rem; font-size: .85rem; }
#prog-detail li { margin: .4rem 0; display: flex; gap: .5rem; align-items: center; }
.pmove { appearance: none; border: 1px solid var(--line-strong); background: var(--card); border-radius: 8px; min-width: 44px; min-height: 44px; cursor: pointer; font-weight: 700; }
.prm { color: var(--stamp); appearance: none; border: none; background: none; font-size: 1rem; min-width: 44px; min-height: 44px; cursor: pointer; }

/* state */
.mrow { display: flex; align-items: center; gap: .7rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .6rem .8rem; margin-bottom: .5rem; }
.mrow .nick { font-weight: 600; font-size: .9rem; }
.mrow .bar { flex: 1; height: 6px; background: var(--paper); border-radius: 3px; overflow: hidden; }
.mrow .bar i { display: block; height: 100%; background: var(--bus); border-radius: 3px; }
.mrow .pct { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-mute); }
.badge-host { font-size: .6rem; border: 1px solid var(--gold); color: var(--gold); border-radius: var(--r-pill); padding: .1rem .4rem; }

/* jp fullscreen */
#jp-full {
  position: fixed; inset: 0; z-index: 60; background: var(--pine-deep); color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
#jp-text { font-family: var(--font-jp); font-size: clamp(3.4rem, 16vw, 7rem); font-weight: 700; text-align: center; line-height: 1.25; }
#jp-close { position: absolute; top: calc(1rem + env(safe-area-inset-top, 0px)); right: 1rem; width: 52px; height: 52px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; font-size: 1.2rem; cursor: pointer; }

/* zone sheet */
#zone-sheet { position: fixed; inset: 0; z-index: 55; background: rgba(10,20,16,.5); display: flex; align-items: flex-end; }
.sheet-card { width: 100%; max-width: 520px; margin: 0 auto; background: var(--card); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 1.2rem 1.2rem calc(1.2rem + var(--safe-b)); }
.sheet-card h3 { margin: 0 0 .8rem; }
.zbtn { display: flex; justify-content: space-between; width: 100%; appearance: none; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-lg); padding: .85rem 1rem; min-height: 52px; font: inherit; font-size: .95rem; cursor: pointer; margin-bottom: .5rem; align-items: center; }
.zbtn small { color: var(--ink-mute); font-family: var(--font-mono); font-size: .68rem; }
.zbtn.active { border-color: var(--pine); background: color-mix(in srgb, var(--pine) 6%, #fff); font-weight: 700; }

/* offline / toast */
#offline-banner {
  position: fixed; top: calc(46px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--est); color: #fff; font-size: .72rem; padding: .35rem .8rem; border-radius: var(--r-pill); z-index: 50;
  pointer-events: none;
}
#toast {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: .8rem; padding: .55rem 1rem; border-radius: var(--r-pill); z-index: 50;
  box-shadow: var(--shadow-md); transition: opacity .25s; pointer-events: none;
}

@media (min-width: 640px) {
  #main { max-width: 560px; }
  #deck { height: min(66dvh, 620px); }
}
@media (prefers-reduced-motion: reduce) {
  .card.fly { transition: opacity .2s; }
}
