/* Шрифты Playfair Display и Inter (Google Fonts, OFL) лежат рядом — с Google ничего не грузим */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(fonts/inter-latin-wght-normal.woff2) format("woff2"); 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: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-cyrillic-wght-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-latin-wght-normal.woff2) format("woff2"); 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: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-cyrillic-wght-italic.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 900; font-display: swap; src: url(fonts/playfair-display-latin-wght-italic.woff2) format("woff2"); 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; }

/* Палитра и шрифты — как у страницы-барабана ../slot и прошлых дней */
:root {
  --bg: #120b07;
  --bg-2: #1a110c;
  --wood: #6b3f24;
  --wood-hi: #8a5532;
  --wood-lo: #3e2414;
  --brass: #e0b45c;
  --brass-lo: #9c7428;
  --cream: #f6ecd9;
  --ink: #2a1a10;
  --red: #d8412f;
  --red-lo: #9e2a1c;
  --text: #f6ecd9;
  --text-soft: #b89f84;
  --glass: rgba(22, 13, 8, .74);
  --line: rgba(255, 255, 255, .12);
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --gut: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(120% 80% at 50% 105%, #3a1d10 0%, rgba(58, 29, 16, 0) 60%),
    radial-gradient(90% 60% at 50% 0%, #24150d 0%, var(--bg) 70%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button, input, a { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
kbd {
  display: inline-block; font: 600 11px/1 var(--sans); padding: 3px 6px 4px; border-radius: 5px;
  border: 1px solid rgba(224, 180, 92, .6); color: var(--brass); background: rgba(224, 180, 92, .08);
}

/* ---------- сцена ---------- */
#cam {
  position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1);
  pointer-events: none; opacity: .55; filter: sepia(.28) saturate(1.1) brightness(.82) contrast(1.06);
}
body.no-cam #cam { visibility: hidden; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; z-index: 1; }

/* ---------- кнопки ---------- */
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--glass); display: grid; place-items: center; padding: 0; flex: none;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background .15s, border-color .15s, transform .08s;
}
.icon-btn:hover { background: rgba(48, 30, 18, .88); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.on { border-color: var(--brass); background: rgba(224, 180, 92, .2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#btnCam .slash { stroke: #ff8a78; }
#btnCam.on .slash { display: none; }
#btnMute .x { display: none; }
#btnMute.on .x { display: block; stroke: #ff8a78; }
#btnMute.on .wave { display: none; }
.btn {
  height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06); font-weight: 600; white-space: nowrap; transition: filter .15s, transform .08s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn.wide { width: 100%; }
.play {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  height: 60px; min-width: 260px; padding: 0 40px; border-radius: 999px; border: 0;
  background: linear-gradient(180deg, #ef5a45, var(--red) 55%, var(--red-lo));
  color: #fff; font-weight: 700; font-size: 19px; letter-spacing: .02em;
  box-shadow: 0 6px 0 #6d1c12, 0 16px 34px -8px rgba(216, 65, 47, .6), inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.play:hover { filter: brightness(1.08); }
.play:active { transform: translateY(4px); box-shadow: 0 2px 0 #6d1c12, 0 8px 20px -8px rgba(216, 65, 47, .6), inset 0 1px 0 rgba(255, 255, 255, .35); }
.play.small { height: 46px; min-width: 0; padding: 0 26px; font-size: 16px; box-shadow: 0 4px 0 #6d1c12, inset 0 1px 0 rgba(255, 255, 255, .35); }
.link {
  border: 0; background: none; color: var(--text-soft); font-size: 15px; padding: 10px 12px;
  text-decoration: underline; text-decoration-color: rgba(184, 159, 132, .45); text-underline-offset: 4px;
}
.link:hover { color: var(--cream); }
.link.small { font-size: 13px; padding: 6px 4px; }
.chip {
  height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .05); font-size: 13px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; transition: background .15s, border-color .15s, transform .08s;
}
.chip:hover { background: rgba(255, 255, 255, .1); }
.chip:active { transform: scale(.96); }
.chip:disabled { opacity: .4; pointer-events: none; }
.chip .ico { display: none; font-size: 15px; line-height: 1; }
.chip .led { width: 8px; height: 8px; border-radius: 50%; background: #5a4636; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .5); }
.chip.tgl[aria-pressed="true"] { border-color: rgba(224, 180, 92, .7); background: rgba(224, 180, 92, .16); }
.chip.tgl[aria-pressed="true"] .led { background: var(--brass); box-shadow: 0 0 8px var(--brass); }
.chip.rec .dot { width: 10px; height: 10px; border-radius: 50%; background: #ff5a45; }
.chip.rec.on { background: rgba(216, 65, 47, .35); border-color: #ff5a45; }
.chip.rec.on .dot { animation: blink .8s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- верхняя панель ---------- */
.bar {
  position: fixed; z-index: 5; top: calc(8px + var(--st)); left: calc(var(--gut) + var(--sl)); right: calc(var(--gut) + var(--sr));
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; pointer-events: none;
}
.bar > * { pointer-events: auto; }
.brand {
  justify-self: start; font-family: var(--serif); font-weight: 800; font-size: 19px; letter-spacing: .01em;
  display: flex; align-items: center; gap: 9px; white-space: nowrap; text-shadow: 0 2px 10px #000;
}
.brand em { color: var(--brass); font-style: italic; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff1c1, #d29a3a 45%, #6e4510 100%);
  box-shadow: 0 0 0 2px rgba(224, 180, 92, .35), 0 0 16px rgba(255, 190, 90, .45);
}
.modes {
  display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.modes button {
  height: 34px; padding: 0 15px; border-radius: 999px; border: 0; background: none; font-size: 14px; font-weight: 600;
  color: var(--text-soft); white-space: nowrap; transition: background .15s, color .15s;
}
.modes button:hover { color: var(--cream); }
.modes button[aria-selected="true"] { background: linear-gradient(180deg, #f0c878, var(--brass)); color: var(--ink); box-shadow: 0 2px 10px -2px rgba(224, 180, 92, .6); }
.modes .short { display: none; }
.tools { justify-self: end; display: flex; gap: 6px; align-items: center; }
.rec-btn {
  height: 40px; padding: 0 14px 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass);
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; white-space: nowrap;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-variant-numeric: tabular-nums;
}
.rec-btn:hover { background: rgba(48, 30, 18, .88); }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #ff5a45; box-shadow: 0 0 0 3px rgba(255, 90, 69, .2); }
.rec-btn.on { background: #b92d1f; border-color: #ff7a66; }
.rec-btn.on .rec-dot { background: #fff; animation: blink .8s steps(2) infinite; }

/* ---------- панель режима ---------- */
.panel {
  position: fixed; z-index: 4; top: calc(58px + var(--st)); left: calc(var(--gut) + var(--sl));
  display: flex; flex-direction: column; gap: 8px; padding: 8px 10px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  max-width: calc(100vw - 2 * var(--gut) - 110px);
}
.prow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bpm { display: flex; align-items: center; gap: 4px; }
.bpm input { width: 120px; }
.bpm output { font-size: 12px; color: var(--text-soft); min-width: 62px; white-space: nowrap; }
.bpm output b { font: 800 18px/1 var(--serif); color: var(--cream); font-variant-numeric: lining-nums tabular-nums; }
.mini {
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .05);
  padding: 0; font-size: 15px; line-height: 1;
}
.mini:disabled, input:disabled { opacity: .35; }
.beats { display: flex; gap: 5px; padding: 0 4px; }
.beats i { width: 9px; height: 9px; border-radius: 50%; background: rgba(246, 236, 217, .16); transition: background .25s, box-shadow .25s; }
.beats i.on { background: var(--brass); box-shadow: 0 0 10px var(--brass); transition: none; }
.beats i.on.acc { background: #ff8a5c; box-shadow: 0 0 12px #ff8a5c; }
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, .2); }
.seg > span { font-size: 12px; color: var(--text-soft); padding: 0 6px 0 8px; }
.seg button { height: 28px; min-width: 30px; padding: 0 8px; border-radius: 999px; border: 0; background: none; font-size: 13px; font-weight: 700; color: var(--text-soft); }
.seg button[aria-pressed="true"] { background: var(--brass); color: var(--ink); }
.seg button:disabled { opacity: .45; }
.loopbox { display: flex; flex-direction: column; gap: 4px; }
#loopCanvas { width: 100%; min-width: 280px; height: 40px; border-radius: 8px; background: rgba(0, 0, 0, .28); display: block; }
.loop-status { font-size: 12px; color: var(--text-soft); }
.loop-status b { color: var(--cream); }

input[type="range"] { -webkit-appearance: none; appearance: none; height: 22px; background: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--brass) var(--p, 50%), rgba(246, 236, 217, .18) var(--p, 50%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(246, 236, 217, .18); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--brass); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--cream); border: 2px solid var(--brass); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--cream); border: 2px solid var(--brass); }

/* ---------- ритм-игра ---------- */
.songs {
  position: fixed; z-index: 4; top: calc(58px + var(--st)); left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100vw - 2 * var(--gut))); padding: 14px 16px 12px; border-radius: 18px; text-align: center;
  background: linear-gradient(180deg, rgba(40, 24, 15, .92), rgba(22, 13, 8, .92)); border: 1px solid rgba(224, 180, 92, .35);
  box-shadow: 0 20px 50px -20px #000; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.songs h2 { margin: 0; font: italic 800 24px/1.1 var(--serif); }
.songs .sub { margin: 4px 0 12px; font-size: 13px; color: var(--text-soft); }
.song-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.song {
  text-align: left; padding: 12px 12px 11px; border-radius: 14px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(107, 63, 36, .35), rgba(62, 36, 20, .35));
  display: flex; flex-direction: column; gap: 3px; transition: transform .12s, border-color .15s, background .15s;
}
.song:hover { border-color: rgba(224, 180, 92, .7); transform: translateY(-2px); }
.song .lvl { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brass); }
.song b { font: 800 18px/1.15 var(--serif); }
.song .meta { font-size: 12px; color: var(--text-soft); }
.song .best { font-size: 12px; color: var(--cream); margin-top: 2px; }
.song .go { margin-top: 6px; align-self: flex-start; font-size: 13px; font-weight: 700; color: #ff8a78; }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--text-soft); cursor: pointer; }
.check input { accent-color: var(--brass); width: 16px; height: 16px; }
.game-bar {
  position: fixed; z-index: 4; top: calc(58px + var(--st)); left: calc(var(--gut) + var(--sl));
  display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 14px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-size: 13px; font-weight: 600;
}

/* ---------- бочка ---------- */
.kick-btn {
  position: fixed; z-index: 4; right: calc(16px + var(--sr)); bottom: calc(16px + var(--sb));
  width: 96px; height: 96px; border-radius: 50%; padding: 0; border: 0;
  background: radial-gradient(circle at 38% 30%, #3a241a, #120a07 70%);
  box-shadow: 0 0 0 4px #7a0f1f, 0 0 0 6px rgba(224, 180, 92, .7), 0 12px 30px -6px #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  touch-action: none;
}
.kick-btn b { font: italic 800 17px/1 var(--serif); color: var(--brass); }
.kick-btn .kick-ring { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.kick-btn.hit { animation: kickPress .16s ease-out; }
@keyframes kickPress { 35% { transform: scale(.9); } }
.kick-btn.hit .kick-ring { animation: kickRing .4s ease-out; }
@keyframes kickRing { from { box-shadow: 0 0 0 0 rgba(255, 150, 70, .8); } to { box-shadow: 0 0 0 26px rgba(255, 150, 70, 0); } }
body.touch .kick-btn kbd, body.touch #selfKick + span::after { display: none; }

/* ---------- подсказки ---------- */
.toast {
  position: fixed; z-index: 6; left: 50%; top: max(calc(120px + var(--st)), 22vh); transform: translate(-50%, -8px);
  max-width: min(560px, calc(100vw - 2 * var(--gut))); padding: 10px 18px; border-radius: 14px;
  background: rgba(30, 18, 11, .92); border: 1px solid rgba(224, 180, 92, .45); box-shadow: 0 14px 34px -14px #000;
  font-size: 15px; font-weight: 500; text-align: center; line-height: 1.35;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--brass); }
body.has-panel .toast { top: auto; bottom: calc(18px + var(--sb)); transform: translate(-50%, 8px); }
body.has-panel .toast.show { transform: translate(-50%, 0); }
.pill {
  position: fixed; z-index: 6; left: 50%; bottom: calc(18px + var(--sb)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 999px;
  background: rgba(30, 18, 11, .92); border: 1px solid var(--line); font-size: 13px; white-space: nowrap;
}
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(224, 180, 92, .3); border-top-color: var(--brass); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.debug {
  position: fixed; z-index: 6; left: calc(var(--gut) + var(--sl)); bottom: calc(12px + var(--sb)); margin: 0;
  padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, .7); color: #cfe9c9;
  font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; pointer-events: none; white-space: pre;
}

/* ---------- стартовый экран ---------- */
.menu-screen {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; overflow-y: auto;
  padding: calc(24px + var(--st)) calc(20px + var(--sr)) calc(24px + var(--sb)) calc(20px + var(--sl));
  background:
    radial-gradient(70% 60% at 50% 42%, rgba(18, 11, 7, .78) 0%, rgba(18, 11, 7, .55) 75%),
    linear-gradient(180deg, rgba(18, 11, 7, .55), rgba(18, 11, 7, .2) 60%, rgba(18, 11, 7, .5));
}
body:not(.menu) .menu-screen { display: none; }
body.menu .bar, body.menu .panel, body.menu .kick-btn, body.menu .songs, body.menu .game-bar { visibility: hidden; }
.menu-in { width: min(880px, 100%); text-align: center; display: flex; flex-direction: column; align-items: center; }
.kicker { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); }
h1 { margin: 0; font: 800 clamp(40px, 7vw, 76px)/1 var(--serif); letter-spacing: -.01em; text-shadow: 0 4px 30px rgba(0, 0, 0, .6); }
h1 em { font-style: italic; color: var(--brass); background: linear-gradient(180deg, #fff0c2, #e0b45c 55%, #b07f2c); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; padding-right: .06em; }
.lead { margin: 14px 0 22px; font-size: 18px; color: var(--cream); opacity: .9; max-width: 560px; line-height: 1.45; }
.steps { list-style: none; margin: 0 0 26px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; }
.step {
  padding: 14px 14px 16px; border-radius: 18px; background: linear-gradient(180deg, rgba(58, 34, 20, .75), rgba(30, 18, 11, .75));
  border: 1px solid rgba(224, 180, 92, .22); display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.step b { font: 700 17px/1.2 var(--serif); margin-top: 6px; }
.step > span { font-size: 13px; color: var(--text-soft); line-height: 1.35; }
.art { position: relative; width: 150px; height: 92px; }
/* 1: руки поднимаются в кадр */
.s1 .frame { position: absolute; inset: 6px 14px; border: 2px dashed rgba(224, 180, 92, .55); border-radius: 12px; }
.s1 .hand { position: absolute; display: block; bottom: 12px; font-size: 38px; line-height: 1; animation: handUp 2.6s ease-in-out infinite; }
.s1 .hand.l { left: 30px; transform: scaleX(-1); }
.s1 .hand.r { right: 30px; animation-delay: .25s; }
@keyframes handUp {
  0% { opacity: 0; translate: 0 34px; }
  25%, 80% { opacity: 1; translate: 0 0; }
  100% { opacity: 0; translate: 0 0; }
}
/* 2: палочка бьёт по барабану */
.s2 .drum {
  position: absolute; left: 38px; bottom: 14px; width: 74px; height: 26px; border-radius: 50%;
  background: radial-gradient(ellipse at 40% 35%, #fbf3e1, #c8b48f); box-shadow: 0 0 0 3px #c9ccd1, 0 9px 0 #8e1426, 0 12px 0 #3a0610;
  animation: drumHit 1.2s ease-out infinite;
}
.s2 .stick {
  position: absolute; left: 70px; top: 20px; width: 78px; height: 7px; border-radius: 4px;
  background: linear-gradient(180deg, #f3d7a2, #b07a3e); transform-origin: 100% 50%; box-shadow: 0 0 12px rgba(255, 196, 110, .6);
  animation: stickHit 1.2s cubic-bezier(.55, 0, .9, .4) infinite;
}
.s2 .boom { position: absolute; left: 55px; bottom: 18px; width: 40px; height: 16px; border-radius: 50%; border: 2px solid #ffc56b; opacity: 0; animation: boom 1.2s ease-out infinite; }
@keyframes stickHit { 0% { transform: rotate(-42deg); } 30% { transform: rotate(8deg); } 34% { transform: rotate(4deg); } 70%, 100% { transform: rotate(-42deg); } }
@keyframes drumHit { 0%, 28% { transform: none; filter: none; } 32% { transform: translateY(3px) scale(1.04, .9); filter: brightness(1.4); } 50%, 100% { transform: none; filter: none; } }
@keyframes boom { 0%, 29% { opacity: 0; transform: scale(.4); } 31% { opacity: 1; } 70%, 100% { opacity: 0; transform: scale(2.2); } }
/* 3: пробел и бочка */
.s3 kbd { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); width: 112px; padding: 8px 0 10px; font-size: 13px; text-align: center; box-shadow: 0 4px 0 rgba(224, 180, 92, .35); animation: keyPress 1.2s ease-out infinite .6s; }
.s3 .kick {
  position: absolute; left: 50%; top: 0; width: 42px; height: 42px; margin-left: -21px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #3a241a, #0c0705); box-shadow: 0 0 0 4px #8e1426, 0 0 0 6px rgba(224, 180, 92, .7);
  animation: kickPulse 1.2s ease-out infinite .6s;
}
@keyframes keyPress { 0%, 100% { translate: 0 0; box-shadow: 0 4px 0 rgba(224, 180, 92, .35); } 8% { translate: 0 3px; box-shadow: 0 1px 0 rgba(224, 180, 92, .35); } 25% { translate: 0 0; } }
@keyframes kickPulse { 0%, 100% { transform: scale(1); } 10% { transform: scale(1.14); box-shadow: 0 0 0 4px #8e1426, 0 0 0 6px rgba(224, 180, 92, .7), 0 0 30px 6px rgba(255, 150, 70, .6); } 40% { transform: scale(1); } }
.privacy { margin: 14px 0 0; font-size: 13px; color: var(--text-soft); max-width: 520px; line-height: 1.45; }
#btnNoCam { margin-top: 10px; }

/* ---------- настройки ---------- */
.drawer {
  position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: min(360px, 100vw);
  display: flex; flex-direction: column; background: linear-gradient(180deg, #24160e, #150d08);
  border-left: 1px solid rgba(224, 180, 92, .25); box-shadow: -20px 0 50px -20px #000;
  padding: var(--st) var(--sr) var(--sb) 0; animation: slideIn .22s ease-out;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; }
.drawer-head h2 { margin: 0; font: italic 800 24px/1 var(--serif); }
.drawer-body { overflow-y: auto; padding: 0 20px 24px; }
.drawer section { padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; flex-direction: column; gap: 8px; }
.drawer h3 { margin: 0; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
.range { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; font-size: 14px; }
.range input { grid-column: 1 / -1; width: 100%; }
.range output { font-size: 13px; color: var(--text-soft); font-variant-numeric: tabular-nums; grid-row: 1; grid-column: 2; }
.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 0;
  border: 0; background: none; text-align: left; font-size: 14px;
}
.switch small { display: block; font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.switch i { flex: none; width: 40px; height: 24px; border-radius: 999px; background: rgba(255, 255, 255, .14); position: relative; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--cream); transition: transform .15s; }
.switch[aria-pressed="true"] i { background: var(--brass); }
.switch[aria-pressed="true"] i::after { transform: translateX(16px); }
.note { margin: 0; font-size: 12px; color: var(--text-soft); line-height: 1.4; }
.keys { margin: 0; display: grid; gap: 6px; font-size: 13px; }
.keys div { display: grid; grid-template-columns: 110px 1fr; align-items: center; }
.keys dt, .keys dd { margin: 0; }
.keys dd { color: var(--text-soft); }

/* ---------- подстройка ---------- */
.calib { position: fixed; z-index: 7; left: 50%; top: calc(58px + var(--st)); transform: translateX(-50%); width: min(560px, calc(100vw - 2 * var(--gut))); }
.calib-card {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 18px;
  background: rgba(30, 18, 11, .94); border: 1px solid rgba(224, 180, 92, .5); box-shadow: 0 18px 40px -18px #000;
}
.calib-num { font: italic 800 48px/1 var(--serif); color: var(--brass); width: 40px; text-align: center; }
.calib-card b { display: block; font-size: 15px; }
.calib-card span { display: block; font-size: 12px; color: var(--text-soft); margin-top: 2px; line-height: 1.35; }
.calib-bar { height: 4px; border-radius: 4px; background: rgba(246, 236, 217, .15); margin-top: 8px; overflow: hidden; }
.calib-bar i { display: block; height: 100%; width: 0; background: var(--brass); }

/* ---------- окна ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; overflow-y: auto;
  padding: calc(16px + var(--st)) calc(16px + var(--sr)) calc(16px + var(--sb)) calc(16px + var(--sl));
  background: rgba(10, 6, 4, .66); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.card {
  width: min(440px, 100%); padding: 24px 24px 20px; border-radius: 22px; text-align: center;
  background: linear-gradient(180deg, #2c1b11, #1a100a); border: 1px solid rgba(224, 180, 92, .35);
  box-shadow: 0 30px 70px -20px #000, inset 0 1px 0 rgba(255, 255, 255, .06);
}
.card.wide { width: min(720px, 100%); }
.card h2 { margin: 6px 0 8px; font: 800 28px/1.15 var(--serif); }
.card p { margin: 0 0 14px; color: var(--text-soft); line-height: 1.45; font-size: 15px; }
.card-emoji { font-size: 44px; line-height: 1; }
.card-btns { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 6px; }
.card-btns.row { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 10px; }
.card-btns .play { min-width: 0; width: 100%; max-width: 320px; }
.card-btns.row .play { width: auto; }
#clipVideo { width: 100%; max-height: 52vh; border-radius: 14px; background: #000; display: block; margin: 4px 0 10px; }
.clip-meta { font-size: 13px !important; margin-bottom: 10px !important; }
.rank {
  font: italic 900 84px/1 var(--serif); margin: 2px 0;
  background: linear-gradient(180deg, #fff0c2, #e0b45c 55%, #a07426); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.badge { display: inline-block; margin: 0 0 10px !important; padding: 4px 12px; border-radius: 999px; background: var(--brass); color: var(--ink) !important; font-weight: 700; font-size: 13px !important; }
.res-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 12px; }
.res-grid div { padding: 10px 4px; border-radius: 12px; background: rgba(255, 255, 255, .05); display: flex; flex-direction: column; gap: 2px; }
.res-grid b { font: 800 22px/1 var(--serif); }
.res-grid span { font-size: 11px; color: var(--text-soft); }

/* ---------- телефон вертикально ---------- */
.rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) {
  body:not(.menu):not(.rot-ok) .rotate {
    position: fixed; inset: 0; z-index: 35; display: grid; place-items: center; text-align: center; padding: 24px;
    background: rgba(12, 7, 4, .94);
  }
  .rotate > div { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 300px; }
  .rotate b { font: 800 24px/1.2 var(--serif); }
  .rotate span { color: var(--text-soft); font-size: 15px; }
  .rotate-ic { font-size: 54px; animation: rot 2s ease-in-out infinite; }
  @keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
}

/* ---------- узкие и низкие экраны ---------- */
body.rec .brand { visibility: hidden; }
@media (max-width: 1080px) {
  /* название убираем совсем: скрытое, оно занимало место и выталкивало кнопки за край */
  .brand { display: none; }
  .bar { grid-template-columns: auto auto; justify-content: space-between; }
}
@media (max-width: 760px) {
  .modes .long { display: none; }
  .modes .short { display: inline; }
  .modes button { padding: 0 11px; font-size: 13px; }
  .rec-btn span { display: none; }
  .rec-btn { padding: 0 12px; }
  .rec-btn.on span { display: inline; }
}
@media (max-height: 500px) {
  :root { --gut: 10px; }
  .bar { top: calc(6px + var(--st)); }
  .icon-btn, .rec-btn { width: 36px; height: 36px; border-radius: 10px; }
  .rec-btn { width: auto; }
  .icon-btn svg { width: 18px; height: 18px; }
  .modes button { height: 30px; }
  .panel { top: calc(48px + var(--st)); padding: 5px 7px; gap: 5px; border-radius: 13px; }
  .panel .prow { flex-wrap: nowrap; gap: 6px; }
  /* лупер на телефоне — одна строка: темп, такты и кнопки, без подписей */
  .panel.loop-mode { flex-direction: row; align-items: center; }
  .panel.loop-mode .lbl, .panel.loop-mode #bpm, .panel.loop-mode .beats, .panel.loop-mode #loopBox { display: none !important; }
  .panel.loop-mode .ico { display: inline; }
  .panel.loop-mode .chip { padding: 0 9px; }
  .panel.loop-mode .bpm output { min-width: 0; }
  .chip { height: 30px; padding: 0 10px; font-size: 12px; }
  .bpm input { width: 84px; }
  .bpm output b { font-size: 15px; }
  #loopCanvas { height: 26px; min-width: 200px; }
  .loop-status { display: none; }
  .seg > span { display: none; }
  .songs, .game-bar, .calib { top: calc(48px + var(--st)); }
  .songs { padding: 10px 12px 8px; }
  .songs h2 { font-size: 19px; }
  .songs .sub { margin: 2px 0 8px; font-size: 12px; }
  .song { padding: 8px 10px; }
  .song b { font-size: 15px; }
  .song .meta { display: none; }
  .kick-btn { width: 74px; height: 74px; right: calc(12px + var(--sr)); bottom: calc(12px + var(--sb)); }
  .kick-btn b { font-size: 14px; }
  .kick-btn kbd { display: none; }
  .toast { top: calc(96px + var(--st)); font-size: 13px; padding: 8px 14px; }
  .menu-screen { place-items: start center; }
  h1 { font-size: 38px; }
  .kicker { margin-bottom: 4px; font-size: 10px; }
  .lead { margin: 6px 0 10px; font-size: 14px; }
  .steps { gap: 8px; margin-bottom: 12px; }
  .step { padding: 6px 8px 8px; border-radius: 14px; }
  .step b { font-size: 14px; margin-top: 2px; }
  .step > span { font-size: 11px; }
  .art { transform: scale(.72); height: 66px; margin: -12px 0 -6px; }
  .play { height: 48px; font-size: 17px; }
  #btnNoCam { margin-top: 2px; padding: 6px; font-size: 13px; }
  .privacy { margin-top: 4px; font-size: 11px; }
  .calib-num { font-size: 36px; }
  .card { padding: 16px; }
  .card h2 { font-size: 22px; }
  .rank { font-size: 56px; }
  #clipVideo { max-height: 42vh; }
}
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .song-list { grid-template-columns: 1fr; }
  .res-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .s1 .hand, .s2 .drum, .s2 .stick, .s2 .boom, .s3 kbd, .s3 .kick, .rotate-ic { animation: none !important; }
}
