:root {
  --bg: #0b0616;
  --panel: rgba(34, 22, 62, 0.62);
  --panel-solid: #1d1335;
  --line: rgba(190, 160, 255, 0.16);
  --fg: #f6f0ff;
  --muted: #a99cc6;
  --gold: #f2c75c;
  --gold-2: #fff1b8;
  --gold-3: #b9842a;
  --gold-grad: linear-gradient(180deg, #fff3c4 0%, #f2c75c 38%, #c48f2c 70%, #ffe7a0 100%);
  --pink: #ff7aa2;
  --up: #6ee7a8;
  --team-valiant: #b896ff;
  --team-celestial: #6fd3ff;
  --team-agrios: #ff9a6b;
  --radius: 20px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
  color: var(--fg);
  background: transparent;
  overflow-x: hidden;
}
body.intro-playing { overflow: hidden; }
a { color: inherit; }
img { display: block; }

/* ---------- Ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, #2a1060 0%, #12082a 45%, var(--bg) 100%); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; will-change: transform; }
.blob.b1 { width: 55vw; height: 55vw; left: -15vw; top: -10vw; background: #6d28ff; }
.blob.b2 { width: 45vw; height: 45vw; right: -12vw; top: 20vh; background: #a43bff; opacity: .4; }
.blob.b3 { width: 40vw; height: 40vw; left: 25vw; bottom: -20vw; background: #4b1fb8; }
.blob.b4 { width: 18vw; height: 18vw; left: 45vw; top: 8vh; background: #f2c75c; opacity: .12; }
#sparkles { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }

/* ---------- Intro ---------- */
#intro { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; overflow: hidden; }
#intro .intro-bg { position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 45%, #3a159a 0%, #14082e 60%, #05020c 100%); }
.curtain { position: absolute; top: 0; bottom: 0; width: 51%; z-index: 3;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.35) 0 2px, transparent 2px 70px),
    repeating-linear-gradient(90deg, #3b0f8c 0px, #6a2bdc 35px, #2a0870 70px);
  box-shadow: inset 0 -80px 120px rgba(0,0,0,.6);
}
.curtain.left { left: 0; border-right: 2px solid rgba(242,199,92,.5); }
.curtain.right { right: 0; border-left: 2px solid rgba(242,199,92,.5); }
.intro-title .ch, .hero h1 .ch { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-stage { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px; }
.intro-logo { position: relative; width: min(46vw, 26vh, 260px); }
.intro-logo img { width: 100%; height: auto; filter: drop-shadow(0 0 30px rgba(242,199,92,.35)); }
.shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.95) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%; background-position: 160% 0;
  -webkit-mask: url(img/logo.png) center / contain no-repeat; mask: url(img/logo.png) center / contain no-repeat;
  mix-blend-mode: screen;
}
.halo { position: absolute; left: 50%; top: 42%; width: 140%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%;
  background: radial-gradient(circle, rgba(242,199,92,.35) 0%, rgba(242,199,92,0) 60%); z-index: -1; }
