:root {
  --bg: #15101f;
  --bg-deep: #0c0814;
  --panel: #221833;
  --panel-hi: #2e2146;
  --panel-glass: rgba(34, 24, 51, 0.85);
  --line: #41325c;
  --text: #f7f1e6;
  --muted: #b4a8cb;
  --amber: #ffb020;
  --amber-glow: rgba(255, 176, 32, 0.4);
  --pink: #ff4d8d;
  --pink-glow: rgba(255, 77, 141, 0.4);
  --teal: #3dd9c4;
  --teal-glow: rgba(61, 217, 196, 0.4);
  --danger: #ff7060;
  --ok: #6fe185;
  --purple: #9d8cff;
  --radius: 14px;
  --font-display: "Arial Black", "Segoe UI Black", "Helvetica Neue", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg-deep); }

body {
  min-height: 100vh;
  margin: 0;
  padding: 1.25rem 1rem 3rem;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.45;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(255, 176, 32, 0.14), transparent 75%),
    radial-gradient(ellipse 60% 30% at 50% 100%, rgba(61, 217, 196, 0.08), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  position: relative;
}

/* Fullscreen FX Canvas for Confetti & Sparks */
.fx-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

#game {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: relative;
  z-index: 10;
}

h1, h2, h3 { margin: 0; }

