/* Player page. Desktop: the game sits in a cabinet bezel. Phones: edge-to-edge, one slim bar, no page scroll. */
.player { max-width: 1100px; margin: 0 auto; padding: 4px var(--gutter) 0; }
.cab { position: relative; padding: 12px 14px 14px; border-radius: 20px; background: linear-gradient(90deg, #0f0e12, #18161c 9%, #141217 50%, #18161c 91%, #0f0e12); box-shadow: 0 0 0 2px #060508, 0 0 0 4px color-mix(in srgb, var(--era) 55%, #111), 0 0 0 5px #060508, 0 50px 90px -30px rgba(0, 0, 0, .95), 0 0 140px -40px var(--era-glow); }
.cab-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cab-title { flex: 1; min-width: 0; }
.cab h1 { margin: 0; font: 700 clamp(1.3rem, 1rem + 1.6vw, 1.9rem)/1.1 var(--f-display); letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cab-meta { margin: 2px 0 0; font: 500 .7rem var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cab-meta b { color: var(--era); font-weight: 500; }
.cab-tools { display: flex; gap: 6px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 44px; min-height: 44px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 8px; background: rgba(0, 0, 0, .25); color: var(--ink-2); font: 500 .85rem var(--f-display); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; cursor: pointer; }
.icon-btn:hover { color: var(--ink); background: rgba(241, 235, 223, .06); }
.icon-btn[aria-pressed="true"] { color: var(--era); border-color: color-mix(in srgb, var(--era) 50%, transparent); }
.icon-btn .ico { width: 20px; height: 20px; }
#btn-back { padding: 0; width: 44px; }
.cab-bezel { padding: clamp(8px, 1.6vw, 14px); border-radius: 14px; background: linear-gradient(180deg, #121115, #050506 70%); box-shadow: inset 0 0 0 1px #000, inset 0 10px 24px rgba(0, 0, 0, .9); }
.cab-screen { position: relative; width: 100%; aspect-ratio: 16 / 10; max-height: calc(100vh - 210px); min-height: 240px; margin: 0 auto; overflow: hidden; border-radius: 8px; background: #000; box-shadow: 0 0 46px -14px var(--era); outline: none; }
.cab-screen iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.cab-screen iframe[hidden], .soon[hidden], .rotate[hidden] { display: none; }
.soon, .rotate { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: var(--ink-2); background: radial-gradient(60% 60% at 50% 40%, color-mix(in srgb, var(--era) 12%, #0d0c10), #08070a); }
.soon-big, .rotate-big { margin: 0; font: 700 clamp(1.5rem, 1rem + 3vw, 2.6rem)/1.05 var(--f-display); color: var(--ink); }
.soon p, .rotate p { max-width: 44ch; margin: 0; }
.rotate { z-index: 3; background: rgba(8, 7, 10, .94); }
.rotate-phone { width: 34px; height: 56px; border: 3px solid var(--era); border-radius: 7px; animation: tilt 2.4s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.cab-info { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 40px; margin: 28px auto 0; padding: 0 4px; }
.cab-info h2 { margin: 0 0 6px; font: 500 .72rem var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.cab-info p { margin: 0 0 8px; color: var(--ink-2); max-width: 60ch; }

/* fullscreen + pseudo-fullscreen (iOS cannot fullscreen an element) */
.cab:fullscreen, .cab.is-full { display: flex; flex-direction: column; width: 100%; height: 100%; max-width: none; margin: 0; padding: 0; border-radius: 0; background: #000; box-shadow: none; }
.cab.is-full { position: fixed; inset: 0; z-index: 100; }
.cab:fullscreen .cab-top, .cab.is-full .cab-top { margin: 0; padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); }
.cab:fullscreen .cab-bezel, .cab.is-full .cab-bezel { flex: 1; min-height: 0; padding: 0; border-radius: 0; background: #000; box-shadow: none; }
.cab:fullscreen .cab-screen, .cab.is-full .cab-screen { max-height: none; min-height: 0; height: 100%; aspect-ratio: auto; border-radius: 0; box-shadow: none; }

/* ---------- phones: edge to edge ---------- */
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  html:has(body.play-page), body.play-page { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body.play-page { position: fixed; inset: 0; background: #000; }
  body.play-page::before { display: none; }
  .play-page .topbar, .play-page .footer, .play-page .cab-info { display: none; }
  .player { position: fixed; inset: 0; max-width: none; padding: 0; }
  .cab { display: flex; flex-direction: column; height: 100%; height: 100dvh; padding: 0; border-radius: 0; background: #000; box-shadow: none; }
  .cab-top { flex: none; gap: 8px; margin: 0; padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left)); background: #0d0c10; border-bottom: 1px solid var(--rule); }
  .cab h1 { font-size: 1.1rem; }
  .cab-meta { font-size: .62rem; }
  .icon-btn { padding: 0; width: 44px; border-color: transparent; background: transparent; }
  .icon-btn .lbl { display: none; }
  .icon-btn[aria-pressed="true"] { border-color: transparent; }
  .cab-tools { gap: 0; }
  .cab-bezel { flex: 1; min-height: 0; padding: 0; border-radius: 0; background: #000; box-shadow: none; }
  .cab-screen { height: 100%; max-height: none; min-height: 0; aspect-ratio: auto; border-radius: 0; box-shadow: none; touch-action: none; padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
  .cab-screen iframe { position: static; display: block; width: 100%; height: 100%; }
}
/* phone held sideways: the bar becomes a rail on the left so the game gets the full height */
@media (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .cab { flex-direction: row; }
  .cab-top { flex-direction: column; justify-content: space-between; width: calc(52px + env(safe-area-inset-left)); padding: max(6px, env(safe-area-inset-top)) 4px max(6px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); border-bottom: 0; border-right: 1px solid var(--rule); }
  .cab-title { display: none; }
  .cab-tools { flex-direction: column; }
  .cab-screen { padding-left: 0; }
}
@media (max-width: 760px) { .cab-info { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .rotate-phone { animation: none; transform: rotate(-90deg); } }

/* ---------- results panel (sits below the bezel, never over the canvas) ---------- */
.results[hidden], .res-manual[hidden], .res-callout[hidden] { display: none; }
.results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 32px; margin-top: 12px; padding: 16px 18px; border: 1px solid var(--rule-2); border-radius: 12px; background: rgba(0, 0, 0, .35); }
.res-kicker { margin: 0; font: 500 .7rem var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.res-title { margin: 2px 0 0; font: 700 1.1rem/1.2 var(--f-display); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.res-score { margin: 0; font: 700 clamp(2rem, 1.4rem + 3vw, 3rem)/1.1 var(--f-display); color: var(--era); font-variant-numeric: tabular-nums; }
.ladder { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-width: 320px; margin: 6px 0 10px; }
.ladder span { height: 14px; border-radius: 2px; background: rgba(241, 235, 223, .1); border: 1px solid var(--rule); }
.ladder span.on { background: var(--era); border-color: var(--era); }
.res-lines { margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: .98rem; }
.res-lines li { margin: 0 0 2px; }
.res-callout { margin: 8px 0 0; color: var(--era); font: 500 .85rem var(--f-mono); letter-spacing: .06em; }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.res-actions .btn { flex: 1 1 auto; min-width: 120px; }
.res-manual { margin-top: 12px; }
.res-manual label { display: block; margin-bottom: 4px; font: 500 .7rem var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.res-manual textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--rule-2); border-radius: 6px; background: #000; color: var(--ink); font: 400 .9rem/1.4 var(--f-mono); resize: none; }
.res-note { margin: 12px 0 0; color: var(--ink-3); font: 400 .8rem var(--f-mono); letter-spacing: .02em; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 120; transform: translate(-50%, 12px); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--room); font: 700 .85rem var(--f-display); letter-spacing: .08em; text-transform: uppercase; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }
.cab:fullscreen .results, .cab.is-full .results { margin: 0; border-radius: 0; flex: none; max-height: 45%; overflow: auto; }
@media (max-width: 760px), (max-height: 520px) and (pointer: coarse) {
  .results { flex: none; grid-template-columns: 1fr; gap: 10px; max-height: 46vh; max-height: 46dvh; margin: 0; padding: 10px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); overflow: auto; border-width: 1px 0 0; border-radius: 0; background: #0d0c10; }
  .res-score { font-size: 2rem; }
  .res-title { display: none; }
  .res-note { margin-top: 6px; }
}
@media (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .results { width: min(44%, 340px); max-height: none; border-width: 0 0 0 1px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
