:root {
  color-scheme: light;
  --bg: #fff;
  --surface: #f3f5f7;
  --ink: #202730;
  --muted: #596572;
  --accent: #2458c6;
  --line: #e3e7eb;
  --ranking-highlight: #eaf0fc;
  --ranking-medal: #f3eddd;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --radius-feature: 20px;
  --radius-cover: 14px;
  --radius-control: 12px;
  --gutter: 20px;
  --app-max-width: 430px;
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { width: 100%; max-width: var(--app-max-width); margin-inline: auto; background: var(--bg); }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; border: 0; min-width: 44px; min-height: 44px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
html[data-input-mode="pointer"] :is(button, a, summary):focus { outline: none; }
button:active { opacity: .8; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { overflow-wrap: anywhere; }
img { display: block; width: 100%; object-fit: cover; }
#catalog, #ranking { height: 100%; overflow-y: auto; overscroll-behavior-y: contain; }
.catalog-header { padding: 18px var(--gutter) 17px; display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 27px; line-height: 1.12; letter-spacing: -.7px; font-weight: 750; }
.ranking-link { padding: 0 8px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; border-radius: var(--radius-control); }
.featured { position: relative; margin: 0 var(--gutter); border-radius: var(--radius-feature); background: var(--surface); overflow: hidden; }
.feature-media { position: relative; aspect-ratio: 4/3; background: var(--surface); overflow: hidden; }
.feature-media > img, .feature-media > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.feature-copy { padding: 16px 18px 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.recommendation { font-size: 12px; font-weight: 600; color: var(--muted); }
.feature-copy h2 { font-size: 25px; line-height: 1.12; letter-spacing: -.6px; }
.feature-open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; background: transparent; border-radius: var(--radius-feature); }
.feature-open:focus-visible { outline-offset: -3px; }
.feature-open:active { background: #2027300a; }
.feature-rank { position: relative; z-index: 2; display: flex; align-items: center; gap: 5px; padding: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; font-size: 13px; white-space: nowrap; }
.rank-action { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; color: var(--ink); }
.feature-play-cue { position: absolute; top: 18px; left: 18px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg); color: var(--ink); font-size: 11px; box-shadow: 0 2px 10px #0002; }
.variant-b .featured { display: grid; grid-template-columns: 42% minmax(0, 1fr); padding: 12px; gap: 14px; align-items: center; }
.variant-b .feature-media { border-radius: 10px; }
.variant-b .feature-copy { min-width: 0; padding: 0; }
.variant-b .feature-copy h2 { font-size: 20px; letter-spacing: -.4px; }
.variant-b .recommendation { font-size: 11px; }
.variant-b .feature-rank { font-size: 12px; }
.variant-b .feature-play-cue { top: 20px; left: 20px; width: 26px; height: 26px; font-size: 10px; }
.media-toggle { position: absolute; z-index: 2; right: 8px; bottom: 8px; width: 44px; height: 44px; border-radius: 50%; background: var(--bg); }
.collection { padding: 24px var(--gutter); }
.section-heading { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.section-heading h2 { font-size: 20px; letter-spacing: -.5px; line-height: 1.25; }
.section-heading > span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.filters { display: flex; gap: 5px; margin: 13px 0 6px; flex-wrap: wrap; }
.filters button { padding: 0 12px; border-radius: var(--radius-control); background: transparent; color: var(--muted); font-size: 13px; font-weight: 550; }
.filters button[aria-pressed=true] { background: var(--ink); color: var(--bg); }
.games { display: grid; grid-template-columns: repeat(var(--catalog-columns, 3), minmax(0, 1fr)); gap: 18px 12px; margin-top: 18px; }
.game { min-width: 0; }
.cover-button { display: block; padding: 0; width: 100%; aspect-ratio: 1; background: var(--surface); border-radius: var(--radius-cover); overflow: hidden; }
.cover-button img { height: 100%; aspect-ratio: 1; }
.game h3 { margin-top: 8px; font-size: 13px; line-height: 1.3; font-weight: 650; letter-spacing: -.15px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; padding: 8px; color: var(--muted); background: var(--surface); font-size: 12px; text-align: center; }
.game-entry { position: fixed; inset: auto 0 0; width: 100%; max-width: var(--app-max-width); margin: 0 auto; max-height: calc(100% - 20px); overflow-y: auto; border: 0; border-radius: 24px 24px 0 0; padding: 24px 20px 20px; background: var(--bg); color: var(--ink); font-family: var(--font); box-shadow: 0 -10px 40px #0002; }
.game-entry::backdrop { background: #0c192433; }
.game-entry h2 { font-size: 23px; letter-spacing: -.5px; line-height: 1.2; padding-right: 40px; margin-top: 7px; }
.sheet-close { position: absolute; top: 12px; right: 10px; width: 44px; height: 44px; background: transparent; border-radius: 50%; font-size: 27px; line-height: 1; color: var(--muted); }
.sheet-period { font-size: 12px; line-height: 1.5; color: var(--muted); margin: 10px 0 18px; }
.sheet-period:last-child { margin-bottom: 0; }
.leaderboard { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.leaderboard caption { text-align: left; font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.leaderboard th { font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 8px 12px; text-align: left; }
.leaderboard td { padding: 13px 8px; border-top: 1px solid var(--line); }
.leaderboard th:last-child, .leaderboard td:last-child { text-align: right; white-space: nowrap; }
.leaderboard td:first-child { color: var(--muted); width: 52px; }
.leaderboard .current-player { background: var(--ranking-highlight); color: var(--accent); font-weight: 700; }
.sheet-leaders { font-size: 13px; color: var(--muted); margin-top: 8px; }
.sheet-leaders summary { padding: 13px 0; min-height: 44px; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#ranking { background: var(--surface); }
.ranking-header { display: flex; gap: 10px; align-items: center; padding: 16px var(--gutter) 18px; }
.ranking-header > button { width: 44px; flex-shrink: 0; background: transparent; border-radius: var(--radius-control); font-size: 23px; margin-left: -8px; }
.ranking-header h1 { font-size: 27px; letter-spacing: -.6px; line-height: 1.15; }
.ranking-header p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ranking-tabs { display: flex; gap: 3px; padding: 3px; background: var(--line); border-radius: var(--radius-control); margin: 0 var(--gutter) 20px; }
.ranking-tabs button { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--muted); background: transparent; border-radius: calc(var(--radius-control) - 3px); }
.ranking-tabs button[aria-pressed=true] { color: var(--ink); background: var(--bg); box-shadow: 0 1px 3px #00000012; }
.ranking-standings, .ranking-game-picker { padding: 0 var(--gutter); }
.rank-personal { display: flex; align-items: center; gap: 10px; padding: 14px 12px; border-radius: var(--radius-cover); background: var(--ranking-highlight); margin-bottom: 24px; font-variant-numeric: tabular-nums; }
.personal-position { min-width: 32px; font-size: 27px; font-weight: 700; text-align: center; color: var(--accent); line-height: 1; }
.personal-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.personal-label strong { font-size: 14px; font-weight: 650; }
.personal-label span { font-size: 12px; color: var(--muted); }
.personal-score { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.personal-score strong { font-size: 19px; line-height: 1.15; letter-spacing: -.4px; }
.personal-score span { font-size: 11px; color: var(--muted); }
.ranking-board { width: 100%; border-spacing: 0; background: var(--bg); border-radius: var(--radius-cover); font-size: 14px; font-variant-numeric: tabular-nums; }
.ranking-board caption { text-align: left; font-size: 17px; letter-spacing: -.3px; font-weight: 650; padding-bottom: 12px; }
.ranking-board td { padding: 12px 0; border-top: 1px solid var(--line); }
.ranking-board tr:first-child td { border-top: 0; }
.ranking-board tr:first-child td:first-child { border-top-left-radius: var(--radius-cover); }
.ranking-board tr:first-child td:last-child { border-top-right-radius: var(--radius-cover); }
.ranking-board tr:last-child td:first-child { border-bottom-left-radius: var(--radius-cover); }
.ranking-board tr:last-child td:last-child { border-bottom-right-radius: var(--radius-cover); }
.ranking-board td:first-child { width: 42px; padding-left: 7px; padding-right: 7px; text-align: center; color: var(--muted); }
.rank-number { display: inline-grid; place-items: center; min-width: 26px; height: 26px; font-size: 12px; }
.rank-number.leading { border-radius: 50%; background: var(--ranking-medal); color: var(--ink); font-weight: 650; }
.ranking-person { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ranking-person > span:last-child { overflow-wrap: anywhere; line-height: 1.35; }
.ranking-avatar { display: grid; place-items: center; width: 32px; height: 32px; flex-shrink: 0; background: var(--surface); border-radius: 50%; font-size: 10px; color: var(--muted); font-weight: 600; }
.ranking-board .ranking-score { text-align: right; font-size: 14px; font-weight: 600; white-space: nowrap; padding-left: 8px; padding-right: 12px; }
.ranking-board .current-player { background: var(--ranking-highlight); }
.ranking-board .current-player .ranking-person { font-weight: 650; }
.ranking-board .current-player .ranking-avatar { background: var(--bg); color: var(--accent); }
.ranking-rules { font-size: 13px; line-height: 1.6; color: var(--muted); margin-top: 12px; }
.ranking-rules summary { cursor: pointer; min-height: 44px; padding: 12px 0; font-size: 12px; }
.ranking-rules p { padding-bottom: 10px; }
.ranking-demo-note { font-size: 11px; color: var(--muted); text-align: center; padding: 20px var(--gutter) 24px; }
.ranking-game-context { margin-top: -6px; margin-bottom: 18px; }
.ranking-game-context > button { background: transparent; font-size: 13px; color: var(--muted); padding: 0 8px; margin-left: -8px; margin-bottom: 8px; border-radius: var(--radius-control); }
.ranking-game-context > div { display: flex; align-items: center; gap: 12px; }
.ranking-game-context img { width: 48px; height: 48px; border-radius: 10px; flex-shrink: 0; }
.ranking-game-context h2 { font-size: 19px; line-height: 1.25; letter-spacing: -.4px; }
#ranking-game-list { background: var(--bg); border-radius: var(--radius-cover); overflow: hidden; }
.ranking-game-choice { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; background: transparent; text-align: left; border-bottom: 1px solid var(--line); }
.ranking-game-choice:last-child { border-bottom: 0; }
.ranking-game-choice:focus-visible { outline-offset: -3px; }
.ranking-game-choice > img { width: 46px; height: 46px; flex-shrink: 0; border-radius: 10px; }
.ranking-game-choice > span { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ranking-game-choice strong { font-size: 14px; line-height: 1.3; font-weight: 600; overflow-wrap: anywhere; }
.ranking-game-choice > span > span { font-size: 12px; color: var(--muted); }
.game-screen { height: 100%; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.game-toolbar { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 6px; padding: 2px 6px; border-bottom: 1px solid var(--line); }
.game-toolbar button { background: transparent; padding: 0 8px; border-radius: var(--radius-control); font-size: 13px; flex-shrink: 0; }
.game-toolbar #game-back { width: 36px; height: 36px; min-height: 36px; padding: 0; font-size: 25px; line-height: 1; }
.game-toolbar > span { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); text-align: center; }
.game-heading { display: flex; flex-direction: column; align-items: center; }
.game-toolbar #launch-diagnostics { min-height: 0; font-size: 9px; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow-x: auto; padding: 0; max-width: 100%; font-variant-numeric: tabular-nums; }
.game-container { flex: 1; min-height: 0; }
.game-container iframe { display: block; width: 100%; height: 100%; border: 0; }
.game-help { position: absolute; top: 65px; left: 16px; right: 16px; padding: 16px; border-radius: var(--radius-control); background: var(--surface); font-size: 14px; line-height: 1.5; }
.game-help button, .game-help a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; margin-top: 10px; border-radius: var(--radius-control); color: var(--ink); background: var(--bg); font: inherit; }
@media (max-width: 370px) { :root { --gutter: 16px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.confirm-action { width: calc(100% - 32px); max-width: calc(var(--app-max-width) - 32px); max-height: calc(100% - 32px); overflow-y: auto; padding: 24px; border: 0; border-radius: var(--radius-feature); background: var(--bg); color: var(--ink); font: inherit; }
.confirm-action::backdrop { background: #0c192466; }
.confirm-action h2 { font-size: 22px; letter-spacing: -.4px; }
.confirm-action p { margin-top: 12px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.confirm-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.confirm-buttons button { border-radius: var(--radius-control); padding: 10px 16px; min-height: 48px; font-size: 14px; font-weight: 600; }
#confirm-cancel { background: var(--accent); color: var(--bg); }
#confirm-accept { background: var(--surface); color: var(--ink); }

.diagnostics-report { margin: auto; width: calc(100% - 32px); max-width: 398px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--bg); color: var(--ink); }
.diagnostics-report::backdrop { background: #0c192466; }
.diagnostics-report textarea { display: block; width: 100%; height: 40vh; margin-bottom: 12px; font: 12px monospace; }
.diagnostics-report button { margin-right: 8px; padding: 8px; }
