*, *::before, *::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  color-scheme: dark;
  --bg: #0e0c09;
  --surface: #181410;
  --surface-hover: rgba(255, 244, 224, 0.06);
  --hairline: rgba(255, 240, 218, 0.11);
  --text: #f7f4ee;
  --muted: #a69c8e;
  --accent: #f59e0b;
  --green: #22c55e;
  --red: #ef4444;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
}

.qz-shell {
  width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.qz-main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.qz-game-area {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* Edge-to-edge full-bleed drum kit stages */
.qz-hero-stage,
.qz-kit-stage {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 1376 / 768;
  background: var(--bg);
  border: none;
  border-radius: 0;
  overflow: hidden;
}

.qz-hero-stage::after,
.qz-kit-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(14, 12, 9, 0.72) 0%, rgba(14, 12, 9, 0) 9%, rgba(14, 12, 9, 0) 86%, var(--bg) 100%);
}

@media (min-width: 961px) {
  .qz-hero-stage::after,
  .qz-kit-stage::after {
    background:
      linear-gradient(90deg, var(--bg) 0%, rgba(14, 12, 9, 0) 6%, rgba(14, 12, 9, 0) 94%, var(--bg) 100%),
      linear-gradient(180deg, rgba(14, 12, 9, 0.72) 0%, rgba(14, 12, 9, 0) 9%, rgba(14, 12, 9, 0) 86%, var(--bg) 100%);
  }
}

.qz-hero-img,
.qz-kit-stage img,
.qz-kit-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.qz-hero-img,
.qz-kit-stage img {
  object-fit: fill;
  user-select: none;
}

/* Start screen copy & CTA */
.qz-start-screen {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: env(safe-area-inset-top);
}

.qz-start-copy {
  width: 100%;
  max-width: 520px;
  padding: 20px 22px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.qz-eyebrow {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.qz-start-copy h1 {
  margin: 0;
  font-size: clamp(1.55rem, 6.2vw, 2.2rem);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.025em;
}

.qz-subcopy {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.45;
}

.qz-play-cta {
  width: 100%;
  max-width: 340px;
  min-height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 800;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #120d07;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.24);
}

.qz-play-cta:active {
  transform: scale(0.985);
}

.qz-play-cta-sm {
  max-width: none;
  width: auto;
  min-height: 44px;
  padding: 0 20px;
  font-size: 0.96rem;
}

/* Gameplay view: edge-to-edge stage + flat choices */
.qz-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.qz-stage-wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
}

.qz-timer-wrap {
  width: 100%;
  line-height: 0;
}

.qz-timer-wrap progress {
  width: 100%;
  height: 4px;
  display: block;
  border: none;
  border-radius: 0;
  appearance: none;
  background: #2a241d;
  accent-color: var(--accent);
}

.qz-timer-wrap progress::-webkit-progress-bar {
  background: #2a241d;
}

.qz-timer-wrap progress::-webkit-progress-value {
  background: var(--accent);
}

.qz-timer-wrap progress::-moz-progress-bar {
  background: var(--accent);
}

.qz-hud-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.qz-hud-left,
.qz-hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.qz-round-label {
  color: var(--text);
  font-weight: 800;
}

.qz-audio-label {
  color: var(--muted);
}

.qz-hud-timer {
  color: var(--accent);
  font-weight: 800;
  min-width: 44px;
  text-align: right;
}

.qz-play-body {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 2px 0 8px;
}

.qz-choices {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--hairline);
}

.qz-choice-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  text-align: left;
  padding: 10px 16px;
  border: none;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

@media (hover: hover) {
  .qz-choice-btn:not([disabled]):hover {
    background: var(--surface-hover);
  }
}

.qz-choice-btn.is-correct {
  background: rgba(34, 197, 94, 0.16);
}

.qz-choice-btn.is-wrong {
  background: rgba(239, 68, 68, 0.16);
}

.qz-choice-art {
  width: 46px;
  height: 46px;
  border-radius: 4px;
  object-fit: cover;
  background: #181410;
  flex-shrink: 0;
}

.qz-choice-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.qz-choice-song {
  font-weight: 700;
  font-size: 0.96rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qz-choice-album {
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qz-choice-key {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

@media (max-width: 720px) {
  .qz-choice-key {
    display: none;
  }
}

.qz-clip-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 0;
}

.qz-ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.qz-ghost-btn:hover {
  color: var(--text);
}

/* Post-guess reveal & summary (unboxed flat layout) */
.qz-reveal {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-top: 4px;
  border-top: 1px solid var(--hairline);
}

.qz-reveal img {
  width: 76px;
  height: 76px;
  border-radius: 6px;
  object-fit: cover;
  background: #181410;
  flex-shrink: 0;
}

.qz-reveal-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
}

.qz-reveal-outcome {
  font-weight: 800;
  font-size: 0.96rem;
}

.qz-reveal-song {
  font-weight: 700;
  font-size: 1.04rem;
}

.qz-reveal-album {
  font-size: 0.82rem;
  color: var(--muted);
}

.qz-reveal-actions,
.qz-summary-actions,
.qz-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.qz-summary {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qz-summary h2 {
  margin: 0;
  font-size: 1.3rem;
}

.qz-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  font-size: 0.88rem;
  color: var(--muted);
}

.qz-summary-stats strong {
  color: var(--text);
}

.qz-postgame-signup,
.qz-volunteer-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--hairline);
}

