/* The arcade cabinet: the game screen, its lit sign, the challenge banner, reactions and high scores. */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-lg);
  min-width: 0;
}

/* Everything in the middle column shares the cabinet's width */
.stage > * {
  width: 100%;
  max-width: clamp(320px, calc((100vh - 250px) * 9 / 13 + 28px), var(--cabinet-max-width));
}

/* ---------- Challenge banner ("Vic scored 42. Beat it!") ---------- */
.challenge {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  text-align: center;
  font-weight: 700;
  background: var(--color-well);
  border: 1px solid var(--color-gold);
  box-shadow: var(--glow-gold);
}
.challenge b { color: var(--color-gold); }
.challenge.won { border-color: var(--color-accent-2); box-shadow: var(--glow-accent-2); }
.challenge.won b { color: var(--color-accent-2); }
.challenge button { margin-top: 10px; }

/* ---------- Cabinet ---------- */
.cabinet {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 24px 24px var(--radius-lg) var(--radius-lg);
  background: linear-gradient(180deg, var(--color-cabinet-top) 0%, var(--color-cabinet-bottom) 100%);
  border: 2px solid var(--color-line-strong);
  box-shadow: var(--glow-cabinet);
}

/* The lit sign on top shows the game's name */
.marquee {
  border-radius: 14px 14px 6px 6px;
  padding: 12px 14px;
  text-align: center;
  background:
    repeating-linear-gradient(0deg, var(--color-marquee-lines) 0 2px, transparent 2px 4px),
    var(--color-well);
  border: 1px solid color-mix(in srgb, var(--color-accent-2) 35%, transparent);
}
.marquee b {
  display: block;
  font: 700 clamp(20px, 3vw, 26px)/1.15 var(--font-ui);
  color: var(--color-accent-2);
  text-shadow: var(--glow-accent-2);
  letter-spacing: .03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen {
  position: relative;
  width: 100%;
  aspect-ratio: var(--screen-ratio);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-screen);
  border: 2px solid var(--color-screen-edge);
  box-shadow: inset 0 0 30px var(--color-screen-shade);
}
.screen iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-md);
  padding: 2px 4px;
}
.now-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.now-actions { display: flex; gap: 6px; flex: none; }
.prompt,
.byline {
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prompt { color: var(--color-text-muted); }
.byline { text-decoration: none; }
.byline:hover { text-decoration: underline; }

/* Full screen mode */
.cabinet.is-full {
  position: fixed;
  inset: 0;
  z-index: 40;
  max-width: none;
  border-radius: 0;
  border: 0;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--color-bg);
}
.cabinet.is-full .marquee { padding: 8px; }
.cabinet.is-full .screen { flex: 1; aspect-ratio: auto; }

/* ---------- Reactions (quick chat) ---------- */
.reactions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.reactions:empty { display: none; }
.reactions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  background: var(--color-well);
}
.reactions button[aria-pressed="true"] {
  border-color: var(--color-accent);
  box-shadow: var(--glow-accent);
}
.reactions .count { color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* ---------- High scores ---------- */
.scorehead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--gap-md);
}
.mybest {
  margin: 0;
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: var(--text-sm);
}
.mybest b {
  margin-left: 6px;
  font-size: 24px;
  color: var(--color-accent);
  text-shadow: var(--glow-accent);
  font-variant-numeric: tabular-nums;
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  counter-reset: rank;
}
.board li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-well);
  counter-increment: rank;
}
.board li::before {
  content: counter(rank);
  font-weight: 700;
  color: var(--color-text-muted);
  text-align: center;
}
.board li:first-child::before { color: var(--color-gold); text-shadow: var(--glow-gold); }
.board li.me { box-shadow: inset 0 0 0 1px var(--color-accent-2); }
.board .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text); }
.board a.name { text-decoration: none; }
.board a.name:hover { text-decoration: underline; }
.board .score { font-weight: 700; font-variant-numeric: tabular-nums; }
.board li.empty { grid-template-columns: 1fr; color: var(--color-text-muted); font-weight: 600; }
.board li.empty::before { content: none; }

/* ---------- Phones: the game fills most of the screen ---------- */
@media (max-width: 760px) {
  .stage { gap: 14px; }
  .stage > * { max-width: none; }
  .cabinet {
    padding: 6px;
    gap: 6px;
    border-radius: 18px 18px var(--radius-md) var(--radius-md);
  }
  .marquee { padding: 8px 10px; }
  .screen { aspect-ratio: auto; height: var(--screen-height-phone); }
}

/* ---------- Result card after each round ("You won by 18!") ---------- */
.result-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--color-well);
  border: 1px solid var(--color-line-strong);
}
.result-card .headline { margin: 0; font-size: var(--text-lg); font-weight: 700; }
.result-card .details { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 600; }
.result-card.won { border-color: var(--color-accent-2); box-shadow: var(--glow-accent-2); }
.result-card.won .headline { color: var(--color-accent-2); }
.result-card.lost { border-color: var(--color-accent); box-shadow: var(--glow-accent); }
.result-actions { display: flex; flex-wrap: wrap; gap: var(--gap-sm); justify-content: center; }
.result-actions button { flex: 1 1 140px; }
.result-card .nudge { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }

/* ---------- Up next (on the result card) ---------- */
.up-next { display: flex; flex-direction: column; gap: var(--gap-sm); text-align: left; }
.up-next .label { margin: 0; font: 700 var(--text-xs)/1 var(--font-ui); letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-muted); }
.up-next-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.up-next-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  text-align: left;
  border-radius: var(--radius-md);
  background: var(--color-well);
  border: 1px solid var(--color-line);
  min-width: 0;
}
.up-next-card .icon {
  flex: none; width: 36px; height: 48px; border-radius: var(--radius-sm); overflow: hidden;
  display: grid; place-items: center; font: 700 16px var(--font-ui); color: var(--color-bg); background: var(--tone-1);
}
.up-next-card .icon img { width: 100%; height: 100%; object-fit: cover; }
.up-next-card .icon.tone-2 { background: var(--tone-2); }
.up-next-card .icon.tone-3 { background: var(--tone-3); }
.up-next-card .icon.tone-4 { background: var(--tone-4); }
.up-next-card .icon.tone-5 { background: var(--tone-5); }
.up-next-card .icon.tone-6 { background: var(--tone-6); }
.up-next-card .text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.up-next-card .why { font: 700 var(--text-xs)/1.2 var(--font-ui); color: var(--color-accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.up-next-card .title { font: 700 var(--text-sm)/1.2 var(--font-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- "Fixing your game…" ---------- */
.fix-banner {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--color-well);
  border: 1px solid var(--color-gold);
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--text-sm);
  text-align: center;
}
