:root {
  color-scheme: dark;
  --bg: #04060a;
  --surface: rgba(4, 6, 10, 0.38);
  --surface-hover: rgba(4, 6, 10, 0.62);
  --border: rgba(255, 255, 255, 0.22);
  --border-strong: rgba(255, 255, 255, 0.45);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --display: "Orbitron", "Exo 2", sans-serif;
  --sans: "Exo 2", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --mono: "Oxanium", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

html:has(body.dash-body) {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

body {
  padding: 28px 24px 48px;
  position: relative;
}

.bg-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  pointer-events: none;
  filter: contrast(1.04) saturate(1.06);
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 60%, rgba(0, 0, 0, 0.04) 0%, rgba(0, 0, 0, 0.22) 100%);
  z-index: 1;
  pointer-events: none;
}

.narrow {
  position: relative;
  z-index: 10;
  max-width: 560px;
  margin: 0 auto;
}

/* --- Dashboard Viewport --- */
body.dash-body {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: clamp(14px, 2vh, 22px) 28px;
}

.dash-viewport {
  position: relative;
  z-index: 10;
  max-width: min(1360px, 95vw);
  width: 100%;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 18px);
}

.dash-header {
  margin-bottom: 0;
  padding-bottom: clamp(8px, 1.3vh, 14px);
  flex-shrink: 0;
}

.dash-header h1 {
  font-size: clamp(32px, 4.2vh, 44px);
}

.dash-viewport h2 {
  font-size: clamp(14px, 1.8vh, 17px);
  letter-spacing: 0.12em;
  color: #e2e8f0;
}

.dash-viewport .draw-status {
  font-size: clamp(12px, 1.45vh, 14px);
  padding: 5px 12px;
}

.dash-viewport .spin-inline-btn {
  padding: 7px 16px;
  font-size: clamp(12px, 1.5vh, 15px);
}

.dash-viewport .reel-text {
  font-size: clamp(17px, 2.2vh, 21px);
  line-height: 1.4;
}

.top-slot-panel {
  padding: 0;
  margin-bottom: 0;
  flex-shrink: 0;
}

.board-panel {
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.board-header {
  margin-bottom: clamp(6px, 1vh, 12px);
  flex-shrink: 0;
}

/* --- Intro Screen --- */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 60%, rgba(4, 6, 10, 0.14) 0%, rgba(4, 6, 10, 0.5) 100%);
}

.intro-card {
  padding: 32px 24px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.92), 0 0 18px rgba(0, 0, 0, 0.75);
}

.intro-title {
  font-family: var(--display);
  font-size: clamp(52px, 7vh, 72px);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 12px;
}

.intro-sub {
  font-size: clamp(16px, 2.1vh, 20px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 34px;
}

.start-btn {
  padding: 15px 44px;
  font-size: clamp(15px, 1.9vh, 18px);
  letter-spacing: 0.1em;
}

/* --- Header & Panels --- */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 22px;
}

h1 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.15;
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
}

h2 {
  font-family: var(--display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 12px;
}

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

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.panel {
  background: transparent;
  padding: 4px 0;
  margin-bottom: 22px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.92), 0 0 10px rgba(0, 0, 0, 0.75);
}

#result {
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* --- Scenario Drum --- */
.draw-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.draw-status {
  font-family: var(--display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.draw-status.live {
  border-color: var(--border-strong);
  color: #ffffff;
}

.spin-inline-btn {
  padding: 5px 12px;
  font-size: 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.draw-window {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  min-height: 86px;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, background-color 0.25s;
}

.draw-window.compact-drum {
  min-height: 64px;
  padding: 10px 20px;
}

.draw-window::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0%, transparent 24%, transparent 76%, rgba(0, 0, 0, 0.22) 100%);
  pointer-events: none;
  z-index: 2;
}

.draw-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.85) 8px, transparent 8px, transparent calc(100% - 8px), rgba(255, 255, 255, 0.85) calc(100% - 8px));
  pointer-events: none;
  z-index: 3;
}

.draw-window.playing {
  border-color: rgba(255, 255, 255, 0.55);
  background: rgba(4, 6, 10, 0.58);
}

.draw-window.locked {
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.14);
}

.reel-text {
  font-size: 14.5px;
  font-weight: 500;
  color: #ffffff;
  width: 100%;
  line-height: 1.45;
  transition: transform 0.08s ease-out, opacity 0.08s ease-out;
}

.reel-text.no-transition { transition: none !important; }
.reel-text.roll-out { transform: translateY(36px); opacity: 0.1; filter: blur(1px); }
.reel-text.roll-in { transform: translateY(-36px); opacity: 0.1; filter: blur(1px); }

/* --- Suno Embed Player --- */
.wire-player {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: clamp(10px, 1.4vh, 14px) 22px;
}

