:root {
  --bg0: #050613;
  --bg1: #050618;
  --glass: rgba(255, 255, 255, 0.06);
  --glass2: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --neon: #78e6ff;
  --neon2: #b874ff;
  --good: #67e8a6;
  --perfect: #7dd3fc;
  --miss: #fb7185;
  --laneLine: rgba(255, 255, 255, 0.08);
  --hitLine: rgba(255, 255, 255, 0.32);
  --note: rgba(12, 15, 26, 0.98);
  --note2: rgba(184, 116, 255, 0.80);
  --shadow: rgba(0, 0, 0, 0.55);
  --safeTop: env(safe-area-inset-top, 0px);
  --safeBottom: env(safe-area-inset-bottom, 0px);
  /* Размеры игрового поля */
  --laneWidth: 1fr;
  --tapZoneH: clamp(80px, 16vh, 120px);
  --hitZoneH: var(--tapZoneH);
  --hitY: calc(100% - var(--tapZoneH) - 22px - var(--safeBottom));
  --tileH: calc(var(--tapZoneH) - 20px);
  --laneGap: 10px;
}

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

html,
body {
  height: 100%;
  margin: 0;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans",
    sans-serif;
  overscroll-behavior: none;
}

body {
  touch-action: manipulation;
  /* Базовый фон - тёмный неоновый клубный градиент + лёгкие частицы */
  background:
    radial-gradient(1200px 900px at 50% -10%, #1a1f44 0%, var(--bg0) 55%, #03030a 100%),
    radial-gradient(circle at 15% 20%, rgba(120, 230, 255, 0.16) 0, transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(184, 116, 255, 0.16) 0, transparent 42%),
    radial-gradient(circle at 30% 80%, rgba(120, 230, 255, 0.10) 0, transparent 45%),
    radial-gradient(circle at 70% 75%, rgba(248, 250, 252, 0.06) 0, transparent 50%);
  transition: background 600ms ease-in-out;
}

/* Animated blurred "fire" background that reacts to multiplier level */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transition: opacity 480ms ease-in-out;
}

body::before {
  filter: blur(34px) saturate(1.5);
  mix-blend-mode: screen;
  animation: bgFlow 8.5s linear infinite;
}

body::after {
  filter: blur(52px) saturate(1.6);
  mix-blend-mode: screen;
  animation: bgFlow2 12s ease-in-out infinite;
}

body.mult1::before,
body.mult1::after {
  opacity: 0.25 !important;
  background:
    radial-gradient(700px 520px at 20% 20%, rgba(120, 230, 255, 0.30), transparent 60%),
    radial-gradient(820px 620px at 80% 20%, rgba(184, 116, 255, 0.25), transparent 62%),
    radial-gradient(900px 700px at 50% 95%, rgba(120, 230, 255, 0.22), transparent 65%) !important;
}

body.mult2::before,
body.mult2::after {
  opacity: 0.50 !important;
  background:
    radial-gradient(800px 600px at 20% 20%, rgba(234, 179, 8, 0.50), transparent 60%),
    radial-gradient(950px 750px at 80% 18%, rgba(251, 191, 36, 0.45), transparent 62%),
    radial-gradient(1000px 780px at 50% 96%, rgba(234, 179, 8, 0.40), transparent 68%) !important;
}

body.mult3::before {
  filter: blur(34px) saturate(2.0) brightness(1.15) !important;
  animation: bgFlow 6s linear infinite, firePulse 2.5s ease-in-out infinite !important;
}

body.mult3::after {
  filter: blur(52px) saturate(2.2) brightness(1.2) !important;
  animation: bgFlow2 8s ease-in-out infinite, firePulse2 3s ease-in-out infinite !important;
}

body.mult3::before,
body.mult3::after {
  opacity: 0.75 !important;
  background:
    radial-gradient(900px 700px at 20% 15%, rgba(220, 38, 38, 0.60), transparent 55%),
    radial-gradient(1000px 800px at 80% 20%, rgba(234, 88, 12, 0.55), transparent 60%),
    radial-gradient(1100px 850px at 50% 95%, rgba(251, 113, 133, 0.50), transparent 65%),
    radial-gradient(850px 650px at 35% 50%, rgba(234, 88, 12, 0.45), transparent 58%),
    radial-gradient(750px 550px at 65% 30%, rgba(220, 38, 38, 0.40), transparent 52%) !important;
}

