@font-face {
  font-family: "Oswald";
  src: url("../assets/fonts/oswald-cyr.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Oswald";
  src: url("../assets/fonts/oswald-lat.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "PT Serif";
  src: url("../assets/fonts/pt-serif-400-normal-cyr.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "PT Serif";
  src: url("../assets/fonts/pt-serif-400-normal-lat.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "PT Serif";
  src: url("../assets/fonts/pt-serif-700-normal-cyr.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "PT Serif";
  src: url("../assets/fonts/pt-serif-700-normal-lat.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "PT Serif";
  src: url("../assets/fonts/pt-serif-400-italic-cyr.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "PT Serif";
  src: url("../assets/fonts/pt-serif-400-italic-lat.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}
@font-face {
  font-family: "PT Mono";
  src: url("../assets/fonts/pt-mono-cyr.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "PT Mono";
  src: url("../assets/fonts/pt-mono-lat.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --paper: #e9dfca;
  --paper-hi: #f2e9d7;
  --paper-lo: #d8c8a9;
  --ink: #171109;
  --ink-2: #0d0905;
  --red: #c0271b;
  --red-dark: #8e1a12;
  --ochre: #c99a3f;
  --teal: #5d8f86;
  --cream: #f2e8d2;
  --muted: #6d5e48;
  --rule: rgba(23, 17, 9, 0.24);
  --font-display: "Oswald", "Arial Narrow", Impact, sans-serif;
  --font-body: "PT Serif", Georgia, "Times New Roman", serif;
  --font-mono: "PT Mono", "Courier New", monospace;
  --pad-h: clamp(94px, 15.5svh, 150px);
  --lane-0: #e03a26;
  --lane-1: #f0b23f;
  --lane-2: #6cb3a6;
  --lane-3: #e07a4a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100svh; overflow-x: hidden; }
body.is-playing { overflow: hidden; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd {
  font-family: var(--font-mono);
  font-size: 0.72em;
  border: 1px solid currentColor;
  border-radius: 0;
  padding: 0.2em 0.42em;
  background: transparent;
  color: inherit;
}
.is-hidden { display: none !important; }
.noscript { padding: 2rem; font-family: var(--font-mono); }

/* ---------- printed paper ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 100% at 78% 0%, #f4ebda 0%, transparent 58%),
    radial-gradient(90% 90% at 8% 100%, #d6c5a5 0%, transparent 58%),
    var(--paper);
}
.bg-halftone {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(23, 17, 9, 0.26) 0.6px, transparent 0.95px);
  background-size: 4px 4px;
  opacity: 0.3;
  mix-blend-mode: multiply;
}
.bg-beam {
  position: absolute;
  background: var(--red);
  transform: rotate(-14deg);
  transform-origin: left center;
  opacity: 0.92;
}
.beam-a { left: 47%; top: 58%; width: 78vw; height: 84px; }
.beam-b { left: 45%; top: 64%; width: 70vw; height: 10px; background: var(--ink); opacity: 0.9; }
.bg-star {
  position: absolute;
  top: -170px;
  right: -100px;
  width: 460px;
  height: 460px;
  background: var(--red);
  opacity: 0.075;
  transform: rotate(12deg);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.bg-frame {
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(23, 17, 9, 0.16);
}

/* ---------- shared type ---------- */
.eyebrow {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--red);
}
.eyebrow::before {
  content: "";
  width: 10px;
  height: 10px;
  flex: none;
  background: var(--red);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* ---------- screens ---------- */
.screen { position: relative; z-index: 2; }

/* ---------- menu ---------- */
.menu {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: calc(76px + env(safe-area-inset-top, 0px));
  flex: none;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(clamp(18px, 4vw, 56px), calc((100vw - 1760px) / 2));
  padding-right: max(clamp(18px, 4vw, 56px), calc((100vw - 1760px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--ink);
  color: var(--cream);
  border-bottom: 4px solid var(--red);
  position: relative;
  z-index: 4;
}
.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-kicker {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.19em;
  color: #d76451;
  white-space: nowrap;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.015em;
  line-height: 1;
  color: var(--cream);
  text-transform: uppercase;
  white-space: nowrap;
}
.brand-logo::before {
  content: "";
  width: 13px;
  height: 13px;
  background: var(--red);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.brand-logo em { font-style: normal; color: var(--red); }
.brand-logo small {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 8px;
  letter-spacing: 0.13em;
  color: #9d8a6d;
  text-transform: uppercase;
  margin-left: 2px;
}
.topbar-right { display: flex; align-items: center; gap: 20px; flex: none; }
.unlisted {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: #c4b393;
  white-space: nowrap;
}
.unlisted i { width: 7px; height: 7px; background: var(--red); }

.lang-switch {
  position: relative;
  flex: none;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lang-switch summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 9px;
  border: 1px solid rgba(242, 232, 210, 0.45);
  color: var(--cream);
  white-space: nowrap;
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary::after { content: " ▾"; color: var(--red); }
.lang-switch ul {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  min-width: 132px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--paper-hi);
  border: 2px solid var(--ink);
  box-shadow: 5px 5px 0 var(--red);
}
.lang-switch li a {
  display: block;
  padding: 7px 9px;
  color: var(--ink);
  white-space: nowrap;
}
.lang-switch li a:hover,
.lang-switch li a.is-active { background: var(--red); color: var(--cream); }

@media (max-width: 1100px) {
  .unlisted { display: none; }
}
@media (max-width: 859px) {
  .lang-switch { display: none; }
}

.menu-main {
  flex: 1;
  width: 100%;
  max-width: 1760px;
  margin: 0 auto;
  padding: clamp(24px, 4.6vh, 48px) max(clamp(18px, 4vw, 56px), calc((100vw - 1760px) / 2));
  padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.55fr);
  gap: clamp(24px, 3.7vw, 62px);
  align-items: center;
  position: relative;
  z-index: 2;
}

.hero { min-width: 0; }
.hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(44px, 4.9vw, 82px);
  line-height: 0.88;
  letter-spacing: -0.012em;
  text-transform: uppercase;
  color: var(--ink);
}
.hero h1 em {
  font-style: normal;
  color: var(--red);
  text-shadow: 3px 3px 0 rgba(23, 17, 9, 0.14);
}
.hero-copy {
  margin: 20px 0 0;
  max-width: 38ch;
  font-size: 14.5px;
  line-height: 1.55;
  color: #3d3224;
}
.hero-copy .ru {
  display: block;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.19em;
  color: var(--red);
}
.keys { margin-top: 24px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.keys-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-right: 5px;
}
.keys kbd {
  width: 31px;
  height: 34px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cream);
  background: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 var(--red);
}
.keys-or {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-left: 7px;
}

.catalogue { min-width: 0; }
.catalogue-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  color: var(--ink);
}
#track-count { color: var(--red); }
.song-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}
.song-card {
  position: relative;
  appearance: none;
  text-align: left;
  padding: 0;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--paper-hi);
  color: var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.song-card:hover { transform: translate(-3px, -3px); box-shadow: 10px 10px 0 var(--ink); }
.song-card.is-selected {
  border-color: var(--red);
  box-shadow: 8px 8px 0 var(--red);
}
.song-card:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

.card-art {
  display: block;
  position: relative;
  height: clamp(132px, 17svh, 180px);
  overflow: hidden;
  background:
    radial-gradient(105% 115% at 82% 0%, rgba(192, 39, 27, 0.4), transparent 56%),
    repeating-linear-gradient(-45deg, transparent 0 12px, rgba(233, 223, 202, 0.035) 12px 13px),
    #0e0a06;
  border-bottom: 2px solid var(--ink);
}
.card-index {
  position: absolute;
  z-index: 1;
  left: 10px;
  bottom: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 72px;
  line-height: 0.78;
  letter-spacing: -0.04em;
  color: rgba(233, 223, 202, 0.16);
}
.card-glyph {
  position: absolute;
  z-index: 2;
  right: 3%;
  top: 12%;
  width: 52%;
  height: 76%;
  filter: saturate(0.95);
}
.card-glyph svg { width: 100%; height: 100%; display: block; }
.card-stamp {
  position: absolute;
  z-index: 3;
  top: 10px;
  left: 10px;
  padding: 3px 5px;
  border: 1px solid #e05245;
  color: #e05245;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  transform: rotate(-7deg);
  background: rgba(233, 223, 202, 0.03);
}
.card-case {
  position: absolute;
  z-index: 3;
  right: 10px;
  bottom: 8px;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  color: rgba(233, 223, 202, 0.55);
}
.card-pick {
  position: absolute;
  z-index: 4;
  right: 10px;
  bottom: 9px;
  padding: 4px 6px;
  background: var(--cream);
  color: var(--red);
  border: 1px solid var(--red);
  box-shadow: 3px 3px 0 var(--red);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.1em;
  transform: translateY(4px) rotate(2deg);
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}
.song-card.is-selected .card-pick { opacity: 1; transform: translateY(0) rotate(2deg); }
.song-card.is-selected .card-case { opacity: 0; }

.card-body { display: block; padding: 12px 14px 13px; }
.card-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  color: var(--red);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-title {
  display: block;
  margin: 5px 0 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(19px, 1.55vw, 23px);
  line-height: 1;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}
.card-stats {
  display: flex;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.card-stats .best { margin-left: auto; color: var(--muted); white-space: nowrap; }
.card-stats .best.is-set { color: var(--red); }
.swipe-hint {
  display: none;
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* ---------- dock ---------- */
.dock {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 98px;
  padding: 14px max(clamp(18px, 4vw, 56px), calc((100vw - 1760px) / 2)) calc(14px + env(safe-area-inset-bottom, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
  background: var(--ink);
  color: var(--cream);
  border-top: 4px solid var(--red);
}
.dock-track { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dock-label {
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  color: #d76451;
}
.dock-track strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#dock-meta {
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  color: #b3a184;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-diff {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(242, 232, 210, 0.28);
  background: #21190f;
}
.dock-diff button {
  appearance: none;
  border: 0;
  background: transparent;
  color: #b8a68a;
  padding: 7px 11px 6px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background 130ms ease, color 130ms ease;
}
.dock-diff button small { font-size: 7.5px; color: #8d7b61; letter-spacing: 0.02em; }
.dock-diff button:hover { color: var(--cream); }
.dock-diff button.is-active { background: var(--red); color: var(--cream); }
.dock-diff button.is-active small { color: rgba(242, 232, 210, 0.68); }
.play-btn {
  appearance: none;
  border: 2px solid var(--cream);
  border-radius: 0;
  padding: 0 22px;
  height: 56px;
  min-width: 176px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--red);
  box-shadow: 5px 5px 0 var(--cream);
  transition: transform 130ms ease, box-shadow 130ms ease, background 130ms ease;
}
.play-btn span { display: flex; flex-direction: column; align-items: center; line-height: 0.95; }
.play-btn b { font-weight: 700; }
.play-btn small {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: 0.2em;
  color: rgba(242, 232, 210, 0.72);
}
.play-btn::before {
  content: "";
  width: 15px;
  height: 15px;
  background: var(--cream);
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.play-btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--cream); background: #d12d20; }
.play-btn:active { transform: translate(1px, 1px); box-shadow: 3px 3px 0 var(--cream); }
.play-btn:disabled { opacity: 0.65; cursor: wait; transform: none; }
.play-btn kbd { border-color: rgba(242, 232, 210, 0.6); color: var(--cream); }

.poster-side {
  position: fixed;
  z-index: 3;
  right: 17px;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.3em;
  color: rgba(23, 17, 9, 0.36);
  pointer-events: none;
}

/* ---------- game ---------- */
.game {
  position: fixed;
  inset: 0;
  background: #100b07;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.game::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 10px;
  border: 1px solid rgba(233, 223, 202, 0.12);
  pointer-events: none;
}
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.game-hud {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) clamp(14px, 2.4vw, 30px) 16px;
  pointer-events: none;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(12, 8, 5, 0.92) 0%, rgba(12, 8, 5, 0.55) 62%, transparent 100%);
  box-shadow: 0 1px 0 rgba(233, 223, 202, 0.12);
}
.game-hud::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--red);
  opacity: 0.8;
}
.hud-cell { display: flex; flex-direction: column; gap: 1px; line-height: 1; }
.hud-cell span {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #e06a52;
}
.hud-cell strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.6vw, 31px);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--cream);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.65);
}
.hud-combo { align-items: center; position: relative; }
.hud-combo strong {
  font-size: clamp(36px, 5vw, 58px);
  line-height: 0.9;
  transition: transform 60ms ease;
}
.hud-combo strong.pop { transform: scale(1.1); }
.hud-combo i {
  position: absolute;
  right: -25px;
  bottom: 6px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--red);
}
.hud-acc { align-items: flex-end; padding-right: 56px; }
.hud-acc strong { color: var(--ochre); }
.pause-btn {
  pointer-events: auto;
  position: absolute;
  right: clamp(14px, 2.4vw, 30px);
  top: calc(15px + env(safe-area-inset-top, 0px));
  width: 38px;
  height: 38px;
  border-radius: 0;
  border: 1px solid rgba(242, 232, 210, 0.5);
  background: #1b130b;
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
}
.pause-btn:hover { background: var(--red); border-color: var(--red); }
.progress {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #2a2014;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--red);
  transition: transform 80ms linear;
  transform-origin: 0 50%;
}
.game-song {
  position: absolute;
  z-index: 5;
  top: calc(76px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  color: #c2ae8d;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}
.game-song em { font-style: normal; color: var(--red); }

.judge {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%) scale(0.8);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 0.86;
  letter-spacing: 0.03em;
  text-align: center;
  color: var(--cream);
  text-shadow: 5px 5px 0 var(--red);
  opacity: 0;
  pointer-events: none;
}
.judge b { display: block; font-weight: 700; }
.judge small {
  display: block;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--cream);
  opacity: 0.8;
  text-shadow: none;
}
.judge.great b { color: var(--ochre); }
.judge.good b { color: var(--teal); }
.judge.miss b { color: var(--red); text-shadow: 4px 4px 0 rgba(233, 223, 202, 0.82); }
.judge.miss small { color: var(--cream); opacity: 0.95; }
.judge.show { animation: judge-pop 640ms ease-out both; }
@keyframes judge-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  68% { opacity: 1; transform: translate(-50%, -56%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.98); }
}

.countdown {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(104px, 17vw, 210px);
  line-height: 0.8;
  color: var(--cream);
  text-shadow: 8px 8px 0 var(--red);
  pointer-events: none;
  opacity: 0;
}
.countdown.go {
  font-size: clamp(42px, 8.2vw, 100px);
  letter-spacing: 0.04em;
  color: var(--cream);
  text-shadow: 6px 6px 0 var(--red);
}
.countdown.show { animation: count-pop 1050ms ease-out both; }
@keyframes count-pop {
  0% { opacity: 0; transform: scale(1.4); }
  12% { opacity: 1; transform: scale(1); }
  82% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}

.pads {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(90vw, 1080px);
  height: var(--pad-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0;
  touch-action: none;
}
.pads button {
  appearance: none;
  border: 1px solid transparent;
  border-top-color: rgba(23, 17, 9, 0.25);
  border-radius: 0;
  background: transparent;
  padding: 0;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.pads button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pads button.is-down { background: rgba(192, 39, 27, 0.12); }

/* ---------- overlays ---------- */
.overlay-layer {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 7, 4, 0.82);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.panel {
  position: relative;
  width: min(560px, 100%);
  border: 2px solid var(--ink);
  border-radius: 0;
  padding: clamp(24px, 4vw, 44px);
  background:
    radial-gradient(110% 120% at 100% 0%, rgba(192, 39, 27, 0.09), transparent 55%),
    var(--paper-hi);
  color: var(--ink);
  box-shadow: 11px 11px 0 var(--red);
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 6px;
  background: var(--red);
}
.panel h2 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 4.5vw, 50px);
  line-height: 0.92;
  text-transform: uppercase;
  letter-spacing: 0.005em;
}
.pause-panel { width: min(500px, 100%); }
.pause-panel::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: 26px;
  width: 104px;
  height: 104px;
  background: var(--red);
  opacity: 0.08;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  pointer-events: none;
}
.pause-meta {
  margin: -8px 0 22px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.solid-btn, .ghost-btn {
  appearance: none;
  border-radius: 0;
  border: 2px solid var(--ink);
  padding: 11px 17px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}
.solid-btn {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 4px 4px 0 var(--red);
}
.solid-btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--red); }
.ghost-btn {
  background: var(--paper-hi);
  color: var(--ink);
  box-shadow: 4px 4px 0 rgba(23, 17, 9, 0.22);
}
.ghost-btn:hover { background: var(--red); color: var(--cream); box-shadow: 5px 5px 0 var(--ink); }
.ghost-btn.danger { color: var(--red-dark); border-color: var(--red-dark); }
.ghost-btn.danger:hover { background: var(--red-dark); color: var(--cream); }
.topbar .ghost-btn {
  background: transparent;
  color: var(--cream);
  border-color: rgba(242, 232, 210, 0.45);
  box-shadow: none;
}
.topbar .ghost-btn:hover {
  background: var(--red);
  border-color: var(--red);
  color: var(--cream);
}
.solid-btn kbd, .ghost-btn kbd {
  color: inherit;
  border-color: currentColor;
  opacity: 1;
  font-size: 8px;
  line-height: 1;
  padding: 2px 4px;
  letter-spacing: 0.04em;
}

/* ---------- settings ---------- */
.settings-panel { width: min(590px, 100%); }
.setting-row { margin-bottom: 22px; }
.setting-row label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink);
  margin-bottom: 12px;
  text-transform: uppercase;
}
.setting-row output { color: var(--red); font-size: 12px; }
.setting-row input[type="range"] {
  width: 100%;
  appearance: none;
  height: 4px;
  border-radius: 0;
  background: var(--ink);
  outline: none;
}
.setting-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 0;
  background: var(--red);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
}
.setting-row input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 0;
  background: var(--red);
  border: 2px solid var(--ink);
}
.setting-row p { margin: 12px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.sound-check .ghost-btn { margin: 4px 0 2px; }
#sound-state.is-on { color: var(--teal); }
#sound-state.is-off { color: var(--red); }
.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 0 22px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-transform: uppercase;
}
.switch-row input { width: 17px; height: 17px; accent-color: var(--red); }
.switch-row em {
  font-style: normal;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-left: auto;
  font-size: 8px;
  text-transform: none;
}

