/* Ghost Road — interface styling */

:root {
  --fg: #dcd8d0;
  --dim: rgba(220, 216, 208, 0.55);
  --faint: rgba(220, 216, 208, 0.16);
  --ember: #ff7a2a;
  --bg: #050607;
  --serif: "Cinzel", "Trajan Pro", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg);
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: radial-gradient(ellipse at 50% 46%, rgba(0,0,0,0) 42%, rgba(0,0,0,0.5) 82%, rgba(0,0,0,0.88) 100%);
}

/* Cinematic letterbox bars */
.letterbox {
  position: fixed;
  left: 0;
  right: 0;
  height: 0;
  background: #000;
  z-index: 5;
  pointer-events: none;
  transition: height 1.8s cubic-bezier(.6, 0, .2, 1);
}
.letterbox.top { top: 0; }
.letterbox.bottom { bottom: 0; }
body.cinematic .letterbox { height: 9vh; }
body.cinematic-lite .letterbox { height: 5vh; }

/* HUD */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: max(18px, env(safe-area-inset-top)) max(26px, env(safe-area-inset-right)) 0 max(26px, env(safe-area-inset-left));
  pointer-events: none;
  transition: opacity 1.4s ease;
}
#hud.hidden { opacity: 0; }
#hud.hidden .hud-buttons { pointer-events: none; }

.stats { display: flex; gap: 38px; }
.stat { display: flex; flex-direction: column; gap: 5px; }

.label {
  font-size: 10px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--dim);
}
.value {
  font-size: 20px;
  font-weight: 300;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  text-shadow: 0 0 14px rgba(0,0,0,0.9);
}
.value.big { font-size: 42px; letter-spacing: 0.12em; }
.value { white-space: nowrap; }

.hud-buttons { display: flex; gap: 10px; pointer-events: auto; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--faint);
  background: rgba(8, 8, 10, 0.35);
  color: var(--dim);
  font-size: 13px;
  cursor: pointer;
  transition: color .3s, border-color .3s, box-shadow .3s, opacity .3s;
}
.icon-btn:hover, .icon-btn:focus-visible {
  outline: none;
  color: var(--fg);
  border-color: rgba(255, 140, 70, 0.5);
  box-shadow: 0 0 18px rgba(255, 110, 40, 0.2);
}
.icon-btn.off { opacity: 0.35; }

/* Full-screen overlays */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1s ease, visibility 0s linear 1s;
}
.screen.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 1s ease, visibility 0s;
}
/* A screen that is fading out must not swallow taps meant for the game underneath. */
.screen:not(.visible) { pointer-events: none; }

#menu {
  justify-content: flex-start;
  padding-left: 9vw;
  background: linear-gradient(90deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.2) 42%, rgba(0,0,0,0) 68%);
}
.menu-inner { position: relative; }

.title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(38px, 7.2vw, 100px);
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  text-transform: uppercase;
  color: #e6e1d8;
  text-shadow: 0 0 46px rgba(255,255,255,0.08), 0 0 2px rgba(255,255,255,0.25);
}
.subtitle {
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 0.12em;
  color: var(--dim);
  margin: 12px 0 48px 4px;
  font-size: clamp(14px, 1.6vw, 20px);
}
.menu-kicker {
  margin: 0 0 10px 4px;
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(255, 140, 70, 0.6);
}
.menu-about {
  max-width: 400px;
  margin: -32px 0 36px 4px;
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: rgba(220, 216, 208, 0.4);
}
#menu.visible .title { animation: titleIn 3.4s ease both; }
#menu.visible .subtitle, #menu.visible .menu-kicker { animation: fadeUp 2.6s 0.9s ease both; }
#menu.visible .menu-about { animation: fadeUp 2.6s 1.2s ease both; }
#menu.visible .menu-buttons { animation: fadeUp 2.4s 1.5s ease both; }
#menu.visible .menu-best, #menu.visible .menu-share { animation: fadeUp 2.4s 2s ease both; }

