/* ============================================================
   火柴人舞台 —— 霓虹剧场导演台样式
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #7c5cff;
  --cyan: #22d3ee;
  --pink: #ff5ca8;
  --orange: #ffb347;
  --panel-bg: rgba(255, 255, 255, .06);
  --panel-border: 1px solid rgba(255, 255, 255, .12);
  --radius: 20px;
  --text: #e8e9ff;
  --text-dim: #9aa0c8;
}

html, body {
  height: 100%;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 50% 30%, #171a3a, #0b0e20);
  overflow: hidden;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  flex: 0 0 auto;
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 14, 32, .72);
  border-bottom: var(--panel-border);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.logo {
  font-size: 19px;
  letter-spacing: 3px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.back-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 14px;
  border: var(--panel-border);
  border-radius: 999px;
  background: var(--panel-bg);
  transition: color .2s, border-color .2s;
}
.back-link:hover { color: var(--cyan); border-color: rgba(34, 211, 238, .5); }

/* ---------- 主布局 ---------- */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  padding: 14px;
  gap: 14px;
}

/* ---------- 舞台 ---------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  border-radius: var(--radius);
  border: var(--panel-border);
  overflow: hidden;
  background: #0b0e20;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45), inset 0 0 60px rgba(124, 92, 255, .08);
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: manipulation;
}

/* 音乐状态角标 */
.music-chip {
  position: absolute;
  left: 14px;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--panel-bg);
  border: var(--panel-border);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.music-chip .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #5b6088;
  transition: background .2s, box-shadow .2s;
}
.music-chip.playing .dot {
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.music-chip.muted .dot { background: var(--pink); }

/* 观众兴奋度槽 */
.excite {
  position: absolute;
  left: 14px; right: 14px;
  bottom: 14px;
  padding: 10px 14px 12px;
  border-radius: 16px;
  background: rgba(11, 14, 32, .62);
  border: var(--panel-border);
  backdrop-filter: blur(8px);
}
.excite-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-dim);
  margin-bottom: 7px;
  letter-spacing: 1px;
}
.excite-best b { color: var(--orange); }
.excite-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.excite-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--pink) 55%, var(--orange));
  box-shadow: 0 0 14px rgba(255, 92, 168, .65);
  transition: width .12s linear;
}
.excite-fill.full {
  animation: exciteFlash .35s ease-in-out infinite alternate;
}
@keyframes exciteFlash {
  from { filter: brightness(1); }
  to   { filter: brightness(1.7); }
}

/* ---------- 控制面板 ---------- */
.control-panel {
  flex: 0 0 308px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ctrl-section { display: flex; flex-direction: column; gap: 10px; }
.ctrl-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-dim);
}

.btn-grid {
  display: grid;
  gap: 9px;
}
.grid-moves { grid-template-columns: 1fr 1fr; }
.grid-effects { grid-template-columns: 1fr 1fr; }
.grid-tools { grid-template-columns: 1fr 1fr; }

button { font-family: inherit; }

.act-btn, .fx-btn, .tool-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 64px;
  padding: 9px 8px;
  color: var(--text);
  background: var(--panel-bg);
  border: var(--panel-border);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s, border-color .15s, background .15s, box-shadow .15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.act-btn:hover, .fx-btn:hover, .tool-btn:hover {
  border-color: rgba(124, 92, 255, .65);
  background: rgba(124, 92, 255, .14);
}
.act-btn:active, .fx-btn:active, .tool-btn:active { transform: scale(.95); }

.act-btn .key, .fx-btn .key, .tool-btn .key {
  position: absolute;
  left: 8px; top: 7px;
  font-size: 10.5px;
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 6px;
  padding: 1px 6px;
  line-height: 1.4;
}
.act-btn .label, .fx-btn .label, .tool-btn .label { font-size: 14px; letter-spacing: 1px; }
.fx-btn .state { font-size: 10.5px; color: var(--text-dim); letter-spacing: 1px; }