/* ---------- results ---------- */
.results {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  color: var(--ink);
  background:
    radial-gradient(80% 70% at 50% 0%, #f4ebda 0%, transparent 60%),
    radial-gradient(90% 90% at 50% 100%, #d8c8a9 0%, transparent 60%),
    var(--paper);
}
.results::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 10px;
  background: var(--red);
}
.results::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(23, 17, 9, 0.24) 0.6px, transparent 0.95px);
  background-size: 4px 4px;
  opacity: 0.22;
  mix-blend-mode: multiply;
}
.results-inner {
  position: relative;
  z-index: 1;
  width: min(660px, 100%);
  text-align: center;
  padding: 26px 0;
}
.results-inner .eyebrow { justify-content: center; }
.rank-wrap { position: relative; display: inline-flex; align-items: flex-start; }
.rank-wrap::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: 50%;
  top: 50%;
  width: 280px;
  height: 280px;
  transform: translate(-50%, -50%) rotate(-8deg);
  background: var(--red);
  opacity: 0.08;
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.rank {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(120px, 19vw, 205px);
  line-height: 0.8;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-shadow: 7px 7px 0 rgba(192, 39, 27, 0.16);
}
.rank.rank-s { color: var(--red); }
.rank.rank-a { color: var(--ink); }
.rank.rank-b { color: #a97522; }
.rank.rank-c { color: var(--red-dark); }
.rank.rank-d { color: var(--red-dark); }
.new-best {
  position: relative;
  z-index: 2;
  margin: 10px 0 0 14px;
  padding: 6px 9px;
  border: 2px solid var(--ink);
  background: var(--red);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  transform: rotate(-3deg);
  box-shadow: 3px 3px 0 var(--ink);
  animation: best-blink 1.4s ease-in-out infinite alternate;
}
@keyframes best-blink { from { opacity: 0.62; } to { opacity: 1; } }
.rank-label {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.32em;
  color: var(--red);
}
.result-title {
  margin-top: 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.6vw, 27px);
  text-transform: uppercase;
  letter-spacing: 0.015em;
}
.result-title em { font-style: normal; color: var(--red); }
.result-score {
  margin: 2px 0 18px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(38px, 5.4vw, 54px);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--ink);
  background: var(--paper-hi);
  margin-bottom: 22px;
}
.result-stats > div {
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
.result-stats > div:nth-child(3n) { border-right: 0; }
.result-stats > div:nth-child(n + 4) { border-bottom: 0; }
.result-stats span {
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.result-stats strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.results-inner .btn-row { justify-content: center; }
.result-code {
  margin: 22px 0 0;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.14em;
  color: rgba(23, 17, 9, 0.45);
}
.result-stamp {
  position: absolute;
  z-index: 2;
  top: 44px;
  right: -6px;
  padding: 6px 10px;
  border: 3px solid var(--red);
  color: var(--red);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.06em;
  transform: rotate(-9deg);
  opacity: 0.72;
  text-transform: uppercase;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  border: 2px solid var(--red);
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  box-shadow: 4px 4px 0 var(--red);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .poster-side { display: none; }
}

@media (max-width: 1080px) {
  .menu-main {
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
    padding-top: 26px;
  }
  .hero h1 { font-size: clamp(38px, 5.2vw, 58px); }
  .hero-copy { max-width: 60ch; margin-top: 14px; }
  .keys { margin-top: 16px; }
  .menu-main { padding-top: 16px; gap: 18px; }
  .song-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-art { height: clamp(100px, 10.5vw, 132px); }
  .card-title { font-size: clamp(16px, 1.4vw, 20px); }
  .bg-beam { display: none; }
}

@media (max-width: 860px) {
  .topbar { height: calc(62px + env(safe-area-inset-top, 0px)); }
  .brand-kicker { display: none; }
  .brand-logo { font-size: 24px; gap: 7px; }
  .brand-logo small { display: none; }
  .unlisted { display: none; }
  .topbar-right { gap: 0; }
  .ghost-btn { padding: 9px 12px; }

  .menu-main { padding-bottom: 210px; }
  .hero h1 { font-size: clamp(36px, 9.4vw, 58px); }
  .hero-copy { font-size: 13px; }
  .song-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 2px 2px 8px;
    scrollbar-width: none;
  }
  .song-grid::-webkit-scrollbar { display: none; }
  .song-card { flex: 0 0 74vw; scroll-snap-align: start; }
  .card-art { height: 118px; }
  .swipe-hint { display: block; }
  .bg-star { width: 300px; height: 300px; top: -130px; right: -90px; }
  .bg-frame { inset: 8px; }

  .dock {
    grid-template-columns: 1fr auto;
    gap: 9px 12px;
    min-height: 0;
    padding-top: 11px;
    padding-bottom: calc(11px + env(safe-area-inset-bottom, 0px));
  }
  .dock-track { grid-column: 1 / -1; }
  .dock-track strong { font-size: 19px; }
  .dock-diff { justify-self: start; }
  .dock-diff button { padding: 6px 9px 5px; }
  .play-btn { height: 48px; min-width: 126px; padding: 0 16px; font-size: 19px; }
  .play-btn kbd { display: none; }
}

@media (max-width: 620px) {
  .hud-cell span { font-size: 8px; letter-spacing: 0.1em; }
  .hud-combo i { right: -21px; bottom: 4px; }
  .hud-acc { padding-right: 47px; }
  .pause-btn { width: 35px; height: 35px; top: calc(12px + env(safe-area-inset-top, 0px)); }
  .game-song { top: calc(66px + env(safe-area-inset-top, 0px)); font-size: 8px; letter-spacing: 0.12em; }
  .judge { top: 58%; font-size: clamp(32px, 9vw, 48px); }
  .judge small { font-size: 8px; letter-spacing: 0.24em; }
  .pads { width: min(90vw, 1080px); gap: 0; padding: 0; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .result-stats > div:nth-child(n + 1) { border-bottom: 1px solid var(--ink); }
  .result-stats > div:nth-child(3n) { border-right: 1px solid var(--ink); }
  .result-stats > div:nth-child(2n) { border-right: 0; }
  .result-stats > div:nth-child(n + 5) { border-bottom: 0; }
  .switch-row em { display: none; }
  .results-inner { padding: 10px 0; }
  .result-stamp { display: none; }
  .new-best { margin-left: 8px; padding: 4px 6px; font-size: 7.5px; }
  .pause-panel::after { width: 74px; height: 74px; right: 12px; bottom: 14px; }
  .rank-wrap::before { width: 210px; height: 210px; }
  .result-code { font-size: 6.5px; }
}

@media (max-width: 380px) {
  .rank { font-size: 100px; }
  .results-inner { padding: 8px 0; }
  .result-title { margin-top: 12px; font-size: 17px; }
  .result-score { margin-bottom: 12px; font-size: 32px; }
  .result-stats { margin-bottom: 16px; }
  .result-stats > div { padding: 9px 6px 8px; }
  .result-stats strong { font-size: 18px; }
  .results-inner .btn-row { flex-wrap: nowrap; }
  .results-inner .solid-btn, .results-inner .ghost-btn { padding: 11px 10px; font-size: 8.5px; }
  .pause-meta { font-size: 8px; letter-spacing: 0.08em; }
  .play-btn { min-width: 108px; font-size: 18px; padding: 0 12px; gap: 8px; }
  .play-btn::before { width: 12px; height: 12px; }
  .play-btn small { font-size: 6.5px; }
}

@media (max-width: 1080px) and (max-height: 760px) {
  .hero-copy { display: none; }
}

@media (max-width: 860px) and (max-height: 800px) {
  .menu-main { padding-top: 14px; gap: 16px; }
  .hero-copy { display: none; }
  .hero h1 { font-size: clamp(30px, 8.6vw, 44px); }
  .keys { margin-top: 12px; }
}

@media (max-width: 860px) and (max-height: 600px) {
  .hero .eyebrow, .hero .keys { display: none; }
  .hero h1 { font-size: 28px; }
  .card-art { height: 100px; }
  .menu-main { gap: 12px; padding-bottom: 144px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .hud-combo strong { font-size: 30px; }
  .game-song { display: none; }
  .countdown { font-size: 64px; }
  .judge { top: 52%; font-size: 28px; }
  .pads { --pad-h: 94px; }

  .menu .topbar { height: calc(50px + env(safe-area-inset-top, 0px)); }
  .menu .hero { display: none; }
  .menu-main {
    grid-template-columns: 1fr;
    padding-top: 10px;
    padding-bottom: 108px;
    align-items: start;
  }
  .catalogue-head { margin-bottom: 8px; }
  .card-art { height: 104px; }
  .card-body { padding: 9px 12px 10px; }
  .card-title { margin: 3px 0 6px; font-size: 16px; }
  .swipe-hint { margin-top: 6px; }
  .dock { min-height: 0; padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .dock-track { display: none; }
  .dock-diff { grid-column: 1; }
  .play-btn { height: 44px; }
}

@media (hover: none) {
  .song-card:hover { transform: none; box-shadow: 7px 7px 0 var(--ink); }
  .song-card.is-selected:hover { box-shadow: 8px 8px 0 var(--red); }
  .play-btn:hover { transform: none; box-shadow: 5px 5px 0 var(--cream); }
}

@media (prefers-reduced-motion: reduce) {
  .judge.show, .countdown.show, .new-best { animation-duration: 1ms; }
  .song-card, .play-btn, .solid-btn, .ghost-btn { transition: none; }
}