/* ---------- Шапка ---------- */
.masthead {
  padding: 0.25rem 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.eq {
  width: 50px;
  height: 42px;
  flex: none;
  fill: var(--pink);
  filter: drop-shadow(0 0 6px var(--pink-glow));
}
.eq rect:nth-child(1) { animation: eqPulse 1.2s ease-in-out infinite alternate; transform-origin: bottom; }
.eq rect:nth-child(2) { fill: var(--amber); animation: eqPulse 0.9s ease-in-out 0.2s infinite alternate; }
.eq rect:nth-child(3) { fill: var(--teal); animation: eqPulse 1.4s ease-in-out 0.4s infinite alternate; }
.eq rect:nth-child(4) { fill: #a270ff; animation: eqPulse 1.1s ease-in-out 0.1s infinite alternate; }

@keyframes eqPulse {
  0% { transform: scaleY(0.7); }
  100% { transform: scaleY(1.05); }
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 6vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.icon-btn:hover {
  background: var(--panel-hi);
  border-color: var(--teal);
}
.icon-btn:active {
  transform: scale(0.96);
}
.help-btn {
  background: rgba(255, 176, 32, 0.1);
  border-color: rgba(255, 176, 32, 0.4);
  color: #ffd678;
}
.help-btn:hover {
  background: rgba(255, 176, 32, 0.2);
  border-color: var(--amber);
}

.rules {
  margin: 0.2rem 0 0;
  max-width: 66ch;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

/* Модальное окно советов */
.help-drawer {
  margin-top: 0.5rem;
  background: var(--panel-hi);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 16px rgba(255, 176, 32, 0.2);
  animation: slideDown 0.25s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.help-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.help-head h3 {
  font-size: 1.1rem;
  color: var(--amber);
  font-family: var(--font-display);
}
.close-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.close-btn:hover { color: var(--text); background: rgba(255,255,255,0.1); }

.help-content ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 0.92rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.help-content li strong { color: var(--teal); }

/* ---------- Сцена и прогресс ---------- */
.stage {
  position: relative;
  overflow: hidden;
  padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1d152c 0%, var(--panel) 100%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
}
.stage h2 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  letter-spacing: -0.01em;
}
.next {
  margin: 0;
  color: var(--amber);
  font-weight: 700;
  font-size: 0.95rem;
  text-shadow: 0 0 10px rgba(255, 176, 32, 0.3);
}

/* Лампы-прожекторы прогресса */
.lamps {
  position: relative;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin: 1.1rem 0 0.5rem;
  padding: 0;
  z-index: 4;
}
.lamps::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 23px;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.lamps li {
  position: relative;
  justify-self: center;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--muted);
  border-radius: 50%;
  border: 3px solid var(--line);
  background: #171124;
  z-index: 2;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.lamps li.done {
  background: var(--amber);
  border-color: #ffe099;
  color: #261600;
  box-shadow: 0 0 24px rgba(255, 176, 32, 0.85), inset 0 2px 4px rgba(255, 255, 255, 0.6);
  transform: scale(1.06);
}

/* ---------- Интерактивная сцена студии и арены ---------- */
.stage-scene {
  position: relative;
  width: 100%;
  height: 200px;
  margin-top: 0.5rem;
  border-radius: 12px;
  background: radial-gradient(ellipse 90% 70% at 50% 120%, #2f214a 0%, #171126 100%);
  border: 1px solid rgba(65, 50, 92, 0.6);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* Прожекторные лучи от ламп */
.spotlight-beams {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  pointer-events: none;
  z-index: 1;
}
.beam {
  justify-self: center;
  width: 90px;
  height: 100%;
  background: linear-gradient(180deg, rgba(255, 176, 32, 0.28) 0%, rgba(255, 176, 32, 0.02) 80%, transparent 100%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
  opacity: 0.15;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.beam.active {
  opacity: 0.85;
  filter: blur(0.5px);
  animation: beamSway 3.5s ease-in-out infinite alternate;
}
.beam.target {
  background: linear-gradient(180deg, rgba(61, 217, 196, 0.35) 0%, rgba(61, 217, 196, 0.05) 85%, transparent 100%);
  opacity: 0.65;
  animation: beamPulse 2s ease-in-out infinite alternate;
}

@keyframes beamSway {
  0% { transform: rotate(-3deg); }
  100% { transform: rotate(3deg); }
}
@keyframes beamPulse {
  0% { opacity: 0.4; }
  100% { opacity: 0.8; }
}

/* Задний план сцены: бейдж площадки и рэк с усилителем */
.scene-backdrop {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 2;
  pointer-events: none;
}

.venue-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(23, 17, 36, 0.85);
  border: 1px solid var(--line);
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.venue-icon { font-size: 1.15rem; }
.venue-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.02em;
}

/* Студийный усилитель с танцующим эквалайзером */
.amp-rack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  background: rgba(18, 13, 28, 0.9);
  border: 1px solid var(--line);
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}
.amp-brand {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.vu-meters {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}
.vu-meters .bar {
  width: 4px;
  border-radius: 1px;
  background: var(--teal);
  height: 4px;
  transition: height 0.1s ease;
  animation: vuJump 1.2s ease-in-out infinite alternate;
}
.vu-meters .bar:nth-child(even) { background: var(--amber); animation-duration: 0.9s; }
.vu-meters .bar:nth-child(3n) { animation-duration: 1.4s; }
.vu-meters .bar:nth-child(4) { background: var(--pink); }

@keyframes vuJump {
  0% { height: 3px; }
  50% { height: 12px; }
  100% { height: 6px; }
}

/* Овердрайв для эквалайзера во время концерта */
.stage-scene.mode-perform .vu-meters .bar {
  animation-duration: 0.4s !important;
  box-shadow: 0 0 6px currentColor;
}

/* Персонаж Музыкант */
.musician-wrapper {
  position: relative;
  align-self: center;
  width: 140px;
  height: 145px;
  z-index: 5;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.musician {
  width: 100%;
  height: 100%;
  animation: musicianGroove 2.4s ease-in-out infinite alternate;
  transform-origin: bottom center;
}
.musician-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

@keyframes musicianGroove {
  0% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-3px) rotate(1deg); }
  100% { transform: translateY(0) rotate(-1deg); }
}

/* Анимации состояний персонажа */
/* Репетиция */
.stage-scene.mode-rehearse .musician {
  animation: rehearseGroove 0.5s ease-in-out infinite alternate;
}
@keyframes rehearseGroove {
  0% { transform: translateY(0) rotate(-2deg); }
  100% { transform: translateY(-4px) rotate(2deg); }
}
.stage-scene.mode-rehearse #arm-left {
  animation: armJam 0.25s ease-in-out infinite alternate;
}
.stage-scene.mode-rehearse #arm-right {
  animation: armJam 0.25s ease-in-out 0.12s infinite alternate;
}
@keyframes armJam {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

/* Подработка */
.stage-scene.mode-work .musician {
  animation: workGroove 1.6s ease-in-out infinite alternate;
}
@keyframes workGroove {
  0% { transform: rotate(-2deg); }
  100% { transform: rotate(3deg); }
}

/* Отдых */
.stage-scene.mode-rest .musician {
  animation: restGroove 3s ease-in-out infinite alternate;
}
@keyframes restGroove {
  0% { transform: translateY(2px) rotate(1deg); }
  100% { transform: translateY(5px) rotate(3deg); }
}

/* Концерт */
.stage-scene.mode-perform .musician {
  animation: concertJump 0.45s ease-in-out infinite alternate;
}
@keyframes concertJump {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-9px) scale(1.04); }
}

/* Провал концерта */
.stage-scene.mode-fail .musician {
  animation: failWobble 0.6s ease-in-out infinite alternate;
}
@keyframes failWobble {
  0% { transform: rotate(-6deg) translateY(4px); }
  100% { transform: rotate(6deg) translateY(4px); }
}

/* Толпа перед сценой */
.crowd {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 28px;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  z-index: 6;
  pointer-events: none;
}
.fan {
  position: relative;
  width: 22px;
  height: 20px;
  background: #0f0a18;
  border-radius: 12px 12px 0 0;
  animation: fanWave 1.4s ease-in-out infinite alternate;
}
.fan:nth-child(even) { animation-duration: 1.8s; height: 24px; }
.fan:nth-child(3n) { animation-duration: 1.2s; height: 18px; }

@keyframes fanWave {
  0% { transform: translateY(4px) rotate(-4deg); }
  100% { transform: translateY(0px) rotate(4deg); }
}
.glowstick {
  position: absolute;
  top: -12px;
  right: -2px;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  transform: rotate(20deg);
}
.glowstick.pink { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
.glowstick.teal { background: var(--teal); box-shadow: 0 0 8px var(--teal); }
.glowstick.amber { background: var(--amber); box-shadow: 0 0 8px var(--amber); }

.phone-torch {
  position: absolute;
  top: -8px;
  left: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff;
}

/* Всплывающие частицы внутри сцены */
.fx-floats {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  bottom: 40px;
  pointer-events: none;
  overflow: hidden;
}
.fx-item {
  position: absolute;
  font-size: 1.35rem;
  font-weight: 800;
  pointer-events: none;
  animation: floatUpAndFade 1.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes floatUpAndFade {
  0% { opacity: 0; transform: translateY(20px) scale(0.6); }
  20% { opacity: 1; transform: translateY(0px) scale(1.15); }
  80% { opacity: 0.9; }
  100% { opacity: 0; transform: translateY(-40px) scale(0.9); }
}

/* Пол сцены */
.floor {
  height: 10px;
  margin-top: 6px;
  border-radius: 5px;
  background: repeating-linear-gradient(90deg, #372a4e 0 20px, #2e2243 20px 40px);
  border-top: 1px solid var(--line);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* Шкала навыка */
.skill {
  margin-top: 1rem;
}
.skill-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}
.skill-title b {
  color: var(--teal);
  font-size: 1.25rem;
  text-shadow: 0 0 10px var(--teal-glow);
}
.skill-meter {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 0.5rem;
}
.skill-meter span {
  height: 16px;
  border-radius: 5px;
  background: #161022;
  border: 1px solid var(--line);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.skill-meter span.on {
  background: var(--teal);
  border-color: #79f7e7;
  box-shadow: 0 0 12px rgba(61, 217, 196, 0.65);
}
.skill-meter span.target {
  border: 2px dashed var(--amber);
  animation: targetPulse 1.4s ease-in-out infinite alternate;
}
@keyframes targetPulse {
  0% { box-shadow: 0 0 2px var(--amber); }
  100% { box-shadow: 0 0 12px var(--amber); }
}

/* ---------- Показатели игрока ---------- */
.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.9rem 1rem;
  border-left: 1px solid var(--line);
  position: relative;
  transition: background-color 0.2s ease;
}
.tile:first-child { border-left: 0; }
.tile:hover { background: rgba(255, 255, 255, 0.02); }

.tile-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}
.tile-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  line-height: 1;
  color: var(--amber);
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.tile-value.pop {
  transform: scale(1.18);
  color: #fff;
}

/* Сердца доверия */
.hearts {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.hearts span {
  display: block;
  width: 32px;
  height: 32px;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.hearts svg {
  width: 100%;
  height: 100%;
  fill: var(--pink);
  stroke: none;
  filter: drop-shadow(0 0 6px var(--pink-glow));
}
.hearts .heart-lost {
  opacity: 0.2;
  transform: scale(0.8) rotate(-15deg);
}
.hearts .heart-lost svg {
  fill: var(--line);
  filter: none;
}

/* Светодиодная полоса энергии */
.leds {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-top: 0.2rem;
}
.leds span {
  height: 24px;
  border-radius: 4px;
  background: #140e20;
  border: 1px solid var(--line);
  transition: background-color 0.25s, box-shadow 0.25s;
}
.leds span.on {
  background: var(--ok);
  border-color: #a4f5b3;
  box-shadow: 0 0 10px rgba(111, 225, 133, 0.65);
}
.leds span.on.warm {
  background: var(--amber);
  border-color: #ffd88a;
  box-shadow: 0 0 10px rgba(255, 176, 32, 0.65);
}
.leds span.on.hot {
  background: var(--danger);
  border-color: #ffa89e;
  box-shadow: 0 0 12px rgba(255, 112, 96, 0.75);
}

/* Всплывающие тосты ресурсов */
.toast-area {
  position: relative;
  display: flex;
  justify-content: center;
  pointer-events: none;
  height: 0;
}
.toast-badge {
  position: absolute;
  top: -24px;
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  animation: toastFloat 1.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 50;
}
.toast-badge.gain { background: var(--ok); color: #0a260f; }
.toast-badge.spend { background: var(--danger); color: #300600; }
.toast-badge.info { background: var(--teal); color: #002b25; }
.toast-badge.warn { background: var(--amber); color: #331f00; }

@keyframes toastFloat {
  0% { opacity: 0; transform: translateY(10px) scale(0.8); }
  20% { opacity: 1; transform: translateY(-5px) scale(1.1); }
  80% { opacity: 0.95; }
  100% { opacity: 0; transform: translateY(-30px) scale(0.9); }
}

.end[hidden],
[hidden] {
  display: none !important;
}

/* ---------- Итог игры ---------- */
.end {
  padding: 1.5rem 1.2rem;
  text-align: center;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--panel-hi);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: endPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
@keyframes endPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.end-icon {
  font-size: 2.75rem;
  margin-bottom: -0.2rem;
}
.end.win {
  border-color: var(--amber);
  background: radial-gradient(circle at 50% 30%, #3e2808, var(--panel-hi) 75%);
  box-shadow: 0 0 35px rgba(255, 176, 32, 0.35);
}
.end.lose {
  border-color: var(--danger);
  background: radial-gradient(circle at 50% 30%, #381313, var(--panel-hi) 75%);
  box-shadow: 0 0 35px rgba(255, 112, 96, 0.25);
}

.end h2 {
  font-family: var(--font-display);
  font-size: 1.9rem;
  letter-spacing: -0.01em;
}
.end.win h2 { color: #ffe48a; }
.end.lose h2 { color: #ff9d92; }

.end p {
  margin: 0;
  max-width: 58ch;
  font-size: 1.05rem;
  color: var(--text);
}

.end-stats {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.92rem;
  color: var(--muted);
}
.end-stats b { color: var(--text); }

.end-restart {
  margin-top: 0.4rem;
}

/* ---------- Действия ---------- */
.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.action {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pad {
  flex: none;
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.25rem 0.9rem;
  align-items: center;
  width: 100%;
  min-height: 126px;
  padding: 0.9rem 1rem;
  font: inherit;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  border: 2px solid var(--line);
  border-bottom-width: 5px;
  border-radius: var(--radius);
  background: var(--panel);
  transition: transform 0.08s, border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.pad:hover:not(:disabled) {
  background: var(--panel-hi);
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}
.pad:active:not(:disabled) {
  transform: translateY(3px);
  border-bottom-width: 2px;
  margin-bottom: 3px;
}
.pad:focus-visible, .restart:focus-visible, .icon-btn:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}
.pad:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  border-bottom-width: 2px;
  margin-bottom: 3px;
  filter: grayscale(0.2);
}

.pad .badge {
  grid-row: 1 / span 3;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  color: #171020;
  background: var(--accent);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pad:hover:not(:disabled) .badge {
  transform: scale(1.08) rotate(-3deg);
}
.pad .badge .ico {
  width: 32px;
  height: 32px;
  stroke-width: 1.8;
}

.pad-title {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.pad-cost, .pad-result {
  font-size: 0.88rem;
  color: var(--muted);
}
.pad-cost b {
  color: var(--text);
  font-weight: 600;
}
.pad-result b {
  color: var(--accent);
  font-weight: 700;
}

.pad[data-action="rehearse"] { --accent: var(--teal); }
.pad[data-action="work"]     { --accent: var(--amber); }
.pad[data-action="rest"]     { --accent: #9d8cff; }
.pad[data-action="perform"]  { --accent: var(--pink); }

.note {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 1.4rem;
}
.action:nth-child(n + 3) .note { min-height: 2.6rem; }
.reason {
  font-size: 0.85rem;
  color: var(--danger);
  font-weight: 600;
}
.warning {
  font-size: 0.87rem;
  color: var(--amber);
}
.warning:not(:empty) {
  padding: 0.35rem 0.65rem;
  border-left: 3px solid var(--amber);
  background: rgba(255, 176, 32, 0.12);
  border-radius: 0 8px 8px 0;
  animation: warnPulse 1.8s ease-in-out infinite alternate;
}
@keyframes warnPulse {
  0% { background: rgba(255, 176, 32, 0.1); }
  100% { background: rgba(255, 176, 32, 0.2); }
}

/* ---------- Журнал ---------- */
.log-box {
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}
.log-box h2 {
  font-size: 1.05rem;
  margin-bottom: 0.55rem;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}
.log {
  margin: 0;
  padding: 0;
  list-style: none;
}
.log li {
  padding: 0.4rem 0;
  color: var(--muted);
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.log li:first-child {
  border-top: 0;
  color: var(--text);
  font-weight: 600;
}

/* Кнопка перезапуска */
.restart {
  align-self: center;
  min-height: 50px;
  padding: 0.8rem 2.2rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: #1f1500;
  background: var(--amber);
  border: 0;
  border-bottom: 5px solid #b37300;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255, 176, 32, 0.3);
  transition: transform 0.08s, background-color 0.15s;
}
.restart:hover { background: #ffc44f; }
.restart:active { transform: translateY(3px); border-bottom-width: 2px; }

/* ---------- Адаптивность для телефонов ---------- */
@media (max-width: 680px) {
  body { padding: 1rem 0.75rem 2rem; }
  .status { grid-template-columns: 1fr 1fr; }
  .tile:nth-child(3) { border-left: 0; }
  .tile:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .actions { grid-template-columns: 1fr; gap: 0.75rem; }
  .note,
  .action:nth-child(n + 3) .note { min-height: 0; }
  .eq { width: 38px; }
  .lamps li { width: 42px; height: 42px; font-size: 1rem; }
  .stage-scene { height: 175px; }
  .musician-wrapper { width: 120px; height: 130px; }
  .top-controls { width: 100%; justify-content: flex-end; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
