/* Long Haul – shared tokens and page base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
:root {
  --lh-ink: #0f0c09;
  --lh-plate: 17, 14, 11;
  --lh-bone: #f1e9d8;
  --lh-sand: #cdbfa2;
  --lh-dim: #9c907a;
  --lh-amber: #f2aa2e;
  --lh-rust: #e4583a;
  --lh-sage: #93c47d;
  --lh-sky: #8fbdd0;
  --lh-line: rgba(241, 233, 216, 0.16);
  --lh-display: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --lh-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
body {
  background: #0b0906; color: var(--lh-bone); overflow: hidden;
  font-family: var(--lh-ui); -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
}
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
#boot {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; background: #0b0906;
  font: 600 13px var(--lh-display); letter-spacing: 0.3em; text-transform: uppercase; color: var(--lh-sand);
}
.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.ic-crit .fillc { fill: currentColor; stroke: currentColor; stroke-width: 1; }
.ic-crit .cut { stroke: #1a0b06; stroke-width: 2.6; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 1.7em; height: 1.7em; padding: 0 0.4em;
  border: 1px solid rgba(241, 233, 216, 0.55); border-bottom-width: 2px; border-radius: 0.3em; background: rgba(0, 0, 0, 0.5);
  font: 600 0.78em/1 var(--lh-mono); color: var(--lh-bone); white-space: nowrap; text-shadow: none; flex: none;
}

/* Opening: TopHat Interactive fades in, then collapses into a point in the middle; the Long Haul logo pops out of it with
   a loading bar and tips underneath (js/main.js drives the bar); when it's full, "Press any key to start".
   .to-game jumps to the Long Haul logo, .ready shows the prompt, .skip fades into the main menu. */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #0b0906; overflow: hidden; }
#splash > * { grid-area: 1 / 1; }
.sp-studio { width: min(72vw, 64vh * 3, 980px); height: auto; opacity: 0;
  animation: lh-sp-studio-in 0.9s ease-out forwards, lh-sp-studio-out 0.6s cubic-bezier(0.6, 0, 0.9, 0.4) 2.1s forwards; }
.sp-spark { width: 14vmin; height: 14vmin; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 236, 200, 0.95) 0, rgba(242, 170, 46, 0.55) 22%, rgba(242, 120, 60, 0) 62%);
  animation: lh-sp-spark 0.75s ease-out 2.45s forwards; }
.sp-game { display: grid; justify-items: center; gap: 1.4em; opacity: 0; transform: scale(0.4);
  animation: lh-sp-pop 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) 2.7s forwards; }
.sp-game img { width: min(70vw, 54vh * 3, 900px); height: auto; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.6)); }
.sp-load { width: min(70vw, 34em); display: grid; gap: 0.5em; opacity: 0; animation: lh-sp-tip 0.5s ease-out 3.2s forwards;
  font: 600 clamp(12px, 0.9vw + 0.5vh + 4px, 17px)/1 var(--lh-ui); color: var(--lh-sand); }
.sp-bar { height: 0.55em; border-radius: 0.3em; background: rgba(241, 233, 216, 0.12); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }
.sp-bar i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--v, 0));
  background: linear-gradient(90deg, #d8891f, var(--lh-amber)); }
.sp-loadrow { display: flex; justify-content: space-between; gap: 1em; letter-spacing: 0.06em; }
.sp-loadrow b { color: var(--lh-bone); font-variant-numeric: tabular-nums; }
.sp-start { display: none; margin: 0; color: var(--lh-bone); font: 700 clamp(15px, 1.4vw + 0.6vh + 6px, 26px)/1 var(--lh-display);
  letter-spacing: 0.24em; text-transform: uppercase; animation: lh-sp-blink 1.1s ease-in-out infinite alternate; }
.sp-tip { margin: 0; max-width: min(90vw, 40em); padding: 0 1em; text-align: center; color: var(--lh-sand); opacity: 0; min-height: 2.9em;
  font: 500 clamp(13px, 1.1vw + 0.6vh + 4px, 20px)/1.45 var(--lh-ui); animation: lh-sp-tip 0.6s ease-out 3.4s forwards; }
.sp-tip b { display: block; margin-bottom: 0.35em; color: var(--lh-amber); font: 700 0.72em/1 var(--lh-display); letter-spacing: 0.3em; text-transform: uppercase; }
.sp-tip span { display: block; transition: opacity 0.35s ease; }
.sp-tip span.sp-swap { opacity: 0; }
/* Loaded: the bar gives way to the prompt */
#splash.ready .sp-load { display: none; }
#splash.ready .sp-start { display: block; }

/* Skipped during the studio logo: straight to the Long Haul logo */
#splash.to-game .sp-studio, #splash.to-game .sp-spark { animation: none; opacity: 0; }
#splash.to-game .sp-game { animation: lh-sp-pop2 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) forwards; }
#splash.to-game .sp-load { animation: lh-sp-tip2 0.4s ease-out 0.3s forwards; }
#splash.to-game .sp-tip { animation: lh-sp-tip2 0.5s ease-out 0.4s forwards; }
/* Started: into the main menu */
#splash.skip { animation: lh-sp-out 0.5s ease-in forwards; }

@keyframes lh-sp-studio-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes lh-sp-studio-out { from { opacity: 1; transform: scale(1); filter: blur(0); } 60% { opacity: 0.9; } to { opacity: 0; transform: scale(0.02, 0.06); filter: blur(2px); } }
@keyframes lh-sp-spark { 0% { opacity: 0; transform: scale(0.2); } 30% { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(2.4); } }
@keyframes lh-sp-pop { from { opacity: 0; transform: scale(0.4); } 60% { opacity: 1; } to { opacity: 1; transform: scale(1); } }
@keyframes lh-sp-pop2 { from { opacity: 0; transform: scale(0.4); } 60% { opacity: 1; } to { opacity: 1; transform: scale(1); } }
@keyframes lh-sp-tip { from { opacity: 0; transform: translateY(0.6em); } to { opacity: 1; transform: none; } }
@keyframes lh-sp-tip2 { from { opacity: 0; transform: translateY(0.6em); } to { opacity: 1; transform: none; } }
@keyframes lh-sp-blink { from { opacity: 1; } to { opacity: 0.45; } }
@keyframes lh-sp-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) {
  .sp-studio { animation: lh-sp-studio-hold 2s steps(1) forwards; opacity: 1; }
  .sp-spark { display: none; }
  .sp-game, .sp-load, .sp-tip { animation: lh-sp-show 0.01s linear 2s forwards; transform: none; }
  #splash.to-game .sp-game, #splash.to-game .sp-load, #splash.to-game .sp-tip { animation: none; opacity: 1; }
  .sp-start { animation: none; }
  .sp-tip span { transition: none; }
}
@keyframes lh-sp-studio-hold { to { opacity: 0; } }
@keyframes lh-sp-show { to { opacity: 1; } }