@keyframes bgFlow {
  0% {
    transform: translate3d(-2%, -1%, 0) scale(1.02) rotate(0deg);
  }
  50% {
    transform: translate3d(2%, 1%, 0) scale(1.06) rotate(2deg);
  }
  100% {
    transform: translate3d(-2%, -1%, 0) scale(1.02) rotate(0deg);
  }
}

@keyframes bgFlow2 {
  0% {
    transform: translate3d(1%, -2%, 0) scale(1.02) rotate(-1deg);
  }
  50% {
    transform: translate3d(-1%, 2%, 0) scale(1.07) rotate(1deg);
  }
  100% {
    transform: translate3d(1%, -2%, 0) scale(1.02) rotate(-1deg);
  }
}

@keyframes firePulse {
  0%, 100% {
    opacity: 0.75;
    filter: blur(34px) saturate(2.0) brightness(1.15);
  }
  50% {
    opacity: 0.85;
    filter: blur(38px) saturate(2.3) brightness(1.25);
  }
}

@keyframes firePulse2 {
  0%, 100% {
    opacity: 0.75;
    filter: blur(52px) saturate(2.2) brightness(1.2);
  }
  50% {
    opacity: 0.90;
    filter: blur(58px) saturate(2.5) brightness(1.35);
  }
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 0;
}

.hudContainer {
  position: relative;
  width: 100%;
  padding: calc(105px + var(--safeTop)) 14px 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 50;
}

.topbar {
  display: none;
}

.hudPauseBtn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, rgba(248, 250, 252, 0.22), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(148, 163, 184, 0.8);
  box-shadow:
    0 0 16px rgba(15, 23, 42, 0.75),
    0 0 22px rgba(120, 230, 255, 0.32);
  padding: 0;
  font-size: 0; /* скрываем возможный текст */
  line-height: 0;
}

.pauseIcon {
  position: relative;
  display: inline-flex;
  gap: 4px;
}

.pauseBar {
  width: 4px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e5e7eb, #cbd5f5);
  box-shadow: 0 0 6px rgba(248, 250, 252, 0.75);
}

.hudCenter {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
}

.score {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 12px rgba(248, 250, 252, 0.8),
    0 0 30px rgba(120, 230, 255, 0.4);
}

.hudMeta {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
}

.mult {
  color: var(--perfect);
  font-weight: 700;
}

/* Старый текст COMBO под основным счётом прячем, чтобы не дублировать счетчик */
.combo {
  display: none;
}

.judge {
  letter-spacing: 0.16em;
}

