:root {
  color-scheme: light;
  --paper: #f5f4ef;
  --ink: #454640;
  --soft: #ecece4;
  --line: #d9dacf;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border-radius: 0; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .32; }
button:focus-visible, canvas:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.game {
  --controls-height: env(safe-area-inset-bottom);
  --hud-offset: 58px; /* set from main.js: just below the score panel */
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
}
.game-stage {
  position: absolute;
  top: env(safe-area-inset-top);
  right: env(safe-area-inset-right);
  bottom: var(--controls-height);
  left: env(safe-area-inset-left);
}
#track { display: block; width: 100%; height: 100%; touch-action: none; outline-offset: -4px; }
.run-actions { position: absolute; top: 48%; left: 0; right: 0; display: flex; justify-content: center; pointer-events: none; }
.start-button {
  height: 48px;
  min-width: 168px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  pointer-events: auto;
}
.start-button span { font-size: 18px; }
.start-button:hover { background: #292b27; }
.start-button[hidden] { display: none; }
.game-controls {
  /* Phones & tablets: a vertical stack in the top-right, under the score — theme, sound, pause */
  position: absolute;
  top: calc(var(--hud-offset) + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#theme { order: 1; }
#sound { order: 2; }
#pause { order: 3; }
.tool-button { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: color-mix(in srgb, var(--paper) 78%, transparent); font-size: 22px; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.tool-button:hover:not(:disabled) { background: var(--soft); }
.sound-slash { display: none; position: absolute; width: 29px; height: 2px; background: var(--ink); transform: rotate(-45deg); box-shadow: 0 0 0 2px var(--paper); }
#sound[aria-pressed="true"] .sound-slash { display: block; }
.jump-button { display: none; /* tap anywhere on the game to jump */ align-items: center; justify-content: center; gap: 12px; width: min(180px, 40vw); height: 64px; border: 1px solid var(--ink); background: transparent; font-size: 11px; letter-spacing: 1.8px; touch-action: none; user-select: none; -webkit-user-select: none; }
.jump-button span { font-size: 26px; }
.jump-button:active, .jump-button.is-held { background: var(--ink); color: var(--paper); }
.theme-sun { display: none; }
[data-theme="dark"] { color-scheme: dark; }
[data-theme="dark"] .theme-moon { display: none; }
[data-theme="dark"] .theme-sun { display: block; }
[data-theme="dark"] .start-button:hover { background: var(--sky); }
.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 (min-width: 760px) and (hover: hover) and (pointer: fine) {
  .game-controls { top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); flex-direction: row; gap: 6px; }
  #theme, #sound, #pause { order: 0; }
  .tool-button { border-radius: 6px; box-shadow: none; }
  .tool-button:hover:not(:disabled) { background: var(--paper); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- Opening splash ---------- */
.splash { position: fixed; inset: 0; z-index: 20; background: #05070f; cursor: pointer; touch-action: none; transition: opacity .55s ease; }
.splash canvas { display: block; width: 100%; height: 100%; }
.splash.is-leaving { opacity: 0; pointer-events: none; }
.splash-skip { position: absolute; top: calc(48px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); height: 36px; padding: 0 16px; border: 1px solid rgba(255,255,255,.55); border-radius: 18px; background: rgba(0,0,0,.45); color: #fff; font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 2px; backdrop-filter: blur(4px); }
.splash-skip:hover { background: rgba(255,255,255,.18); }
.splash-hint { position: absolute; left: 50%; bottom: calc(52px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 8px 14px; border-radius: 16px; background: rgba(0,0,0,.55); color: #fff; font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; pointer-events: none; animation: splash-pulse 1.4s ease-in-out infinite; }
.splash-hint[hidden] { display: none; }
@keyframes splash-pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .splash-hint { animation: none; } }

/* ---------- Mobile Snack Bar: Tap for Jump (Before Game Start) ---------- */
.mobile-hint-snackbar {
  position: absolute;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  color: var(--paper);
  border: 1px solid color-mix(in srgb, var(--paper) 25%, transparent);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.35s ease, transform 0.35s ease;
  animation: mobile-snackbar-float 2.2s ease-in-out infinite;
}
.mobile-hint-snackbar[hidden] {
  display: none !important;
}
.mobile-hint-snackbar.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
  pointer-events: none;
}
.mobile-hint-icon {
  font-size: 15px;
  display: inline-block;
  animation: tap-hand-bounce 1s ease-in-out infinite alternate;
}
@keyframes tap-hand-bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-3px); }
}
@keyframes mobile-snackbar-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}
@media (min-width: 760px) and (hover: hover) and (pointer: fine) {
  .mobile-hint-snackbar {
    display: none !important;
  }
}