/* One opening prompt, on the first studio logo. */
#splash { animation:none; }
#splash .studio-first { display:grid; justify-items:center; gap:28px; width:min(85vw,900px); transition:opacity 450ms ease,transform 450ms ease; }
.studio-first img { width:100%; height:auto; }
#studio-start { background:none; border:0; color:var(--lh-bone); padding:12px; cursor:pointer; font:600 clamp(13px,2vw,18px) var(--lh-display); letter-spacing:.15em; text-transform:uppercase; }
#studio-start:focus-visible { outline:2px solid var(--lh-amber); }
#splash.studio-finish .studio-first { opacity:0; transform:scale(.04); }
@media(prefers-reduced-motion:reduce){#splash .studio-first{transition:none;}}
/* The intro after "start" (index.html): the TopHat video, the seizure warning and the legal notice, one at a time */
#splash .intro-step { opacity: 0; visibility: hidden; transition: opacity 600ms ease, visibility 0s linear 600ms; }
#splash .intro-step.on { opacity: 1; visibility: visible; transition: opacity 600ms ease, visibility 0s; }
#splash .intro-video { width: 100%; height: 100%; object-fit: contain; background: #000; pointer-events: none; }
#splash .intro-card { width: min(88vw, 46em); text-align: center; color: var(--lh-bone); font: 500 clamp(14px, 0.7vw + 0.6vh + 7px, 19px)/1.6 var(--lh-ui); }
#splash .intro-card h2 { margin: 0 0 1.1em; color: var(--lh-amber); font: 700 clamp(18px, 1.2vw + 1vh + 8px, 30px)/1.2 var(--lh-display); letter-spacing: 0.04em; }
#splash .intro-card p { margin: 0 0 1em; }
#splash .intro-legal p { color: var(--lh-sand); }
#splash .intro-legal .intro-small { margin-top: 1.6em; font-size: 0.82em; opacity: 0.8; }
#splash .intro-hint { align-self: end; margin: 0 0 4vh; color: var(--lh-sand); opacity: 0; font: 600 clamp(11px, 0.6vw + 0.5vh + 5px, 15px)/1 var(--lh-display); letter-spacing: 0.12em;
  transition: opacity 600ms ease; pointer-events: none; }
#splash .intro-hint.on { opacity: 0.7; transition-delay: 1.2s; }
@media (prefers-reduced-motion: reduce) { #splash .intro-step, #splash .intro-step.on, #splash .intro-hint { transition: none; } }

/* iPhone / iPad in the browser: install to the Home Screen first (index.html) */
#ios-gate { position: fixed; inset: 0; z-index: 200; overflow-y: auto; display: grid; align-content: center; justify-items: center; gap: 1em;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  background: #0b0906; color: var(--lh-bone); font: 16px/1.45 var(--lh-ui); text-align: center; }
#ios-gate img { width: min(70vw, 340px); height: auto; }
#ios-gate h1 { margin: 0; font: 700 1.35em/1.2 var(--lh-display); letter-spacing: 0.04em; text-transform: uppercase; color: var(--lh-amber); }
#ios-gate ol { margin: 0; padding: 0 0 0 1.4em; max-width: 26em; display: grid; gap: 0.6em; text-align: left; }
#ios-gate p { margin: 0; max-width: 26em; color: var(--lh-sand); font-size: 0.92em; }
#ios-gate svg { width: 1.2em; height: 1.2em; vertical-align: -0.2em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
