:root {
  --bg: #fafaf9;
  --fg: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --card: #ffffff;
  --accent: #1c1917;
  --buy: #1f7a4d;
  --buy-soft: #d9f0e3;
  --sell: #b43c3c;
  --sell-soft: #f6dcdc;
  --hold: #6b6b6b;
  --warn: #a16207;
  font-size: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131211; --fg: #e7e5e4; --muted: #a8a29e; --line: #2a2725; --card: #1b1917;
    --accent: #e7e5e4; --buy: #4fc389; --buy-soft: #16382a; --sell: #e06767; --sell-soft: #3d1c1c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45; }
a { color: inherit; }
main { max-width: 1240px; margin: 0 auto; padding: 24px 20px 48px; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 8px; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.top { display: flex; align-items: center; gap: 24px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.brand { font-weight: 650; text-decoration: none; letter-spacing: 0.01em; }
.top nav { display: flex; gap: 16px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--fg); }
.auth { margin-left: auto; display: flex; gap: 10px; align-items: center; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--bg); text-decoration: none; font: inherit; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.danger { background: var(--sell); border-color: var(--sell); color: #fff; }

.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .live-grid { grid-template-columns: 1fr; } }

.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.video iframe, .chat iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: #999; }
.chat { position: relative; height: 420px; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; position: sticky; top: 16px; }
.phase-line { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.78rem; letter-spacing: 0.02em; text-transform: uppercase; }
.tag.buy { color: var(--buy); border-color: var(--buy); }
.tag.sell { color: var(--sell); border-color: var(--sell); }
.tag.hold { color: var(--hold); }
.tag.override { color: var(--warn); border-color: var(--warn); }
.tag.open { color: var(--buy); border-color: var(--buy); }
.tag.locked { color: var(--warn); border-color: var(--warn); }

.lean .label { color: var(--muted); font-size: 0.85rem; }
.lean-value { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; margin: 2px 0 8px; }
.lean-value.buy { color: var(--buy); }
.lean-value.sell { color: var(--sell); }
.conf { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.conf-bar { height: 100%; width: 0; background: var(--fg); transition: width .4s; }

.tally { margin-top: 20px; }
.tally-head { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 6px; }
.bar { position: relative; display: flex; height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; }
.bar-up { background: var(--buy); width: 0; transition: width .4s; }
.bar-down { background: var(--sell); width: 0; transition: width .4s; margin-left: auto; }
.threshold { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); opacity: .7; }
.tally .small { margin-top: 6px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.vote { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: transparent; color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; }
.vote svg { width: 20px; height: 20px; fill: currentColor; }
.vote.up:not(:disabled):hover { background: var(--buy-soft); border-color: var(--buy); }
.vote.down:not(:disabled):hover { background: var(--sell-soft); border-color: var(--sell); }
.vote.chosen.up { background: var(--buy-soft); border-color: var(--buy); }
.vote.chosen.down { background: var(--sell-soft); border-color: var(--sell); }
.vote:disabled { opacity: .45; cursor: not-allowed; }
.turnstile { margin-top: 10px; }
#hint { margin-top: 8px; min-height: 1.2em; }

.result { margin-top: 16px; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 0.92rem; }

.status { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.status div { display: flex; flex-direction: column; }
.status dt { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; }
.status dd { margin: 0; font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 28px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline label { display: flex; flex-direction: column; gap: 4px; }
input { font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }

.prose { max-width: 720px; }
footer { max-width: 1240px; margin: 0 auto; padding: 24px 20px 40px; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }

/* --- brand line --- */
.brand-sub { color: var(--muted); font-size: 0.82rem; margin-left: -10px; }
@media (max-width: 700px) { .brand-sub { display: none; } }

/* --- flying vote icons -----------------------------------------------------
   Spawned on your own vote (a burst) and when other viewers vote (a drift).
   Pointer-events none so they never intercept a click on the vote buttons. */
.flyer-layer { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.flyer { position: absolute; width: 26px; height: 26px; opacity: 0; will-change: transform, opacity; }
.flyer svg { width: 100%; height: 100%; fill: currentColor;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
.flyer.up { color: var(--buy); }
.flyer.down { color: var(--sell); }
.flyer.burst { width: 34px; height: 34px; }
@keyframes flyup {
  0%   { opacity: 0; transform: translate3d(0, 10px, 0) scale(.5) rotate(0deg); }
  12%  { opacity: 1; transform: translate3d(0, -10px, 0) scale(1.15) rotate(-6deg); }
  100% { opacity: 0; transform: translate3d(var(--dx, 0), -190px, 0) scale(.85) rotate(var(--rot, 12deg)); }
}
@media (prefers-reduced-motion: reduce) { .flyer { display: none; } }

/* --- lifetime tracker strip --- */
.tracker { display: flex; gap: 26px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 18px; margin-bottom: 18px; }
.tracker .stat { display: flex; flex-direction: column; gap: 2px; }
.tracker .k { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; }
.tracker .v { font-size: 1.05rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tracker .spark { margin-left: auto; width: 120px; height: 28px; }
.tracker .spark svg { width: 100%; height: 100%; }

/* --- compact Google sign-in ------------------------------------------------
   Smaller than the default button, with the official mark. Says what signing in
   is for, since "Sign in with Google" alone does not tell a viewer why bother. */
.btn.sm { padding: 5px 10px; font-size: 0.85rem; }
.btn.gsi { display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; font-size: 0.85rem; font-weight: 550;
  background: var(--card); color: var(--fg); border: 1px solid var(--line);
  border-radius: 8px; text-decoration: none; line-height: 1; }
.btn.gsi:hover { border-color: var(--muted); }
.btn.gsi svg { width: 16px; height: 16px; flex: none; }
.explain { color: var(--muted); font-size: 0.82rem; margin: 8px 0 0; line-height: 1.35; }
