@font-face {
  font-family: "PP Mori";
  src: url("./fonts/ppmori-regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* Display modes */
.mode-picker {
  margin: 0 max(1.5rem, 3.2vw) 1.6rem;
  padding: clamp(1rem, 2vw, 1.4rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 0 0, rgba(30, 215, 96, 0.11), transparent 35%),
    rgba(12, 12, 12, 0.72);
  display: grid;
  grid-template-columns: minmax(170px, 0.7fr) minmax(0, 2.3fr);
  gap: 1rem 1.4rem;
  align-items: center;
}

.mode-picker-copy h3,
.playlist-section-heading h3 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  letter-spacing: -0.045em;
}

.mode-picker-copy > p:last-child {
  max-width: 21rem;
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.mode-option {
  min-width: 0;
  min-height: 94px;
  padding: 0.85rem;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #202020;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 10px;
  gap: 0.7rem;
  align-items: center;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.mode-option:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: #282828;
}

.mode-option.selected {
  border-color: var(--green);
  background: rgba(30, 215, 96, 0.11);
  box-shadow: inset 0 0 0 1px var(--green);
  transform: translateY(-1px);
}

.mode-option-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  background: #101010;
  display: grid;
  place-items: center;
  font-family: "Material Symbols Rounded";
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1;
  font-variation-settings: "FILL" 1;
}

.mode-option.selected .mode-option-icon {
  color: var(--black);
  background: var(--green);
}

.mode-option-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.mode-option-copy strong {
  font-size: 0.78rem;
  line-height: 1.1;
}

.mode-option-copy small {
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 550;
  line-height: 1.3;
}

.mode-option > i {
  width: 10px;
  height: 10px;
  border: 2px solid var(--subtle);
  border-radius: 50%;
}

.mode-option.selected > i {
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(30, 215, 96, 0.15);
}

.airplay-tip {
  grid-column: 1 / -1;
  min-height: 58px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(30, 215, 96, 0.28);
  border-radius: 12px;
  background: rgba(30, 215, 96, 0.08);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.airplay-tip > span {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  color: var(--black);
  background: var(--green);
  display: grid;
  place-items: center;
  font-family: "Material Symbols Rounded";
  font-size: 1.15rem;
}

.airplay-tip strong {
  font-size: 0.72rem;
}

.airplay-tip p {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.35;
}

.playlist-section-heading {
  padding: 0 max(1.5rem, 3.2vw) 0.9rem;
}

.mode-live-badge {
  padding: 0.28rem 0.46rem;
  border: 1px solid rgba(30, 215, 96, 0.42);
  border-radius: 999px;
  color: var(--green);
  background: rgba(30, 215, 96, 0.1);
  font-size: 0.52rem;
  letter-spacing: 0.1em;
}

.fullscreen-button {
  min-height: 32px;
  margin-left: 0.35rem;
  padding: 0 0.72rem;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  white-space: nowrap;
  font-size: 0.64rem;
  font-weight: 800;
}

.fullscreen-button:hover {
  border-color: rgba(255, 255, 255, 0.34);
  background: var(--card-hover);
}

.fullscreen-button span {
  font-family: "Material Symbols Rounded";
  font-size: 1rem;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
}

.mode-fixed,
.mode-airplay {
  transition: none;
}

/* AirPlay is deliberately bolder and keeps important content away from TV overscan. */
@media (min-width: 901px) {
  .mode-airplay {
    --tv-safe-x: clamp(1.8rem, 3.5vw, 4.75rem);
    background: #090909;
  }

  .mode-airplay .game-header {
    min-height: clamp(76px, 8.5vh, 104px);
    padding-right: var(--tv-safe-x);
    padding-left: var(--tv-safe-x);
    background: linear-gradient(90deg, #050505, #111 52%, #050505);
  }

  .mode-airplay .mini-brand .cue-wordmark {
    font-size: clamp(1.3rem, 1.8vw, 2rem);
  }

  .mode-airplay .turn-label {
    font-size: clamp(0.9rem, 1.25vw, 1.25rem);
  }

  .mode-airplay .turn-label i {
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
  }

  .mode-airplay .score-label {
    gap: 0.8rem;
  }

  .mode-airplay .score-side small {
    max-width: 10rem;
    font-size: clamp(0.62rem, 0.8vw, 0.82rem);
  }

  .mode-airplay .score-side strong {
    font-size: clamp(1.7rem, 2.4vw, 2.5rem);
  }

  .mode-airplay .score-divider {
    height: 34px;
  }

  .mode-airplay .score-label > span {
    font-size: 0.78rem;
  }

  .mode-airplay .play-layout {
    grid-template-columns: minmax(390px, 29vw) minmax(0, 1fr);
  }

  .mode-airplay .song-panel {
    padding: clamp(1.2rem, 2.2vh, 2rem) clamp(1.4rem, 2.6vw, 3rem);
    background: linear-gradient(180deg, #171717, #0c0c0c);
  }

  .mode-airplay .qr-frame {
    width: min(36vh, 23vw, 410px);
    padding: clamp(0.8rem, 1.1vw, 1.2rem);
    border-radius: 14px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
  }

  .mode-airplay .qr-content > h2 {
    font-size: clamp(1.9rem, 2.6vw, 3rem);
  }

  .mode-airplay .qr-content > p,
  .mode-airplay .spotify-link {
    font-size: clamp(0.76rem, 0.9vw, 0.94rem);
  }

  .mode-airplay .timeline-heading {
    padding: clamp(1.35rem, 2.4vh, 2.2rem) var(--tv-safe-x) 1rem;
  }

  .mode-airplay .timeline-heading h2 {
    font-size: clamp(2.8rem, 4.2vw, 5.2rem);
  }

  .mode-airplay .round-pot {
    font-size: 0.78rem;
  }

  .mode-airplay .round-pot span {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .mode-airplay .timeline {
    padding-right: var(--tv-safe-x);
    padding-left: var(--tv-safe-x);
  }

  .mode-airplay .timeline::before {
    right: var(--tv-safe-x);
    left: var(--tv-safe-x);
  }

  .mode-airplay .timeline-card,
  .mode-airplay .mystery-card {
    width: clamp(150px, 10vw, 190px);
    min-width: clamp(150px, 10vw, 190px);
    min-height: clamp(188px, 22vh, 230px);
    flex-basis: clamp(150px, 10vw, 190px);
    padding: 1.1rem;
    border-radius: 10px;
  }

  .mode-airplay .placement-slot {
    width: clamp(66px, 4.5vw, 86px);
    min-width: clamp(66px, 4.5vw, 86px);
    height: 150px;
    flex-basis: clamp(66px, 4.5vw, 86px);
  }

  .mode-airplay .placement-slot span {
    width: 44px;
    height: 44px;
  }

  .mode-airplay .card-year {
    font-size: clamp(2rem, 2.4vw, 2.8rem);
  }

  .mode-airplay .timeline-card h3 {
    font-size: clamp(0.86rem, 1vw, 1.05rem);
  }

  .mode-airplay .timeline-card p,
  .mode-airplay .mystery-card p {
    font-size: clamp(0.66rem, 0.75vw, 0.78rem);
  }

  .mode-airplay .action-bar {
    min-height: clamp(92px, 10vh, 118px);
    padding-right: var(--tv-safe-x);
    padding-left: var(--tv-safe-x);
  }

  .mode-airplay .action-bar > p {
    font-size: clamp(0.78rem, 0.95vw, 1rem);
  }

  .mode-airplay .primary-button,
  .mode-airplay .secondary-button,
  .mode-airplay .risk-button {
    min-height: 56px;
    padding-right: 1.7rem;
    padding-left: 1.7rem;
    font-size: 0.92rem;
  }

  .mode-airplay .handoff-card {
    width: min(760px, 76vw);
    padding: clamp(2.5rem, 5vw, 5rem);
    border-radius: 30px;
  }

  .mode-airplay .handoff-screen .handoff-card h2 {
    font-size: clamp(5rem, 8.5vw, 9rem);
  }

  .mode-airplay .handoff-card > p:not(.eyebrow) {
    max-width: 36rem;
    font-size: 1.05rem;
  }

  .mode-airplay .reveal-year {
    font-size: clamp(7rem, 11vw, 12rem);
  }

  .mode-airplay .reveal-card h2 {
    max-width: 26rem;
    font-size: clamp(1.8rem, 2.7vw, 3rem);
  }
}

@media (max-width: 1050px) {
  .mode-picker {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .mode-picker {
    margin: 0 1rem 1.1rem;
    padding: 0.9rem;
  }

  .mode-options {
    grid-template-columns: 1fr;
  }

  .mode-option {
    min-height: 74px;
  }

  .playlist-section-heading {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .fullscreen-button {
    width: 32px;
    min-width: 32px;
    padding: 0;
    font-size: 0;
  }

  .mode-live-badge {
    display: none;
  }
}

@font-face {
  font-family: "PP Mori";
  src: url("./fonts/ppmori-semibold.otf") format("opentype");
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
}

html,
body,
button,
input {
  font-family: "PP Mori", Arial, sans-serif;
}

.cue-wordmark {
  color: var(--text);
  font-family: "PP Mori", Arial, sans-serif;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.09em;
  line-height: 1;
}

.brand-lockup {
  justify-content: flex-end;
}

.brand-lockup .cue-wordmark {
  font-size: 1.55rem;
}

.game-header {
  grid-template-areas: "score turn brand";
  grid-template-columns: 1fr auto 1fr;
}

.mini-brand {
  grid-area: brand;
  justify-self: end;
}

.turn-label {
  grid-area: turn;
}

.score-label {
  grid-area: score;
  justify-self: start;
}

.playlist-play {
  display: none !important;
}

.qr-content {
  display: contents;
}

.qr-content > h2 {
  letter-spacing: -0.04em;
  margin: 0.5rem 0 0.15rem;
  font-size: max(1.5rem, min(3vw, 2.25rem));
}

.qr-content > p {
  max-width: 19rem;
  color: var(--muted);
  margin: 0.2rem auto;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
}

.mobile-qr-button,
.mobile-qr-close {
  display: none;
}

.handoff-screen {
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--team-color) 13%, transparent), transparent 32%),
    var(--surface);
  padding: clamp(1.25rem, 4vw, 3rem);
}

.handoff-card {
  width: min(100%, 560px);
  padding: clamp(2rem, 6vw, 4.5rem);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(9, 9, 9, 0.82);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.handoff-screen .handoff-card h2 {
  max-width: 10ch;
  margin: 0.3em 0 0.45em;
  font-size: clamp(3.1rem, 8vw, 6.5rem);
  letter-spacing: -0.075em;
  line-height: 0.9;
  overflow-wrap: anywhere;
}

.handoff-card > p:not(.eyebrow) {
  max-width: 27rem;
  color: var(--muted);
  margin: 1.25rem 0 1.7rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
}

.handoff-playlist {
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.76rem;
}

.handoff-playlist span {
  flex: 0 0 auto;
  font-size: 1.05rem;
}

.winner-screen h2,
.reveal-card h2,
.reveal-card p {
  overflow-wrap: anywhere;
}

.handoff-playlist strong {
  font-weight: 700;
}

.handoff-card .primary-button {
  min-width: 190px;
}

.mobile-qr-button span,
.mobile-qr-close span {
  font-family: "Material Symbols Rounded";
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  letter-spacing: normal;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
}

@media (max-width: 600px) {
  .setup-sidebar {
    min-height: 185px;
    padding: max(1rem, env(safe-area-inset-top)) 1.2rem 1.2rem;
  }

  .brand-lockup .cue-wordmark {
    font-size: 1.25rem;
  }

  .sidebar-copy {
    margin: 1.8rem 0 0;
  }

  .sidebar-copy h1 {
    max-width: 11ch;
    margin-bottom: 0.7rem;
    font-size: clamp(2.5rem, 12vw, 3.7rem);
  }

  .sidebar-copy > p:last-child {
    font-size: 0.78rem;
  }

  .setup-topbar {
    padding: 1.2rem 1rem 0.9rem;
  }

  .setup-topbar h2 {
    font-size: 2rem;
  }

  .playlist-grid {
    gap: 0.65rem;
    padding: 0 1rem 1.2rem;
  }

  .playlist-card {
    padding: 0.55rem;
  }

  .setup-dock {
    padding: 1rem max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }

  .game-header {
    min-height: 54px;
    padding-right: max(0.7rem, env(safe-area-inset-right));
    padding-left: max(0.7rem, env(safe-area-inset-left));
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 0.55rem;
  }

  .mini-brand .cue-wordmark {
    font-size: 1rem;
  }

  .turn-label {
    gap: 0.3rem;
    white-space: nowrap;
    font-size: 0.62rem;
  }

  .turn-label i {
    width: 6px;
    height: 6px;
  }

  .score-label {
    gap: 0.3rem;
  }

  .score-side {
    gap: 0.15rem;
  }

  .score-side small {
    max-width: 3.1rem;
    font-size: 0.46rem;
  }

  .score-side strong {
    font-size: 0.95rem;
  }

  .score-divider {
    height: 16px;
  }

  .score-label > span {
    display: none;
  }

  .new-game-button {
    min-height: 30px;
    width: 30px;
    margin-left: 0;
  }

  .handoff-screen {
    padding: 1rem;
  }

  .handoff-card {
    padding: 2rem 1.35rem;
    border-radius: 18px;
  }

  .handoff-screen .handoff-card h2 {
    font-size: clamp(2.8rem, 15vw, 4.5rem);
  }

  .handoff-card > p:not(.eyebrow) {
    margin: 1rem 0 1.4rem;
    font-size: 0.8rem;
  }

  .stage-answer .play-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 48px minmax(0, 1fr);
  }

  .stage-answer .song-panel {
    min-height: 0;
    padding: 0 max(0.75rem, env(safe-area-inset-right)) 0 max(0.75rem, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .stage-answer .song-panel-head {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .stage-answer .song-panel-head .step-kicker {
    font-size: 0.55rem;
  }

  .stage-answer .deck-count {
    margin-left: auto;
    font-size: 0.5rem;
  }

  .mobile-qr-button {
    min-height: 32px;
    padding: 0 0.72rem;
    color: var(--black);
    background: var(--team-color);
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.61rem;
    font-weight: 800;
  }

  .mobile-qr-button span {
    font-size: 0.92rem;
  }

  .stage-answer .qr-content {
    display: none;
  }

  .stage-answer .song-panel.show-mobile-qr .qr-content {
    z-index: 40;
    position: fixed;
    inset: 0.65rem;
    padding: 3rem 1.1rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(16, 16, 16, 0.98);
    box-shadow: 0 24px 90px rgba(0, 0, 0, 0.72);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .mobile-qr-close {
    min-height: 34px;
    padding: 0 0.8rem;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    font-size: 0.65rem;
    font-weight: 700;
  }

  .mobile-qr-close span {
    font-size: 0.9rem;
  }

  .stage-answer .qr-frame {
    grid-row: auto;
    width: min(68vw, 270px);
    margin: 0 auto 0.8rem;
    padding: 0.7rem;
  }

  .stage-answer .qr-content > h2 {
    margin: 0 0 0.2rem;
    font-size: 1.65rem;
  }

  .stage-answer .qr-content > p {
    margin: 0.2rem auto;
    text-align: center;
    font-size: 0.68rem;
  }

  .stage-answer .spotify-link {
    grid-column: auto;
    margin-top: 0.75rem;
  }

  .stage-answer .qr-reload-button {
    grid-column: auto;
    justify-self: auto;
    margin-top: 0.6rem;
  }

  .stage-answer .timeline-heading {
    min-height: 58px;
    padding: 0.65rem 0.9rem 0.35rem;
  }

  .stage-answer .timeline-heading .step-kicker {
    display: none;
  }

  .stage-answer .timeline-heading h2 {
    margin-top: 0;
    font-size: 1.55rem;
  }

  .stage-answer .round-pot {
    font-size: 0.5rem;
  }

  .stage-answer .round-pot span {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .timeline {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .timeline::before {
    right: 1rem;
    left: 1rem;
  }

  .timeline-card,
  .mystery-card {
    width: 112px;
    min-width: 112px;
    min-height: 138px;
    flex-basis: 112px;
    padding: 0.72rem;
  }

  .placement-slot {
    width: 50px;
    min-width: 50px;
    height: 92px;
    flex-basis: 50px;
  }

  .action-bar {
    min-height: 66px;
    padding: 0.55rem max(0.8rem, env(safe-area-inset-right)) max(0.55rem, env(safe-area-inset-bottom)) max(0.8rem, env(safe-area-inset-left));
  }

  .stage-answer .action-bar > p {
    display: none;
  }

  .stage-answer .lock-button {
    width: 100%;
    min-width: 0;
  }

  .stage-reveal .play-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(238px, min(42dvh, 320px)) minmax(0, 1fr);
  }

  .stage-reveal .song-panel {
    min-height: 0;
    padding: 0.7rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    position: relative;
    overflow: hidden;
  }

  .stage-reveal .song-panel-head {
    position: absolute;
    top: 0.7rem;
    right: 1rem;
    left: 1rem;
  }

  .stage-reveal .reveal-card {
    padding-top: 1.5rem;
  }

  .stage-reveal .reveal-year {
    font-size: 3.3rem;
  }

  .stage-reveal .reveal-card h2 {
    max-width: 18rem;
    font-size: 1.1rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
  }

  .stage-reveal .sample-info {
    margin-top: 0.5rem;
    padding: 0.55rem 0.65rem;
  }

  .stage-reveal .sample-info p {
    font-size: 0.59rem;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
  }

  .stage-reveal .timeline-heading {
    min-height: 52px;
    padding-top: 0.45rem;
    padding-bottom: 0.25rem;
  }

  .stage-reveal .timeline-card {
    width: 104px;
    min-width: 104px;
    min-height: 112px;
    flex-basis: 104px;
    padding: 0.65rem;
  }

  .stage-reveal .timeline-card.at-risk {
    transform: translateY(-8px);
  }

  .reveal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
  }

  .reveal-actions > div,
  .reveal-actions button {
    width: 100%;
    min-width: 0;
  }
}

/* Responsive geometry hardening */
.catalog-pill i,
.turn-label i,
.team-fields label > span,
.round-pot span,
.placement-slot span,
.goal-stepper button,
.winner-burst {
  flex: 0 0 auto;
  aspect-ratio: 1;
}

.goal-stepper button {
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}

.playlist-art > span {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  line-height: 1;
}

.selected-art,
.handoff-playlist span {
  line-height: 1;
}

.qr-frame {
  flex: 0 0 auto;
}

.primary-button > span,
.risk-button > span,
.spotify-link span,
.qr-reload-button span,
.new-game-button span,
.mobile-qr-button span,
.mobile-qr-close span,
.sample-info > span {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
}

@media (max-width: 600px) {
  .new-game-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    gap: 0;
  }

  .mobile-qr-button {
    min-height: 36px;
  }

  .stage-reveal .song-panel-head {
    width: auto;
  }

  .reveal-actions button {
    padding-right: 0.45rem;
    padding-left: 0.45rem;
    gap: 0.3rem;
    white-space: nowrap;
    font-size: 0.65rem;
  }
}

@media (min-width: 601px) and (max-width: 900px) and (orientation: portrait) {
  .stage-answer .play-layout {
    grid-template-rows: minmax(300px, 40dvh) minmax(0, 1fr);
  }

  .stage-reveal .play-layout {
    grid-template-rows: minmax(280px, 35dvh) minmax(0, 1fr);
  }

  .stage-reveal .reveal-year {
    font-size: 4.5rem;
  }
}

@media (max-height: 500px) and (max-width: 950px) and (orientation: landscape) {
  .setup-screen {
    grid-template-columns: minmax(175px, 24vw) minmax(0, 1fr);
  }

  .setup-sidebar {
    min-height: 100dvh;
    padding: 1rem;
  }

  .brand-lockup .cue-wordmark {
    font-size: 1.1rem;
  }

  .sidebar-copy {
    margin: auto 0;
  }

  .sidebar-copy h1 {
    margin-bottom: 0;
    font-size: clamp(2rem, 6vw, 2.8rem);
  }

  .sidebar-copy > p:last-child,
  .mini-rules {
    display: none;
  }

  .setup-main {
    height: 100dvh;
    padding-bottom: 0;
    overflow-y: auto;
  }

  .setup-topbar {
    padding: 1rem 1rem 0.8rem;
  }

  .setup-topbar h2 {
    font-size: 1.8rem;
  }

  .playlist-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    padding: 0 1rem 1rem;
  }

  .setup-dock {
    min-height: 0;
    padding: 0.8rem 1rem max(0.8rem, env(safe-area-inset-bottom));
    position: static;
    grid-template-columns: 1fr;
  }

  .game-header {
    min-height: 48px;
    padding-right: max(0.75rem, env(safe-area-inset-right));
    padding-left: max(0.75rem, env(safe-area-inset-left));
  }

  .mini-brand .cue-wordmark {
    font-size: 1rem;
  }

  .turn-label {
    gap: 0.35rem;
    font-size: 0.68rem;
  }

  .score-label {
    gap: 0.35rem;
  }

  .score-side small {
    max-width: 4rem;
    font-size: 0.49rem;
  }

  .score-side strong {
    font-size: 1rem;
  }

  .score-label > span {
    display: none;
  }

  .new-game-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    margin-left: 0;
    padding: 0;
    gap: 0;
    font-size: 0;
  }

  .handoff-screen {
    padding: 0.65rem;
  }

  .handoff-card {
    width: min(100%, 520px);
    padding: 1rem 1.5rem;
    border-radius: 16px;
  }

  .handoff-screen .handoff-card h2 {
    margin: 0.18em 0 0.25em;
    font-size: clamp(2.4rem, 8vw, 3.1rem);
  }

  .handoff-playlist {
    min-height: 34px;
  }

  .handoff-card > p:not(.eyebrow) {
    margin: 0.55rem 0 0.75rem;
    font-size: 0.7rem;
  }

  .handoff-card .primary-button {
    min-height: 42px;
  }

  .stage-answer .play-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 44px minmax(0, 1fr);
  }

  .stage-answer .song-panel {
    min-height: 0;
    padding: 0 max(0.75rem, env(safe-area-inset-right)) 0 max(0.75rem, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .stage-answer .song-panel-head {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
  }

  .stage-answer .song-panel-head .step-kicker {
    font-size: 0.55rem;
  }

  .stage-answer .deck-count {
    margin-left: auto;
    font-size: 0.5rem;
  }

  .mobile-qr-button {
    min-height: 34px;
    padding: 0 0.7rem;
    color: var(--black);
    background: var(--team-color);
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.61rem;
    font-weight: 800;
  }

  .stage-answer .qr-content {
    display: none;
  }

  .stage-answer .song-panel.show-mobile-qr .qr-content {
    z-index: 40;
    position: fixed;
    inset: 0.5rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(16, 16, 16, 0.99);
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.72);
    display: grid;
    grid-template-columns: minmax(150px, 230px) minmax(0, 1fr);
    grid-template-rows: repeat(4, auto);
    align-content: center;
    align-items: center;
    column-gap: clamp(1rem, 4vw, 2.5rem);
  }

  .stage-answer .qr-frame {
    grid-column: 1;
    grid-row: 1 / 5;
    width: min(58vh, 220px);
    margin: 0;
    padding: 0.6rem;
  }

  .stage-answer .qr-content > h2,
  .stage-answer .qr-content > p,
  .stage-answer .spotify-link,
  .stage-answer .qr-reload-button {
    grid-column: 2;
  }

  .stage-answer .qr-content > h2 {
    align-self: end;
    margin: 0 0 0.2rem;
    font-size: 1.6rem;
  }

  .stage-answer .qr-content > p {
    align-self: start;
    margin: 0 0 0.5rem;
    text-align: left;
    font-size: 0.64rem;
  }

  .stage-answer .spotify-link,
  .stage-answer .qr-reload-button {
    justify-self: start;
    margin: 0.35rem 0 0;
  }

  .mobile-qr-close {
    min-height: 32px;
    padding: 0 0.7rem;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    font-size: 0.62rem;
    font-weight: 700;
  }

  .stage-answer .timeline-heading,
  .stage-reveal .timeline-heading {
    min-height: 50px;
    padding: 0.45rem 0.9rem 0.25rem;
  }

  .timeline-heading h2 {
    margin-top: 0;
    font-size: 1.55rem;
  }

  .timeline-heading .step-kicker {
    display: none;
  }

  .round-pot span {
    width: 30px;
    height: 30px;
  }

  .timeline-card,
  .mystery-card {
    width: 112px;
    min-width: 112px;
    min-height: 130px;
    flex-basis: 112px;
    padding: 0.7rem;
  }

  .placement-slot {
    width: 50px;
    min-width: 50px;
    height: 88px;
    flex-basis: 50px;
  }

  .action-bar {
    min-height: 60px;
    padding-top: 0.45rem;
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom));
  }

  .stage-answer .action-bar > p {
    display: none;
  }

  .stage-answer .lock-button {
    width: min(100%, 320px);
    min-width: 0;
    margin-left: auto;
  }

  .stage-reveal .play-layout {
    display: grid;
    grid-template-columns: minmax(210px, 40vw) minmax(0, 1fr);
    grid-template-rows: 1fr;
  }

  .stage-reveal .song-panel {
    min-height: 0;
    padding: 0.55rem 0.75rem;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    display: flex;
    position: relative;
  }

  .stage-reveal .song-panel-head {
    width: auto;
    position: absolute;
    top: 0.55rem;
    right: 0.75rem;
    left: 0.75rem;
  }

  .stage-reveal .reveal-card {
    padding-top: 1rem;
  }

  .stage-reveal .result-stamp {
    padding: 0.35rem 0.55rem;
    font-size: 0.48rem;
  }

  .stage-reveal .reveal-year {
    font-size: 3rem;
  }

  .stage-reveal .reveal-card h2 {
    max-width: 16rem;
    font-size: 1rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
  }

  .stage-reveal .sample-info {
    margin-top: 0.35rem;
    padding: 0.45rem 0.55rem;
  }

  .stage-reveal .sample-info p {
    font-size: 0.54rem;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    display: -webkit-box;
    overflow: hidden;
  }

  .reveal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .reveal-actions > div,
  .reveal-actions button {
    width: 100%;
    min-width: 0;
  }

  .reveal-actions button {
    padding-right: 0.45rem;
    padding-left: 0.45rem;
    gap: 0.3rem;
    white-space: nowrap;
    font-size: 0.64rem;
  }
}

@media (max-height: 340px) and (max-width: 600px) and (orientation: landscape) {
  .game-shell {
    --risk-lift: 8px;
  }

  .game-header {
    min-height: 44px;
  }

  .new-game-button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .stage-answer .play-layout {
    grid-template-rows: 40px minmax(0, 1fr);
  }

  .mobile-qr-button {
    min-height: 32px;
  }

  .stage-answer .timeline-heading,
  .stage-reveal .timeline-heading {
    min-height: 44px;
    padding-top: 0.3rem;
    padding-bottom: 0.2rem;
  }

  .timeline-heading h2 {
    font-size: 1.35rem;
  }

  .timeline-card,
  .mystery-card {
    width: 104px;
    min-width: 104px;
    min-height: 104px;
    flex-basis: 104px;
    padding: 0.6rem;
  }

  .timeline-card.at-risk {
    transform: translateY(-8px);
  }

  .card-year {
    font-size: 1.4rem;
  }

  .placement-slot {
    height: 78px;
  }

  .action-bar {
    min-height: 50px;
    padding-top: 0.25rem;
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom));
  }

  .stage-answer .lock-button {
    min-height: 42px;
  }
}

/* Multi-team setup and live scoring */
.setup-dock {
  grid-template-columns: minmax(150px, 0.75fr) minmax(290px, 2fr) auto auto;
}

.team-editor {
  min-width: 0;
  display: grid;
  gap: 0.38rem;
}

.team-editor-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.team-editor-head > small {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.team-count {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
}

.team-count strong {
  min-width: 2.5rem;
  text-align: center;
  font-size: 0.63rem;
}

.team-count button {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: var(--card);
  display: grid;
  place-items: center;
  font-family: "Material Symbols Rounded";
  font-size: 0.95rem;
  font-style: normal;
  font-weight: 500;
  line-height: 1;
  letter-spacing: normal;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
}

.team-count button:disabled {
  cursor: not-allowed;
  opacity: 0.28;
}

.team-fields {
  min-width: 0;
  padding-bottom: 2px;
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--subtle) transparent;
}

.team-fields label {
  min-width: 112px;
  height: 38px;
  flex: 1 0 112px;
  padding: 0 0.6rem;
}

.team-fields input {
  font-size: 0.7rem;
}

.score-label {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.score-strip {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.22rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.score-strip::-webkit-scrollbar {
  display: none;
}

.score-strip .score-side {
  min-width: 0;
  padding: 0.28rem 0.4rem;
  border: 1px solid transparent;
  border-radius: 999px;
  flex: 0 0 auto;
  gap: 0.25rem;
}

.score-strip .score-side.active {
  border-color: color-mix(in srgb, var(--team-color) 55%, transparent);
  background: color-mix(in srgb, var(--team-color) 14%, #151515);
}

.score-strip .score-side.opponent {
  opacity: 0.72;
}

.score-strip .score-side > i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}

.score-strip .score-side small {
  max-width: 4.4rem;
  font-size: 0.52rem;
}

.score-strip .score-side strong {
  margin: 0;
  font-size: 1rem;
}

.score-target,
.fullscreen-button,
.new-game-button {
  flex: 0 0 auto;
}

@media (min-width: 761px) {
  .game-header {
    grid-template-columns: minmax(0, 2fr) auto minmax(70px, 0.45fr);
  }
}

@media (min-width: 901px) {
  .mode-airplay .score-strip .score-side {
    padding: 0.34rem 0.5rem;
  }

  .mode-airplay .score-strip .score-side small {
    max-width: 5.3rem;
    font-size: clamp(0.55rem, 0.66vw, 0.72rem);
  }

  .mode-airplay .score-strip .score-side strong {
    font-size: clamp(1.05rem, 1.35vw, 1.5rem);
  }
}

@media (max-width: 1180px) {
  .setup-dock {
    grid-template-columns: minmax(120px, 0.6fr) minmax(230px, 1.7fr) auto auto;
    gap: 0.7rem;
  }

  .selected-art {
    width: 46px;
    height: 46px;
  }

  .score-strip .score-side small {
    max-width: 3.2rem;
  }
}

@media (orientation: portrait) {
  .setup-main {
    padding-bottom: 218px;
  }

  .setup-dock {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .selected-summary {
    display: none;
  }

  .team-editor {
    grid-column: 1 / -1;
  }

  .setup-dock .start-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .setup-main {
    padding-bottom: 0;
  }

  .setup-dock {
    grid-template-columns: 1fr;
  }

  .team-editor,
  .goal-stepper,
  .setup-dock .start-button {
    grid-column: 1;
  }

  .team-fields label {
    min-width: 132px;
    flex-basis: 132px;
  }

  .score-label {
    gap: 0.22rem;
  }

  .score-strip .score-side {
    padding: 0.22rem 0.3rem;
  }

  .score-strip .score-side small {
    max-width: 2.4rem;
    font-size: 0.44rem;
  }

  .score-strip .score-side strong {
    font-size: 0.88rem;
  }
}
