/* Mobile Arcade v0.4 — compact game shelf and a viewport-filling player. */
:root {
  color-scheme: dark;
  --bg: #100d20;
  --panel: #1c172e;
  --panel-hover: #241c39;
  --line: #352b48;
  --purple: #b7a3ef;
  --pink: #f794bf;
  --gold: #ffd38c;
  --text: #f7f0ff;
  --muted: #b7acc8;
  --quiet: #9184a6;
  --gutter: clamp(16px, 3vw, 28px);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Avenir Next", Avenir, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body {
  min-width: 260px;
  margin: 0;
  background: radial-gradient(ellipse at 65% 0, #291a3b 0, transparent 550px), var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}
::selection { color: var(--bg); background: var(--gold); }

.header-inner, #arcade-home, .footer-inner { max-width: 1100px; margin-inline: auto; }
.header-inner, .hero, .section, .about, .footer-inner {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.top {
  position: relative;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid #44334e;
  background: #130f23e6;
}
.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  white-space: nowrap;
  font: 800 19px/1 var(--mono);
  letter-spacing: -1.1px;
}
.logo .mark { color: var(--gold); font-size: 26px; margin-right: 9px; }
.logo .brand-name { color: var(--text); }
.logo .brand-name > span { color: var(--gold); }
.logo small { color: var(--purple); font-size: 10px; letter-spacing: -.4px; margin-left: 3px; }
.top nav { display: flex; align-items: center; gap: 9px; }
.top nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 8px 11px;
  border-radius: 5px;
  color: #d9cee9;
  font-size: 13px;
  font-weight: 600;
}
.skip-link {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 20;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 5px;
  background: var(--gold);
  color: var(--bg);
  font-weight: 700;
}
.skip-link:focus { transform: translateY(0); }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: 40px;
  padding-bottom: 32px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--purple);
  font: 700 10px/1.4 var(--mono);
  letter-spacing: 1.6px;
}
.live-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  background: var(--gold);
  box-shadow: 0 0 10px #ffd38c45;
}
.hero h1 {
  position: relative;
  z-index: 1;
  margin: 12px 0 10px;
  font-size: clamp(32px, 4.7vw, 52px);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -1.8px;
}
.hero h1 span, .hero h1 em { display: block; }
.hero h1 em { color: var(--gold); font-style: normal; }
.hero-copy { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: 15px; }
.hero-spark {
  position: absolute;
  z-index: -1;
  right: 40px;
  top: 5px;
  color: #4b345a;
  opacity: .45;
  font: 200px/1 var(--sans);
  transform: rotate(9deg);
  pointer-events: none;
}

