/* =========================================================================
   NEON BLOCKS — стили
   Тёмная неоновая эстетика: глубокий фон, стеклянные панели, мягкое свечение.
   Всё на CSS-переменных, чтобы палитра менялась в одном месте.
   ========================================================================= */

:root {
  --bg: #05060d;
  --bg-2: #0a0d1a;
  --panel: rgba(18, 23, 43, 0.62);
  --panel-line: rgba(120, 160, 255, 0.14);
  --panel-line-hi: rgba(140, 200, 255, 0.32);
  --text: #e8edff;
  --text-dim: #8b97bd;
  --text-faint: #5f6b91;
  --cyan: #22d3ee;
  --violet: #a855f7;
  --blue: #4f7cff;
  --pink: #ff4d8d;
  --lime: #3ddc84;
  --amber: #ffc53f;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow-panel: 0 18px 50px rgba(0, 0, 0, 0.55);
  --glow-cyan: 0 0 22px rgba(34, 211, 238, 0.45);
  --font-ui: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Orbitron', 'Rajdhani', sans-serif;
  /* Orbitron рисует перечёркнутый ноль — для чисел берём Rajdhani. */
  --font-num: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Атрибут hidden должен побеждать любые display из правил ниже. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 600;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button { font-family: inherit; color: inherit; }

/* ---------------------------------------------------------------- фон ---- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #101838 0%, #070a15 55%, #04050b 100%);
}

.ambient__grid {
  position: absolute;
  inset: -20% -20% -35% -20%;
  background-image:
    linear-gradient(rgba(90, 140, 255, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 140, 255, 0.075) 1px, transparent 1px);
  background-size: 58px 58px;
  transform: perspective(620px) rotateX(62deg) translateY(6%);
  transform-origin: 50% 100%;
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent 72%);
  animation: gridDrift 14s linear infinite;
}

@keyframes gridDrift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 58px, 58px 0; }
}

.ambient__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  will-change: transform;
}
.ambient__glow--a {
  width: 46vw; height: 46vw;
  left: -10vw; top: -12vw;
  background: radial-gradient(circle, rgba(79, 124, 255, 0.55), transparent 68%);
  animation: float1 18s ease-in-out infinite;
}
.ambient__glow--b {
  width: 40vw; height: 40vw;
  right: -8vw; top: 4vh;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.5), transparent 68%);
  animation: float2 22s ease-in-out infinite;
}
.ambient__glow--c {
  width: 52vw; height: 34vw;
  left: 22vw; bottom: -16vw;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.34), transparent 70%);
  animation: float3 26s ease-in-out infinite;
}

@keyframes float1 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(6vw, 5vh, 0) scale(1.14); }
}
@keyframes float2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1.08); }
  50%      { transform: translate3d(-7vw, 8vh, 0) scale(0.94); }
}
@keyframes float3 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(-5vw, -6vh, 0) scale(1.2); }
}

.ambient__scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.022) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
  pointer-events: none;
}

.ambient__noise {
  position: absolute;
  inset: -50%;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/></filter><rect width='160' height='160' filter='url(%23n)'/></svg>");
  animation: grain 0.6s steps(3) infinite;
  pointer-events: none;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-2%, 1%); }
  66%  { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

/* ------------------------------------------------------------- макет ---- */

.stage {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  /* Колонки держатся рядом с полем, а не разъезжаются по краям экрана. */
  grid-template-columns:
    minmax(180px, 220px)
    minmax(0, min(46vh, 560px))
    minmax(180px, 220px);
  /* Строка не может вырасти выше экрана — иначе появляется прокрутка. */
  grid-template-rows: minmax(0, 1fr);
  gap: clamp(12px, 1.6vw, 26px);
  align-items: stretch;
  justify-content: center;
  padding: clamp(10px, 1.6vh, 22px) clamp(12px, 2vw, 34px);
}

.rail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(8px, 1.2vh, 16px);
  min-width: 0;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.rail--left { align-items: stretch; }
.rail--right { align-items: stretch; }

/* ------------------------------------------------------------ панели ---- */

.panel {
  position: relative;
  padding: clamp(10px, 1.1vh, 15px) clamp(12px, 1.2vw, 16px);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  overflow: hidden;
}

/* Тонкая светящаяся линия по верхней кромке — «стекло с подсветкой». */
.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--panel-line-hi), transparent);
}

.panel__title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.panel__hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
}

