/* SPOKO volební studio — /volby/ (standalone page, see template-volby.php) */

:root {
  --bg: #071a2b;
  --bg-2: #0c2740;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f2f7fb;
  --muted: #9fb4c6;
  --teal: #3dccd5;
  --teal-dark: #2a98c4;
  --red: #ff4d5e;
  --gold: #ffd23f;
  --radius: 18px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Paytone One", "Inter", sans-serif;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--bg-2); }

body.volby {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(61, 204, 213, 0.25), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(42, 152, 196, 0.25), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

a { color: var(--teal); }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.live-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(255, 77, 94, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(255, 77, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 94, 0); }
}

/* ------------------------------------------------------------------ gate */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.gate__card {
  width: 100%;
  max-width: 440px;
  padding: 36px 28px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(12px);
  text-align: center;
}

.gate__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 16px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
}

.gate__title {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: clamp(2.2rem, 9vw, 3rem);
  line-height: 1;
  color: var(--teal);
}

.gate__lead { margin: 0 0 24px; color: var(--muted); }

.gate__form { display: flex; gap: 8px; }

.gate__form input {
  flex: 1; min-width: 0;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit; font-size: 1rem;
}

.gate__form input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }

.gate__form button,
.gate__form input { min-height: 48px; }

.gate__form button {
  padding: 0 18px;
  border: 0; border-radius: 12px;
  background: var(--teal);
  color: #04202f;
  font: inherit; font-weight: 800;
  cursor: pointer;
}

.gate__error { margin: 16px 0 0; color: var(--red); font-weight: 600; }
.gate__hint { margin: 16px 0 0; color: var(--muted); font-size: 0.9rem; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: rgba(7, 26, 43, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--panel-border);
}

.topbar__brand { display: flex; align-items: center; gap: 10px; letter-spacing: 0.04em; }

.topbar__live {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--red);
  color: #fff;
  font-size: 0.75rem; font-weight: 800;
}

.topbar__meta { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); text-align: right; }

.demo-badge {
  padding: 2px 8px; border-radius: 6px;
  background: var(--gold); color: #3a2c00;
  font-weight: 800; font-size: 0.75rem;
}

/* ------------------------------------------------------------------ layout */

.studio {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 96px;
  display: grid;
  gap: 24px;
}

.section-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  font-weight: 400;
}

.section-head p { margin: 4px 0 16px; color: var(--muted); font-size: 0.95rem; }

.race,
.council,
.coalitions,
.elected,
.hero {
  padding: 24px 20px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
}

.race,
.zvoleni { padding: 24px 20px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--panel-border); }

/* race and councillors, one under the other */
.swap { display: grid; gap: 24px; }

.zvoleni__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.zv {
  display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-left: 4px solid var(--party);
}
.zvoleni .zv { animation: pop 0.5s both; }
.zv--spoko { background: rgba(61, 204, 213, 0.14); }
.zv__rank { font-weight: 800; font-size: 0.9rem; color: var(--muted); min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; }
.zv__face {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  overflow: hidden;
  background: color-mix(in srgb, var(--party) 55%, #0c2740);
  border: 2px solid var(--party);
  font-weight: 800; color: #fff;
}
.zv__face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.zv__who { display: flex; flex-direction: column; min-width: 0; }
.zv__name { font-size: 0.95rem; line-height: 1.2; }
.zv__party { font-size: 0.75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zv__votes { font-weight: 800; font-size: 0.9rem; color: var(--party); font-variant-numeric: tabular-nums; white-space: nowrap; }
.zv--seats { grid-template-columns: auto 1fr; }
.zvoleni__spoko { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--panel-border); }
.zvoleni__list--spoko { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.zvoleni__list--spoko .zv__party { white-space: normal; }
@media (max-width: 480px) { .zvoleni__list--spoko { grid-template-columns: 1fr; } }
.zvoleni__subtitle { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: clamp(1.1rem, 3vw, 1.4rem); color: var(--teal); }
.zv--seats .zv__face { font-size: 1.2rem; }

.split { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .split { grid-template-columns: 1.1fr 1fr; } }

/* ------------------------------------------------------------------ hero */

.hero { text-align: center; }

.hero__eyebrow { margin: 0; color: var(--muted); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.04em; }

.hero__title {
  margin: 8px 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2rem, 8vw, 3.6rem);
  line-height: 1.05;
  background: linear-gradient(90deg, #fff, var(--teal));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.hero__sub { margin: 0 0 20px; color: var(--muted); }

.hero__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 760px) { .hero__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.stat {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
}

.stat__label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.stat__value { font-size: 1.6rem; font-weight: 800; }
.stat__value--mono { font-variant-numeric: tabular-nums; }
.stat__note { font-size: 0.7rem; color: var(--muted); font-style: italic; }
.urns { font-size: 1.1rem; letter-spacing: 4px; }
.urn--done { animation: pop 0.5s ease; display: inline-block; }

/* ------------------------------------------------------------------ race */

.track { display: grid; gap: 14px; }

.lane {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--party) 18%, transparent), transparent);
  border-left: 4px solid var(--party);
}

