:root {
  --bg: #020202;
  --bg-elevated: rgba(255, 255, 255, 0.025);
  --border: rgba(255, 255, 255, 0.18);
  --text: #fbfdff;
  --muted: #b9c0cb;
  --accent: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.34);
  --success: #22c55e;
  --danger: #f97316;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(124, 58, 237, 0.14), transparent 24%),
    radial-gradient(circle at bottom, rgba(255, 255, 255, 0.035), transparent 22%),
    linear-gradient(180deg, #090909 0%, #000000 100%);
  color: var(--text);
}

body.modal-open {
  overflow: hidden;
}

.celebration-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 40;
}

.shell {
  width: min(1100px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.eyebrow,
.label,
.stat-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--muted);
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  margin-top: 0.15rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.1;
}

h4 {
  font-size: 1.1rem;
}

.subtle,
.helper-text,
.instructions li,
.leaderboard-form label,
.form-meta {
  color: var(--muted);
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1.2rem;
  margin-bottom: 1rem;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  justify-content: center;
}

.launchbar {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.post-run-reveal {
  padding: 1rem;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.12), rgba(56, 189, 248, 0.05));
  border: 1px solid rgba(124, 58, 237, 0.22);
  display: grid;
  gap: 0.7rem;
}

.launchbar-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.top-mode-switch {
  width: 100%;
}

.vcl-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.vcl-badge-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.55rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.vcl-badge-link:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
}

.vcl-badge-link img {
  display: block;
  max-width: 100%;
  height: auto;
}

.hero-actions {
  margin-top: 0.35rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.project-link-button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.arena-stats-wrap {
  margin-bottom: 0.25rem;
}

.arena-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.stat-card strong {
  font-size: clamp(1.1rem, 2vw, 1.5rem);
}

.compact-stat {
  padding: 0.8rem 0.9rem;
  gap: 0.4rem;
}

.compact-stat strong {
  font-size: clamp(1rem, 1.8vw, 1.25rem);
}

.arena-panel,
.leaderboard-panel,
.podium-panel {
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.mode-switch {
  display: inline-flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.mode-pill {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

.mode-pill.active {
  border-color: rgba(124, 58, 237, 0.8);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.34), rgba(124, 58, 237, 0.2));
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.32), 0 0 24px rgba(124, 58, 237, 0.18);
  transform: translateY(-1px);
}

.challenge-banner {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.18), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(124, 58, 237, 0.28);
  color: #ece9ff;
  text-align: center;
}

.action-cue {
  justify-self: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-message {
  text-align: center;
  color: #d8dee8;
  min-height: 1.5rem;
}

.arena {
  width: 100%;
  min-height: 360px;
  border: none;
  border-radius: 28px;
  color: var(--text);
  font-size: clamp(1.3rem, 2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: transform 120ms ease, background 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.arena:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.34);
}

.arena.waiting {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.012));
}

.arena.ready {
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.22), transparent 28%), var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 70px var(--accent-soft);
}

.arena.too-soon {
  background: linear-gradient(180deg, rgba(249, 115, 22, 0.25), rgba(249, 115, 22, 0.16));
}

.slice-arena {
  display: grid;
  gap: 0.9rem;
}

.slice-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

 .slice-board {
  min-height: 360px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background:
    radial-gradient(circle at 50% 20%, rgba(124, 58, 237, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  overflow: hidden;
  position: relative;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.slice-board svg {
  display: block;
  width: 100%;
  height: 100%;
}

#sliceShape {
  fill: rgba(124, 58, 237, 0.22);
  stroke: rgba(255, 255, 255, 0.62);
  stroke-width: 1.2;
}

#sliceCutLine {
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 1.2;
  stroke-dasharray: 4 3;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.24));
}

.slice-move-hint {
  position: absolute;
  left: 50%;
  top: 1rem;
  transform: translateX(-50%);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(7, 10, 18, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #eef1ff;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  pointer-events: none;
  backdrop-filter: blur(10px);
  animation: slice-hint-breathe 2.2s ease-in-out infinite;
}

.helper-row,
.helper-actions,
.leaderboard-header,
.leaderboard-form-row,
.leaderboard-item,
.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.helper-row {
  min-height: 2.5rem;
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  cursor: pointer;
}

.ghost-button:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.podium-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: end;
}

.podium-place {
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: podium-float 4.8s ease-in-out infinite;
}

