@font-face {
  font-family: "Lilita One";
  src: url("brand/LilitaOne.woff2") format("woff2");
  font-display: swap;
}
:root {
  --bg: oklch(88.92% 0.0743 170.04);
  --surface: oklch(96.75% 0.0328 83.71);
  --fg: oklch(30.98% 0.0407 172.40);
  --muted: oklch(50.44% 0.0352 161.15);
  --border: oklch(30.98% 0.0407 172.40);
  --accent: oklch(80.95% 0.1593 170.54);
  --font-display: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  --font-body: "Trebuchet MS", system-ui, sans-serif;
  --font-mono: ui-monospace, monospace;
  --raised: 0 3px 0 var(--border);
  --gutter: clamp(12px, 2.5vw, 32px);
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font-body);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--surface);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--border);
}
button:disabled { cursor: default; }
h1, h2, p { margin: 0; }
h2 { font: 400 clamp(27px, 4vw, 46px)/1.04 var(--font-display); text-wrap: balance; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
#playground {
  position: relative; width: 100%; height: 100%; height: 100dvh; height: min(100dvh, var(--visible-height, 100dvh));
  overflow: hidden; isolation: isolate; background: var(--bg);
}
#play-field { position: absolute; inset: 0; }
.orientation-notice, .touch-jump { display: none; }
#patio-backdrop { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
#patio-backdrop img { display: block; width: 1536px; height: 1024px; max-width: none; transform-origin: top left; }
#game-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; }
#game-canvas:focus-visible { outline: 3px dashed var(--border); outline-offset: -5px; }
.corner-brand, .back-button {
  position: absolute; z-index: 5;
  left: max(var(--gutter), env(safe-area-inset-left));
  top: max(var(--gutter), env(safe-area-inset-top));
}
.corner-brand {
  display: grid; align-items: center; min-height: 46px; padding: 7px 12px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 13px;
  box-shadow: var(--raised);
}
.corner-brand img { display: block; width: clamp(92px, 10vw, 136px); height: auto; }
.corner-brand:hover, .round-button:hover, .back-button:hover { translate: 0 -2px; }
.corner-tools {
  position: absolute; z-index: 5; display: flex; gap: 10px;
  right: max(var(--gutter), env(safe-area-inset-right));
  top: max(var(--gutter), env(safe-area-inset-top));
}
.round-button, .back-button, .primary-button, .secondary-button {
  min-height: 44px; border: 1.5px solid var(--border); border-radius: 100px;
  background: var(--surface); box-shadow: var(--raised);
}
.round-button { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; }
.round-button svg, .back-button svg {
  width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.help-button { font: 400 26px/1 var(--font-display); }
.back-button { display: flex; align-items: center; gap: 7px; padding: 5px 13px; font-weight: 700; }
.distance-hud {
  position: absolute; top: max(var(--gutter), env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); display: flex; align-items: baseline; gap: 5px;
  z-index: 2; padding: 4px 13px; pointer-events: none;
  border-radius: 100px; background: var(--surface); border: 1.5px solid var(--border);
}
.distance-hud span { font: 400 clamp(25px, 4vw, 36px)/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.distance-hud small { font-weight: 700; }
.choice-dialog, .race-dialog, .help-dialog {
  background: var(--surface); color: var(--fg); border: 2px solid var(--border);
  border-radius: 27px; box-shadow: 0 5px 0 var(--border);
}
.choice-dialog, .race-dialog { position: absolute; left: 50%; text-align: center; }
.choice-dialog {
  top: max(80px, 10%); transform: translateX(-50%);
  width: min(520px, calc(100% - 28px)); padding: 18px; z-index: 3;
}
.choice-dialog p { margin-top: 8px; line-height: 1.4; font-size: clamp(13px, 1.8vw, 16px); }
.runner-skills {
  width: 100%; table-layout: fixed; border-spacing: 4px 0; margin-top: 13px;
  font-size: clamp(11px, 1.7vw, 14px);
}
.runner-skills th, .runner-skills td { padding: 5px; }
.runner-skills thead th:not(:first-child) { font: 400 clamp(14px, 2.5vw, 19px)/1.12 var(--font-display); }
.runner-skills thead th { border-radius: 7px 7px 0 0; }
.runner-skills thead small {
  display: block; margin-top: 4px; font: 400 10px/1.2 var(--font-body); color: var(--muted);
}
.runner-skills thead th:first-child { width: 26%; }
.runner-skills tbody th { text-align: left; line-height: 1.2; }
.runner-skills tr:last-child td { border-radius: 0 0 7px 7px; padding-bottom: 8px; }
.runner-skills [data-active] { background: color-mix(in oklch, var(--bg) 50%, var(--surface)); }
.skill-bar {
  position: relative; height: 8px; overflow: hidden; border-radius: 100px;
  background: color-mix(in oklch, var(--fg) 16%, var(--surface));
}
.skill-bar::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: var(--skill-fill);
  background: var(--fg); border-radius: inherit;
}
.primary-button, .secondary-button, .text-button {
  min-height: 44px; padding: 10px 19px; font-size: 15px; line-height: 1.25;
  font-weight: 700;
}
.primary-button { background: var(--accent); }
.primary-button:hover, .secondary-button:hover { translate: 0 -2px; box-shadow: 0 5px 0 var(--border); }
.primary-button:active, .secondary-button:active, .round-button:active, .back-button:active {
  translate: 0 2px; box-shadow: 0 1px 0 var(--border);
}
.choice-dialog .primary-button { margin-top: 15px; }
.text-button { border: 0; background: transparent; border-radius: 12px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.runner-actors, #world-hotspots { position: absolute; inset: 0; pointer-events: none; }
.runner-actors { z-index: 2; }
.actor-button {
  position: absolute; transform: translate(-50%, -100%);
  display: block; border: 0; padding: 0; background: transparent;
  border-radius: 24px; pointer-events: auto;
}
.actor-button span {
  position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  padding: 3px 9px; border: 1px solid transparent; border-radius: 100px;
  font: 400 clamp(16px, 2vw, 25px)/1.1 var(--font-display);
  white-space: nowrap; background: var(--surface);
}
.actor-button:hover span, .actor-button[aria-pressed="true"] span { border-color: var(--border); box-shadow: 0 2px 0 var(--border); }
.actor-button:focus-visible { outline: 3px dashed var(--border); outline-offset: 2px; box-shadow: none; }
#world-hotspots { overflow: hidden; }
.world-hotspot {
  position: absolute; transform: translate(-50%, -50%); opacity: 0;
  border: 0; pointer-events: none; background: transparent; border-radius: 40%; padding: 0;
}
.world-hotspot:focus-visible {
  opacity: 1; outline: 3px dashed var(--surface);
  outline-offset: 4px; box-shadow: 0 0 0 6px var(--border);
}
.scene-hint {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(var(--gutter), env(safe-area-inset-bottom));
  width: max-content; max-width: calc(100% - 30px); z-index: 2;
  padding: 9px 14px; border: 1.5px solid var(--border); border-radius: 100px;
  background: var(--surface); box-shadow: 0 2px 0 var(--border);
  font-size: clamp(12px, 2vw, 15px); line-height: 1.35; text-align: center;
  pointer-events: none; transition: opacity .3s, translate .3s;
}
.scene-hint.is-quiet { opacity: 0; translate: 0 5px; }
.race-dialog {
  top: 50%; transform: translate(-50%, -50%);
  width: min(405px, calc(100% - 34px)); max-height: calc(100% - 28px);
  overflow: auto; overscroll-behavior: contain; padding: clamp(16px, 3vw, 28px); z-index: 7;
}
.race-dialog h2 { font-size: clamp(25px, 4vw, 36px); margin-block: 5px 8px; }
.dialog-dog { font-size: 13px; font-weight: 700; color: var(--muted); }
.race-dialog p { line-height: 1.4; }
.result-distance { margin-top: 12px; display: flex; align-items: baseline; justify-content: center; gap: 7px; }
.result-distance strong { font: 400 clamp(32px, 6vw, 50px)/1 var(--font-display); }
.race-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 17px; }
.help-dialog {
  width: min(515px, calc(100% - 32px)); max-height: calc(min(100dvh, var(--visible-height, 100dvh)) - 28px); padding: 0;
  overflow: hidden;
}
.help-dialog[open] { display: flex; flex-direction: column; }
.help-dialog::backdrop { background: oklch(30.98% 0.0407 172.40 / .47); }
.help-heading {
  display: flex; flex: none; justify-content: space-between; align-items: center; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--border);
}
.help-heading h2 { font-size: clamp(25px, 5vw, 36px); }
.dialog-close { flex: 0 0 46px; }
.help-content { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 16px 20px 22px; line-height: 1.5; }
.help-content p + p, .help-content details, .help-content .primary-button { margin-top: 12px; }
.help-content summary { display: list-item; align-content: center; min-height: 44px; cursor: pointer; font-weight: 700; }
.help-content .primary-button { display: block; }
.transition-curtain { position: absolute; inset: 0; z-index: 10; background: var(--surface); opacity: 0; pointer-events: none; transition: opacity .24s ease-in-out; }
.is-transitioning .transition-curtain { opacity: 1; pointer-events: auto; }
.is-transitioning.is-revealing .transition-curtain { opacity: 0; }
.is-transitioning .choice-dialog, .is-transitioning .runner-actors { visibility: hidden; }
.loading {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center;
  gap: 12px; padding: 24px; text-align: center; background: var(--bg); z-index: 20;
}
.loading strong { font: 400 clamp(28px, 6vw, 48px)/1 var(--font-display); }
.loading span { max-width: 40ch; line-height: 1.5; }
@media (max-width: 820px) and (orientation: portrait) {
  .choice-dialog { top: max(76px, calc(env(safe-area-inset-top) + 64px)); }
}
@media (pointer: coarse), (max-width: 820px) {
  .touch-jump:not([hidden]) {
    display: block; position: absolute; z-index: 5;
    right: max(var(--gutter), env(safe-area-inset-right));
    bottom: max(var(--gutter), env(safe-area-inset-bottom)); min-width: 96px; min-height: 49px;
  }
  #playground[data-scene="runner"][data-race-mode="playing"] .scene-hint { display: none; }
}
@media (max-height: 680px) and (min-width: 480px) and (orientation: landscape) {
  .choice-dialog {
    left: max(var(--gutter), env(safe-area-inset-left)); transform: none;
    --choice-top: max(15%, calc(var(--gutter) + 52px), calc(env(safe-area-inset-top) + 52px));
    top: var(--choice-top);
    width: min(435px, calc(50% - var(--gutter) - 8px)); padding: 12px;
    max-height: calc(100% - var(--choice-top) - 10px);
    overflow: auto; overscroll-behavior: contain;
  }
  .choice-dialog h2 { font-size: clamp(22px, 3vw, 33px); }
  .choice-dialog p { margin-top: 4px; font-size: 12px; }
  .choice-dialog .primary-button { margin-top: 8px; }
  .runner-skills { margin-top: 7px; border-spacing: 2px 0; }
  .runner-skills th, .runner-skills td { padding: 4px; }
}
@media (max-height: 520px) { .race-actions { margin-top: 8px; } }
@media (max-height: 360px) and (min-width: 480px) and (orientation: landscape) {
  .choice-dialog { padding: 9px 11px; }
  .choice-dialog p { display: none; }
  .runner-skills { font-size: 11px; }
  .runner-skills thead th:not(:first-child) { font-size: 15px; }
  .runner-skills th, .runner-skills td { padding: 3px; }
}
@media (max-width: 360px) {
  .choice-dialog { padding: 18px 14px; }
  .race-dialog { padding: 16px; }
  .race-actions { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.orientation-back { display: inline-block; margin-top: 1em; color: inherit; }

/* Touch selection and long-press must not interrupt play. */
#playground, #playground *, #help-dialog, #help-dialog * {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
#playground button, #playground a { touch-action: manipulation; }
#patio-backdrop .portrait-backdrop { display: none; }
@media (max-width: 640px) and (orientation: portrait) {
  #patio-backdrop img { display: none; }
  #patio-backdrop .portrait-backdrop { display: block; width: 936px; height: 1400px; }
  #playground[data-scene="patio"] .scene-hint {
    max-width: calc(100% - 26px);
  }
  .choice-dialog { top: max(66px, calc(env(safe-area-inset-top) + 56px)); padding: 12px; }
  .choice-dialog p { margin-top: 4px; }
  .runner-skills { margin-top: 7px; border-spacing: 2px 0; }
  .runner-skills th, .runner-skills td { padding: 3px; }
  .choice-dialog .primary-button { margin-top: 6px; }
  .distance-hud { padding: 3px 8px; }
  #pan-help { display: none; }
}
@media (max-width: 640px) and (max-height: 570px) and (orientation: portrait) {
  .choice-dialog h2 { font-size: 24px; }
  .choice-dialog p, .runner-skills thead small { display: none; }
  .choice-dialog { padding-top: 8px; }
}
