:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05060a;
  color: #f4f7fb;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 246, 255, 0.1), transparent 32rem),
    #05060a;
}

.player-nav {
  min-height: 58px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #27303d;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.player-nav a { color: #dfff00; text-decoration: none; }
.player-nav a:last-child { justify-self: end; }
.player-nav span { color: #8d9aab; }
.player-breadcrumb {
  width: min(100% - 32px, 1440px);
  margin: 12px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #8d9aab;
  font-size: 12px;
}
.player-breadcrumb a { color: #00f6ff; }

.player {
  width: min(100%, 1440px);
  min-height: calc(100vh - 58px);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  align-items: center;
  gap: 24px;
}

.player--portrait {
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 56vh) minmax(180px, 1fr);
}

.player--landscape {
  grid-template-columns: 1fr 1fr;
  align-content: start;
}

.player--landscape .player-stage {
  grid-column: 1 / -1;
  width: min(100%, 1100px);
  aspect-ratio: var(--game-aspect, 16 / 9);
  justify-self: center;
}

.player--landscape .player-info { align-self: start; }

.player-info {
  min-width: 0;
  padding: clamp(18px, 2.5vw, 34px);
  border: 1px solid #27303d;
  background: rgba(11, 14, 20, 0.86);
}

.player-info h1 {
  margin: 8px 0 16px;
  font-size: clamp(28px, 4vw, 58px);
  line-height: 0.95;
}

.player-info p { color: #aab5c5; line-height: 1.6; }
.player-label { color: #00f6ff !important; font-size: 11px; letter-spacing: 0.14em; }
.player-back { display: inline-block; margin-top: 18px; color: #dfff00; text-decoration: none; }

.player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--game-aspect, 9 / 16);
  max-height: calc(100vh - 106px);
  overflow: hidden;
  justify-self: center;
  background: #0b0e14;
  border: 1px solid #3b4656;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.player-stage iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  background: #0b0e14;
  overflow: hidden;
}

.player-fullscreen-toggle {
  position: absolute;
  z-index: 8;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  min-height: 42px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(113, 225, 255, .72);
  border-radius: 12px;
  color: #effcff;
  background: rgba(3, 11, 28, .78);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .34), inset 0 1px rgba(255, 255, 255, .13);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font: 700 11px/1 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .08em;
  cursor: pointer;
  touch-action: manipulation;
}
.player-fullscreen-toggle > span:first-child { font-size: 20px; line-height: .8; }
.player-fullscreen-toggle:focus-visible { outline: 3px solid #dfff00; outline-offset: 3px; }
.player-fullscreen-toggle[aria-pressed="true"] {
  border-color: rgba(255, 224, 112, .82);
  color: #fff1a8;
}

/* Jump's portrait result title uses the full top line. Keep fullscreen
   available outside runs without laying a text-width control over that title. */
#player[data-game-id="jump-to-the-moon"] .player-fullscreen-toggle {
  width: 52px;
  min-width: 52px;
  min-height: 52px;
  padding: 0;
  justify-content: center;
}
#player[data-game-id="jump-to-the-moon"] .player-fullscreen-toggle [data-player-fullscreen-label] {
  display: none;
}

.player-stage:fullscreen,
.player-stage:-webkit-full-screen {
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  border: 0;
  aspect-ratio: auto;
  background: #020611;
}

body.player-immersive {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #020611;
}
body.player-immersive .player-nav,
body.player-immersive .player-breadcrumb,
body.player-immersive .player-info,
body.player-immersive .player-content,
body.player-immersive .game-gallery,
body.player-immersive .network-footer,
body.player-immersive #player-result {
  display: none !important;
}
body.player-immersive .player {
  position: fixed;
  z-index: 1000;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 0;
  display: block;
}
body.player-immersive .player-stage {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  aspect-ratio: auto;
  box-shadow: none;
}

.player-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 24px;
  background: #0b0e14;
  color: #aab5c5;
  text-align: center;
  pointer-events: none;
}