.hudRight {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.trackInfo {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.trackTitle {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.trackArtist {
  font-size: 11px;
  color: var(--muted);
}

.hudTimeBlock {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.ringWrapper {
  position: relative;
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stageLabel {
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--text);
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}

.timeLabel {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.ring {
  width: 66px;
  height: 66px;
  transform: rotate(-90deg);
  opacity: 0.7;
}

.ringTrack,
.ringValue {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  r: 20;
  cx: 24;
  cy: 24;
}

.ringTrack {
  stroke: rgba(255, 255, 255, 0.14);
}

.ringValue {
  stroke: var(--neon);
  stroke-dasharray: 126;
  stroke-dashoffset: 126;
  filter: drop-shadow(0 0 12px rgba(120, 230, 255, 0.4));
}

.playfield {
  position: relative;
  flex: 1;
  overflow: hidden;
  padding: 0 12px 0 12px;
  display: flex;
  flex-direction: column;
}

.lanes {
  position: absolute;
  top: calc(64px + 44px + var(--safeTop)); /* Начинается под HUD контейнером (высота контента + padding-top) */
  left: 12px;
  right: 12px;
  bottom: calc(var(--tapZoneH) + 64px + var(--safeBottom));
  display: grid;
  grid-template-columns: repeat(3, var(--laneWidth));
  gap: var(--laneGap);
  padding: 0; /* Убираем padding, чтобы дорожки занимали всю высоту */
  perspective: 2500px;
  perspective-origin: center top;
  height: calc(100% - 64px - 44px - var(--safeTop)); /* Высота с учетом HUD контейнера */
}

.lane {
  position: relative;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(15, 23, 42, 0.6), rgba(15, 23, 42, 0.8));
  border: 1px solid rgba(148, 163, 184, 0.28);
  overflow: hidden;
  transform-style: preserve-3d;
  transform: perspective(2500px) rotateX(18deg);
  transform-origin: center bottom;
  /* Компенсируем визуальное уменьшение высоты из-за перспективы */
  height: 100%;
  min-height: 100%;
}

/* Градиент прозрачности сверху дорожки */
.lane::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 25%;
  background: linear-gradient(to bottom, 
    rgba(5, 6, 19, 1) 0%,
    rgba(5, 6, 19, 0.8) 15%,
    rgba(5, 6, 19, 0.4) 30%,
    rgba(5, 6, 19, 0) 50%,
    transparent 100%);
  pointer-events: none;
  z-index: 10;
  border-radius: 18px 18px 0 0;
}

.lane.lanePerfect,
.lane.laneGood,
.lane.laneMiss {
  animation: lanePulse 170ms ease-out 1;
}

.lane.lanePerfect {
  box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.20), 0 0 24px rgba(34, 197, 94, 0.10);
}

.lane.laneGood {
  box-shadow: inset 0 0 0 1px rgba(234, 179, 8, 0.18), 0 0 22px rgba(234, 179, 8, 0.10);
}

.lane.laneMiss {
  box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.18), 0 0 22px rgba(251, 113, 133, 0.10);
}

.lane.lanePerfect::before {
  background:
    linear-gradient(180deg, rgba(34, 197, 94, 0.10), transparent 35%, transparent 70%, rgba(34, 197, 94, 0.05)),
    radial-gradient(800px 600px at 50% 0%, rgba(34, 197, 94, 0.12), transparent 60%);
}
.lane.laneGood::before {
  background:
    linear-gradient(180deg, rgba(234, 179, 8, 0.10), transparent 35%, transparent 70%, rgba(234, 179, 8, 0.05)),
    radial-gradient(800px 600px at 50% 0%, rgba(234, 179, 8, 0.12), transparent 60%);
}
.lane.laneMiss::before {
  background:
    linear-gradient(180deg, rgba(251, 113, 133, 0.10), transparent 35%, transparent 70%, rgba(251, 113, 133, 0.05)),
    radial-gradient(800px 600px at 50% 0%, rgba(251, 113, 133, 0.12), transparent 60%);
}

@keyframes lanePulse {
  0% {
    filter: saturate(1);
  }
  40% {
    filter: saturate(1.25);
  }
  100% {
    filter: saturate(1);
  }
}

.lane::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(120, 230, 255, 0.05), transparent 35%, transparent 70%, rgba(184, 116, 255, 0.08)),
    radial-gradient(800px 600px at 50% 0%, rgba(120, 230, 255, 0.08), transparent 60%);
  pointer-events: none;
}


.hitZone {
  position: absolute;
  left: 12px;
  right: 12px;
  top: var(--hitY);
  height: 2px;
  pointer-events: none;
}

.hitLine {
  height: 2px;
  /* Линию скрываем визуально, оставляя элемент для расчёта метрик */
  background: transparent;
  box-shadow: none;
}

.bottomControls {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tapZoneH) + 12px + var(--safeBottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.controlsRow {
  display: flex;
  gap: 10px;
}

.fileBtn {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  user-select: none;
}

.fileBtn input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

button.primary {
  flex: 1;
  background: linear-gradient(90deg, rgba(120, 230, 255, 0.30), rgba(184, 116, 255, 0.26));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 14px 30px rgba(120, 230, 255, 0.12);
}

button:disabled {
  opacity: 0.5;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px;
  backdrop-filter: blur(8px);
}

.tapZones {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 80px;
  height: calc(var(--tapZoneH) + var(--safeBottom));
  padding: 10px 12px calc(10px + var(--safeBottom)) 12px;
  pointer-events: none;
}

.tapZoneUnified {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}

.tapZoneUnified::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(148, 163, 184, 0.16), transparent 60%);
  border: 1px solid rgba(148, 163, 184, 0.55);
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.9),
    0 18px 40px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  z-index: 1;
}