.podium-place::before,
.podium-place::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.podium-place::before {
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.16), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 45%);
  opacity: 0.9;
}

.podium-place::after {
  inset: auto -18% -32% -18%;
  height: 70%;
  background: radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 34%, transparent 72%);
  opacity: 0.32;
  transform: scaleX(0.92);
  animation: podium-light-breathe 4.6s ease-in-out infinite;
}

.podium-gold {
  min-height: 180px;
  background: linear-gradient(180deg, rgba(250, 204, 21, 0.14), rgba(255, 255, 255, 0.03));
  border-color: rgba(250, 204, 21, 0.35);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.12), 0 0 36px rgba(250, 204, 21, 0.12);
  animation-delay: 0s;
}

.podium-silver {
  min-height: 155px;
  background: linear-gradient(180deg, rgba(226, 232, 240, 0.12), rgba(255, 255, 255, 0.03));
  animation-delay: 0.35s;
}

.podium-bronze {
  min-height: 140px;
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.14), rgba(255, 255, 255, 0.03));
  animation-delay: 0.7s;
}

.podium-medal {
  font-size: 1.8rem;
  animation: podium-spark 2.8s ease-in-out infinite;
}

.podium-rank-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.podium-score {
  color: var(--muted);
}

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

@keyframes podium-light-breathe {
  0%, 100% {
    opacity: 0.22;
    transform: scaleX(0.9) scaleY(0.96);
  }
  50% {
    opacity: 0.4;
    transform: scaleX(1.02) scaleY(1.04);
  }
}

@keyframes podium-spark {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.28));
  }
}

@keyframes slice-hint-breathe {
  0%, 100% {
    opacity: 0.78;
    transform: translateX(-50%) translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(2px);
  }
}

@keyframes intro-pill-pulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.18);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.34), 0 0 18px rgba(124, 58, 237, 0.18);
  }
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.leaderboard-board {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.board-head {
  align-items: flex-start;
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.leaderboard-item {
  padding: 0.85rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-rank {
  width: 3rem;
  color: var(--muted);
}

.leaderboard-name {
  flex: 1;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.leaderboard-score {
  font-size: 1rem;
}

.leaderboard-form {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.leaderboard-form-inline {
  margin-top: 0.35rem;
}

.share-sheet {
  padding: 1rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  gap: 0.85rem;
}

.share-sheet-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.share-text-output {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font: inherit;
}

.leaderboard-form label {
  display: block;
  margin-bottom: 0.8rem;
}

.form-meta {
  display: block;
  margin-top: 0.4rem;
}

.leaderboard-form input {
  width: 100%;
  max-width: 7rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.leaderboard-form input:focus {
  outline: 2px solid rgba(124, 58, 237, 0.55);
  outline-offset: 2px;
}

.site-footer {
  margin-top: 1rem;
  padding: 0 0.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer a {
  color: var(--text);
}

.instructions {
  margin-top: 1rem;
  padding: 1rem 1.2rem;
}

.instructions-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.intro-instructions {
  margin-bottom: 1rem;
}

.instructions ol {
  margin: 0.85rem 0 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.55rem;
}

.confetti-piece {
  position: absolute;
  top: -8vh;
  width: var(--size, 12px);
  height: calc(var(--size, 12px) * 1.8);
  opacity: 0.95;
  transform: translate3d(0, 0, 0) rotate(0deg);
  animation: confetti-fall var(--duration, 2.8s) ease-out forwards;
  animation-delay: var(--delay, 0s);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.15);
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, -8vh, 0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 0px), 110vh, 0) rotate(var(--rotate, 180deg));
    opacity: 0;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(640px, 100%);
  padding: 1.25rem;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.96), rgba(10, 10, 10, 0.96));
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
}

.intro-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.intro-points > div {
  padding: 1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  gap: 0.45rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .leaderboard-grid,
  .podium-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 1rem, 1100px);
    padding-top: 1rem;
  }

  .topbar,
  .launchbar-copy,
  .helper-row,
  .helper-actions,
  .leaderboard-header,
  .leaderboard-form-row,
  .leaderboard-item,
  .board-head,
  .instructions-topline,
  .podium-header,
  .slice-topline {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-pill {
    flex: 1 1 0;
  }

  .intro-points {
    grid-template-columns: 1fr;
  }

  .vcl-badges {
    justify-content: center;
  }

  .arena {
    min-height: 300px;
  }

  .leaderboard-rank {
    width: auto;
  }
}