.menu-buttons { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.menu-buttons.centered { align-items: center; }
.menu-buttons.row { flex-direction: row; justify-content: center; gap: 48px; flex-wrap: wrap; }

.btn {
  position: relative;
  background: none;
  border: none;
  color: var(--dim);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  padding: 10px 0;
  cursor: pointer;
  transition: color .45s, letter-spacing .45s, text-shadow .45s;
}
.btn::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 50%;
  width: 16px;
  height: 1px;
  background: var(--ember);
  box-shadow: 0 0 8px var(--ember);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity .45s, transform .45s;
}
.btn:hover, .btn:focus-visible {
  outline: none;
  color: var(--fg);
  letter-spacing: 0.5em;
  text-shadow: 0 0 18px rgba(255, 130, 60, 0.35);
}
.btn:hover::before, .btn:focus-visible::before { opacity: 1; transform: scaleX(1); }
.btn.primary { color: #ebe6dc; }

.menu-best {
  margin-top: 44px;
  font-size: 10px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(220, 216, 208, 0.35);
}
.menu-best span { color: var(--dim); letter-spacing: 0.2em; }
.menu-foot {
  position: absolute;
  right: 4vw;
  bottom: calc(9vh + 18px);
  font-size: 10px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(220, 216, 208, 0.25);
}

.panel {
  width: min(560px, 90vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 40px 44px;
  background: rgba(4, 5, 6, 0.82);
  border: 1px solid rgba(220, 216, 208, 0.08);
  box-shadow: 0 30px 80px rgba(0,0,0,0.8);
  text-align: left;
}
.panel.narrow { width: min(360px, 90vw); text-align: center; }
.panel h2, .death-title {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: 0.3em;
  font-size: 22px;
  margin-bottom: 18px;
  color: #e6e1d8;
}
.panel.narrow h2 { margin-bottom: 28px; }
.lead { color: var(--dim); font-family: var(--serif); font-style: italic; margin-bottom: 24px; line-height: 1.5; }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px; margin-bottom: 24px; }
.controls .row { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--fg); letter-spacing: 0.05em; }
.keys { display: flex; gap: 4px; min-width: 70px; }
kbd {
  display: inline-block;
  min-width: 26px;
  padding: 4px 6px;
  border: 1px solid rgba(220, 216, 208, 0.22);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: 11px;
  text-align: center;
  color: var(--fg);
  background: rgba(255,255,255,0.03);
}
kbd.wide { min-width: 60px; }
.tips { list-style: none; margin-bottom: 26px; }
.tips li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--dim);
  line-height: 1.5;
}
.tips li::before { content: '\2014'; position: absolute; left: 0; color: rgba(255, 122, 42, 0.6); }

/* Death screen */
#death { background: radial-gradient(ellipse at center, rgba(0,0,0,0.55), rgba(0,0,0,0.85)); }
.death-inner { text-align: center; padding: 20px; }
.death-title { font-size: clamp(22px, 4vw, 44px); margin-bottom: 14px; }
#death.visible .death-title { animation: titleIn 2.6s ease both; }
#death.visible .death-cause { animation: fadeUp 2s 0.6s ease both; }
#death.visible .death-dist { animation: fadeUp 2s 1s ease both; }
#death.visible .menu-buttons, #death.visible .hint, #death.visible .death-best { animation: fadeUp 2s 1.5s ease both; }
.death-cause { font-family: var(--serif); font-style: italic; color: var(--dim); margin-bottom: 38px; letter-spacing: 0.08em; }
.death-dist { display: flex; flex-direction: column; gap: 8px; align-items: center; margin-bottom: 12px; }
.death-best { min-height: 20px; margin-bottom: 36px; font-size: 11px; letter-spacing: 0.38em; text-transform: uppercase; color: rgba(255, 140, 70, 0.75); }
.hint { margin-top: 26px; font-size: 10px; letter-spacing: 0.35em; text-transform: uppercase; color: rgba(220, 216, 208, 0.28); }

/* Horseman advice */
#advice {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 7;
  max-width: min(340px, 64vw);
  padding: 12px 20px;
  pointer-events: none;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(14px, 1.6vw, 19px);
  line-height: 1.45;
  letter-spacing: 0.05em;
  text-align: center;
  color: #ece3d6;
  text-shadow: 0 0 14px rgba(255, 110, 40, 0.35), 0 0 3px rgba(0,0,0,1);
  background: radial-gradient(ellipse at center, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.25) 55%, rgba(0,0,0,0) 72%);
  opacity: 0;
  filter: blur(5px);
  transition: opacity 1.2s ease, filter 1.2s ease;
  will-change: transform, opacity;
}
#advice::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 1px;
  height: 16px;
  background: linear-gradient(rgba(255, 150, 80, 0.55), rgba(255, 150, 80, 0));
}
#advice.show { opacity: 1; filter: blur(0); }