/* 当前动作 */
.act-btn.on {
  border-color: var(--primary);
  background: rgba(124, 92, 255, .22);
  box-shadow: 0 0 18px rgba(124, 92, 255, .4);
}
.act-btn.on .label { color: #fff; }

/* 特效激活态 */
.fx-fire.on {
  border-color: #ff7a3c;
  background: rgba(255, 110, 50, .2);
  box-shadow: 0 0 18px rgba(255, 110, 50, .45);
}
.fx-burn.on {
  border-color: var(--orange);
  background: rgba(255, 179, 71, .18);
  box-shadow: 0 0 18px rgba(255, 179, 71, .4);
}
.fx-sword.on {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, .16);
  box-shadow: 0 0 18px rgba(34, 211, 238, .4);
}
.fx-trans.on {
  border-color: #ffd34d;
  background: rgba(255, 211, 77, .18);
  box-shadow: 0 0 20px rgba(255, 211, 77, .5);
}
.fx-btn.cooling { opacity: .55; }
.fx-btn.cooling .state { color: var(--pink); }
.fx-btn.on .state { color: #fff; }

.fx-hint {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-dim);
}

/* BPM 滑块 */
.bpm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}
.bpm-row input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 4px;
}
.bpm-val {
  min-width: 34px;
  text-align: right;
  color: var(--cyan);
  font-weight: 700;
  font-size: 15px;
}

.tool-btn.on {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, .16);
  box-shadow: 0 0 16px rgba(34, 211, 238, .35);
}
.tool-btn.accent { border-color: rgba(124, 92, 255, .6); }
.tool-btn.pink {
  grid-column: span 2;
  flex-direction: row;
  gap: 10px;
  min-height: 50px;
  border-color: rgba(255, 92, 168, .55);
  background: rgba(255, 92, 168, .12);
}
.tool-btn.pink:active { animation: beatHit .25s ease; }
@keyframes beatHit {
  0% { box-shadow: 0 0 0 rgba(255, 92, 168, .8); }
  100% { box-shadow: 0 0 34px rgba(255, 92, 168, 0); }
}

/* ---------- 底部快捷键 ---------- */
.shortcut-bar {
  flex: 0 0 auto;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  letter-spacing: 2px;
  color: var(--text-dim);
  border-top: var(--panel-border);
  background: rgba(11, 14, 32, .6);
}

/* ---------- 开场引导浮层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 9, 22, .72);
  backdrop-filter: blur(10px);
  transition: opacity .35s;
}
.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
.intro-panel {
  width: min(560px, 100%);
  padding: 34px 36px 30px;
  border-radius: var(--radius);
  background: rgba(23, 26, 58, .92);
  border: var(--panel-border);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.intro-title {
  font-size: 26px;
  margin-bottom: 12px;
  background: linear-gradient(90deg, var(--primary), var(--cyan), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-lead { color: var(--text); font-size: 14.5px; margin-bottom: 16px; }
.intro-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
}
.intro-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-dim);
}
.intro-list li::before {
  content: "";
  position: absolute;
  left: 0; top: .62em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}
.btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  letter-spacing: 4px;
  color: #fff;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(90deg, var(--primary), #9b7cff);
  box-shadow: 0 10px 30px rgba(124, 92, 255, .45);
  transition: transform .15s, filter .15s;
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: scale(.97); }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  html, body { overflow: auto; }
  .app { min-height: 100%; height: auto; }
  .layout {
    flex-direction: column;
    padding: 10px;
    gap: 10px;
  }
  .stage { flex: 0 0 auto; height: min(58vh, 520px); }
  .control-panel {
    flex: 1 1 auto;
    padding: 12px;
    gap: 12px;
  }
  .act-btn, .fx-btn { min-height: 74px; }
  .act-btn .label, .fx-btn .label { font-size: 15px; }
  .shortcut-bar { height: auto; padding: 8px 12px; line-height: 1.9; text-align: center; }
  .logo { font-size: 16px; letter-spacing: 2px; }
  .back-link { padding: 6px 10px; font-size: 13px; }
}

@media (max-width: 420px) {
  .grid-moves, .grid-effects, .grid-tools { gap: 7px; }
  .act-btn, .fx-btn { min-height: 68px; padding: 8px 4px; }
}