:root {
  color-scheme: dark;
  --bg: #121212;
  --panel: #1c1c1c;
  --panel-2: #242424;
  --text: #f7f1e6;
  --muted: #a9a59d;
  --line: #37332b;
  --gold: #f5c34b;
  --mint: #39d98a;
  --red: #ff5f57;
  --blue: #63b3ff;
  --violet: #c084fc;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

button.primary {
  background: var(--gold);
  color: #16120a;
  border-color: #ffd96e;
  font-weight: 800;
}

button.danger {
  border-color: #7e3734;
  background: #3a1d1b;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
select {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
  color: var(--text);
}

input[type="checkbox"] {
  min-height: 20px;
  width: 20px;
  padding: 0;
  accent-color: var(--gold);
}

.checkbox-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.screen {
  min-height: 100vh;
}

.public-page {
  --public-font: "Comic Sans MS", Arial, Helvetica, sans-serif;
  background: #fff;
  color: #000;
  font-family: var(--public-font);
  overflow: hidden;
}

.public-page button,
.public-page input {
  font-family: var(--public-font);
}

.public-page .join {
  position: fixed;
  inset: 0;
  width: 100%;
  background: #fff;
}

.public-page .screen {
  min-height: 100vh;
}

.public-page .join-panel {
  width: min(520px, 100%);
}

.public-page .brand h1 {
  color: #000;
  font-size: clamp(52px, 18vw, 118px);
  text-align: center;
  line-height: 0.95;
}

.public-page input {
  min-height: 58px;
  border: 3px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-size: 22px;
  text-align: center;
}

.public-page input::placeholder {
  color: #000;
  opacity: 1;
}

.public-page button.primary {
  min-height: 58px;
  border: 3px solid #000;
  border-radius: 0;
  background: #fff;
  color: #000;
  font-size: 30px;
  font-weight: 900;
}

.public-page .performer {
  position: fixed;
  inset: 0;
  width: 100%;
  display: block;
  overflow: hidden;
  min-height: 100vh;
  background: #fff;
}

.public-status {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  top: 42%;
  color: #000;
  font-family: var(--public-font);
  font-size: clamp(34px, 10vw, 76px);
  font-weight: 900;
  text-align: center;
  pointer-events: none;
}

.public-page .waterfall {
  position: absolute;
  inset: 0;
  width: 100%;
  height: auto;
  background: #fff;
}

.public-page .hit-line {
  height: 12px;
  background: #f00;
  box-shadow: 0 0 0 3px #000;
}

.public-page .note,
.public-page .note.drums,
.public-page .note.guitar,
.public-page .note.melody,
.public-page .note.piano,
.public-page .note.bass {
  min-height: 30px;
  border: 3px solid #000;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  color: #000;
  font-size: 16px;
  line-height: 1;
  padding-bottom: 2px;
  transition: background-color 80ms linear, color 80ms linear, border-color 80ms linear, opacity 80ms linear, transform 80ms linear;
}

.public-page .note.entering {
  border-color: #777;
  color: #777;
}

.public-page .note.armed {
  background: #000;
  color: #fff;
  border-color: #000;
  transform: scale(1.08);
}

.public-page .note.played {
  background: #888;
  color: #fff;
  border-color: #888;
  transform: scale(0.96);
}

.public-page .note.missed {
  background: #fff;
  color: #bbb;
  border-color: #bbb;
}

.public-page .hit-button {
  position: fixed;
  z-index: 6;
  left: 0;
  right: 0;
  bottom: 0;
  border-top: 3px solid #000;
  background: #fff;
  color: #000;
  font-family: var(--public-font);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.public-page .hit-button.ready {
  background: #fff;
  color: #000;
}

.public-page .hit-button.hit {
  background: #f2f2f2;
  color: #000;
}

.public-page .lyrics-view {
  position: absolute;
  inset: 0;
  height: auto;
  background: #fff;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.public-page .lyrics-scroll {
  gap: 24px;
  padding: 42vh 8px 52vh;
  will-change: transform;
}

.public-page .lyric-line {
  color: #777;
  border-color: transparent;
  font-family: var(--public-font);
  min-height: 72px;
  display: block;
  padding: 4px 8px;
  text-align: center;
  font-size: clamp(28px, 9vw, 62px);
  font-weight: 900;
  line-height: 1.08;
}

.public-page .lyric-line.mine {
  border-color: transparent;
}

.public-page .lyric-line.active {
  background: #fff;
  text-decoration: none;
}

.public-page .lyric-segment {
  display: inline-block;
  margin: 0 0.16em;
  color: #777;
  transition: color 80ms linear, transform 80ms linear, opacity 80ms linear;
}

.public-page .lyric-segment.mine {
  color: #ffd400;
  -webkit-text-stroke: 1px #000;
  text-shadow: 0 2px 0 #000;
}

.public-page .lyric-segment.active {
  transform: scale(1.08);
}

.public-page .lyric-segment.past {
  color: #d3d3d3;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.public-page .lyric-segment.mine.past {
  color: #fff0a6;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

.public-page .lyric-segment.mine.active {
  color: #ffea00;
  -webkit-text-stroke: 1.5px #000;
  text-shadow: 0 3px 0 #000;
}

.join {
  display: grid;
  place-items: center;
  padding: 24px;
}

.join-panel {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
}

.brand {
  display: grid;
  gap: 6px;
}

.brand h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.02;
}

.brand p,
.hint {
  margin: 0;
  color: var(--muted);
}

.role-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.role-row button.active {
  border-color: var(--gold);
  color: var(--gold);
}

.performer {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.94);
}

.who {
  display: grid;
  gap: 2px;
}

.who strong {
  font-size: 15px;
}

.status {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.waterfall {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(to bottom, rgba(245, 195, 75, 0.08), transparent 36%),
    repeating-linear-gradient(to right, rgba(255,255,255,0.035), rgba(255,255,255,0.035) 1px, transparent 1px, transparent 12.5%),
    #141414;
}

.hit-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 116px;
  height: 3px;
  background: var(--gold);
  box-shadow: 0 0 22px rgba(245, 195, 75, 0.55);
}

.note {
  position: absolute;
  width: 11.5%;
  min-height: 16px;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,0.22);
  background: var(--blue);
  box-shadow: 0 8px 22px rgba(0,0,0,0.36);
  display: grid;
  place-items: center;
  color: #071019;
  font-weight: 800;
  font-size: 12px;
  pointer-events: none;
}

.note.drums {
  background: #ff8a65;
}

.note.guitar {
  background: #a6e22e;
}

.note.melody,
.note.piano {
  background: var(--gold);
}

.note.bass {
  background: #5eead4;
}

.hit-button {
  min-height: 112px;
  width: 100%;
  border-radius: 0;
  border-width: 1px 0 0;
  font-size: clamp(28px, 8vw, 54px);
  font-weight: 900;
  background: #f7f1e6;
  color: #111;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.hit-button.ready {
  background: #fff;
}

.hit-button.hit {
  background: #f2f2f2;
}

.lyrics-view {
  height: 100%;
  overflow: hidden;
  padding: 16px;
  background: #111;
}

.lyrics-scroll {
  display: grid;
  gap: 10px;
  transition: transform 0.18s linear;
  padding: 40vh 0 45vh;
}

.lyric-line {
  min-height: 44px;
  display: grid;
  align-items: center;
  padding: 8px 12px;
  border-left: 3px solid transparent;
  color: #76736e;
  font-size: clamp(20px, 4vw, 34px);
  line-height: 1.15;
}

.lyric-line.mine {
  color: #f7f1e6;
  border-color: var(--gold);
}

.lyric-line.active {
  color: var(--gold);
  background: rgba(245, 195, 75, 0.08);
}

.admin {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.admin header {
  padding: 18px 20px 10px;
  border-bottom: 1px solid var(--line);
}

.admin h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.admin-main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 16px 20px 24px;
  min-height: 0;
}

.controls,
.roster,
.timeline-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.controls {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.roster {
  margin-top: 12px;
  overflow: hidden;
}

.roster h2,
.timeline-panel h2 {
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.people {
  display: grid;
  max-height: calc(100vh - 430px);
  overflow: auto;
}

.person {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.person:last-child {
  border-bottom: 0;
}

.person small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.person-actions {
  display: grid;
  grid-template-columns: 72px 112px;
  gap: 6px;
}

.person-actions button {
  min-height: 38px;
  padding: 0 8px;
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  background: #777;
}

.dot.on {
  background: var(--mint);
}

.dot.audio {
  background: var(--gold);
}

.dot.samples {
  background: var(--blue);
}

.timeline-panel {
  min-height: 0;
  overflow: hidden;
}

.admin-timeline {
  position: relative;
  height: calc(100vh - 245px);
  min-height: 360px;
  overflow: hidden;
  background:
    repeating-linear-gradient(to right, rgba(255,255,255,0.03), rgba(255,255,255,0.03) 1px, transparent 1px, transparent 64px),
    #151515;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3px;
  left: 25%;
  background: var(--gold);
  box-shadow: 0 0 20px rgba(245, 195, 75, 0.5);
}

.admin-note {
  position: absolute;
  height: 9px;
  border-radius: 4px;
  background: rgba(99, 179, 255, 0.8);
}

.admin-note.assigned {
  background: rgba(57, 217, 138, 0.78);
}

.admin-note.fallback {
  background: rgba(255, 95, 87, 0.9);
}

.url-box {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.url-box strong {
  display: block;
  color: var(--gold);
  font-size: 15px;
}

.url-box small {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.sim-admin-link {
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
  color: var(--gold);
  text-decoration: none;
  font-weight: 800;
}

.text-link {
  color: var(--gold);
  text-decoration: none;
  font-weight: 700;
}

.simulation {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
}

.sim-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
}

.sim-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.sim-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 140px)) repeat(2, minmax(180px, 1fr));
  gap: 10px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.switch-row {
  min-height: 44px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
}

.switch-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--gold);
}

.sim-progress {
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  gap: 10px;
  align-items: center;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}

.sim-progress input {
  min-height: 32px;
  padding: 0;
  accent-color: var(--gold);
}

.sim-progress span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sim-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.sim-lyrics {
  min-height: 0;
  overflow: hidden;
  background: #111;
  padding: 0 22px;
}

.sim-panel {
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.sim-panel h2 {
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}

.sim-meters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 12px;
}

.sim-tracks,
.sim-people {
  overflow: auto;
}

.sim-tracks {
  max-height: 310px;
  border-bottom: 1px solid var(--line);
}

.sim-track {
  display: grid;
  grid-template-columns: 18px 1fr 62px;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.sim-track input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--gold);
}

.sim-track button {
  min-height: 34px;
}

.sim-track-detail {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.sim-track-detail strong,
.sim-track-detail span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-track-detail span {
  color: var(--muted);
  font-size: 12px;
}

.sim-people {
  max-height: calc(100vh - 690px);
  overflow: auto;
}

.sim-person {
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.sim-person span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 820px) {
  .admin-grid,
  .admin-main {
    grid-template-columns: 1fr;
  }

  .people {
    max-height: 320px;
  }

  .sim-controls,
  .sim-grid {
    grid-template-columns: 1fr;
  }

  .sim-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .sim-lyrics {
    min-height: 52vh;
  }
}