@media (min-width: 760px) {
  .lane { grid-template-columns: 180px 1fr 110px; align-items: center; }
  .lane__road { margin-top: 0; }
}

.lane__label { display: flex; flex-direction: column; }
.lane__name { font-weight: 800; line-height: 1.2; }
.lane__leader { font-size: 0.8rem; color: var(--muted); }

.lane__score { display: flex; gap: 10px; align-items: baseline; }
@media (min-width: 760px) { .lane__score { flex-direction: column; align-items: flex-end; gap: 0; } }
.lane__pct { font-size: 1.4rem; font-weight: 800; color: var(--party); font-variant-numeric: tabular-nums; }
.lane__votes { font-size: 0.8rem; color: var(--muted); }

.lane__road {
  --runner-w: 76px;
  position: relative;
  height: 150px;
  margin-top: 14px;
  border-bottom: 3px dashed rgba(255, 255, 255, 0.18);
}

.lane__finish {
  position: absolute; right: 0; bottom: 4px;
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.lane__finish::before {
  content: "";
  position: absolute; right: 50%; bottom: -7px;
  width: 4px; height: 140px;
  background: repeating-linear-gradient(180deg, #fff 0 8px, #111 8px 16px);
  opacity: 0.35;
}

/* Runner: oversized head on a tiny body — the bobblehead look. */
.runner {
  --progress: 0;
  position: absolute;
  bottom: 0;
  left: calc(var(--progress) * (100% - var(--runner-w) - 34px));
  width: var(--runner-w);
  display: flex; flex-direction: column; align-items: center;
  transition: left 2.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.runner__head {
  position: relative; z-index: 2;
  width: 76px; height: 76px;
  margin-bottom: -10px;
  border-radius: 50%;
  border: 4px solid var(--party);
  background: #1b3550;
  overflow: visible;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
  transform-origin: 50% 100%;
  animation: wobble 2.4s ease-in-out infinite;
}

.runner__head img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.runner__initials {
  display: grid; place-items: center;
  width: 100%; height: 100%;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 1.6rem;
  color: #fff;
  background: color-mix(in srgb, var(--party, #3dccd5) 55%, #0c2740);
}

.runner__crown {
  position: absolute; top: -26px; left: 50%;
  transform: translateX(-50%) scale(0);
  font-size: 1.6rem;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.runner__body { width: 54px; height: 64px; overflow: visible; }
.runner__body .torso,
.runner__body .arm rect,
.runner__body .leg rect { fill: var(--party); }
.runner__body .leg rect { fill: color-mix(in srgb, var(--party) 60%, #0b1d2e); }
.runner__body .jersey { font: 800 16px var(--font); fill: #fff; }
.runner__body .leg,
.runner__body .arm { transform-box: fill-box; transform-origin: 50% 10%; }

.runner__bubble {
  position: absolute; z-index: 3;
  bottom: calc(100% + 4px); left: 70%;
  padding: 4px 9px;
  border-radius: 10px 10px 10px 2px;
  background: #fff; color: #0b1d2e;
  font-size: 0.72rem; font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.runner.is-idle .runner__body { animation: hop 1.1s ease-in-out infinite; }
.runner.is-idle .arm--l { animation: stretch 1.1s ease-in-out infinite; }

.runner.is-running .leg--l { animation: stride 0.36s linear infinite alternate; }
.runner.is-running .leg--r { animation: stride 0.36s linear infinite alternate-reverse; }
.runner.is-running .arm--l { animation: stride 0.36s linear infinite alternate-reverse; }
.runner.is-running .arm--r { animation: stride 0.36s linear infinite alternate; }
.runner.is-running .runner__head { animation-duration: 0.72s; }

.runner.is-leading .runner__crown { transform: translateX(-50%) scale(1); }

.runner.is-winner { animation: jump 0.8s ease-in-out infinite; }
.runner.is-winner .arm--l { transform: rotate(150deg); }
.runner.is-winner .arm--r { transform: rotate(-150deg); }

.runner.is-sad .runner__head { animation: none; transform: rotate(-8deg); filter: saturate(0.6); }

@keyframes wobble {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

@keyframes stride {
  from { transform: rotate(-28deg); }
  to { transform: rotate(28deg); }
}

@keyframes hop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes stretch {
  0%, 100% { transform: rotate(0); }
  50% { transform: rotate(150deg); }
}

@keyframes jump {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-22px); }
}

@keyframes pop {
  0% { transform: scale(0.3); }
  70% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* ------------------------------------------------------------------ council */

.hemicycle { width: 100%; max-width: 420px; display: block; margin: 0 auto; }

.seat {
  fill: rgba(255, 255, 255, 0.08);
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.5;
}

.seat--taken {
  stroke: rgba(255, 255, 255, 0.85);
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.5s both;
}

.legend { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 10px; }
.legend__dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.legend__name { flex: 1; font-size: 0.9rem; }
.legend__seats { font-size: 1.2rem; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ coalitions */

.coal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.coal {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid transparent;
}

.coal--spoko { border-color: var(--teal); background: rgba(61, 204, 213, 0.1); }
.coal--empty { display: block; color: var(--muted); font-style: italic; }
.coal__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.coal__seats { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.coal__verdict { grid-column: 1 / -1; font-size: 0.85rem; color: var(--muted); }

.chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--party) 30%, transparent);
  border: 1px solid var(--party);
  font-size: 0.8rem; font-weight: 700;
}

/* ------------------------------------------------------------------ elected */

.elected__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
}

.member {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  animation: pop 0.6s both;
}

.member__photo {
  --party: var(--teal);
  width: 110px; height: 110px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--teal);
  margin-bottom: 6px;
}

.member__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.member__name { font-size: 0.95rem; }
.member__votes { font-size: 0.8rem; color: var(--muted); }

/* ------------------------------------------------------------------ misc */

.error-banner {
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(255, 77, 94, 0.15);
  border: 1px solid var(--red);
}

.studio__foot { color: var(--muted); font-size: 0.8rem; text-align: center; }
.studio__foot p { margin: 4px 0; }
.demo-switch a { white-space: nowrap; }

.ticker {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: stretch;
  background: #fff; color: #0b1d2e;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.ticker__label {
  display: flex; align-items: center;
  padding: 10px 12px;
  background: var(--red); color: #fff;
  font-weight: 800; font-size: 0.75rem; letter-spacing: 0.06em;
  white-space: nowrap;
}

.ticker__viewport { flex: 1; min-width: 0; padding: 10px 14px; overflow: hidden; }
.ticker__text { margin: 0; font-weight: 600; font-size: 0.9rem; line-height: 1.35; }
.ticker__text.is-in { animation: slide-in 0.5s ease both; }

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

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; }

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