.tapZoneUnified::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background-image: linear-gradient(
    to right,
    transparent 0,
    transparent calc(33.333% - 0.5px),
    rgba(148, 163, 184, 0.5) 33.333%,
    transparent calc(33.333% + 0.5px),
    transparent calc(66.666% - 0.5px),
    rgba(148, 163, 184, 0.5) 66.666%,
    transparent calc(66.666% + 0.5px),
    transparent 100%
  );
  opacity: 0.8;
  pointer-events: none;
  z-index: 1;
}

.perfectLine {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(125, 211, 252, 0.90) 5%,
    rgba(125, 211, 252, 1) 50%,
    rgba(125, 211, 252, 0.90) 95%,
    transparent 100%);
  box-shadow: 
    0 0 10px rgba(125, 211, 252, 0.60),
    0 0 20px rgba(125, 211, 252, 0.30),
    0 0 30px rgba(125, 211, 252, 0.15);
  pointer-events: none;
  z-index: 2;
}

.tapZoneUnified.active {
  transform: translateY(1px);
}

.tapZoneUnified.active::before {
  border-color: rgba(120, 230, 255, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(120, 230, 255, 0.22),
    0 0 0 3px rgba(120, 230, 255, 0.08),
    0 18px 40px rgba(120, 230, 255, 0.10);
}

.tapZoneUnified.flash::before {
  box-shadow:
    inset 0 0 0 1px rgba(120, 230, 255, 0.25),
    0 0 0 3px rgba(120, 230, 255, 0.07),
    0 18px 40px rgba(120, 230, 255, 0.10) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)), 
              radial-gradient(closest-side, var(--flash-color, rgba(120, 230, 255, 0.18)), transparent 70%) !important;
}

/* Статичные демонстрационные тайлы, если будут добавлены в разметку */
.demoTile {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 78%;
  height: var(--tileH);
  border-radius: 18px;
  background: linear-gradient(180deg, 
    rgba(15, 23, 42, 0.98) 0%,
    rgba(12, 18, 34, 0.98) 50%,
    rgba(8, 12, 24, 0.98) 100%);
  border: 2px solid rgba(15, 23, 42, 1);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(15, 23, 42, 0.9),
    0 0 22px rgba(148, 163, 184, 0.25);
}

.demoTile::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(248, 250, 252, 0.5) 10%,
    rgba(248, 250, 252, 0.9) 50%,
    rgba(248, 250, 252, 0.5) 90%,
    transparent 100%);
}


.note {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) scale(0.35);
  width: 78%;
  height: var(--tileH);
  border-radius: 18px;
  background: linear-gradient(180deg, 
    rgba(15, 23, 42, 0.98) 0%,
    rgba(12, 18, 34, 0.98) 50%,
    rgba(8, 12, 24, 0.98) 100%);
  border: 2px solid rgba(15, 23, 42, 1);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.8),
    0 0 16px rgba(15, 23, 42, 0.9),
    0 0 22px rgba(148, 163, 184, 0.25);
  opacity: 0.3;
  will-change: transform, top, opacity;
  transform-origin: center center;
  transition: transform 0.05s linear, opacity 0.05s linear;
}