.panel__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 7px;
}
.panel__row b {
  font-family: var(--font-num);
  font-size: 14px;
  color: var(--text);
}

/* --------------------------------------------------------- превью ---- */

.preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 62px;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(80% 120% at 50% 0%, rgba(90, 140, 255, 0.12), transparent 70%),
    rgba(6, 9, 20, 0.55);
  border: 1px solid rgba(120, 160, 255, 0.1);
  overflow: hidden;
}

.preview canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.preview--hold { min-height: 74px; }

.nextlist {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.preview--next { min-height: 46px; opacity: 0.72; }
.preview--lead {
  min-height: 72px;
  opacity: 1;
  border-color: rgba(34, 211, 238, 0.32);
  box-shadow: inset 0 0 24px rgba(34, 211, 238, 0.1);
}

/* --------------------------------------------------- списки данных ---- */

.statlist, .keylist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.statlist li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--text-dim);
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(120, 160, 255, 0.07);
}
.statlist li:last-child { border-bottom: none; padding-bottom: 0; }
.statlist b {
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.keylist li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-faint);
}
.keylist span { margin-left: auto; }

kbd {
  display: inline-block;
  min-width: 21px;
  padding: 2px 6px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  color: #cfe0ff;
  background: linear-gradient(180deg, rgba(60, 80, 140, 0.55), rgba(24, 32, 60, 0.75));
  border: 1px solid rgba(140, 180, 255, 0.22);
  border-bottom-width: 2px;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------- арена ---- */

.arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, 1vh, 12px);
  height: 100%;
  width: 100%;
  min-width: 0;
  justify-content: center;
}

/* HUD и счёт держим по ширине поля, чтобы колонки не разъезжались. */
.arena > .hud,
.arena > .scoreboard {
  width: 100%;
  max-width: var(--arena-width, 520px);
}

.hud {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  justify-content: space-between;
}

.hud__brand { display: flex; flex-direction: column; line-height: 1; }