/* Touch controls */
#touch {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 max(18px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  pointer-events: none;
}
body.touch.playing #touch { display: flex; }
.tc-group { display: flex; gap: 12px; align-items: flex-end; pointer-events: auto; }
.tc {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 1px solid rgba(220, 216, 208, 0.18);
  background: rgba(12, 12, 14, 0.28);
  color: rgba(220, 216, 208, 0.6);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  touch-action: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.tc small { font-size: 8px; letter-spacing: 0.25em; opacity: 0.7; }
.tc.big { width: 88px; height: 88px; }
.tc.active {
  background: rgba(255, 110, 40, 0.16);
  border-color: rgba(255, 130, 60, 0.5);
  color: #fff;
  box-shadow: 0 0 22px rgba(255, 100, 30, 0.25);
}

#fade {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.8s ease;
}
#fade.clear { opacity: 0; }

@keyframes titleIn {
  from { opacity: 0; letter-spacing: 0.6em; filter: blur(8px); }
  to { opacity: 1; filter: blur(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 720px), (max-height: 500px) {
  .stats { gap: 18px; }
  .value { font-size: 15px; }
  .label { font-size: 8px; }
  .icon-btn { width: 34px; height: 34px; font-size: 11px; }
  #menu { padding-left: 7vw; }
  .subtitle { margin-bottom: 22px; }
  .menu-buttons { gap: 4px; }
  .btn { font-size: 12px; padding: 8px 0; }
  .menu-best { margin-top: 18px; }
  .panel { padding: 26px 24px; }
  .controls { grid-template-columns: 1fr; }
  .menu-foot { display: none; }
  .menu-buttons.row { gap: 26px; }
  .death-cause { margin-bottom: 18px; }
  .death-best { margin-bottom: 18px; }
}
@media (max-height: 500px) {
  .tc { width: 58px; height: 58px; }
  .tc.big { width: 72px; height: 72px; }
}

/* Pass 1 additions */
.screen.fast { transition: opacity 0.2s ease, visibility 0s linear 0.2s; }
.screen.fast.visible { transition: opacity 0.2s ease, visibility 0s; }
#death.visible .death-title { animation-duration: 1.2s; }
#death.visible .death-cause, #death.visible .death-stats { animation: fadeUp 0.8s 0.1s ease both; }
#death.visible .menu-buttons, #death.visible .hint, #death.visible .death-best { animation: fadeUp 0.8s 0.25s ease both; }
.death-stats { display: flex; justify-content: center; gap: 64px; margin-bottom: 12px; }
.value.dim { color: var(--dim); }
.menu-keys {
  margin-top: 30px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: rgba(220, 216, 208, 0.4);
}
.menu-keys kbd { padding: 2px 5px; min-width: 20px; margin-right: 2px; }
#menu.visible .menu-keys { animation: fadeUp 2.4s 1.8s ease both; }
#debug {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 30;
  margin: 0;
  padding: 10px 12px;
  font: 12px/1.5 Consolas, "Courier New", monospace;
  color: #9fe29f;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(159, 226, 159, 0.3);
  pointer-events: none;
  white-space: pre;
}
#debug[hidden] { display: none; }
@media (max-width: 720px), (max-height: 500px) {
  .death-stats { gap: 32px; }
  .value.big { font-size: 28px; }
  .menu-keys { display: none; }
}

/* START RIDE — the one big call to action */
.btn.start {
  font-size: clamp(16px, 1.7vw, 21px);
  letter-spacing: 0.46em;
  padding: 18px 40px 18px calc(40px + 0.46em);
  margin: 0 0 14px -2px;
  color: #f1ebe0;
  border: 1px solid rgba(255, 122, 42, 0.45);
  background: linear-gradient(90deg, rgba(255, 110, 40, 0.14), rgba(255, 110, 40, 0.03));
  box-shadow: 0 0 28px rgba(255, 100, 30, 0.12), inset 0 0 18px rgba(255, 110, 40, 0.06);
  transition: color .45s, letter-spacing .45s, text-shadow .45s, border-color .45s, box-shadow .45s, background .45s;
}
.btn.start:hover, .btn.start:focus-visible {
  letter-spacing: 0.52em;
  border-color: rgba(255, 140, 70, 0.8);
  background: linear-gradient(90deg, rgba(255, 110, 40, 0.24), rgba(255, 110, 40, 0.06));
  box-shadow: 0 0 40px rgba(255, 100, 30, 0.28), inset 0 0 22px rgba(255, 110, 40, 0.1);
}
.btn.start::before { left: -30px; }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--dim);
  text-decoration: underline;
  text-decoration-color: rgba(220, 216, 208, 0.25);
  text-underline-offset: 3px;
  transition: color .3s;
}
.link-btn:hover, .link-btn:focus-visible { outline: none; color: var(--fg); }
.link-btn:disabled { cursor: default; opacity: 0.45; text-decoration: none; }