.qz-postgame-signup h3,
.qz-volunteer-form h3 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--text);
}

.qz-vol-sub {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.qz-vol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 560px) {
  .qz-vol-grid {
    grid-template-columns: 1fr;
  }
}

.qz-vol-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qz-vol-locked {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

/* Single bottom More Options button */
.qz-footer-bar {
  margin-top: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
}

.qz-more-btn {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.qz-more-btn:hover {
  color: var(--text);
  border-color: rgba(255, 240, 218, 0.28);
}

/* Shared button, form, and modal dialog styling in matching warm ebony */
.qz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: #241e18;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.qz-btn-sm {
  font-size: 0.78rem;
  padding: 6px 10px;
}

.qz-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: rgba(245, 158, 11, 0.6);
  color: #120d07;
}

.qz-btn-subtle {
  background: transparent;
  color: var(--muted);
}

.qz-btn[aria-pressed="true"] {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent);
  color: #fde68a;
}

.qz-auth-gate {
  max-width: 720px;
  margin: 24px auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.qz-auth-intro h2 {
  margin: 0 0 6px;
}

.qz-auth-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.qz-auth-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 680px) {
  .qz-auth-forms {
    grid-template-columns: 1fr;
  }
}

.qz-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: #14110d;
  border: 1px solid var(--hairline);
}

.qz-form h3 {
  margin: 0;
  font-size: 0.95rem;
}

.qz-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qz-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.qz-field input,
.qz-field select,
.qz-field textarea {
  font: inherit;
  font-size: max(1rem, 0.92em);
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 240, 218, 0.16);
  background: #0e0c09;
  color: var(--text);
}

.qz-pw-wrap {
  display: flex;
  gap: 6px;
}

.qz-pw-wrap input {
  flex: 1 1 auto;
  min-width: 0;
}

.qz-pw-toggle {
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
  background: #241e18;
  color: var(--muted);
  cursor: pointer;
}

.qz-form-err {
  margin: 0;
  min-height: 1.1em;
  font-size: 0.78rem;
  color: #fca5a5;
}

.qz-live-status {
  margin: 4px 16px 0;
  min-height: 1.1em;
  font-size: 0.82rem;
  color: #fbbf24;
  text-align: center;
}

dialog.qz-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: min(90dvh, 840px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(255, 240, 218, 0.18);
  border-radius: 14px;
  background: #16120e;
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  overflow-y: auto;
}

dialog.qz-dialog.qz-dialog-sm {
  width: min(480px, calc(100vw - 24px));
}

dialog.qz-dialog[open] {
  display: flex;
  flex-direction: column;
}

dialog.qz-dialog::backdrop {
  overflow: hidden;
  background: rgba(8, 6, 4, 0.82);
  backdrop-filter: blur(6px);
}

.qz-dialog-shell {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qz-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qz-dialog-head h1 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.qz-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.qz-opt-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
}

.qz-opt-section h2 {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.qz-opt-row,
.qz-opt-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.qz-opt-actions {
  justify-content: flex-start;
}

.qz-opt-meta {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}

.qz-opt-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Responsive leaderboard table */
.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(460px, 65vh);
  container-type: inline-size;
}

.qz-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.84rem;
}

.qz-table caption {
  text-align: left;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.qz-table th,
.qz-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  white-space: nowrap;
}

.qz-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 2;
  background: #1c1712;
}

.qz-table tbody th {
  position: sticky;
  inset-inline-start: 0;
  background: #14110d;
  font-weight: 700;
}

@container (width < 560px) {
  .qz-table, .qz-table thead, .qz-table tbody, .qz-table tr, .qz-table th, .qz-table td {
    display: block;
  }
  .qz-table thead {
    display: none;
  }
  .qz-table tr {
    margin-block-end: 10px;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    padding: 6px 8px;
  }
  .qz-table tbody th {
    position: sticky;
    inset-block-start: 0;
    background: #211b15;
    border-radius: 6px;
  }
  .qz-table td:nth-child(2)::before { content: "Player: "; color: var(--muted); font-weight: 600; }
  .qz-table td:nth-child(3)::before { content: "Score: "; color: var(--muted); font-weight: 600; }
  .qz-table td:nth-child(4)::before { content: "Accuracy: "; color: var(--muted); font-weight: 600; }
  .qz-table td:nth-child(5)::before { content: "Streak: "; color: var(--muted); font-weight: 600; }
  .qz-table td:nth-child(6)::before { content: "Mode: "; color: var(--muted); font-weight: 600; }
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