.player-status--recovery {
  grid-template-columns: auto auto;
  gap: 12px;
  padding: 24px;
  background: rgba(11, 14, 20, .94);
  pointer-events: auto;
}
.player-status--recovery span { grid-column: 1 / -1; }
.player-status--recovery button,
.player-status--recovery a {
  padding: 10px 14px;
  border: 1px solid #dfff00;
  color: #dfff00;
  background: transparent;
  cursor: pointer;
}

.player--error { grid-template-columns: minmax(0, 640px); justify-content: center; }
.player--error .player-info--right { display: none; }

.player-content { width: min(100% - 32px, 76ch); margin: 0 auto 64px; color: #aab5c5; line-height: 1.7; }
.player-content h2 { margin-top: 32px; color: #f4f7fb; }
.player-content li { margin-block: 8px; }
.player-content a:focus-visible, .player-info button:focus-visible { outline: 3px solid #dfff00; outline-offset: 3px; }
.player-content details { padding: 12px 0; border-bottom: 1px solid #27303d; }
.game-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 28px 0; }
.game-facts div { padding: 16px; border: 1px solid #27303d; background: #0b0e14; }
.game-facts dt { color: #00f6ff; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.game-facts dd { margin: 8px 0 0; }
.game-gallery { width: min(100% - 32px, 1180px); margin: 48px auto; }
.game-gallery h2 { text-align: center; }
.game-gallery > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.game-gallery figure { margin: 0; padding: 10px; border: 1px solid #27303d; background: #0b0e14; }
.game-gallery img { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; }
body:has(.player[data-game-id="penalty-signal-nations"]) .game-gallery img { aspect-ratio: 16 / 10; }
.game-gallery figcaption { padding: 12px 4px 4px; color: #aab5c5; line-height: 1.5; }
.player-info button { width: 100%; min-height: 44px; margin-top: 10px; padding: 12px; border: 1px solid #3b4656; background: #111722; color: #f4f7fb; }
#related-games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#related-games a { padding: 14px; border: 1px solid #27303d; color: #dfff00; text-decoration: none; }
#player-result { position: fixed; z-index: 10; inset: auto 16px 16px; width: min(440px, calc(100% - 32px)); margin-left: auto; padding: 22px; border: 1px solid #00f6ff; background: #0b0e14; box-shadow: 0 24px 80px #000; }
#player-result button, #game-leaderboard button { min-height: 44px; padding: 10px 14px; border: 1px solid #3b4656; background: #111722; color: #f4f7fb; }
#game-leaderboard { width: min(620px, calc(100% - 24px)); max-height: 80vh; border: 1px solid #00f6ff; background: #0b0e14; color: #f4f7fb; }
#game-leaderboard::backdrop { background: rgba(0, 0, 0, .75); }
#leaderboard-periods { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
#game-leaderboard-list { padding-left: 28px; line-height: 2; }

.network-footer {
  padding: 34px 24px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, auto) minmax(280px, 1fr);
  align-items: end;
  gap: 24px;
  border-top: 1px solid #27303d;
  color: #8d9aab;
  background: #05060a;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: .04em;
}
.network-footer__brand,
.network-footer__legal { display: grid; gap: 6px; }
.network-footer strong,
.network-footer [data-legal-operator] { color: #f4f7fb; }
.network-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 18px; }
.network-footer a { color: #a995ff; text-decoration: none; }
.network-footer p { margin: 0; text-align: right; }

@media (min-width: 1100px) {
  .player--landscape {
    width: min(100%, 1440px);
    min-height: calc(100vh - 58px);
    padding: 12px;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 26vw);
    grid-template-rows: auto 1fr;
    align-content: start;
  }

  .player--landscape .player-stage {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 100%;
    max-height: calc(100vh - 82px);
    align-self: start;
  }

  .player--landscape .player-info {
    padding: 14px 16px;
  }

  .player--landscape .player-info--left { grid-column: 2; grid-row: 1; }
  .player--landscape .player-info--right { grid-column: 2; grid-row: 2; }
  .player--landscape .player-info h1 { margin: 3px 0 7px; font-size: clamp(26px, 2.5vw, 38px); }
  .player--landscape .player-info p { margin-block: 6px; line-height: 1.42; }
  .player--landscape .player-back { margin-top: 6px; }
  .player--landscape .player-info button { width: auto; margin: 5px 5px 0 0; padding: 8px 10px; }
  .player--landscape + .player-content { margin-top: 12px; margin-bottom: 40px; line-height: 1.55; }
  .player--landscape + .player-content h2 { margin-top: 22px; }
  .player--landscape + .player-content li { margin-block: 5px; }

  .player--landscape[data-game-id="penalty-signal-nations"] {
    width: min(100%, 1600px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto;
  }

  .player--landscape[data-game-id="penalty-signal-nations"] .player-stage {
    --penalty-stage-height: min(calc(100svh - 82px), 860px, calc((100vw - 24px) / 1.6));
    grid-column: 1 / -1;
    grid-row: 1;
    width: min(100%, calc(var(--penalty-stage-height) * 1.6));
    height: var(--penalty-stage-height);
    max-height: none;
    aspect-ratio: 16 / 10;
    justify-self: center;
  }

  .player--landscape[data-game-id="penalty-signal-nations"] .player-info--left { grid-column: 1; grid-row: 2; }
  .player--landscape[data-game-id="penalty-signal-nations"] .player-info--right { grid-column: 2; grid-row: 2; }
}

@media (min-width: 861px) and (max-width: 1099px) {
  .player--landscape {
    padding: 12px;
    gap: 12px;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
    align-content: start;
  }
  .player--landscape .player-stage { grid-column: 1 / -1; grid-row: 1; width: min(100%, 960px); }
  .player--landscape .player-info { padding: 16px 18px; }
  .player--landscape .player-info--left { grid-column: 1; grid-row: 2; }
  .player--landscape .player-info--right { grid-column: 2; grid-row: 2; }
  .player--landscape .player-info h1 { margin: 4px 0 8px; font-size: 34px; }
  .player--landscape .player-info p { margin-block: 7px; line-height: 1.45; }
  .player--landscape .player-info button { width: auto; margin: 6px 6px 0 0; padding: 9px 12px; }

  .player--landscape[data-game-id="penalty-signal-nations"] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .player--landscape[data-game-id="penalty-signal-nations"] .player-stage {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
  }
  .player--landscape[data-game-id="penalty-signal-nations"] .player-info--left { grid-column: 1; grid-row: 2; }
  .player--landscape[data-game-id="penalty-signal-nations"] .player-info--right { grid-column: 2; grid-row: 2; }
}

@media (max-width: 860px) {
  .player-nav { padding: 0 14px; grid-template-columns: auto 1fr auto; }
  .player-nav span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .player { padding: 12px; gap: 12px; }
  .player--portrait,
  .player--landscape { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .player--portrait .player-stage,
  .player--landscape .player-stage { grid-column: 1; grid-row: 1; max-height: none; }
  .player--portrait .player-stage { width: auto; height: min(66svh, 600px); max-width: 100%; }
  .player-fullscreen-toggle { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); }
  .player--landscape[data-game-id="penalty-signal-nations"] .player-stage {
    width: 100%;
    height: min(76svh, 720px);
    aspect-ratio: auto;
  }
  .player-info { padding: 12px 14px; }
  .player-info--left { grid-column: 1; grid-row: 2; }
  .player-info--right { grid-column: 1; grid-row: 3; }
  .player-info h1 { margin: 2px 0 6px; font-size: 25px; }
  .player-info p { margin: 5px 0; line-height: 1.35; }
  #player-description { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .player-info--left > p:not(.player-label):not(#player-description) {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
  .player-label { margin-top: 0 !important; }
  .player-back { margin-top: 6px; }
  #related-games { grid-template-columns: 1fr; }
  .game-facts { grid-template-columns: 1fr; }
  .game-gallery > div { grid-template-columns: 1fr; }
  .network-footer {
    padding: 30px 16px;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 22px;
  }
  .network-footer nav { justify-content: flex-start; }
  .network-footer p { text-align: left; }
}
/* Legal identity remains outside the playable stage and does not intercept game input. */
.legal-operator-footer {
  padding: 24px;
  color: #91a6b8;
  background: #05060a;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  text-align: center;
}

.legal-operator-footer p { margin: 4px 0; }
.legal-operator-footer [data-legal-operator] { color: #eefcff; font-weight: 700; }