.section { padding-top: 28px; padding-bottom: 0; scroll-margin-top: 16px; }
.game-collection { padding-top: 10px; }
.sectionhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 16px;
}
.sectionhead h2, .about h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: .6px;
}
.collection-count { margin: 0; color: var(--muted); font: 11px/1.4 var(--mono); white-space: nowrap; }
.collection-count > span:first-child { color: var(--gold); }
.collection-count > span[aria-hidden] { margin-inline: 3px; color: var(--quiet); }
.section-meta { color: var(--quiet); font: 10px/1.4 var(--mono); letter-spacing: .7px; white-space: nowrap; }
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 250px));
  gap: 20px;
  align-items: stretch;
}
.gamecard {
  min-width: 0;
  border: 1px solid #44324f;
  border-radius: 9px;
  background: var(--panel);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.game-link { display: flex; height: 100%; flex-direction: column; border-radius: 8px; }
.game-link:focus-visible { outline-offset: 5px; }
.poster {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #46324e;
  background: #171125;
}
.gameplay-poster { display: block; width: 100%; height: 100%; object-fit: cover; }
.cardinfo { display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: 13px 14px 14px; }
.cardinfo h3 { margin: 0 0 3px; font-size: 17px; font-weight: 750; line-height: 1.25; letter-spacing: -.25px; }
.cardinfo p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.play {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 5px 9px;
  border: 1px solid #7c5c4d;
  border-radius: 4px;
  background: #352634;
  color: var(--gold);
  font: 800 11px/1.3 var(--mono);
  letter-spacing: .7px;
  white-space: nowrap;
}
.empty-state { grid-column: 1 / -1; margin: 0; padding: 18px 0; color: var(--muted); font-size: 14px; }

.scores-section { margin-top: 20px; padding-top: 28px; }
.local-scores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 520px; }
.local-score-card { min-width: 0; padding: 15px 16px; border: 1px solid var(--line); border-radius: 7px; background: #191427; }
.local-score-card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 650; line-height: 1.3; }
.score-label { margin: 0 0 5px; color: var(--quiet); font: 10px/1.4 var(--mono); letter-spacing: .6px; text-transform: uppercase; }
.score-value { display: block; margin: 0; color: var(--gold); font: 700 clamp(22px, 4vw, 28px)/1.1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.7px; overflow-wrap: anywhere; }
.score-detail { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.score-note { max-width: 520px; margin: 11px 0 0; color: var(--quiet); font-size: 11px; line-height: 1.5; }
.about {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-top: 38px;
  padding-top: 28px;
  padding-bottom: 36px;
  border-top: 1px solid var(--line);
}
.about-mark { flex: 0 0 auto; color: var(--gold); font: 31px/1 var(--sans); }
.about h2 { font-size: 14px; letter-spacing: .5px; }
.about p { max-width: 660px; margin: 8px 0 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.site-footer { border-top: 1px solid var(--line); background: #100c1c; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-top: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}
.footer-inner p { margin: 0; color: var(--quiet); font-size: 11px; }
.footer-inner p:last-child { display: flex; align-items: center; gap: 14px; }
.footer-free { color: var(--muted); font: 9px/1.4 var(--mono); letter-spacing: .6px; }
.version { color: var(--quiet); font: 10px/1.4 var(--mono); }

/* The player occupies the viewport. The toolbar is a real layout row, so
   its controls never obscure the iframe and the page retains its scroll position. */
body.game-active { overflow: hidden; overscroll-behavior: none; }
html:has(body.game-active) { overflow: hidden; overscroll-behavior: none; }
#play-game {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
  background: #0a0816;
}
#play-game:fullscreen { width: 100%; height: 100%; max-width: none; max-height: none; border: 0; }
#play-game::backdrop { background: #0a0816; }
.game-toolbar {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: max(6px, env(safe-area-inset-top)) 10px 6px;
  border-bottom: 1px solid #392b48;
  background: #171124;
}
.game-actions { display: flex; align-items: center; gap: 6px; }
.toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid #4d3b60;
  border-radius: 6px;
  background: #251c35;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  touch-action: manipulation;
}
.toolbar-button svg { display: block; flex: 0 0 20px; width: 20px; height: 20px; }
.arcade-back { padding-left: 7px; color: var(--gold); }
.fullscreen-toggle { width: 44px; flex: 0 0 44px; }
.toolbar-button[aria-pressed="true"] { border-color: #92745c; background: #342735; color: var(--gold); }
.now-playing { min-width: 0; }
#now-playing-title { margin: 0; overflow: hidden; color: #e7dcf5; font: 700 12px/1.35 var(--mono); letter-spacing: .6px; text-overflow: ellipsis; white-space: nowrap; }
#fullscreen-note { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.3; }
#fullscreen-note:empty { display: none; }
.game-viewport {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #0a0816;
}
#embedded-game {
  display: block;
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: #0a0816;
}
.game-status {
  z-index: 1;
  display: flex;
  grid-area: 1 / 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 24px;
  overflow: auto;
  background: #100d20;
  text-align: center;
}
.status-spark { color: var(--gold); font-size: 40px; line-height: 1; }
#game-status-title { max-width: 440px; margin: 16px 0 0; font-size: 20px; line-height: 1.3; }
#game-status-message { max-width: 400px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.retry-button { min-height: 44px; margin-top: 20px; padding: 10px 20px; border: 1px solid var(--gold); border-radius: 6px; background: var(--gold); color: #24182a; font-weight: 750; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (hover: hover) {
  .top nav a:hover { background: #2b2039; color: var(--gold); }
  .gamecard:hover { border-color: #ae81a3; background: var(--panel-hover); transform: translateY(-3px); }
  .gamecard:hover .play { border-color: var(--gold); background: #48313f; }
  .toolbar-button:hover { border-color: #9e829f; background: #352541; }
  .retry-button:hover { background: #ffe0aa; }
}

@media (min-width: 700px) {
  .cards { grid-template-columns: repeat(3, minmax(0, 250px)); }
  .local-scores { grid-template-columns: repeat(3, minmax(0, 250px)); gap: 20px; max-width: 790px; }
  .hero h1 span, .hero h1 em { display: inline; }
  .hero h1 { line-height: 1.12; }
}

@media (min-width: 1040px) {
  .cards { grid-template-columns: repeat(4, minmax(0, 250px)); }
}

@media (max-width: 650px) {
  .header-inner { min-height: 60px; gap: 8px; }
  .logo { font-size: 14px; letter-spacing: -.8px; }
  .logo .mark { margin-right: 6px; font-size: 21px; }
  .logo small { display: none; }
  .top nav { gap: 0; }
  .top nav a { padding-inline: 8px; font-size: 12px; }
  .hero { padding-top: 24px; padding-bottom: 25px; }
  .hero h1 { max-width: 360px; font-size: clamp(32px, 8.5vw, 39px); letter-spacing: -1.2px; }
  .hero-copy { font-size: 13px; }
  .hero-spark { right: 14px; top: 5px; font-size: 160px; opacity: .3; }
  .sectionhead { gap: 9px; margin-bottom: 13px; }
  .sectionhead h2 { font-size: 14px; letter-spacing: .4px; }
  .collection-count { font-size: 9px; }
  .collection-count > span[aria-hidden] { margin-inline: 1px; }
  .section-meta { font-size: 8px; letter-spacing: .4px; }
  .cards { gap: 12px; }
  .cardinfo { padding: 10px 10px 11px; }
  .cardinfo h3 { font-size: 15px; letter-spacing: -.25px; }
  .cardinfo p { font-size: 11px; }
  .play { margin-top: 10px; padding: 4px 8px; font-size: 10px; }
  .scores-section { margin-top: 10px; padding-top: 27px; }
  .local-score-card { padding: 12px; }
  .local-score-card h3 { margin-bottom: 9px; font-size: 12px; }
  .score-detail { font-size: 11px; }
  .score-note { font-size: 10px; }
  .about { margin-top: 28px; padding-top: 23px; padding-bottom: 28px; gap: 12px; }
  .about h2 { font-size: 12px; }
  .about p { font-size: 12px; }
  .about-mark { font-size: 27px; }
  .footer-inner { gap: 10px; padding-top: 16px; }
  .footer-inner p { font-size: 10px; }
  .footer-inner p:last-child { gap: 9px; }
  .footer-free { font-size: 8px; letter-spacing: 0; }
  .version { font-size: 9px; }
  .game-toolbar { gap: 10px; padding-inline: 7px; }
  #now-playing-title { font-size: 10px; letter-spacing: .2px; }
}

@media (max-width: 339px) {
  .top nav a { padding-inline: 6px; font-size: 11px; }
  .logo { font-size: 12px; }
  .logo .mark { margin-right: 4px; font-size: 18px; }
  .hero h1 { font-size: 30px; }
  .sectionhead { flex-wrap: wrap; gap: 5px 12px; }
  .cards { grid-template-columns: minmax(0, 250px); justify-content: center; }
  .local-scores { grid-template-columns: minmax(0, 1fr); }
  .footer-inner { flex-wrap: wrap; }
  .game-toolbar { gap: 7px; }
  .game-actions { gap: 4px; }
  .arcade-back { padding-right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