.intro-kicker { margin: 28px 0 4px; font-size: 13px; letter-spacing: .5em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.intro-title { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 6vw, 64px); font-weight: 700; letter-spacing: .04em;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.intro-line { width: min(60vw, 360px); height: 2px; margin-top: 18px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.intro-sub { margin-top: 14px; color: var(--muted); font-size: 14px; letter-spacing: .2em; text-transform: uppercase; }
.skip { position: absolute; z-index: 4; right: 22px; bottom: 22px; background: rgba(255,255,255,.08); color: var(--fg); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px; font: inherit; font-size: 13px; cursor: pointer; backdrop-filter: blur(6px); }
.skip:hover { background: rgba(255,255,255,.16); }

/* ---------- Layout ---------- */
main { max-width: 1160px; margin: 0 auto; padding: 28px 18px 80px; }
.glass { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; margin-bottom: 22px; }
.hero-mark { width: 92px; height: auto; filter: drop-shadow(0 0 18px rgba(242,199,92,.4)); }
.kicker { margin: 0; font-size: 12px; letter-spacing: .4em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.hero h1 { margin: 4px 0 2px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(28px, 4vw, 44px); line-height: 1.05;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { margin: 0; color: var(--muted); }

.countdown { display: flex; gap: 8px; align-items: flex-end; }
.cd-unit { text-align: center; }
.cd-box { display: block; min-width: 58px; padding: 10px 8px; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums;
  border-radius: 14px; background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02)); border: 1px solid var(--line); overflow: hidden; }
.cd-box span { display: inline-block; }
.cd-label { font-size: 10px; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); margin-top: 4px; display: block; }
.cd-closed { font-size: 22px; font-weight: 700; color: var(--pink); }

.stats { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.1fr); gap: 12px; margin-bottom: 12px; }
.stat { padding: 14px 18px; min-width: 0; }
.stat .label, .share .label { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 800; margin-top: 2px; line-height: 1.15; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .value.gold { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat .hint, .share .hint { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .hint b { color: var(--up); font-weight: 700; }
.s-leader { display: flex; gap: 14px; align-items: center; }
.s-leader img { width: 52px; height: 52px; flex: none; border-radius: 50%; object-fit: cover; object-position: 50% 22%;
  border: 2px solid var(--gold); box-shadow: 0 0 18px rgba(242,199,92,.35); }
.s-leader > div { min-width: 0; }
.s-leader .value { font-size: 20px; }
.s-status { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 4px; }
.live i { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 0 rgba(110,231,168,.7); }
.live.stale i { background: var(--muted); }
.btn { align-self: flex-start; border: 1px solid rgba(242,199,92,.45); background: rgba(242,199,92,.1); color: var(--gold-2); padding: 6px 14px;
  border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: rgba(242,199,92,.2); }
.btn:disabled { opacity: .5; cursor: default; }

/* Vote share: one stacked bar, a segment per candidate */
.share { padding: 14px 18px 16px; margin-bottom: 22px; }
.share-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; }
.share-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: rgba(255,255,255,.05); gap: 2px; }
.share-bar i { display: block; height: 100%; width: 0; background: var(--c); box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.share-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 18px; margin-top: 12px; font-size: 13px; }
.share-legend div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.share-legend div::before { content: ""; width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.share-legend span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.share-legend b { font-variant-numeric: tabular-nums; }

.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.seg { position: relative; display: inline-flex; padding: 4px; border-radius: 999px; }
.seg .pill { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: var(--gold-grad); box-shadow: 0 4px 20px rgba(242,199,92,.35); }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; color: var(--muted); padding: 8px 18px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; transition: color .3s; }
.seg button.on { color: #2a1650; }
.note { color: var(--muted); font-size: 13px; max-width: 520px; margin: 0; }
.note a { color: var(--gold); }
.error { background: rgba(120, 30, 60, .5); border: 1px solid #a33a5e; padding: 10px 14px; border-radius: 12px; font-size: 13px; margin-bottom: 16px; }

/* ---------- Cards (shared by podium and list) ---------- */
.card { position: relative; overflow: hidden; }
.card .photo { position: relative; flex: none; display: block; }
.card .photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; border-radius: 50%; }
.card .ring { position: absolute; inset: -4px; border-radius: 50%; padding: 3px; background: conic-gradient(from 0deg, var(--gold-3), var(--gold-2), var(--gold), var(--gold-3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; }
.card .crown { position: absolute; left: 50%; top: -26px; width: 44px; translate: -50% 0; opacity: 0; filter: drop-shadow(0 2px 8px rgba(242,199,92,.6)); }
.card .name { font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .team { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.card .others { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }
.card .others a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted; }
.card .others a:hover { color: var(--gold); }
.card .score { font-variant-numeric: tabular-nums; }
.card .big { font-size: 30px; font-weight: 800; line-height: 1; display: block; }
.card .unit { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.card .delta { font-size: 12px; color: var(--up); font-weight: 600; display: block; min-height: 1em; }
.card .gap { font-size: 12px; color: var(--muted); display: block; }
.card .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.05); }
.card .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold)); box-shadow: 0 0 12px var(--gold); }
.card .flash { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: radial-gradient(60% 80% at 50% 50%, rgba(242,199,92,.35), transparent 70%); opacity: 0; }
.float-delta { position: absolute; z-index: 5; font-weight: 800; color: var(--up); pointer-events: none; text-shadow: 0 0 10px rgba(110,231,168,.6); }

/* Podium: top three */
.podium { display: grid; grid-template-columns: 1fr 1.18fr 1fr; gap: 16px; align-items: end; margin-bottom: 18px; }
.podium .card { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 18px 22px; overflow: visible; }
.podium .card .photo { width: 120px; height: 120px; margin-bottom: 14px; }
.podium .card[data-place="1"] { padding-top: 52px; border-color: rgba(242,199,92,.55);
  box-shadow: 0 20px 60px -20px rgba(242,199,92,.45), inset 0 0 0 1px rgba(242,199,92,.2); }
.podium .card[data-place="1"] .photo { width: 156px; height: 156px; }
.podium .card .ring { opacity: 1; }
.podium .card[data-place="1"] .crown { opacity: 1; }
.podium .card .who { width: 100%; }
.podium .card .score { margin-top: 12px; }
.podium .card[data-place="1"] .big { font-size: 44px; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.podium .card .rank { position: absolute; top: 12px; left: 14px; font-family: Georgia, serif; font-size: 22px; font-weight: 700; color: var(--gold); }
.podium .card .bar { border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }

/* List: ranks 4+ */
.list { display: grid; gap: 10px; }
.list .card { display: grid; grid-template-columns: 44px 60px 1fr auto; gap: 16px; align-items: center; padding: 12px 20px 12px 12px; }
.list .card .photo { width: 60px; height: 60px; }
.list .card .rank { font-size: 22px; font-weight: 800; text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.list .card .score { text-align: right; }
.list .card .who { min-width: 0; }

/* Teams */
h2.section { font-family: Georgia, serif; font-size: 22px; margin: 44px 0 14px; display: flex; align-items: center; gap: 14px; }
h2.section::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line), transparent); }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.teamcard { padding: 18px 20px; position: relative; overflow: hidden; }
.teamcard .team { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.teamcard .big { font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0 10px; }
.teamcard .track { height: 6px; border-radius: 99px; background: rgba(255,255,255,.06); overflow: hidden; }
.teamcard .track i { display: block; height: 100%; width: 0; border-radius: 99px; background: currentColor; box-shadow: 0 0 14px currentColor; }
.teamcard .members { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* Vote share sits at the bottom, under the team totals */
.teams + .share { margin: 14px 0 0; }

.kicker .msu-seal { display: inline-block; width: 22px; height: 22px; margin-right: 8px; vertical-align: -6px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255,255,255,.35), 0 0 12px rgba(255,171,0,.35); }
.btn-pdf { text-decoration: none; padding: 9px 16px; font-weight: 600; background: linear-gradient(180deg, rgba(255,171,0,.22), rgba(114,4,85,.35));
  border-color: rgba(255,171,0,.6); }
.btn-pdf:hover { background: linear-gradient(180deg, rgba(255,171,0,.35), rgba(114,4,85,.5)); }

@media (max-width: 860px) {
  .hero { grid-template-columns: auto 1fr; }
  .countdown { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .s-leader { grid-column: 1 / -1; order: -1; }
  .s-status { grid-column: 1 / -1; flex-direction: row; align-items: center; }
  .s-status .btn { align-self: center; }
}
@media (max-width: 620px) {
  main { padding: 18px 12px 60px; }
  .hero { gap: 12px 14px; margin-bottom: 16px; }
  .hero-mark { width: 54px; }
  .kicker { font-size: 10px; letter-spacing: .3em; }
  .hero h1 { font-size: 26px; }
  .hero p.sub { font-size: 13px; }
  .countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .cd-box { min-width: 0; font-size: 22px; padding: 8px 4px; border-radius: 12px; }
  .cd-label { font-size: 9px; }

  .stats { gap: 8px; margin-bottom: 8px; }
  .stat { padding: 12px 14px; border-radius: 16px; }
  .stat .value { font-size: 22px; }
  .s-leader .value { font-size: 18px; }
  .s-leader img { width: 46px; height: 46px; }
  .s-status { padding: 10px 14px; }
  .s-status .label { display: none; }
  .live { margin: 0; font-size: 13px; }
  .share { padding: 12px 14px 14px; border-radius: 16px; margin-bottom: 16px; }
  .share-legend { grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; }

  .toolbar { gap: 10px; margin-bottom: 18px; }
  .seg { display: flex; width: 100%; }
  .btn-pdf { width: 100%; text-align: center; }
  .seg button { flex: 1; padding: 8px 4px; font-size: 13px; }
  .note { font-size: 12px; }

  /* Compact three-column podium: 2 · 1 · 3 */
  .podium { grid-template-columns: 1fr 1.15fr 1fr; gap: 8px; margin-bottom: 10px; }
  .podium .card { padding: 30px 6px 14px; border-radius: 16px; }
  .podium .card[data-place="1"] { padding-top: 36px; }
  .podium .card .photo { width: 62px; height: 62px; margin-bottom: 10px; }
  .podium .card[data-place="1"] .photo { width: 80px; height: 80px; }
  .podium .card .crown { width: 30px; top: -20px; }
  .podium .card .rank { top: 8px; left: 10px; font-size: 16px; }
  .podium .card .name { white-space: normal; font-size: 12px; line-height: 1.2; min-height: 2.4em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .podium .card .team { font-size: 9px; letter-spacing: .08em; }
  .podium .card .others, .podium .card .gap { display: none; }
  .podium .card .score { margin-top: 8px; }
  .podium .card .big { font-size: 20px; }
  .podium .card[data-place="1"] .big { font-size: 26px; }
  .podium .card .unit { font-size: 9px; }
  .podium .card .delta { font-size: 11px; }

  .list { gap: 8px; }
  .list .card { grid-template-columns: 22px 44px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px 10px 8px; border-radius: 16px; }
  .list .card .photo { width: 44px; height: 44px; }
  .list .card .rank { font-size: 16px; }
  .list .card .name { font-size: 14px; }
  .list .card .team { font-size: 10px; letter-spacing: .08em; }
  .list .card .others { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
  .list .card .others .o-link { display: none; }
  .list .card .big { font-size: 20px; }
  .list .card .unit { font-size: 9px; }
  .list .card .delta { font-size: 11px; }
  .list .card .gap { display: none; }

  h2.section { font-size: 19px; margin: 32px 0 10px; }
  .teams { gap: 8px; }
  .teamcard { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 12px 14px; border-radius: 16px; }
  .teamcard .big { font-size: 22px; margin: 0; grid-row: 1 / 3; grid-column: 2; }
  .teamcard .members { margin: 0; grid-column: 1; }
  .teamcard .track { grid-column: 1 / -1; margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .blob { display: none; }
}