.menu-user {
  margin-top: 14px;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(220, 216, 208, 0.35);
}
.menu-user[hidden] { display: none; }
#menu.visible .menu-user { animation: fadeUp 2.4s 2s ease both; }

/* Sign-in */
#auth { background: radial-gradient(ellipse at center, rgba(0,0,0,0.45), rgba(0,0,0,0.8)); }
.auth-panel { position: relative; width: min(440px, calc(100vw - 32px)); padding: 36px 40px 30px; }
.auth-step[hidden] { display: none; }
.auth-close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--dim);
  cursor: pointer;
  transition: color .3s;
}
.auth-close:hover, .auth-close:focus-visible { outline: none; color: var(--fg); }
.auth-count {
  font-size: 10px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: rgba(255, 140, 70, 0.7);
  margin-bottom: 14px;
}
#auth.visible .auth-step:not([hidden]) { animation: fadeUp 0.6s ease both; }

.choice-list { display: flex; flex-direction: column; gap: 10px; }
.choice {
  text-align: left;
  padding: 15px 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(220, 216, 208, 0.14);
  color: var(--fg);
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .3s, background .3s, box-shadow .3s;
}
.choice:hover, .choice:focus-visible, .choice.selected {
  outline: none;
  border-color: rgba(255, 130, 60, 0.6);
  background: rgba(255, 110, 40, 0.08);
  box-shadow: 0 0 18px rgba(255, 100, 30, 0.12);
}

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.field input {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: var(--fg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(220, 216, 208, 0.18);
  border-radius: 0;
  color-scheme: dark;
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
  transition: border-color .3s, box-shadow .3s;
}
.field input:focus { outline: none; border-color: rgba(255, 130, 60, 0.65); box-shadow: 0 0 16px rgba(255, 100, 30, 0.14); }

.auth-actions { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.auth-actions .btn { font-size: 12px; }
.auth-actions .btn::before { display: none; }
.auth-actions .btn:disabled { opacity: 0.4; cursor: default; }
.auth-panel .lead { margin-bottom: 20px; }
.auth-actions.spaced { margin-top: 24px; }

.google-slot { display: flex; justify-content: center; min-height: 44px; margin-top: 8px; }
.google-slot:empty { display: none; }
.auth-note { font-size: 12px; color: rgba(220, 216, 208, 0.4); text-align: center; letter-spacing: 0.05em; }
.auth-note[hidden] { display: none; }

.auth-status { min-height: 18px; margin-top: 18px; font-size: 12px; letter-spacing: 0.04em; line-height: 1.5; color: var(--dim); }
.auth-status.error { color: #ff9a66; }
#auth.busy .auth-panel { cursor: progress; }

@media (max-width: 480px) {
  .auth-panel { padding: 30px 22px 24px; }
  .btn.start { padding: 16px 28px 16px calc(28px + 0.46em); }
}

/* =====================================================================
   Home / title screen
   Desktop: title column on the left, floating player comments on the
   right, a near-invisible footer in the bottom letterbox bar.
   Tablet: same composition, narrower comments.
   Phones (narrow or short screens): one scrolling column.
   ===================================================================== */

.subtitle { margin: 10px 0 14px 4px; }
.menu-about { margin: 0 0 30px 4px; max-width: 430px; }
.menu-keys { margin-top: 22px; }
.menu-keys kbd { margin-left: 10px; }
.menu-keys kbd:first-child { margin-left: 0; }
.menu-keys kbd + kbd { margin-left: 3px; }
.menu-best { margin-top: 26px; }

/* Keep the title column clear of the comments column. */
.menu-inner { max-width: calc(100vw - 9vw - clamp(240px, 19vw, 340px) - 6vw); }
.title { font-size: clamp(38px, 5.9vw, 100px); white-space: nowrap; }

/* ---------- share ---------- */
.menu-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 12px;
}
.share-line {
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 140, 70, 0.75);
}
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  background: rgba(255, 110, 40, 0.06);
  border: 1px solid rgba(255, 130, 60, 0.35);
  border-radius: 3px;
  color: var(--fg);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color .3s, background .3s, box-shadow .3s;
}
.share-btn svg { fill: var(--ember); stroke: var(--ember); stroke-width: 1.3; }
.share-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(220, 216, 208, 0.16);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(220, 216, 208, 0.7);
  cursor: pointer;
  transition: color .3s, border-color .3s, box-shadow .3s;
}
.share-icon svg { fill: currentColor; }
.share-icon svg .o { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.share-btn:hover, .share-btn:focus-visible,
.share-icon:hover, .share-icon:focus-visible {
  outline: none;
  color: var(--fg);
  border-color: rgba(255, 140, 70, 0.8);
  box-shadow: 0 0 14px rgba(255, 100, 30, 0.22);
}
.share-btn:hover, .share-btn:focus-visible { background: rgba(255, 110, 40, 0.14); }
.share-status { font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ember); }

