/* ZANOKA RUNNER LITE's own page, /runner/ (owner, 11 Oct 2026: "PUT ZANOKA RUNNER LITE AS A TAB PEOPLE CAN PRESS ON
   THE NORMAL WEBSITE TOO AND PLAY IT. AND THEY SHOULD BE ABLE TO PLAY IT ON MOBILE TOO"). The game is /404-game.js, the
   same file the 404 page uses; /runner.js adds the full-screen button. External file because the page's CSP allows no
   inline styles. The game fits any canvas shape: wider shows more of the course, taller adds sky. */

.runner-main {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.runner-main::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  background:
    radial-gradient(ellipse 60% 50% at 50% 38%, rgba(64, 140, 255, .16), transparent 70%),
    radial-gradient(ellipse 45% 40% at 14% 20%, rgba(108, 231, 255, .08), transparent 70%),
    linear-gradient(180deg, #050915 0%, #071127 52%, #050915 100%);
}

.runner-main::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: .5;
  background-image:
    radial-gradient(circle, rgba(220, 240, 255, .7) .7px, transparent 1.2px),
    radial-gradient(circle, rgba(170, 215, 255, .45) .6px, transparent 1.1px);
  background-position: 0 0, 37px 61px;
  background-size: 97px 89px, 151px 137px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
}

/* The page starts just under the fixed Steam bar and header (--header-offset is the header's height + 28 px, kept up
   to date by script.js; the bar is already a spacer in the page flow), so the header never covers the game. */
.runner-wrap {
  padding-block: calc(var(--header-offset, 112px) + 6px) clamp(56px, 7vw, 96px);
}

.runner-head {
  max-width: 56rem;
  margin: 0 0 clamp(14px, 2vw, 22px);
}

.runner-head .eyebrow { margin: 0 0 14px; }

.runner-title {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -.01em;
}

