/* Robot Recess player and game page (Cabinet Plan §13, §14): the stage (bar, frame, deck, rail), cover, overlays,
   toasts, faces, board, "Your progress", "More games", chips and notes. The frame never moves: Big Screen, the phone
   player and full screen are classes on .rr-player and <html> around the server-rendered .rr-stage. */

/* ── Game pages are wide (§14.2): the site grows to min(100vw - 32px, 1600px); retro.css's narrow margins stay. ── */
@media (min-width: 1181px) {
  body[data-width="wide"] .site { max-width: min(calc(100vw - 32px), 1600px); }
}

.rr-player {
  --rr-p-navy: var(--rr-navy, #1b2a6b);
  --rr-p-yellow: var(--rr-yellow, #ffd23f);
  --rr-p-red: var(--rr-red, #e8392c);
  --rr-p-green: var(--rr-green, #1fa34a);
  --rr-p-blue: var(--rr-blue, #1f6feb);
  --rr-p-panel: var(--rr-panel, #fffbe6);
  --rr-p-ink: var(--rr-ink, #1a1a2e);
  margin: 0 0 16px;
}

/* ── Frame ── */
.rr-player-frame {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  background: #05071a;
  border: 4px solid var(--rr-p-navy);
  border-radius: 12px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25), inset 0 0 0 2px rgba(255, 255, 255, 0.08);
}
/* The cabinet's game box (§14.2): the column's width, never under 838 px, as tall as the window minus the title row and
   deck (122 px). Low specificity: Big Screen and full screen size it their own way. */
:where(.rr-stage-body) .rr-player-frame { width: min(100%, max(838px, calc((100vh - 122px) * var(--rr-ar, 1.7778)))); }
/* Tall games: the height decides (never smaller than Phase A's caps). */
:where(.rr-player[data-aspect='1:1'], .rr-player[data-aspect='3:4'], .rr-player[data-aspect='9:16']) :where(.rr-stage-body) .rr-player-frame {
  width: min(100%, max(calc(min(78vh, 800px) * var(--rr-ar)), calc(min(100vh - 122px, 900px) * var(--rr-ar))));
}
/* The OUT OF ORDER cover (the team's view of a game players can't open) has no stage around it: the same box as the
   cabinet's, no wider than the cabinet's game column, never the whole wide page. */
.rr-player-off .rr-player-frame { width: min(100%, max(838px, calc((100vh - 122px) * var(--rr-ar, 1.7778)))); }
.rr-player-off:is([data-aspect='1:1'], [data-aspect='3:4'], [data-aspect='9:16']) .rr-player-frame {
  width: min(100%, max(calc(min(78vh, 800px) * var(--rr-ar)), calc(min(100vh - 122px, 900px) * var(--rr-ar))));
}
@media (min-width: 1280px) {
  .rr-player-off { max-width: calc(100% - 358px); margin-inline: auto; } /* the rail's 340 px + the 18 px gap */
}

.rr-game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000;
}

/* ── INSERT COIN cover ── */
.rr-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  color: #fff;
  background: var(--rr-p-navy);
}
.rr-cover[hidden] { display: none; }
.rr-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.1) brightness(0.75);
}
.rr-cover-shade {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at center, rgba(5, 7, 26, 0.15) 0%, rgba(5, 7, 26, 0.7) 100%);
  pointer-events: none;
}
.rr-coin {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 26px 14px;
  border: 4px solid var(--rr-p-navy);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff3a8 0%, var(--rr-p-yellow) 45%, #f0a500 100%);
  color: var(--rr-p-navy);
  box-shadow: 0 6px 0 #9a6a00, 0 10px 24px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  font: inherit;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.rr-coin:hover { transform: translateY(-2px); box-shadow: 0 8px 0 #9a6a00, 0 12px 28px rgba(0, 0, 0, 0.45); }
.rr-coin:active { transform: translateY(4px); box-shadow: 0 2px 0 #9a6a00, 0 4px 12px rgba(0, 0, 0, 0.4); }
.rr-coin:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }
.rr-coin:disabled { cursor: progress; filter: grayscale(0.4); }
.rr-coin-slot {
  width: 10px;
  height: 34px;
  border-radius: 6px;
  background: #1a1300;
  box-shadow: inset 0 0 0 2px #6b4a00, 0 0 0 4px rgba(255, 255, 255, 0.5);
}
.rr-coin-label { font-size: 20px; letter-spacing: 1px; animation: rr-blink 1.1s steps(1, end) infinite; }
.rr-coin-sub { font-size: 13px; font-weight: bold; max-width: 28ch; }
.rr-loading .rr-coin-label { animation: none; }
.rr-loading .rr-coin-label::after { content: '…'; }
.rr-cover-hint {
  position: relative;
  margin: 0;
  font-size: 12px;
  color: #dfe6ff;
  text-shadow: 0 1px 0 #000;
}
.rr-cover-error {
  position: relative;
  margin: 0;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--rr-p-red);
  color: #fff;
  font-weight: bold;
}
.rr-cover-error[hidden] { display: none; }
/* "Play here instead" for games that open in Big Screen (computers only: phones always play full screen). */
.rr-cover-alt {
  position: relative;
  min-height: 32px;
  padding: 5px 14px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: rgba(5, 7, 26, 0.6);
  color: #fff;
  font: 700 13px/1.2 var(--font-body, sans-serif);
  cursor: pointer;
}
.rr-cover-alt:hover { background: var(--rr-p-yellow); border-color: var(--rr-p-navy); color: var(--rr-p-navy); }
.rr-cover-alt:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.rr-touch .rr-cover-alt { display: none; }
.rr-cover-off .rr-cover-note {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 36ch;
  margin: 0;
  padding: 14px 16px;
  border: 3px solid var(--rr-p-yellow);
  border-radius: 10px;
  background: rgba(5, 7, 26, 0.85);
}
.rr-cover-off .rr-cover-note .pixel { color: var(--rr-p-yellow); font-size: 14px; }

/* ── Overlays and modals (inside the frame, so they also work in fullscreen) ── */
.rr-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: auto;
  background: rgba(5, 7, 26, 0.78);
}
.rr-overlay[hidden] { display: none; }
/* A modal too tall for the frame (a wide game on a narrow screen) covers the page instead (player.js fitModal). */
.rr-overlay.rr-overlay-page { position: fixed; z-index: 1000; }
.rr-modal {
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  margin: auto;
  overflow: auto;
  padding: 16px 18px;
  border: 4px solid var(--rr-p-navy);
  border-radius: 14px;
  background: var(--rr-p-panel);
  color: var(--rr-p-ink);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
  text-align: center;
}
.rr-modal p { margin: 0 0 10px; }
.rr-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}
.rr-form-error { min-height: 1em; color: var(--rr-p-red); font-weight: bold; }
.rr-form-error:empty { display: none; }