/* ---------- rating (sample) ---------- */
.menu-rating { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.rating-stars {
  position: relative;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 4px;
  color: rgba(220, 216, 208, 0.16);
  white-space: nowrap;
}
.rating-stars::before {
  content: '\2605\2605\2605\2605\2605';
  position: absolute;
  left: 0;
  top: 0;
  width: var(--fill, 100%);
  overflow: hidden;
  color: rgba(255, 138, 51, 0.85);
}
.rating-text { display: flex; flex-direction: column; gap: 2px; padding-left: 16px; border-left: 1px solid rgba(220, 216, 208, 0.12); }
.rating-score { font-size: 19px; letter-spacing: 0.04em; color: rgba(220, 216, 208, 0.5); }
.rating-score b { font-weight: 600; color: rgba(235, 230, 220, 0.85); }
.rating-label { font-size: 11px; letter-spacing: 0.06em; color: rgba(220, 216, 208, 0.6); }
#menu.visible .menu-rating { animation: fadeUp 2.4s 2.1s ease both; }

/* ---------- player comments (sample) — floating, no border, no card ---------- */
.comments {
  position: absolute;
  right: 3vw;
  top: calc(9vh + 8vh);
  bottom: calc(9vh + 5vh);
  width: clamp(240px, 19vw, 340px);
  display: flex;
  flex-direction: column;
  background: transparent;
}
#menu.visible .comments { animation: fadeUp 2.4s 2.2s ease both; }
.comments-title {
  position: relative;
  margin: 0;
  padding-left: 16px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(220, 216, 208, 0.8);
}
.comments-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 2px;
  height: 16px;
  transform: translateY(-50%);
  background: var(--ember);
  box-shadow: 0 0 8px rgba(255, 122, 42, 0.6);
}
.comments-note { margin: 6px 0 12px 16px; font-size: 10px; letter-spacing: 0.06em; color: rgba(220, 216, 208, 0.4); }
.comments-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0 10px 0 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  scrollbar-width: thin;
  scrollbar-color: rgba(220, 216, 208, 0.14) transparent;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 28px), transparent);
}
.comments-list::-webkit-scrollbar { width: 3px; }
.comments-list::-webkit-scrollbar-track { background: transparent; }
.comments-list::-webkit-scrollbar-thumb { background: rgba(220, 216, 208, 0.14); border-radius: 3px; }
.comments-list:focus-visible { outline: 1px dashed rgba(255, 130, 60, 0.55); outline-offset: 4px; }
.comment {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(220, 216, 208, 0.05);
}
.comment:last-child { border-bottom: none; padding-bottom: 32px; }
.comment-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #ebe6dc;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  opacity: 0.4;
}
.comment-stars { font-size: 11px; letter-spacing: 2px; color: #ff8a33; opacity: 0.85; }
.comment-stars .off { color: rgba(220, 216, 208, 0.35); }
.comment-text {
  margin: 4px 0 3px;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: rgba(220, 216, 208, 0.72);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
  user-select: text;
  -webkit-user-select: text;
}
.comment-time { font-size: 11px; letter-spacing: 0.04em; color: rgba(220, 216, 208, 0.45); }

/* ---------- footer: account + legal, inside the bottom letterbox bar ---------- */
.menu-footer {
  position: absolute;
  left: max(3.2vw, env(safe-area-inset-left));
  right: max(3.2vw, env(safe-area-inset-right));
  bottom: calc(3vh + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(220, 216, 208, 0.5);
}
#menu.visible .menu-footer { animation: fadeUp 2.4s 2.2s ease both; }
.menu-footer .menu-user { margin: 0; font-size: 12px; letter-spacing: 0.06em; color: rgba(220, 216, 208, 0.55); animation: none; }
.legal-links { display: flex; flex-wrap: wrap; margin-left: auto; }
.legal-links a {
  padding: 4px 12px;
  color: rgba(220, 216, 208, 0.5);
  text-decoration: none;
  transition: color .3s;
}
.legal-links a + a { border-left: 1px solid rgba(220, 216, 208, 0.16); }
.legal-links a:last-child { padding-right: 0; }
.legal-links a:hover, .legal-links a:focus-visible { outline: none; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.menu-foot { top: calc(9vh + 16px); bottom: auto; right: 3.5vw; }

/* Sign-in overlay: terms notice under the Google button */
.auth-legal { margin-top: 18px; font-size: 11.5px; line-height: 1.6; text-align: center; color: rgba(220, 216, 208, 0.5); }
.auth-legal a { color: rgba(220, 216, 208, 0.8); text-underline-offset: 3px; }
.auth-legal a:hover, .auth-legal a:focus-visible { color: var(--fg); outline: none; }

/* ---------- short desktop/laptop screens (e.g. 1280×720, 1366×768) ---------- */
@media (max-height: 820px) and (min-height: 501px) and (min-width: 721px) {
  .menu-kicker { margin-bottom: 2px; }
  .subtitle { margin: 4px 0 8px 4px; }
  .menu-about { margin-bottom: 18px; max-width: 480px; font-size: 11.5px; line-height: 1.6; }
  .btn.start { padding-top: 14px; padding-bottom: 14px; margin-bottom: 6px; }
  .menu-buttons { gap: 4px; }
  .menu-keys { margin-top: 12px; }
  .menu-best { margin-top: 16px; }
  .menu-share { margin-top: 8px; }
  .menu-rating { margin-top: 12px; }
}

/* ---------- tablet ---------- */
@media (max-width: 1100px) and (min-width: 721px) and (min-height: 501px) {
  .comments { right: 2.5vw; width: clamp(220px, 27vw, 300px); }
  .menu-inner { max-width: calc(100vw - 9vw - clamp(220px, 27vw, 300px) - 5vw); }
  .comment { grid-template-columns: 30px 1fr; gap: 10px; }
  .comment-avatar { width: 30px; height: 30px; font-size: 10px; }
  .comment-text { font-size: 12px; }
}

/* ---------- phones: portrait or landscape — one scrolling column ---------- */
@media (max-width: 720px), (max-height: 500px) {
  #menu.screen {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding:
      calc(9vh + 22px + env(safe-area-inset-top))
      max(6vw, calc(env(safe-area-inset-right) + 16px))
      calc(9vh + 12px + env(safe-area-inset-bottom))
      max(6vw, calc(env(safe-area-inset-left) + 16px));
  }
  .menu-inner { max-width: 560px; }
  .title { font-size: clamp(27px, 8.8vw, 60px); letter-spacing: 0.26em; }
  .menu-about { margin-bottom: 22px; }
  .menu-share { gap: 10px 14px; }
  .share-btn { padding: 0 18px; font-size: 11px; }
  .menu-rating { margin-top: 18px; }
  .comments {
    position: static;
    width: auto;
    max-width: 560px;
    margin-top: 34px;
  }
  .comments-list { flex: none; max-height: 300px; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .comments-list { max-height: min(380px, 55svh); }   /* 3–4 comments on a portrait phone */
  .menu-footer { position: static; margin-top: 30px; justify-content: flex-start; }
  .legal-links { margin-left: -12px; }
  .legal-links a { padding: 10px 12px; }
}

/* =====================================================================
   Touch devices & phones (gameplay)
   body.touch is set by game.js on coarse-pointer devices or first touch.
   ===================================================================== */

html, body { height: 100%; height: 100dvh; }

/* Keyboard hints on keyboard devices, thumb hints on touch devices. */
.menu-touch-keys { display: none; margin-top: 16px; font-size: 11px; letter-spacing: 0.08em; line-height: 1.6; color: rgba(220, 216, 208, 0.45); }
body.touch .menu-touch-keys { display: block; }
body.touch .menu-keys { display: none; }
body.touch #death .hint { display: none; }

/* Landscape phones (the main way to play): START RIDE must be on screen without scrolling. */
@media (max-height: 500px) {
  .menu-about { display: none; }
  .menu-kicker { margin-bottom: 2px; font-size: 9px; }
  .title { font-size: clamp(26px, 10vh, 48px); }
  .subtitle { margin: 4px 0 12px 4px; font-size: 14px; }
  .btn.start { padding-top: 13px; padding-bottom: 13px; }
  .menu-touch-keys { margin-top: 10px; }
}

/* Touch controls: never select, magnify or open callouts while riding. */
#touch, #touch * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.tc:focus-visible { outline: 2px solid rgba(255, 130, 60, 0.7); outline-offset: 2px; }

/* Finger-sized targets on any touch device (phones and tablets). */
body.touch .icon-btn { width: 44px; height: 44px; }
body.touch .share-btn { min-height: 44px; }
body.touch .share-icon { width: 44px; height: 44px; }

/* Fullscreen: only offered on touch devices whose browser supports it. */
.fs-btn { display: none; place-items: center; }
body.touch.can-fullscreen .fs-btn { display: inline-grid; }
.fs-btn svg { display: block; }

/* Bigger targets on pause and game-over screens for fingers. */
body.touch .panel .menu-buttons .btn,
body.touch #death .menu-buttons .btn { min-height: 48px; min-width: 150px; padding: 12px 18px; }
body.touch .panel .menu-buttons.centered { gap: 8px; }
body.touch .auth-actions .btn { min-height: 44px; padding: 10px 4px; }

/* Rotate tip (portrait phones, first seconds of a ride) — never blocks play */
#rotate {
  position: fixed;
  left: 50%;
  top: calc(max(12px, env(safe-area-inset-top)) + 92px);
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 130, 60, 0.25);
  background: rgba(8, 9, 10, 0.6);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  color: rgba(220, 216, 208, 0.75);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .6s ease, visibility 0s linear .6s;
}
body.rotate-tip #rotate { opacity: 1; visibility: visible; transition: opacity .6s ease; }
.rotate-icon { color: rgba(220, 216, 208, 0.7); flex: none; }

/* Phones: compact HUD */
@media (max-width: 720px), (max-height: 500px) {
  #hud { padding-top: max(12px, env(safe-area-inset-top)); }
  .stats { gap: 18px; }
  .stat { gap: 3px; }
}

/* Portrait phones: compact HUD (2-column stats, utility buttons kept on screen) and
   compact floating controls lifted off the gesture area. */
@media (orientation: portrait) and (max-width: 600px) {
  #hud {
    gap: 10px;
    padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  }
  .stats { display: grid; grid-template-columns: repeat(2, auto); gap: 8px 20px; min-width: 0; }
  .stat .label { font-size: 8px; letter-spacing: 0.3em; }
  .stat .value { font-size: 15px; }
  .hud-buttons { flex: none; gap: 8px; }

  #touch {
    padding:
      0
      max(12px, env(safe-area-inset-right))
      calc(max(14px, env(safe-area-inset-bottom)) + 10px)
      max(12px, env(safe-area-inset-left));
  }
  .tc-group { gap: 8px; }
  .tc { width: clamp(44px, 14vw, 56px); height: clamp(44px, 14vw, 56px); font-size: 9px; letter-spacing: 0.1em; }
  .tc.big { width: clamp(48px, 16vw, 62px); height: clamp(48px, 16vw, 62px); }
  .tc small { font-size: 7px; }
}
@media (orientation: portrait) and (max-width: 360px) {
  body.touch .icon-btn { width: 40px; height: 40px; }
  .hud-buttons { gap: 6px; }
  .stats { gap: 8px 14px; }
}

