/* Rooftop Rush — тёмная glass-тема (неоновый teal + коралл), намеренно != Sort Sprint */
:root {
  --bg: #0b1120;
  --bg2: #101a2e;
  --ink: #eef3fb;
  --muted: #8ea2bd;
  --teal: #8ef4e4;
  --blue: #6fb7ff;
  --coral: #ff6b5e;
  --orange: #ff9f43;
  --gold: #f4c542;
  --good: #7ddb8a;
  --bad: #ff5f52;
  --glass: rgba(255, 255, 255, .055);
  --line: rgba(255, 255, 255, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(111, 183, 255, .16) 0%, transparent 60%),
    radial-gradient(900px 650px at -10% 110%, rgba(255, 107, 94, .13) 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}
.shell {
  width: min(100vw, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  gap: 10px;
}

/* --- шапка --- */
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .05em; font-size: 17px; text-transform: uppercase; min-width: 0; }
.brand-mark {
  font-size: 15px; line-height: 1;
  background: var(--teal);
  color: #06222b; border-radius: 9px; padding: 5px 6px;
  box-shadow: 0 4px 14px rgba(142, 244, 228, .25);
}
.brand-text { color: var(--ink); line-height: 1.12; }
#hazard-tip { position: absolute; z-index: 2; top: 9px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 22px); width: max-content; padding: 7px 11px; border: 1px solid #f4b766; border-radius: 8px; background: #141a29ed; color: #fff0d5; text-align: center; font-size: 13px; font-weight: 750; pointer-events: none; }
#hazard-tip[hidden] { display: none; }
.header-tools { display: flex; gap: 6px; flex-shrink: 0; }
.quiet {
  background: var(--glass); color: var(--ink);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 11px; font-size: 12px; font-weight: 600; cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background .15s, transform .05s;
}
.quiet:hover { background: rgba(255, 255, 255, .12); }
.quiet:active { transform: translateY(1px); }

/* --- HUD: glass-чипы 3x2 --- */
.hud {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--glass); border: 1px solid var(--line);
  border-radius: 16px; padding: 8px;
  backdrop-filter: blur(10px);
}
.hud > div {
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 11px; padding: 5px 6px;
  display: flex; flex-direction: column; align-items: center; min-width: 0;
}
.hud small { font-size: 8.5px; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.hud strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.25; }
#hud-score { color: var(--teal); font-size: 17px; }
#hud-best { color: var(--gold); }
#hud-dist { color: var(--blue); }
#hud-combo[data-hot="true"] { color: var(--orange); text-shadow: 0 0 10px rgba(255, 159, 67, .6); }
#hud-lives { font-size: 12px; letter-spacing: 1px; }
#hud-level { color: var(--coral); }

/* --- полоски прогресса (место зарезервировано всегда, чтобы не прыгало) --- */
.levelbar, .combobar { display: flex; align-items: center; gap: 8px; padding: 0 4px; min-height: 14px; }
.combobar.off, .ghost { visibility: hidden; }
#levelbar-label, #combobar-label {
  font-size: 9.5px; font-weight: 800; letter-spacing: .07em; white-space: nowrap;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
#combobar-label { color: var(--gold); }
.levelbar-track, .combobar-track {
  flex: 1; height: 7px; border-radius: 4px;
  background: rgba(255, 255, 255, .08); overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .05);
}
#levelbar-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--blue)); border-radius: 4px; transition: width .15s linear; }
#combobar-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--orange), var(--coral)); border-radius: 4px; }
.combobar[data-hot="true"] #combobar-label { color: var(--orange); }
.combobar[data-hot="true"] #combobar-fill { box-shadow: 0 0 10px rgba(255, 159, 67, .8); }

/* --- тост (достижения) --- */
.toast {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  z-index: 6;
  background: rgba(13, 20, 34, .95); color: var(--ink);
  border: 1px solid rgba(244, 197, 66, .5);
  font-weight: 800; font-size: 13px;
  padding: 9px 16px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 0 18px rgba(244, 197, 66, .25);
  animation: toast-in .25s ease-out; pointer-events: none; white-space: nowrap;
}
.toast[hidden] { display: none; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* --- звёзды и reward --- */
.stars { color: var(--gold); font-size: 26px; letter-spacing: 4px; text-shadow: 0 0 14px rgba(244, 197, 66, .55); }
.secondary.reward { border-color: rgba(244, 197, 66, .55); color: var(--gold); }
.panel[data-kind="over"] .stars { display: inline-block; margin-bottom: 6px; }

/* --- сцена --- */
.stage {
  position: relative; flex: 1; min-height: 420px;
  border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 14px 34px rgba(0, 0, 0, .35);
  touch-action: none;
}
#field { display: block; width: 100%; height: 100%; outline: none; }
#field:focus { outline: none; }
#field:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--teal); }
.stage:focus { outline: none; }

/* --- оверлей: тёмное стекло --- */
.overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 9, 18, .62);
  backdrop-filter: blur(7px);
  padding: 16px;
}
.overlay[hidden] { display: none; }
.panel {
  background: rgba(13, 20, 34, .94); color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 22px; padding: 20px 20px 14px;
  width: 100%; max-width: 340px; text-align: center;
  max-height: 100%; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(12px);
}
.eyebrow { font-size: 10px; letter-spacing: .16em; font-weight: 800; color: var(--teal); margin: 0 0 6px; text-transform: uppercase; }
.panel h1 { margin: 0 0 10px; font-size: 27px; line-height: 1.12; color: #fff; }
.panel[data-kind="over"] h1 { color: var(--coral); }
.ov-text { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: #cdd9ea; }
.ov-text b { font-size: 18px; color: #fff; }
.ov-text .record { color: var(--gold); }
.ov-tip { margin: 0 0 14px; font-size: 12px; color: var(--muted); line-height: 1.45; }
/* --- howto: список с эмодзи --- */
.howto { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.howto[hidden] { display: none; }
.howto li {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line);
  border-radius: 11px; padding: 6px 10px; font-size: 12.5px; line-height: 1.3; color: #dbe5f4;
}
.howto .ic {
  font-size: 16px; width: 26px; height: 26px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(142, 244, 228, .1); border: 1px solid rgba(142, 244, 228, .25);
  border-radius: 8px;
}
.primary {
  width: 100%; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, var(--coral), var(--orange));
  color: #fff8f4;
  font-size: 16px; font-weight: 800; padding: 13px 16px;
  box-shadow: 0 5px 0 #a33a2e, 0 12px 26px rgba(255, 107, 94, .35);
  transition: transform .05s, box-shadow .05s;
}
.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 #a33a2e, 0 6px 16px rgba(255, 107, 94, .3); }
.primary:disabled { opacity: .55; cursor: default; }
.secondary {
  width: 100%; margin-top: 9px;
  border: 1px solid var(--line); background: var(--glass); color: var(--ink);
  border-radius: 14px; padding: 11px; font-weight: 700; font-size: 13.5px; cursor: pointer;
  transition: background .15s;
}
.secondary:hover { background: rgba(255, 255, 255, .11); }
.panel-foot { margin: 15px 0 0; font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }

/* --- подвал --- */
.dock { text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dock p { margin: 0; font-size: 11.5px; }
.dock .keys, .dock .touch {
  display: inline-block; background: var(--glass); border: 1px solid var(--line);
  padding: 4px 12px; border-radius: 999px;
}
.dock .credit a { color: var(--muted); }

@media (min-width: 560px) {
  .shell { padding-top: 20px; }
  .stage { min-height: 520px; }
}
@media (prefers-reduced-motion: reduce) {
  .primary:active { transform: none; }
}