.note.hold-note {
  /* Тайл остается обычного размера - это верхняя часть длинной ноты */
  border-radius: 18px !important;
  background: linear-gradient(180deg, 
    rgba(120, 230, 255, 0.15) 0%,
    rgba(120, 230, 255, 0.08) 20%,
    rgba(15, 23, 42, 0.98) 40%,
    rgba(12, 18, 34, 0.98) 60%,
    rgba(8, 12, 24, 0.98) 100%) !important;
  border: 2px solid rgba(120, 230, 255, 0.8) !important;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(120, 230, 255, 0.6),
    0 0 30px rgba(120, 230, 255, 0.4),
    inset 0 0 10px rgba(120, 230, 255, 0.2) !important;
  position: relative !important;
  overflow: visible !important; /* Позволяем линии выходить за границы тайла */
  /* Высота тайла остается стандартной */
  height: var(--tileH) !important;
  /* Делаем тайл более заметным */
  opacity: 0.6 !important;
}

/* Вертикальная линия, идущая вверх от тайла */
.note.hold-note::after {
  content: "" !important;
  position: absolute !important;
  top: 0 !important; /* Начинается от верха тайла */
  left: 50% !important;
  transform: translateX(-50%) translateY(-100%) !important; /* Сдвигаем вверх на всю высоту линии */
  width: 6px !important; /* Более широкая вертикальная линия для заметности */
  height: var(--hold-line-height, 100px) !important; /* Высота устанавливается через JS, минимум 100px для видимости */
  min-height: 50px !important; /* Минимальная высота для гарантии видимости */
  background: linear-gradient(0deg, 
    rgba(120, 230, 255, 1) 0%,
    rgba(120, 230, 255, 0.9) 30%,
    rgba(120, 230, 255, 0.7) 60%,
    rgba(120, 230, 255, 0.5) 100%) !important;
  box-shadow: 
    0 0 12px rgba(120, 230, 255, 0.8),
    0 0 24px rgba(120, 230, 255, 0.5),
    0 0 40px rgba(120, 230, 255, 0.3) !important;
  pointer-events: none !important;
  z-index: 1 !important;
  transition: height 0.05s linear !important;
  border-radius: 3px 3px 0 0 !important;
  /* Гарантируем видимость линии */
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Прогресс удержания - заполнение линии снизу вверх (от тайла вверх) */
.note.hold-note::before {
  content: "" !important;
  position: absolute !important;
  top: 0 !important; /* Начинается от верха тайла */
  left: 50% !important;
  transform: translateX(-50%) translateY(-100%) !important; /* Сдвигаем вверх на всю высоту линии */
  width: 6px !important;
  height: calc(var(--hold-progress, 0) * var(--hold-line-height, 0px)) !important;
  background: linear-gradient(0deg, 
    rgba(120, 230, 255, 1) 0%,
    rgba(120, 230, 255, 0.95) 30%,
    rgba(120, 230, 255, 0.9) 60%,
    rgba(120, 230, 255, 0.7) 100%) !important;
  box-shadow: 
    0 0 16px rgba(120, 230, 255, 1),
    0 0 32px rgba(120, 230, 255, 0.6),
    0 0 48px rgba(120, 230, 255, 0.3) !important;
  pointer-events: none !important;
  z-index: 2 !important;
  transition: height 0.05s linear !important;
  border-radius: 3px 3px 0 0 !important;
}

.note.hold-note.held {
  border-color: rgba(120, 230, 255, 0.8) !important;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(120, 230, 255, 0.6),
    0 0 30px rgba(120, 230, 255, 0.4) !important;
  background: linear-gradient(180deg, 
    rgba(120, 230, 255, 0.2) 0%,
    rgba(15, 23, 42, 0.98) 20%,
    rgba(12, 18, 34, 0.98) 50%,
    rgba(8, 12, 24, 0.98) 100%) !important;
}

.note.hold-note.held::after {
  box-shadow: 
    0 0 12px rgba(120, 230, 255, 0.8),
    0 0 24px rgba(120, 230, 255, 0.5);
}

.note::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: linear-gradient(90deg, 
    transparent 0%,
    rgba(248, 250, 252, 0.5) 10%,
    rgba(248, 250, 252, 0.9) 50%,
    rgba(248, 250, 252, 0.5) 90%,
    transparent 100%);
  pointer-events: none;
}

