@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap");

/* worldbuild.io "worldhopper" theme tokens — mirrors worldbuild/site/src/app/globals.css */
:root {
  --wb-bg: #0e0c16;
  --wb-surface: #181424;
  --wb-accent: #a088ee;
  --wb-accent-alt: #d07ab0;
  --wb-accent-warm: #eca870;
  --wb-text: #faf8fc;
  --wb-muted: #b4b0c4;
  --wb-dim: #7f7a93;
  --wb-border: rgba(160, 136, 238, 0.333);
  --wb-border-subtle: rgba(160, 136, 238, 0.18);
  --wb-track: rgba(160, 136, 238, 0.1);
  --wb-glow-accent: 0 0 20px rgba(160, 136, 238, 0.45);
  --wb-gradient-primary: linear-gradient(to right, #a088ee, #d07ab0);
  --wb-gradient-text: linear-gradient(135deg, #a088ee, #d07ab0, #eca870);
  --wb-sidebar-hover: rgba(160, 136, 238, 0.06);
  --wb-sidebar-active: rgba(160, 136, 238, 0.1);
  --wb-font: "JetBrains Mono", ui-monospace, monospace;
  --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 16px;
  --phi: 1.618;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
html, body { min-height: 100%; }
body {
  background: var(--wb-bg);
  color: var(--wb-text);
  font-family: var(--wb-font);
  font-size: 0.9375rem;
  line-height: 1.65;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; }
:focus-visible { outline: 2px solid var(--wb-accent); outline-offset: 3px; }
::selection { background: rgba(160, 136, 238, 0.4); }

.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--wb-accent);
}
.gradient-text {
  background: var(--wb-gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--wb-accent);
}

/* ---- worldbuild shell (sidebar · topbar · footer) ------------------------- */
.wb-app-shell { display: flex; min-height: 100vh; }
.wb-skip { position: absolute; left: -9999px; }
.wb-skip:focus { left: 1rem; top: 1rem; z-index: 50; padding: 0.5rem 1rem; border: 1px solid var(--wb-accent); border-radius: 8px; background: var(--wb-bg); }
.wb-sidebar {
  width: 240px; flex-shrink: 0;
  border-right: 1px solid var(--wb-border);
  background: var(--wb-surface);
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 400ms var(--ease-smooth);
}
.wb-sidebar-inner { display: flex; flex-direction: column; height: 100%; padding: 1rem; }
body.nav-open .wb-sidebar { transform: none; }
.wb-scrim { display: none; position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.6); }
body.nav-open .wb-scrim { display: block; }
.wb-brand { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem; margin-bottom: 1.5rem; font-size: 0.875rem; font-weight: 700; letter-spacing: -0.01em; }
.wb-brand img { width: 28px; height: 28px; }
.wb-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.i { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-link, .sidebar-contact {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.625rem 1rem; font-size: 0.8125rem;
  color: var(--wb-muted);
  border-left: 2px solid transparent;
  transition: color 200ms, background 200ms;
}
.sidebar-link:hover { color: var(--wb-accent); background: var(--wb-sidebar-hover); }
.sidebar-link[data-active="true"] { color: var(--wb-accent); border-left-color: var(--wb-accent); background: var(--wb-sidebar-active); }
.sidebar-group-label { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.sidebar-group-subtitle { font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.9; }
.sidebar-children { display: flex; flex-direction: column; gap: 2px; padding-left: 0.75rem; margin-left: 0.5rem; border-left: 1px solid var(--wb-border); }
.sidebar-children .sidebar-link { font-size: 0.75rem; }
.sidebar-lock { margin-left: auto; width: 14px; height: 14px; opacity: 0.6; }
.sidebar-contact { font-weight: 600; color: var(--wb-accent-warm); }
.sidebar-contact:hover { background: rgba(236, 168, 112, 0.08); }
.wb-sidebar-foot { margin-top: 0.75rem; padding-top: 1rem; border-top: 1px solid var(--wb-border); }
.wb-sidebar-foot .sidebar-link { font-size: 0.75rem; }
.wb-sidebar-foot p { margin-top: 0.75rem; padding: 0 1rem; font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--wb-muted); line-height: 1.5; }

.wb-main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.wb-topbar {
  position: sticky; top: 0; z-index: 30;
  height: 3.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--wb-border);
  background: color-mix(in srgb, var(--wb-bg) 95%, transparent);
  backdrop-filter: blur(8px);
}
.wb-topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.wb-topbar-left p:last-child { font-size: 0.75rem; color: var(--wb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-menu-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; border: 1px solid var(--wb-border); cursor: pointer; }
.wb-menu-btn:hover { border-color: var(--wb-accent); }
.wb-tabs { display: flex; gap: 0.25rem; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.wb-tabs a { padding: 0.45rem 0.75rem; border-radius: 8px; color: var(--wb-muted); min-height: 36px; display: grid; place-items: center; }
.wb-tabs a:hover { color: var(--wb-accent); background: var(--wb-sidebar-hover); }
body[data-page="stage"] .wb-tabs a[href="/"],
body[data-page="vote"] .wb-tabs a[href="/vote"],
body[data-page="results"] .wb-tabs a[href="/results"] { color: var(--wb-accent); background: var(--wb-sidebar-active); }
#main-content { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.wb-footer { border-top: 1px solid var(--wb-border); background: var(--wb-surface); }
.wb-footer-inner { display: flex; flex-direction: column; gap: 1.5rem; padding: 2rem 1rem; }
.wb-footer-name { font-size: 0.875rem; font-weight: 700; }
.wb-footer-inner p { max-width: 24rem; font-size: 0.75rem; color: var(--wb-muted); margin-top: 0.25rem; }
.wb-footer-inner .quote { font-style: italic; opacity: 0.7; margin-top: 0.5rem; }
.wb-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.wb-footer nav a { color: var(--wb-muted); }
.wb-footer nav a:hover { color: var(--wb-accent); }

@media (min-width: 768px) {
  .wb-sidebar { position: sticky; top: 0; height: 100vh; transform: none; }
  .wb-menu-btn, .wb-scrim, body.nav-open .wb-scrim { display: none; }
  .wb-topbar { padding: 0 1.5rem; }
  .wb-footer-inner { flex-direction: row; justify-content: space-between; align-items: flex-start; padding: 2rem 1.5rem; }
}
@media (max-width: 520px) { .wb-topbar-left p:last-child { display: none; } }

/* ---- bars (shared by stage, vote, results) -------------------------------- */
.bars { display: grid; gap: 0.9em; }
.bar-row { display: grid; gap: 0.35em; }
.bar-head { display: flex; justify-content: space-between; gap: 1em; align-items: baseline; }
.bar-label { color: var(--wb-muted); line-height: 1.25; }
.bar-value { color: var(--wb-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-track { height: 0.6em; min-height: 8px; border-radius: 4px; background: var(--wb-track); overflow: hidden; }
.bar-fill {
  height: 100%; width: 0; border-radius: 4px;
  background: rgba(180, 176, 196, 0.45);
  transition: width 800ms var(--ease-smooth);
}
.bar-row.lead .bar-fill { background: var(--wb-gradient-primary); box-shadow: var(--wb-glow-accent); }
.bar-row.lead .bar-label, .bar-row.lead .bar-value { color: var(--wb-text); }
.bar-row.mine .bar-label::after { content: " · you"; color: var(--wb-accent-alt); font-size: 0.85em; }

.live-dot {
  display: inline-block; width: 0.55em; height: 0.55em; border-radius: 50%;
  background: var(--wb-accent-alt); margin-right: 0.5em;
  box-shadow: 0 0 10px var(--wb-accent-alt);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; transform: scale(0.8); } }
.bump { animation: bump 400ms ease-out; }
@keyframes bump { 30% { transform: scale(1.18); color: var(--wb-accent); } }

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