/* High-score initials */
.rr-hs-title { color: var(--rr-p-red); font-size: 16px; letter-spacing: 1px; animation: rr-blink 0.9s steps(1, end) infinite; }
/* Colors come from the design system's .lcd (glowing green on a dark panel). The score carries its label, so it wraps. */
.rr-hs-score { max-width: 100%; font-size: 20px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
.rr-slots { display: flex; justify-content: center; gap: 12px; margin: 6px 0 4px; }
.rr-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rr-slot-input {
  width: 1.6em;
  padding: 6px 0;
  border: 3px solid var(--rr-p-navy);
  border-radius: 8px;
  background: #05071a;
  color: var(--rr-p-yellow);
  font-size: 34px;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  caret-color: transparent;
}
.rr-slot-input:focus { outline: none; border-color: var(--rr-p-red); box-shadow: 0 0 0 4px rgba(232, 57, 44, 0.35); animation: rr-glow 0.8s ease-in-out infinite alternate; }
.rr-slot-btn {
  width: 44px;
  height: 28px;
  border: 2px solid var(--rr-p-navy);
  border-radius: 6px;
  background: #fff;
  color: var(--rr-p-navy);
  font-size: 13px;
  cursor: pointer;
}
.rr-slot-btn:hover { background: var(--rr-p-yellow); }
.rr-hs-help { font-size: 13px; }
.rr-hs-keys { font-size: 11px; opacity: 0.8; }

/* Review (report card) */
.rr-review { text-align: left; max-width: 480px; }
.rr-review-title { margin: 0 0 4px; text-align: center; color: var(--rr-p-navy); font-size: 16px; }
.rr-review-sub { text-align: center; font-size: 12px; opacity: 0.85; }
.rr-review-had { margin: -4px 0 10px; text-align: center; font-weight: 700; color: var(--rr-p-navy); }
.rr-field { margin: 0 0 10px; padding: 0; border: 0; }
.rr-field legend, .rr-note { display: block; margin-bottom: 4px; font-weight: bold; }
.rr-stars { display: flex; gap: 2px; }
.rr-stars label {
  font-size: 32px;
  line-height: 1;
  padding: 0 2px;
  color: #c9c3a6;
  cursor: pointer;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
/* Light up every star up to the checked (or hovered) one. */
.rr-stars:has(input:checked) label { color: var(--rr-p-yellow); -webkit-text-stroke: 1px #a87400; }
.rr-stars input:checked + label ~ label { color: #c9c3a6; -webkit-text-stroke: 0; }
.rr-stars.rr-stars:hover label { color: var(--rr-p-yellow); -webkit-text-stroke: 1px #a87400; }
.rr-stars.rr-stars label:hover ~ label { color: #c9c3a6; -webkit-text-stroke: 0; }
.rr-stars input:focus-visible + label { outline: 3px solid var(--rr-p-blue); outline-offset: 2px; border-radius: 4px; }
.rr-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.rr-choices label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 2px solid var(--rr-p-navy);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: normal;
}
.rr-choices label:has(input:checked) { background: var(--rr-p-yellow); font-weight: bold; }
.rr-note { font-weight: bold; }
.rr-note[hidden] { display: none; }
.rr-note textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 8px;
  border: 2px solid var(--rr-p-navy);
  border-radius: 6px;
  font: inherit;
  font-weight: normal;
  resize: vertical;
  box-sizing: border-box;
}

/* ── Toasts: small, top center, at most two (player.js merges bursts of unlocks). Games keep their own controls in the
   corners (Kunlun's Rules / Pause CPU / Menu and turn card, Pond's speed buttons and tool column), so toasts stay out
   of them, cover as little as they can, and let clicks through. ── */
.rr-toasts {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: min(360px, calc(100% - 16px));
  transform: translateX(-50%);
  pointer-events: none;
}
.rr-toast {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  max-width: 100%;
  padding: 5px 10px;
  border: 2px solid var(--rr-p-yellow);
  border-radius: 9px;
  background: var(--rr-p-navy);
  color: #fff;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  animation: rr-toast-in 0.25s ease-out;
}
.rr-toast strong { font-size: 12.5px; }
/* Small frames (phones, short windows): title and detail share a line when they fit. */
@media (max-width: 560px), (max-height: 500px) {
  .rr-toasts { top: 6px; gap: 4px; }
  .rr-toast { flex-direction: row; flex-wrap: wrap; justify-content: center; column-gap: 6px; padding: 3px 9px; font-size: 11.5px; }
  .rr-toast strong { font-size: 12px; }
}
.rr-toast-achievement { background: var(--rr-p-yellow); color: var(--rr-p-navy); border-color: var(--rr-p-navy); }
.rr-toast-achievement strong::before { content: '🏆 '; }
.rr-toast-score strong::before { content: '★ '; }
.rr-toast-out { opacity: 0; transform: translateY(-6px); transition: opacity 0.35s, transform 0.35s; }

/* ── The cabinet (§14.2): the game column (frame, then the deck) and the rail beside it from 1280 px, under it below ── */
.rr-stage-body { display: flex; flex-direction: column; gap: 14px; }
.rr-stage-main { position: relative; display: flex; flex-direction: column; min-width: 0; }
.rr-frame-slot { min-width: 0; }
@media (min-width: 1280px) {
  .rr-stage-body.rr-has-rail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: stretch; }
  /* As tall as the game column, scrolling inside ("sticky"). */
  .rr-stage-body.rr-has-rail > .rr-rail { contain: size; }
}

/* ── The control deck under the game (§14.5): faces, best, achievements, Big screen, Full screen, Report ── */
.rr-deck {
  container: rr-deck / inline-size;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-height: 48px;
  margin-top: 8px;
  padding: 3px 8px;
  border: 3px solid var(--rr-p-navy);
  border-radius: 12px;
  background: #fff;
  color: var(--rr-p-ink);
}
.rr-deck-space { flex: 0 0 0; }
.rr-deck .btn { flex: none; white-space: nowrap; }
.rr-deck-team { font-size: 13px; font-weight: 700; color: var(--rr-p-navy); }
.rr-deck-best, .rr-deck-ach { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 12.5px; white-space: nowrap; }
.rr-deck-best[hidden], .rr-deck-ach[hidden] { display: none; }
.rr-deck-best-k { font-size: 10px; color: #b3261e; } /* a darker red: 4.5:1 on white */
.rr-deck-best-v { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; color: var(--rr-p-navy); }
/* At most two lines, so the deck stays one 48 px row; it takes two thirds of the row's spare room (the faces' hint the
   rest) and never pushes onto a row of its own. Long lines show a short form (setStatus `short`); screen readers and
   the title get the whole sentence. Scoped to the deck: team.css has its own .rr-status chip (bold, nowrap) and is
   loaded on game pages too. */
.rr-deck .rr-status {
  display: -webkit-box;
  flex: 2 1 0;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 0;
  font: 400 12px/1.25 var(--font-body, sans-serif);
  color: var(--rr-muted, #4c5577);
  text-align: right;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.rr-deck .rr-status:empty { display: none; }

.rr-faces { display: flex; flex: 1 1 auto; align-items: center; gap: 4px 5px; min-width: 0; padding: 2px; border-radius: 10px; }
.rr-faces-label { margin-right: 2px; font-size: 11px; color: var(--rr-p-navy); }
.rr-face {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 32px;
  height: 32px;
  padding: 0 9px 0 3px;
  border: 2px solid var(--rr-p-navy);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 0 var(--rr-p-navy);
  color: var(--rr-p-navy);
  font: 700 12px/1 var(--font-body, sans-serif);
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.12s ease;
}
.rr-face-art { flex: none; width: 24px; height: 24px; background: center / contain no-repeat; image-rendering: pixelated; }
.rr-face-1 { background-image: url("/static/img/face-1.svg"); }
.rr-face-2 { background-image: url("/static/img/face-2.svg"); }
.rr-face-3 { background-image: url("/static/img/face-3.svg"); }
.rr-face-4 { background-image: url("/static/img/face-4.svg"); }
.rr-face-5 { background-image: url("/static/img/face-5.svg"); }
.rr-face:hover:not([aria-disabled='true']) { background: #fff6c2; transform: translateY(-1px); }
.rr-face:active:not([aria-disabled='true']) { transform: translateY(2px); box-shadow: 0 0 0 var(--rr-p-navy); }
.rr-face:focus-visible, .rr-chip:focus-visible { outline: 3px solid var(--rr-p-blue); outline-offset: 2px; }
.rr-face[aria-pressed='true'] { background: var(--rr-p-yellow); border-color: var(--rr-p-red); box-shadow: 0 2px 0 var(--rr-p-red); }
/* Locked: still focusable (aria-disabled), so a press can say why. */
.rr-face[aria-disabled='true'] { cursor: not-allowed; box-shadow: none; }
.rr-faces[data-state='locked'] .rr-face:not([aria-pressed='true']) .rr-face-art { filter: grayscale(1); opacity: 0.6; }
.rr-faces[data-state='locked'] .rr-face { border-style: dashed; }
/* Words where there is room; the aria-label always has them. */
@container rr-deck (max-width: 1180px) {
  .rr-face-word { display: none; }
  .rr-face { padding: 0 4px; justify-content: center; }
}
/* The faces' live region: at most two lines, so the deck stays one 48 px row. */
.rr-faces-hint {
  display: -webkit-box;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--rr-muted, #4c5577);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
/* With the difficulty chips showing, the hint is for screen readers only. */
.rr-faces[data-state='draft'] .rr-faces-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
/* A narrow deck shows Full screen and Report as icons (their names stay). */
@container rr-deck (max-width: 1000px) {
  .rr-deck .rr-deck-word { display: none; }
}
.rr-difficulty { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.rr-difficulty[hidden] { display: none; }
.rr-difficulty-q { font-size: 12px; font-weight: 700; color: var(--rr-p-navy); }
.rr-chip {
  min-height: 30px;
  padding: 3px 10px;
  border: 2px solid var(--rr-p-navy);
  border-radius: 999px;
  background: #fff;
  color: var(--rr-p-navy);
  font: 700 12px/1.2 var(--font-body, sans-serif);
  white-space: nowrap;
  cursor: pointer;
}
.rr-chip:hover { background: #fff6c2; }
.rr-chip[aria-pressed='true'] { background: var(--rr-p-yellow); }
.rr-chip[hidden] { display: none; }
.rr-faces.rr-faces-nudge { box-shadow: 0 0 0 3px var(--rr-p-yellow), 0 0 0 5px var(--rr-p-navy); animation: rr-nudge-glow 1.2s ease-in-out 3; }
.rr-bar-faces.rr-faces-nudge { background: var(--rr-p-yellow); }

/* ── The rail (§14.2): Judge | Scores | Chat ── */
.rr-rail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 4px solid var(--rr-p-navy);
  border-radius: 12px;
  background: #fff;
  color: var(--rr-p-ink);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
}
.rr-rail-head { display: flex; align-items: flex-end; gap: 4px; flex: none; padding: 7px 7px 0; background: var(--rr-p-navy); }
.rr-rail-tabs { display: flex; flex: 1 1 auto; gap: 4px; min-width: 0; }
.rr-rail-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex: 1 1 0;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px 5px;
  border: 2px solid #0a1150;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: #c9d3ff;
  color: var(--rr-p-navy);
  font: 700 12px/1 var(--font-pixel, monospace);
  text-transform: uppercase;
  cursor: pointer;
}
.rr-rail-tab[hidden] { display: none; }
.rr-rail-tab:hover { background: #fff6c2; }
.rr-rail-tab[aria-selected='true'] { background: #fff; box-shadow: inset 0 4px 0 var(--rr-tab-accent, var(--rr-p-yellow)); }
.rr-rail-tab-judge { --rr-tab-accent: var(--rr-purple, #8a3ffc); }
.rr-rail-tab-scores { --rr-tab-accent: var(--rr-p-yellow); }
.rr-rail-tab-chat { --rr-tab-accent: var(--rr-p-blue); }
.rr-rail-tab:focus-visible, .rr-rail-tuck:focus-visible { outline: 3px solid var(--rr-p-yellow); outline-offset: -3px; }
.rr-rail-tab-icon { font-size: 13px; line-height: 1; }
.rr-rail-tuck {
  display: none;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  margin-bottom: 4px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font: 700 16px/1 var(--font-body, sans-serif);
  cursor: pointer;
}
.rr-rail-tuck:hover { background: rgba(255, 255, 255, 0.16); }
.rr-rail-panels { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.rr-rail-panel { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 12px; }
.rr-rail-panel[hidden] { display: none; }
.rr-rail-panel-chat { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.rr-rail-panel-chat > * { flex: 1 1 auto; min-height: 0; }
.rr-rail-panel-scores > * + * { margin-top: 0; }
.rr-rail-panel-scores > :not([hidden]) ~ :not([hidden]) { margin-top: 12px; }
/* Under the game: panels take their own height; the chat box gets a definite one. */
@media (max-width: 1279.98px) {
  .rr-rail-panel { flex: none; overflow: visible; }
  .rr-rail-panel-chat { height: min(70vh, 560px); overflow: hidden; }
}

/* The Judge tab (§14.6, §14.8). */
.rr-judge > * + * { margin-top: 12px; }
.rr-judge > [hidden] + * { margin-top: 0; }
.rr-fun-sum { text-align: center; }
.rr-fun-big { margin: 0; color: var(--rr-p-navy); font: 700 34px/1 var(--font-pixel, monospace); }
.rr-fun-of { font-size: 15px; color: var(--rr-muted, #4c5577); }
.rr-fun-stars { margin: 4px 0 0; }
.rr-fun-label { margin: 4px 0 0; font-weight: 700; font-size: 13px; }
.rr-fun-all { margin: 2px 0 0; color: var(--rr-muted, #4c5577); }
.rr-fun-bars { margin: 10px 0 0; padding: 0; list-style: none; text-align: left; }
.rr-fun-bar { display: grid; grid-template-columns: 22px minmax(0, 9.5em) minmax(0, 1fr) 2.5em; align-items: center; gap: 6px; font-size: 12px; }
.rr-fun-bar + .rr-fun-bar { margin-top: 3px; }
.rr-fun-bar-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-fun-bar-track { height: 10px; overflow: hidden; border: 2px solid var(--rr-p-navy); border-radius: 999px; background: var(--rr-soft, #f3f7ff); }
.rr-fun-bar-fill { display: block; height: 100%; background: var(--rr-p-yellow); }
.rr-fun-bar-n { text-align: right; font-variant-numeric: tabular-nums; }
.rr-fun-diff, .rr-fun-notes { margin: 8px 0 0; color: var(--rr-muted, #4c5577); }
.rr-fun-diff-q { font-weight: 700; color: var(--rr-p-navy); }
.rr-fun-diff-part { white-space: nowrap; }
.rr-fun-none { padding: 12px; border: 3px dashed var(--rr-p-navy); border-radius: 12px; background: var(--rr-soft, #f3f7ff); text-align: center; }
.rr-fun-none-title { margin: 0 0 4px; color: var(--rr-p-navy); font: 700 14px/1.3 var(--font-pixel, monospace); text-transform: uppercase; }
.rr-fun-none-text { margin: 0; font-size: 13px; }
.rr-my-rating { margin: 0; padding: 7px 10px; border: 2px solid var(--rr-p-navy); border-radius: 10px; background: #fff6c2; font-size: 13px; }
.rr-my-rating[hidden] { display: none; }
.rr-my-rating-label { font-weight: 700; }
.rr-my-rating-team { background: #eceef4; }
.rr-link-btn { padding: 0; border: 0; background: none; color: var(--rr-blue, #1f6feb); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.rr-link-btn[hidden] { display: none; }
.rr-how { padding: 10px 12px; border: 2px solid var(--rr-p-navy); border-radius: 10px; background: #f1e9ff; }
.rr-how-title { margin: 0 0 4px; font-size: 13px; color: var(--rr-p-navy); }
.rr-how-steps { margin: 0; padding-left: 20px; font-size: 13px; }
.rr-rail-meter .judgment-meter { margin: 0; }

/* ── Stage: Big Screen, the phone player and full screen (§13.7, §14.3) ── */
/* The bar shows only while maximized (and in full screen on touch devices, or on a computer while it has focus). */
.rr-bar {
  display: none;
  align-items: center;
  gap: 8px;
  height: 44px;
  flex: none;
  padding: 0 8px;
  background: var(--rr-p-navy);
  color: #fff;
  --focus: #ffd400;
}
.rr-player.rr-max .rr-bar { display: flex; }
.rr-bar-back {
  flex: none;
  min-height: 32px;
  padding: 5px 12px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: 700 13px/1.2 var(--font-body, sans-serif);
  white-space: nowrap;
  cursor: pointer;
}
.rr-bar-back:hover { background: rgba(255, 255, 255, 0.16); }
.rr-bar-title {
  min-width: 0;
  overflow: hidden;
  color: var(--rr-p-yellow);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rr-bar-fun { flex: none; padding: 2px 8px; border: 1px solid rgba(255, 255, 255, 0.5); border-radius: 999px; color: #fff; font-size: 12px; white-space: nowrap; }
.rr-bar-space { flex: 1 1 auto; }
.rr-bar .btn { flex: none; white-space: nowrap; }
.rr-bar-faces { display: none; }
.rr-touch .rr-bar-faces { display: inline-flex; }
.rr-touch .rr-bar button { min-height: 40px; min-width: 40px; }
.rr-touch .rr-bar-wide { display: none; }
.rr-no-fs .rr-bar [data-rr-fullscreen] { display: none; }
@media (max-width: 640px) {
  .rr-bar-wide, .rr-bar-fun { display: none; }
}

/* Maximized: under the 44 px bar, the game area over the 48 px deck, and the rail (340 / 48 tucked / 480 wide). */
.rr-player.rr-max .rr-stage {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: #05071a;
  /* Notch-safe (game pages render with viewport-fit=cover). */
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
.rr-player.rr-max .rr-stage-body,
.rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-stage-body { display: flex; flex-direction: row; flex: 1 1 auto; min-height: 0; gap: 0; }
.rr-player.rr-max .rr-stage-main,
.rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-stage-main { flex: 1 1 auto; min-width: 0; min-height: 0; }
/* Letterbox: the largest box of the game's shape, centred; fill: all of it (§14.4). */
.rr-player.rr-max .rr-frame-slot,
.rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-frame-slot {
  container-type: size;
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.rr-player.rr-max .rr-player-frame,
.rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-player-frame {
  width: min(100cqw, 100cqh * var(--rr-ar, 1.7778));
  height: min(100cqh, 100cqw / var(--rr-ar, 1.7778));
  max-width: none;
  margin: 0;
  aspect-ratio: auto !important;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.rr-player.rr-max[data-fit='fill'] .rr-player-frame,
.rr-player[data-fit='fill'] .rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-player-frame { width: 100%; height: 100%; }
/* "Arcade at night": the deck is a dark 48 px strip under the game. */
.rr-player.rr-max .rr-deck {
  flex: none;
  flex-wrap: nowrap;
  height: 48px;
  min-height: 0;
  margin: 0;
  padding: 0 8px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #0b1033;
  color: #fff;
}
.rr-player.rr-max .rr-deck .rr-status { display: none; } /* one live region: the bar's */
.rr-player.rr-max .rr-faces { flex-wrap: nowrap; }
.rr-player.rr-max .rr-faces-label, .rr-player.rr-max .rr-difficulty-q, .rr-player.rr-max .rr-deck-team { color: var(--rr-p-yellow); }
.rr-player.rr-max .rr-faces-hint { overflow: hidden; color: #dfe6ff; text-overflow: ellipsis; white-space: nowrap; }
.rr-player.rr-max .rr-deck-best, .rr-player.rr-max .rr-deck-ach { color: #fff; }
.rr-player.rr-max .rr-deck-best-k { color: var(--rr-p-yellow); }
.rr-player.rr-max .rr-deck-best-v { color: #fff; }
.rr-player.rr-max .rr-deck .btn-ghost { color: #fff; }
.rr-player.rr-max .rr-deck .btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.rr-player.rr-max .rr-deck :is([data-rr-big], [data-rr-fullscreen]) { display: none; } /* the bar has Exit and Full screen */
.rr-player.rr-max .rr-rail {
  flex: none;
  width: 340px;
  contain: size;
  border: 0;
  border-left: 2px solid #1d2a7a;
  border-radius: 0;
  box-shadow: none;
}
.rr-player.rr-max.rr-rail-wide .rr-rail { width: 480px; }
.rr-player.rr-max .rr-rail-panel { flex: 1 1 auto; overflow: auto; }
.rr-player.rr-max .rr-rail-panel-chat { height: auto; overflow: hidden; }
.rr-player.rr-max:not(.rr-touch) .rr-rail-tuck { display: inline-flex; }
.rr-player.rr-max.rr-rail-tucked .rr-rail { width: 48px; background: var(--rr-p-navy); }
.rr-player.rr-max.rr-rail-tucked .rr-rail-head { flex-direction: column; align-items: stretch; flex: 1 1 auto; gap: 6px; padding: 6px 5px; }
.rr-player.rr-max.rr-rail-tucked .rr-rail-tabs { flex-direction: column; flex: none; gap: 6px; }
.rr-player.rr-max.rr-rail-tucked .rr-rail-tab { position: relative; flex: none; height: 38px; padding: 0; border: 2px solid #c9d3ff; border-radius: 8px; }
.rr-player.rr-max.rr-rail-tucked .rr-rail-tab[aria-selected='true'] { box-shadow: inset 4px 0 0 var(--rr-tab-accent, var(--rr-p-yellow)); }
.rr-player.rr-max.rr-rail-tucked .rr-rail-tab-icon { font-size: 16px; }
.rr-player.rr-max.rr-rail-tucked .rr-rail-tab-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.rr-player.rr-max.rr-rail-tucked .rr-rail-tab .chat-unread { position: absolute; top: -6px; right: -6px; }
.rr-player.rr-max.rr-rail-tucked .rr-rail-tuck { width: auto; margin: auto 0 0; }
.rr-player.rr-max.rr-rail-tucked .rr-rail-panels { display: none; }

/* The phone player: no rail; ★ Fun shows the deck as a strip over the game (§14.3). */
.rr-player.rr-max.rr-touch .rr-rail { display: none; }
.rr-player.rr-max.rr-touch .rr-deck { display: none; }
.rr-player.rr-max.rr-touch.rr-deck-open .rr-deck {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: flex;
  flex-wrap: wrap;
  height: auto;
  min-height: 52px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(11, 16, 51, 0.94);
}
.rr-player.rr-max.rr-touch .rr-deck :is([data-rr-big], [data-rr-fullscreen], [data-rr-report], .rr-deck-space) { display: none; }
/* The strip's message gets its own full-width line under the faces (the Big Screen one-line rule would cut it to a
   few letters), and the difficulty chips their own row. */
.rr-player.rr-max.rr-touch .rr-faces { flex-wrap: wrap; }
.rr-player.rr-max.rr-touch .rr-faces-hint { flex: 1 0 100%; white-space: normal; text-overflow: clip; }
.rr-touch .rr-face { min-width: 44px; height: 44px; }
.rr-touch .rr-chip { min-height: 40px; }

/* Full screen shows only the game in Phase B; the bar stays on touch devices (Back, ★ Fun, Exit). */
.rr-stage:is(:fullscreen, :-webkit-full-screen) { display: flex; flex-direction: column; width: 100vw; height: 100vh; padding: 0; background: #05071a; }
.rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-rail { display: none !important; }
.rr-player:not(.rr-deck-open) .rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-deck,
.rr-player:not(.rr-touch) .rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-deck { display: none; }
.rr-player:not(.rr-touch) .rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-bar { display: none; }
.rr-player.rr-touch .rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-bar,
.rr-player.rr-bar-reveal .rr-stage:is(:fullscreen, :-webkit-full-screen) .rr-bar { display: flex; }

/* Page scroll locked behind the maximized player, and the page behind it stops painting (and leaves the tab order). */
html.rr-max-open,
html.rr-max-open body { overflow: hidden; overscroll-behavior: none; }
html.rr-max-open :is(.masthead, .footer, .sidebar, .flash, .skip-link, .sky, .rr-ask),
html.rr-max-open .main > :not(.rr-player) { visibility: hidden; }

/* During a run every decoration outside the player stands still, hidden or not (§14.9: close to no CPU). */
html.rr-running .sky::before,
html.rr-running .sky::after,
html.rr-running .ticker-track,
html.rr-running :is(.masthead, .footer, .main > :not(.rr-player)) *,
html.rr-running :is(.masthead, .footer, .main > :not(.rr-player)) *::before,
html.rr-running :is(.masthead, .footer, .main > :not(.rr-player)) *::after { animation-play-state: paused !important; }

/* Notch padding for the page itself, only on pages that opted in (game pages). */
body[data-viewport-fit="cover"] { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }

/* ── High-score board (hidden until the game keeps score, §13.5.5) ── */
.rr-scoreboard[hidden] { display: none; }
.rr-scoreboard {
  padding: 12px 14px 10px;
  border: 4px solid var(--rr-navy, #1b2a6b);
  border-radius: 12px;
  background: #05071a;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px);
  color: #e8ecff;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.25);
}
.rr-scoreboard-title {
  margin: 0 0 10px;
  text-align: center;
  font-size: 15px;
  color: var(--rr-yellow, #ffd23f);
  text-shadow: 0 0 6px rgba(255, 210, 63, 0.6), 2px 2px 0 var(--rr-red, #e8392c);
}
.rr-board { margin: 0; padding: 0; list-style: none; }
.rr-board-row {
  display: grid;
  grid-template-columns: 3.5em 3.5em 1fr;
  align-items: baseline;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 4px;
}
.rr-board-row:nth-child(odd) { background: rgba(255, 255, 255, 0.04); }
.rr-board-rank { color: #6fd3ff; font-weight: bold; font-size: 12px; }
.rr-board-initials { color: #fff; letter-spacing: 2px; }
.rr-board-score { text-align: right; color: var(--rr-yellow, #ffd23f); font-variant-numeric: tabular-nums; }
.rr-board-top .rr-board-rank, .rr-board-top .rr-board-initials { color: var(--rr-yellow, #ffd23f); }
.rr-board-top .rr-board-score { color: #ff7a59; }
.rr-board-me { outline: 2px solid var(--rr-green, #1fa34a); }
.rr-board-empty .rr-board-initials, .rr-board-empty .rr-board-rank { color: #46507d; }
.rr-board-none { margin: 6px 0; text-align: center; color: #c7cff7; font-size: 13px; }
.rr-board-none[hidden] { display: none; }
.rr-board-label { margin: 8px 0 0; text-align: center; font-size: 11px; color: #8d97c7; }

/* ── "Your progress": best and achievements (§13.8) ── */
.rr-progress[hidden], .rr-progress [hidden] { display: none; }
.rr-progress {
  padding: 12px 14px 10px;
  border: 4px solid var(--rr-navy, #1b2a6b);
  border-radius: 12px;
  background: var(--rr-panel, #fff);
  color: var(--rr-ink, #1a1a2e);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2);
}
.rr-progress-title {
  margin: 0 0 8px;
  text-align: center;
  font-size: 14px;
  color: var(--rr-navy, #1b2a6b);
  text-shadow: 2px 2px 0 var(--rr-yellow, #ffd23f);
}
.rr-progress-best { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 10px; }
.rr-progress-label { flex: 1 0 100%; font-weight: 700; font-size: 13px; color: var(--rr-navy, #1b2a6b); }
.rr-progress-best .lcd { max-width: 100%; overflow: hidden; font-size: 12px; text-overflow: ellipsis; }
.rr-progress-rank {
  padding: 2px 7px;
  border: 2px solid var(--rr-navy, #1b2a6b);
  border-radius: 999px;
  background: var(--rr-yellow, #ffd23f);
  color: var(--rr-navy, #1b2a6b);
  font: 700 11px/1.4 var(--font-arcade, monospace);
}
.rr-progress-rank:empty { display: none; }
.rr-progress-sub { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 6px; font-size: 13px; color: var(--rr-navy, #1b2a6b); }
.rr-ach-count { font-weight: 400; color: var(--rr-muted, #4c5577); }
.rr-ach-list { max-height: 240px; margin: 0; padding: 0; overflow: auto; list-style: none; }
.rr-ach-list:empty { display: none; }
.rr-ach { padding: 3px 6px; border-radius: 6px; font-size: 13px; overflow-wrap: anywhere; }
.rr-ach:nth-child(odd) { background: var(--rr-soft, #f3f7ff); }
.rr-ach-empty { margin: 0; font-size: 13px; color: var(--rr-muted, #4c5577); }
.rr-progress-where { margin: 8px 0 0; color: var(--rr-muted, #4c5577); }

/* ── Game page: stage chips beside the title and the note under the player (§13.5.3) ── */
.game-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 1px 9px;
  border: 2px solid var(--rr-navy, #1b2a6b);
  border-radius: 999px;
  font: 700 11.5px/1.6 var(--font-body, sans-serif);
  white-space: nowrap;
  vertical-align: middle;
}
.game-chip-featured { background: linear-gradient(180deg, #fff27a, #f5b400); color: var(--rr-navy, #1b2a6b); }
.game-chip-judgment { background: #5a24b0; color: #fff; }
.game-chip-archived { background: #5a6079; color: #fff; }
.game-chip-sub { font-size: 12px; color: var(--rr-muted, #4c5577); white-space: nowrap; }
.game-note {
  margin: 0;
  padding: 8px 12px;
  border: 2px solid var(--rr-navy, #1b2a6b);
  border-radius: 10px;
  background: #eceef4;
  font-size: 13px;
}
.game-note-judgment { background: #f1e9ff; }
.main > .rr-player + .game-note { margin-top: -6px; }

/* ── Cover: "You're a judge" on Under Judgment games (§14.8) ── */
.rr-cover-judge {
  position: relative;
  margin: 0;
  padding: 4px 12px;
  border: 2px solid var(--rr-p-yellow);
  border-radius: 999px;
  background: rgba(5, 7, 26, 0.82);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.rr-cover-judges { position: relative; margin: 0; }
.rr-cover-judges-chip { display: inline-block; padding: 2px 10px; border: 2px solid var(--rr-p-navy); border-radius: 999px; background: #5a24b0; color: #fff; font-size: 12px; font-weight: 700; }

/* ── "More games" (§14.8): one row of up to six tiles right under the cabinet ── */
.rr-more-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 0 0 8px; }
.rr-more-title { margin: 0; color: var(--rr-p-navy); font-size: 15px; }
.rr-more-link { font-weight: 700; font-size: 13px; }
.rr-more-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.rr-more-item { min-width: 0; }
.rr-more-item .tile { height: 100%; }
@media (max-width: 1100px) {
  .rr-more-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .rr-more-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* ── Recess Rooms: the room chip, "Players" and its card, the room-code box (docs/ROOMS.md §9.6) ── */
.rr-room-chip {
  display: inline-flex;
  align-items: center;
  flex: none;
  max-width: 100%;
  padding: 2px 8px;
  overflow: hidden;
  border: 2px solid var(--rr-p-navy);
  border-radius: 999px;
  background: #e8f1ff;
  color: var(--rr-p-navy);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.rr-room-chip[hidden], .rr-deck-rooms[hidden] { display: none; }
/* The phone player hides the deck behind ★ Fun: "Players" sits in its bar too (touch only; Big Screen keeps the deck's). */
.rr-bar-rooms { display: none; }
.rr-touch .rr-bar-rooms:not([hidden]) { display: inline-flex; }
.rr-player.rr-max .rr-room-chip { border-color: #8fa6ff; background: transparent; color: #fff; }
.rr-rooms-report .rr-choices label { max-width: 100%; overflow-wrap: anywhere; }
.rr-rooms-report .rr-choices label:has(input:disabled) { opacity: 0.6; cursor: default; }
.rr-rooms-report [data-rr-rooms-who][hidden] { display: none; }
.rr-rooms-note { margin: 10px 0 0; text-align: center; opacity: 0.85; }
.rr-rooms-code { max-width: 360px; }
.rr-rooms-code-label { display: block; margin: 0 0 6px; font-weight: bold; }
.rr-rooms-code-input {
  width: min(100%, 12ch);
  padding: 8px 10px;
  border: 3px solid var(--rr-p-navy);
  border-radius: 8px;
  background: #fff;
  color: var(--rr-p-ink);
  font-size: 22px;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
}
.rr-rooms-code-input:focus-visible { outline: 3px solid var(--rr-p-blue); outline-offset: 2px; }

/* ── Motion ── */
/* Blinks with opacity: text hidden with visibility drops out of the accessible name ("INSERT COIN" half the time). */
@keyframes rr-blink { 50% { opacity: 0; } }
@keyframes rr-glow { from { box-shadow: 0 0 0 3px rgba(232, 57, 44, 0.25); } to { box-shadow: 0 0 0 6px rgba(232, 57, 44, 0.45); } }
@keyframes rr-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes rr-nudge-glow { 0%, 100% { box-shadow: 0 0 0 3px var(--rr-p-yellow), 0 0 0 5px var(--rr-p-navy); } 50% { box-shadow: 0 0 0 6px var(--rr-p-yellow), 0 0 0 8px var(--rr-p-navy); } }

@media (prefers-reduced-motion: reduce) {
  .rr-coin-label, .rr-hs-title, .rr-slot-input:focus, .rr-toast, .rr-faces.rr-faces-nudge { animation: none; }
  .rr-coin, .rr-toast-out, .rr-face { transition: none; }
  .rr-face:hover, .rr-face:active { transform: none; }
}

@media (max-width: 520px) {
  .rr-player-frame { border-width: 3px; border-radius: 8px; }
  .rr-cover-judge, .rr-cover-hint { display: none; }
  .rr-coin { padding: 12px 18px 10px; }
  .rr-coin-label { font-size: 15px; }
  .rr-slot-input { font-size: 28px; }
  .rr-stars label { font-size: 28px; }
  .rr-deck { padding: 5px 6px; gap: 6px; }
  .rr-faces-label { display: none; }
}