.runner-title em {
  font-style: normal;
  color: var(--blue, #6ce7ff);
}

.runner-nowrap { white-space: nowrap; }

.runner-lede {
  max-width: 52rem;
  margin: 0;
  color: var(--muted, #a5b8cd);
  font-size: 1.06rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.runner-lede strong { color: var(--gold, #ffd77a); white-space: nowrap; }

/* The game panel */
.runner-play {
  max-width: 1060px;
  padding: clamp(12px, 1.8vw, 20px);
  border: 1px solid rgba(123, 239, 255, .18);
  border-radius: var(--ui-radius-lg, 18px);
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, rgba(64, 140, 255, .12), transparent 70%),
    linear-gradient(180deg, rgba(14, 30, 62, .62), rgba(6, 14, 32, .8));
  box-shadow: 0 24px 60px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .04);
  touch-action: manipulation;       /* a near miss next to the game never double-tap zooms */
}

.runner-stage {
  position: relative;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.runner-canvas {
  display: block;
  width: 100%;
  /* as tall as fits under the bars on a laptop screen, never a thin strip */
  height: clamp(220px, min(36vw, 100vh - 380px), 380px);
  height: clamp(220px, min(36vw, 100svh - 380px), 380px);
  border-radius: var(--ui-radius-md, 12px);
  background: linear-gradient(180deg, #030713 0%, #07122d 45%, #0f2858 80%, #13295a 80.6%, #091530 90%, #040915 100%);
  box-shadow: 0 0 0 1px rgba(123, 239, 255, .26), 0 0 0 4px rgba(2, 6, 15, .55), 0 14px 40px rgba(20, 70, 160, .28);
  cursor: pointer;
  outline: none;
  touch-action: none;               /* taps on the game never scroll or zoom the page */
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.runner-canvas:focus-visible {
  outline: 3px solid var(--comic-gold, #ffe08a);
  outline-offset: 4px;
}

.runner-noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--muted, #a5b8cd);
  font-weight: 700;
}

.runner-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.runner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: 14px 2px 0;
}

.runner-hint {
  margin: 0;
  color: var(--muted, #a5b8cd);
  font-size: .95rem;
  line-height: 1.5;
}

.runner-hint kbd {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid rgba(123, 239, 255, .32);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(10, 22, 48, .9);
  color: #eef9ff;
  font-family: var(--font-label, ui-monospace, monospace);
  font-size: .82em;
  line-height: 1.5;
}

/* Full screen (shown only where the browser allows it; iPhone Safari does not) */
.runner-fs,
.runner-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  color: var(--text, #edf7ff);
  background: rgba(10, 34, 58, .78);
  border: 1px solid rgba(123, 239, 255, .34);
  border-radius: 10px;
  font-family: var(--comic-display, ui-rounded, system-ui, sans-serif);
  font-size: .875rem;
  font-weight: 800;
  letter-spacing: .03em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.runner-fs svg,
.runner-exit svg { flex: 0 0 auto; color: var(--gold, #ffd77a); }

.runner-fs:hover,
.runner-fs:focus-visible,
.runner-exit:hover,
.runner-exit:focus-visible {
  color: var(--ink, #050915);
  background: var(--gold, #ffd77a);
  border-color: var(--gold, #ffd77a);
  box-shadow: 0 8px 24px rgba(238, 161, 72, .22), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.runner-fs:hover svg,
.runner-fs:focus-visible svg,
.runner-exit:hover svg,
.runner-exit:focus-visible svg { color: var(--ink, #050915); }

.runner-fs:focus-visible,
.runner-exit:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }

.runner-fs[hidden],
.runner-exit[hidden] { display: none; }

/* In full screen the stage fills the screen and the game fills the stage; the exit button floats top left. */
.runner-exit {
  position: absolute;
  top: max(10px, env(safe-area-inset-top, 0px));
  left: max(10px, env(safe-area-inset-left, 0px));
  z-index: 1;
  min-height: 40px;
  padding: 0 12px;
  background: rgba(5, 12, 28, .72);
}

.runner-stage.is-fullscreen {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  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);
  background: #030713;
}

.runner-stage.is-fullscreen .runner-canvas {
  width: 100%;
  height: 100%;
  border-radius: 0;
  box-shadow: none;
}

.runner-stage::backdrop { background: #030713; }

.runner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: clamp(18px, 2.4vw, 26px) 0 0;
}

/* Phones held upright: the game takes the full width and a tall, roughly square box (a bigger target for thumbs),
   capped so it still fits on screen under the bars and the title. */
@media (max-width: 600px) {
  .runner-wrap { padding-top: calc(var(--header-offset, 112px) + 2px); }
  .runner-head { margin-bottom: 14px; }
  .runner-head .eyebrow { display: none; }
  .runner-title { margin-bottom: 8px; font-size: clamp(1.85rem, 8.4vw, 2.5rem); }
  .runner-lede { font-size: .98rem; line-height: 1.5; }
  .runner-play {
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
  .runner-canvas {
    height: clamp(240px, min(100vw - 36px, 100vh - 330px), 440px);
    height: clamp(240px, min(100vw - 36px, 100svh - 330px), 440px);
  }
  .runner-bar { margin-top: 12px; }
  .runner-hint { font-size: .9rem; }
  .runner-actions .button { flex: 1 1 100%; justify-content: center; }
}

/* Phones turned sideways: title and buttons on the left, the game on the right, sized to the space under the bars. */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1180px) {
  .runner-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr);
    grid-template-areas:
      "head stage"
      "bar stage"
      "actions stage";
    grid-template-rows: auto auto 1fr;
    column-gap: clamp(16px, 2.4vw, 28px);
    align-items: start;
    padding-top: calc(var(--header-offset, 112px) - 6px);
  }
  .runner-head { grid-area: head; margin-bottom: 10px; }
  .runner-head .eyebrow { display: none; }
  .runner-title { margin-bottom: 6px; font-size: clamp(1.35rem, 3.4vw, 1.9rem); }
  .runner-lede { font-size: .88rem; line-height: 1.45; }
  .runner-play { display: contents; }
  .runner-stage { grid-area: stage; }
  .runner-bar { grid-area: bar; flex-direction: column; align-items: flex-start; gap: 8px; margin: 0 0 12px; }
  .runner-fs { order: -1; }            /* the Full screen button first, so it shows without scrolling */
  .runner-hint { font-size: .85rem; }
  .runner-canvas {
    height: max(150px, calc(100vh - var(--steam-bar-h, 48px) - var(--header-offset, 112px) - var(--safe-area-top, 0px) - 4px));
    height: max(150px, calc(100svh - var(--steam-bar-h, 48px) - var(--header-offset, 112px) - var(--safe-area-top, 0px) - 4px));
  }
  .runner-actions { grid-area: actions; flex-direction: column; align-items: stretch; gap: 8px; margin: 0; }
  .runner-actions .button { justify-content: center; min-height: 44px; padding-block: 8px; font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .runner-fs,
  .runner-exit { transition: none; }
}

/* While the stage is in full screen the page behind it can't scroll, and its reserved scrollbar gutter goes too, so
   the game reaches the right edge of the screen. */
html:has(.runner-stage.is-fullscreen) {
  overflow: hidden;
  scrollbar-gutter: auto;
}