.wp-left {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.wp-art {
  width: clamp(62px, 8.5vh, 78px);
  height: clamp(62px, 8.5vh, 78px);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(4, 6, 10, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 6px;
}

.wp-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vinyl-disc {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  background: repeating-radial-gradient(circle at center, #0e0e0e 0px, #0e0e0e 2px, #1f1f1f 3px, #090909 4px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vinyl-disc::before {
  content: "";
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #1a1a1a;
}

.vinyl-disc::after {
  content: "";
  position: absolute;
  width: 10%;
  height: 10%;
  border-radius: 50%;
  background: #000000;
}

.wp-rank {
  display: inline-block;
  font-size: clamp(13px, 1.65vh, 16px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.08em;
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  margin-bottom: 4px;
}

.wp-team {
  width: 100%;
  font-family: var(--display);
  font-size: clamp(20px, 2.6vh, 27px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wp-title {
  width: 100%;
  font-family: var(--sans);
  font-size: clamp(13px, 1.6vh, 16px);
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wp-score {
  width: 100%;
  font-size: clamp(22px, 2.7vh, 28px);
  font-weight: 700;
  color: #ffffff;
  margin-top: 4px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wp-hint {
  font-size: 13.5px;
  color: #fde68a;
  text-align: center;
}

.wp-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 1.2vh, 10px);
}

#mcAudio {
  width: 100%;
  height: 40px;
  border-radius: 6px;
  outline: none;
}

#mcEmbedBox {
  width: 100%;
}

#mcEmbedBox iframe {
  display: block;
  width: 100%;
  height: 152px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: #000000;
}

.wp-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.wp-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #ffffff;
  border: none;
  padding: 6px 8px;
  line-height: 1;
  cursor: pointer;
}

.wp-ctrl-btn svg {
  display: block;
  width: 24px;
  height: 24px;
}

.wp-ctrl-btn:hover {
  background: transparent;
  color: #ffffff;
  opacity: 0.78;
}

.wp-play-btn {
  padding: 4px 10px;
}

.wp-play-btn svg {
  width: 28px;
  height: 28px;
}

/* --- Leaderboard --- */
.board-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
  overflow-y: auto;
  padding-right: 2px;
}

.board-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.board-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.board-table th,
.board-table td {
  padding: clamp(7px, 1vh, 11px) 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  vertical-align: middle;
  font-size: clamp(16px, 2.05vh, 20px);
}

.board-table td.lb-rank {
  font-size: clamp(20px, 2.5vh, 26px);
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
}

.board-table td:nth-child(2) {
  overflow: hidden;
}

.board-table td:last-child {
  font-size: clamp(22px, 2.7vh, 28px);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.lb-song {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lb-thumb {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(4, 6, 10, 0.6);
}

.lb-thumb-empty {
  display: inline-block;
  background: radial-gradient(circle, #ffffff 18%, #1a1a1a 22%, #0e0e0e 100%);
}

.lb-song-text {
  flex: 1;
  min-width: 0;
}

.lb-team-name {
  font-family: var(--display);
  font-size: clamp(20px, 2.5vh, 26px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-track-title {
  font-size: clamp(13px, 1.55vh, 15px);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.board-empty {
  font-size: clamp(14px, 1.75vh, 16px);
  text-align: center;
  padding: 26px 14px;
}

.board-table th {
  font-family: var(--display);
  font-size: clamp(12px, 1.5vh, 14px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding-top: clamp(9px, 1.1vh, 13px);
  padding-bottom: clamp(9px, 1.1vh, 13px);
  background: rgba(4, 6, 10, 0.35);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(4, 6, 10, 0.34); }
tr.active-row td { background: rgba(4, 6, 10, 0.36); }
tr.top td { background: rgba(4, 6, 10, 0.44); }
tr.top td:first-child { box-shadow: inset 3px 0 0 #ffffff; color: #ffffff; font-weight: 700; }

/* --- Forms & Cards --- */
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 14px 0 6px;
}

label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="file"] {
  width: 100%;
  background: var(--surface);
  color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}

input[type="file"] {
  padding: 6px 8px;
  font-size: 13px;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  background: rgba(4, 6, 10, 0.6);
  color: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 5px 12px;
  margin-right: 10px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

input[type="text"]::placeholder { color: rgba(255, 255, 255, 0.55); }
input[type="text"]:focus { border-color: var(--border-strong); background: rgba(4, 6, 10, 0.65); }

button {
  background: rgba(255, 255, 255, 0.9);
  color: #0b0f18;
  border: 1px solid #ffffff;
  border-radius: 4px;
  padding: 10px 16px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
}

button:hover { background: #ffffff; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #ffffff;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
}

@media (max-width: 900px) {
  html:has(body.dash-body),
  body.dash-body { height: auto; overflow: auto; }
  .board-grid { grid-template-columns: 1fr; overflow-y: visible; }
}

@media (max-width: 600px) {
  body { padding: 20px 14px 36px; }
  .wire-player { flex-direction: column; gap: 14px; }
  .wp-left, .wp-main { width: 100%; }
  .grid3 { grid-template-columns: 1fr; }
}
