* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; overflow: hidden; background: var(--zl-bg, #06060a); }
body { font-family: var(--zl-font, system-ui, sans-serif); color: var(--zl-text, #f2f0ee); }

#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }

/* subtle cinematic vignette over the canvas — grounds the image without a
   post-processing pass */
.vignette {
  position: fixed; inset: 0; z-index: 5; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 42%, transparent 55%, rgba(4,4,8,.28) 100%);
  mix-blend-mode: multiply;
}

.hidden { display: none !important; }

/* ───────────── overlays (menu / pause) ───────────── */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--zl-haze-violet, rgba(76,59,77,.10)), transparent 60%),
    linear-gradient(180deg, rgba(6,6,10,0.42), rgba(6,6,10,0.66));
  backdrop-filter: blur(3px);
  animation: fade var(--zl-dur, .3s) var(--zl-ease, ease) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.panel {
  width: min(560px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  background: color-mix(in srgb, var(--zl-surface-1, #14141c) 76%, transparent);
  border: 1px solid var(--zl-line, rgba(255,255,255,.1));
  border-radius: var(--zl-radius-xl, 22px);
  box-shadow: var(--zl-shadow-lg, 0 30px 80px rgba(0,0,0,.6));
  padding: clamp(26px, 5vw, 44px);
  text-align: center;
}
.panel--sm { width: min(380px, 100%); display: grid; gap: 14px; }

.brand { display: grid; gap: 8px; margin-bottom: 14px; }
.logo {
  font-size: clamp(58px, 12vw, 96px);
  font-weight: 800; letter-spacing: -.06em; line-height: .9;
  background: linear-gradient(180deg, #fff, #d9dcc9 62%, var(--zl-accent-soft, #9dae50));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 60px var(--zl-accent-glow, rgba(157,174,80,.22));
}
.logo--sm { font-size: clamp(30px, 7vw, 44px); }
.eyebrow {
  font-size: var(--zl-text-sm, 14px); text-transform: uppercase;
  letter-spacing: .28em; color: var(--zl-text-muted, #a8a4b0); font-weight: 600;
}
.sub {
  font-size: var(--zl-text-lg, 18px); color: var(--zl-text-soft, #cfcbd6);
  line-height: 1.55; max-width: 44ch; margin: 0 auto 22px;
}

/* time of day picker */
.time-pick { margin-bottom: 24px; }
.ctitle { display: block; margin-bottom: 12px; }
.time-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.time-opt {
  display: grid; gap: 9px; place-items: center;
  padding: 14px 8px; cursor: pointer;
  background: var(--zl-surface-2, #1b1b26);
  border: 1.5px solid var(--zl-line, rgba(255,255,255,.1));
  border-radius: var(--zl-radius-md, 14px);
  color: var(--zl-text-soft, #cfcbd6);
  font-size: var(--zl-text-sm, 14px); font-weight: 600;
  transition: border-color .18s, transform .18s, background .18s;
}
.time-opt:hover { transform: translateY(-2px); border-color: var(--zl-line-strong, rgba(255,255,255,.25)); }
.time-opt.sel { border-color: var(--zl-accent-soft, #9dae50); background: var(--zl-accent-wash, rgba(157,174,80,.12)); color: var(--zl-text, #fff); }
.tdot { width: 26px; height: 26px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.tdot.dawn { background: linear-gradient(135deg, #f0b58c, #24345f); }
.tdot.day { background: linear-gradient(135deg, #cfdfee, #3a6fc9); }
.tdot.dusk { background: linear-gradient(135deg, #e89d62, #222a52); }
.tdot.night { background: linear-gradient(135deg, #25324f, #060a19); }

.startbtn { width: 100%; margin-bottom: 26px; }

/* controls list */
.controls { text-align: left; border-top: 1px solid var(--zl-line, rgba(255,255,255,.08)); padding-top: 20px; }
.crow {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; color: var(--zl-text-soft, #cfcbd6); font-size: var(--zl-text-base, 16px);
}
.crow span:last-child { margin-left: auto; color: var(--zl-text-muted, #a8a4b0); font-size: var(--zl-text-sm, 14px); }
kbd {
  font-family: var(--zl-font-mono, monospace); font-size: 13px; font-weight: 700;
  min-width: 30px; text-align: center; padding: 5px 8px;
  background: var(--zl-surface-3, #24242f); color: var(--zl-text, #fff);
  border: 1px solid var(--zl-line-strong, rgba(255,255,255,.22));
  border-bottom-width: 3px; border-radius: 7px;
}
.mouse { font-size: 18px; }

.hint { color: var(--zl-text-muted, #a8a4b0); font-size: var(--zl-text-sm, 14px); margin-top: 6px; }

/* ───────────── FAQ ───────────── */
.faq { text-align: left; border-top: 1px solid var(--zl-line, rgba(255,255,255,.08)); padding-top: 20px; margin-top: 20px; }
.faq-item { padding: 10px 0; border-bottom: 1px solid var(--zl-line, rgba(255,255,255,.06)); }
.faq-item:last-child { border-bottom: none; padding-bottom: 0; }
.faq-q { font-size: var(--zl-text-base, 16px); font-weight: 600; color: var(--zl-text, #f2f0ee); margin-bottom: 5px; }
.faq-a { font-size: var(--zl-text-sm, 14px); color: var(--zl-text-muted, #a8a4b0); line-height: 1.5; }

/* ───────────── HUD ───────────── */
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.reticle {
  position: absolute; top: 50%; left: 50%; width: 7px; height: 7px;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: rgba(255,255,255,.5); box-shadow: 0 0 0 1px rgba(0,0,0,.35);
  mix-blend-mode: difference;
}
.hud.third .reticle { display: none; }
.lobby-badge {
  position: absolute; top: 20px; left: 20px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--zl-radius-pill, 999px);
  background: color-mix(in srgb, var(--zl-surface-1, #14141c) 58%, transparent);
  border: 1px solid var(--zl-line, rgba(255,255,255,.1));
  backdrop-filter: blur(8px);
  font-size: 14px; font-weight: 700; color: var(--zl-text, #fff);
}
.lobby-badge #lobbyCount { font-variant-numeric: tabular-nums; }
.lobby-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .16em; color: var(--zl-text-muted, #a8a4b0); }
.lobby-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--zl-success, #5ad27a);
  box-shadow: 0 0 0 0 rgba(90,210,122,.6); animation: lobbyPulse 2.4s infinite;
}
@keyframes lobbyPulse {
  0% { box-shadow: 0 0 0 0 rgba(90,210,122,.5); }
  70% { box-shadow: 0 0 0 7px rgba(90,210,122,0); }
  100% { box-shadow: 0 0 0 0 rgba(90,210,122,0); }
}
.dist-card {
  position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: baseline; gap: 8px;
  padding: 12px 22px; border-radius: var(--zl-radius-pill, 999px);
  background: color-mix(in srgb, var(--zl-surface-1, #14141c) 60%, transparent);
  border: 1px solid var(--zl-line, rgba(255,255,255,.1));
  backdrop-filter: blur(8px);
}
.dist-val { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dist-unit { font-size: 16px; font-weight: 700; color: var(--zl-accent-soft, #9dae50); }
.dist-label { font-size: 12px; text-transform: uppercase; letter-spacing: .18em; color: var(--zl-text-muted, #a8a4b0); margin-left: 4px; }
.dist-sep { width: 1px; height: 22px; align-self: center; background: var(--zl-line-strong, rgba(255,255,255,.13)); margin: 0 8px; }
.climb-arrow { font-size: 15px; font-weight: 800; color: var(--zl-accent2-soft, #b095b3); }
.climb-val { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.climb-unit { font-size: 13px; font-weight: 700; color: var(--zl-text-muted, #a8a4b0); }
.hud-hint {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--zl-text-muted, #a8a4b0); letter-spacing: .04em;
  opacity: .7;
}

@media (max-width: 560px) {
  .time-row { grid-template-columns: repeat(2, 1fr); }
  .crow span:last-child { font-size: 13px; }
}

/* ───────────── touch controls ───────────── */
.touch-ui { display: none; }
.pause-btn { display: none; }
/* by default show desktop controls list, hide touch one */
.controls--touch { display: none; }
body.is-touch .controls--desktop { display: none; }
body.is-touch .controls--touch { display: block; }
body.is-touch .reticle { display: none; }
.tk { display: inline-flex; width: 30px; justify-content: center; font-size: 18px; color: var(--zl-accent-soft, #9dae50); }

body.is-touch .touch-ui { display: block; }
body.is-touch .pause-btn {
  display: grid; place-items: center;
  position: absolute; top: calc(18px + env(safe-area-inset-top)); right: calc(18px + env(safe-area-inset-right));
  width: 44px; height: 44px; border-radius: 50%;
  background: color-mix(in srgb, var(--zl-surface-1, #14141c) 62%, transparent);
  border: 1px solid var(--zl-line, rgba(255,255,255,.12)); color: var(--zl-text, #fff);
  backdrop-filter: blur(8px); pointer-events: auto;
}

/* left half is the joystick zone; the knob follows the finger */
.joy-zone {
  position: absolute; left: 0; bottom: 0;
  width: 45%; height: 62%;
  pointer-events: auto; touch-action: none;
}
.joy-base {
  position: fixed; width: 128px; height: 128px; margin: -64px 0 0 -64px;
  border-radius: 50%; opacity: 0; transition: opacity .15s;
  background: radial-gradient(circle, rgba(157,174,80,.10), transparent 70%);
  border: 2px solid rgba(157,174,80,.35);
  display: grid; place-items: center; pointer-events: none;
}
.joy-base.on { opacity: 1; }
.joy-knob {
  width: 58px; height: 58px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(189,206,116,.9), rgba(89,100,42,.85));
  border: 1px solid rgba(255,255,255,.35); box-shadow: 0 6px 18px rgba(0,0,0,.45);
}

/* right-bottom action buttons */
.touch-btns {
  position: absolute; right: calc(18px + env(safe-area-inset-right));
  bottom: calc(26px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; gap: 12px; pointer-events: none;
}
.tbtn {
  pointer-events: auto; touch-action: none;
  display: grid; place-items: center; gap: 2px;
  width: 66px; height: 66px; border-radius: 50%;
  background: color-mix(in srgb, var(--zl-surface-1, #14141c) 58%, transparent);
  border: 1.5px solid var(--zl-line-strong, rgba(255,255,255,.16));
  color: var(--zl-text, #f2f0ee); backdrop-filter: blur(8px);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  transition: transform .08s, background .12s, border-color .12s;
}
.tbtn span { font-size: 9.5px; color: var(--zl-text-soft, #cfcbd6); }
.tbtn.pressed { transform: scale(.92); background: color-mix(in srgb, var(--zl-accent, #3e4618) 40%, transparent); }
.tbtn.active { border-color: var(--zl-accent-soft, #9dae50); background: var(--zl-accent-wash, rgba(157,174,80,.16)); color: var(--zl-accent-soft, #9dae50); }
.tbtn--go { width: 76px; height: 76px; border-color: var(--zl-accent-soft, #9dae50); background: color-mix(in srgb, var(--zl-accent, #3e4618) 42%, transparent); }

/* on touch, lift the distance card to the top so it never sits under the
   action buttons; shrink it a touch to leave room for the pause button */
body.is-touch .dist-card {
  bottom: auto; top: calc(16px + env(safe-area-inset-top));
  left: 50%; transform: translateX(-50%);
  padding: 8px 16px;
}
body.is-touch .lobby-badge {
  top: calc(72px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
}
body.is-touch .dist-val { font-size: 26px; }

/* let the menu panel breathe on short screens */
@media (max-height: 720px) {
  .panel { padding: clamp(20px, 4vw, 32px); }
  .sub { margin-bottom: 16px; }
  .time-pick { margin-bottom: 16px; }
}