.hud__logo {
  font-family: var(--font-display);
  font-size: clamp(16px, 2vw, 23px);
  font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(96deg, #7ce7ff 0%, #a78bfa 45%, #ff6fae 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(120, 190, 255, 0.45));
}
.hud__logo b { font-weight: 900; }

.hud__tag {
  margin-top: 3px;
  font-size: 10px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.hud__tools { display: flex; gap: 7px; }

.iconbtn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(20, 26, 48, 0.6);
  border: 1px solid var(--panel-line);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  backdrop-filter: blur(10px);
}
.iconbtn svg {
  width: 19px; height: 19px;
  fill: none;
  stroke: #b9c8ef;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}
.iconbtn svg path[d^="M4 9v6"], .iconbtn svg rect, .iconbtn svg circle { fill: #b9c8ef; stroke: none; }
.iconbtn:hover {
  transform: translateY(-2px);
  border-color: var(--panel-line-hi);
  box-shadow: 0 8px 24px rgba(40, 90, 220, 0.28);
}
.iconbtn:active { transform: translateY(0) scale(0.95); }
.iconbtn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.iconbtn.is-off svg { stroke: #4a5677; opacity: 0.55; }
.iconbtn.is-off svg rect, .iconbtn.is-off svg circle, .iconbtn.is-off svg path[d^="M4 9v6"] { fill: #4a5677; }
.iconbtn.is-off .wave1, .iconbtn.is-off .wave2 { display: none; }

/* ---------------------------------------------------- счёт ---- */

.scoreboard {
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1.6vw, 22px);
  width: 100%;
  padding: clamp(7px, 0.9vh, 12px) clamp(12px, 1.4vw, 18px);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
}

.score { display: flex; flex-direction: column; gap: 2px; }
.score--sm { margin-left: auto; }
.score--sm + .score--sm { margin-left: 0; }

.score__label {
  font-size: 9px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.score__value {
  font-family: var(--font-num);
  font-size: clamp(19px, 2.4vw, 30px);
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 0 18px rgba(120, 200, 255, 0.5);
  transition: transform 0.12s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.score--sm .score__value {
  font-size: clamp(15px, 1.6vw, 20px);
  color: #cfe0ff;
}
.score__value.is-bump { transform: scale(1.16); }

/* ---------------------------------------------------- поле ---- */

.board {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  /* Пропорция до инициализации JS; затем размер задаётся точно в пикселях. */
  aspect-ratio: 10 / 20;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(16, 22, 44, 0.7), rgba(8, 11, 22, 0.85));
  border: 1px solid rgba(130, 170, 255, 0.16);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

/* Бегущая неоновая рамка вокруг поля. */
.board__frame {
  position: absolute;
  inset: -1px;
  border-radius: 23px;
  padding: 1px;
  background: conic-gradient(from 0deg,
    rgba(34, 211, 238, 0) 0%,
    rgba(34, 211, 238, 0.85) 12%,
    rgba(168, 85, 247, 0.85) 28%,
    rgba(34, 211, 238, 0) 45%,
    rgba(34, 211, 238, 0) 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: frameSpin 6s linear infinite;
  opacity: 0.75;
  pointer-events: none;
}

@keyframes frameSpin {
  to { transform: rotate(1turn); }
}

.board.is-danger {
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 70, 110, 0.5),
    0 0 60px rgba(255, 60, 100, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: dangerPulse 1.1s ease-in-out infinite;
}

@keyframes dangerPulse {
  50% { box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 70, 110, 0.75),
    0 0 90px rgba(255, 60, 100, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.07); }
}

.board__canvas-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  display: block;
  border-radius: 12px;
  box-shadow:
    0 0 0 1px rgba(140, 180, 255, 0.14),
    0 0 46px rgba(40, 90, 200, 0.22);
  touch-action: none;
}

/* --------------------------------------- всплывающие подписи ---- */

.board__banner {
  position: absolute;
  left: 50%;
  top: 24%;
  transform: translate(-50%, 0);
  font-family: var(--font-display);
  font-size: clamp(20px, 3.4vw, 40px);
  font-weight: 900;
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
}

.board__banner.is-show {
  animation: bannerIn 1.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bannerIn {
  0%   { opacity: 0; transform: translate(-50%, 18px) scale(0.7); filter: blur(8px); }
  18%  { opacity: 1; transform: translate(-50%, 0) scale(1.06); filter: blur(0); }
  32%  { transform: translate(-50%, 0) scale(1); }
  72%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -26px) scale(1.02); }
}

.board__combo {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  background: linear-gradient(120deg, rgba(255, 77, 141, 0.9), rgba(168, 85, 247, 0.9));
  box-shadow: 0 0 26px rgba(255, 77, 141, 0.55);
  opacity: 0;
  transform: translateY(-8px) scale(0.85);
  transition: opacity 0.2s ease, transform 0.24s cubic-bezier(0.2, 1.6, 0.4, 1);
  pointer-events: none;
  z-index: 4;
}
.board__combo.is-show { opacity: 1; transform: translateY(0) scale(1); }

/* --------------------------------------------------- оверлей ---- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 14, 0.72);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  transition: opacity 0.32s ease, visibility 0.32s ease;
}
.overlay.is-hidden { opacity: 0; visibility: hidden; }

.overlay__card {
  position: relative;
  width: min(400px, 100%);
  padding: clamp(20px, 3vh, 34px) clamp(18px, 2.6vw, 30px);
  text-align: center;
  border-radius: 22px;
  background: linear-gradient(170deg, rgba(24, 32, 62, 0.9), rgba(10, 14, 28, 0.94));
  border: 1px solid rgba(140, 180, 255, 0.2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: cardIn 0.42s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}

.overlay__glow {
  position: absolute;
  left: 50%; top: -60%;
  width: 150%; height: 120%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 50%, rgba(79, 124, 255, 0.4), transparent 60%);
  pointer-events: none;
}

.overlay__title {
  position: relative;
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 900;
  letter-spacing: 0.06em;
  background: linear-gradient(96deg, #8ceaff, #b39bff 50%, #ff7db5);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(120, 180, 255, 0.5));
}

.overlay__sub {
  position: relative;
  margin: 0 0 20px;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.overlay__stats {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}
.overlay__stats > div {
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid rgba(130, 170, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.overlay__stats span {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.overlay__stats b {
  font-family: var(--font-num);
  font-size: 19px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.overlay__levels { position: relative; margin-bottom: 18px; }
.overlay__levels-label {
  display: block;
  margin-bottom: 8px;
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.chips { display: flex; gap: 6px; justify-content: center; }

.chip {
  min-width: 42px;
  padding: 7px 0;
  border-radius: 10px;
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  background: rgba(12, 17, 34, 0.8);
  border: 1px solid rgba(130, 170, 255, 0.16);
  cursor: pointer;
  transition: all 0.18s ease;
}
.chip:hover { color: #fff; border-color: var(--panel-line-hi); transform: translateY(-1px); }
.chip.is-on {
  color: #041018;
  background: linear-gradient(140deg, #7ce7ff, #58b8ff);
  border-color: transparent;
  box-shadow: 0 6px 20px rgba(60, 190, 255, 0.4);
}
.chip:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.cta {
  position: relative;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #04121c;
  background: linear-gradient(120deg, #6ee7ff 0%, #8b8bff 50%, #ff7ab8 100%);
  background-size: 200% 100%;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(60, 140, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.16s cubic-bezier(0.2, 1.5, 0.4, 1), box-shadow 0.24s ease, background-position 0.6s ease;
}
.cta:hover {
  transform: translateY(-2px);
  background-position: 100% 0;
  box-shadow: 0 20px 44px rgba(80, 160, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.cta:active { transform: translateY(0) scale(0.985); }
.cta:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.cta__label { position: relative; z-index: 2; }

.cta__shine {
  position: absolute;
  top: 0; left: -40%;
  width: 32%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: skewX(-18deg);
  animation: shine 3.4s ease-in-out infinite;
}
@keyframes shine {
  0%, 62% { left: -40%; }
  85%, 100% { left: 120%; }
}

.overlay__foot {
  position: relative;
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

/* ------------------------------------------------- индикаторы ---- */

.meter {
  height: 7px;
  border-radius: 99px;
  background: rgba(8, 12, 26, 0.8);
  border: 1px solid rgba(130, 170, 255, 0.12);
  overflow: hidden;
}
.meter i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, #22d3ee, #a855f7);
  box-shadow: 0 0 14px rgba(80, 200, 255, 0.6);
  transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.badges { display: flex; gap: 6px; margin-top: 10px; }

.badge {
  flex: 1;
  padding: 5px 0;
  text-align: center;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #4b5776;
  background: rgba(10, 14, 30, 0.7);
  border: 1px solid rgba(130, 170, 255, 0.1);
  transition: all 0.24s ease;
}
.badge.is-on {
  color: #061420;
  background: linear-gradient(120deg, #ffd166, #ff8fa3);
  border-color: transparent;
  box-shadow: 0 0 20px rgba(255, 180, 90, 0.5);
}

/* ------------------------------------------- тач-управление ---- */

.touchpad {
  display: none;
  width: 100%;
  gap: 7px;
  grid-template-columns: repeat(5, 1fr);
}

.tbtn {
  padding: 14px 0;
  border-radius: 13px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: #cfe0ff;
  background: rgba(20, 27, 50, 0.75);
  border: 1px solid rgba(130, 170, 255, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: transform 0.1s ease, background 0.14s ease, box-shadow 0.14s ease;
  touch-action: manipulation;
}
.tbtn.is-active, .tbtn:active {
  transform: scale(0.94);
  background: linear-gradient(140deg, rgba(110, 231, 255, 0.85), rgba(139, 139, 255, 0.85));
  color: #05121c;
  box-shadow: 0 0 24px rgba(90, 200, 255, 0.5);
}
.tbtn--wide { grid-column: span 3; }

/* -------------------------------------------------- адаптив ---- */

@media (max-width: 1080px) {
  .stage { grid-template-columns: minmax(150px, 180px) minmax(0, auto) minmax(150px, 180px); }
  .panel--keys { display: none; }
}

@media (max-width: 880px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    align-content: start;
  }
  .rail--left, .rail--right {
    grid-row: 1;
    grid-column: 1;
    flex-direction: row;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rail--left { display: none; }
  .rail--right {
    display: grid;
    grid-template-columns: 1fr;
  }
  .arena { grid-row: 2; }
  .panel--meter { display: none; }
  .panel--next { padding: 8px 10px; }
  .panel--next .panel__title { margin-bottom: 6px; }
  .nextlist {
    flex-direction: row;
    gap: 6px;
  }
  .preview--next { flex: 1; min-height: 42px; }
  .preview--lead { min-height: 42px; flex: 1.3; }
  .touchpad { display: grid; }
  .hud__tag { display: none; }
  .scoreboard { padding: 6px 12px; }
}

@media (max-width: 880px) and (orientation: landscape) {
  .touchpad { display: none; }
  .rail--right { display: none; }
}

@media (pointer: coarse) and (min-width: 881px) {
  .touchpad { display: grid; max-width: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  .ambient__grid, .ambient__glow, .ambient__noise, .board__frame, .cta__shine { animation: none; }
  .board.is-danger { animation: none; }
}