.note::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 17px;
  background: linear-gradient(180deg, 
    rgba(255, 255, 255, 0.20) 0%,
    rgba(255, 255, 255, 0.06) 30%,
    transparent 55%,
    rgba(15, 23, 42, 0.35) 80%,
    rgba(15, 23, 42, 0.6) 100%);
  mix-blend-mode: overlay;
  pointer-events: none;
}

.note.hitFlash {
  animation: hitFlash 160ms ease-out 1;
}

@keyframes hitFlash {
  0% {
    filter: drop-shadow(0 0 0 rgba(125, 211, 252, 0));
    transform: translateX(-50%) scale(var(--current-scale, 1));
  }
  40% {
    filter: drop-shadow(0 0 14px rgba(125, 211, 252, 0.55));
    transform: translateX(-50%) scale(calc(var(--current-scale, 1) * 1.04));
  }
  100% {
    filter: drop-shadow(0 0 0 rgba(125, 211, 252, 0));
    transform: translateX(-50%) scale(var(--current-scale, 1));
  }
}

.shake {
  animation: shake 120ms linear 1;
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-2px);
  }
  60% {
    transform: translateX(2px);
  }
  100% {
    transform: translateX(0);
  }
}

.hidden {
  display: none !important;
}

/* Модальные окна */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 19, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.modal-content {
  position: relative;
  z-index: 1001;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.modal-title {
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 24px 0;
  letter-spacing: 0.05em;
  color: var(--text);
}

.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 16px;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  transition: all 200ms ease;
  text-align: center;
}

.modal-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.modal-btn:active:not(:disabled) {
  transform: translateY(0);
}

.modal-btn.primary {
  background: linear-gradient(90deg, rgba(120, 230, 255, 0.30), rgba(184, 116, 255, 0.26));
  border-color: rgba(255, 255, 255, 0.20);
  box-shadow: 0 8px 24px rgba(120, 230, 255, 0.15);
}

.modal-btn.primary:hover:not(:disabled) {
  background: linear-gradient(90deg, rgba(120, 230, 255, 0.40), rgba(184, 116, 255, 0.35));
  box-shadow: 0 12px 32px rgba(120, 230, 255, 0.25);
}

.modal-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-btn.fileBtn {
  position: relative;
  overflow: hidden;
}

.modal-btn.fileBtn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.analysis-mode-selector {
  display: flex;
  gap: 12px;
  margin: 16px 0;
  justify-content: center;
}

.mode-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 200ms ease;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  user-select: none;
}

.mode-label:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.20);
}

.mode-label input[type="radio"] {
  margin: 0;
  cursor: pointer;
  accent-color: rgba(120, 230, 255, 0.8);
  width: 18px;
  height: 18px;
}

.mode-label input[type="radio"]:checked + span {
  color: rgba(120, 230, 255, 0.95);
  font-weight: 600;
}

.mode-label:has(input[type="radio"]:checked) {
  background: rgba(120, 230, 255, 0.15);
  border-color: rgba(120, 230, 255, 0.35);
  box-shadow: 0 0 0 1px rgba(120, 230, 255, 0.20);
}

.modal-hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-top: 8px;
  line-height: 1.4;
}

/* Размытие интерфейса при открытом модальном окне */
body.modal-open #app {
  filter: blur(8px);
  pointer-events: none;
  transition: filter 300ms ease;
}

/* Countdown overlay */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 1;
  transition: opacity 600ms ease-out;
}

.countdown-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.countdown-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 19, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.countdown-number {
  position: relative;
  z-index: 2001;
  font-size: 120px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 
    0 0 40px rgba(120, 230, 255, 0.6),
    0 0 80px rgba(184, 116, 255, 0.4),
    0 0 120px rgba(120, 230, 255, 0.3);
  letter-spacing: 0.1em;
  user-select: none;
  pointer-events: none;
}

.countdown-number.pulse {
  animation: countdownPulse 0.8s ease-out;
}

@keyframes countdownPulse {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

body.countdown-active #app {
  filter: blur(12px);
  pointer-events: none;
  transition: filter 400ms ease;
}

body.countdown-fadeout #app {
  filter: blur(0px);
  pointer-events: auto;
  transition: filter 800ms ease-out;
}


