/* 霓虹弹珠台 · 赛博霓虹街机机台样式
   红线：桌面双栏沉浸机台（非四角散落按钮 / 非 SaaS 卡片集群）、移动端一体掌机 +
   底部广告安全避让区、触控防滚动、实体按键质感、动效可降级。 */

:root {
  --bg-0: #0b0620;
  --bg-1: #170c38;
  --panel: rgba(32, 16, 66, 0.72);
  --panel-edge: rgba(120, 90, 255, 0.35);
  --cyan: #5adcff;
  --mint: #7ef0c0;
  --pink: #ff78c8;
  --gold: #ffd76a;
  --text: #efe9ff;
  --dim: #a99bd8;
  --font: ui-sans-serif, system-ui, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 700px at 50% -10%, #2a1458 0%, var(--bg-1) 45%, var(--bg-0) 100%);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none;
  min-height: 100vh;
}

#game-app {
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px 18px 26px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- 机台顶边一体化状态条（禁止四角散落） ---- */
#stage-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(70, 34, 130, 0.85), rgba(34, 16, 70, 0.85));
  border: 1px solid rgba(140, 110, 255, 0.4);
  box-shadow: 0 4px 22px rgba(90, 220, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

#back-home {
  color: var(--cyan);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(90, 220, 255, 0.1);
  border: 1px solid rgba(90, 220, 255, 0.3);
}

#back-home:hover { background: rgba(90, 220, 255, 0.2); }

#stage-title {
  flex: 1;
  margin: 0;
  font-size: 19px;
  letter-spacing: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stage-actions { display: flex; gap: 8px; }

.bar-btn {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: rgba(120, 90, 255, 0.18);
  border: 1px solid rgba(140, 110, 255, 0.45);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

.bar-btn:hover { background: rgba(120, 90, 255, 0.32); transform: translateY(-1px); }
.bar-btn:active { transform: translateY(1px); }

/* ---- 主舞台三区：左翼机关牌匾 / 中央机台 / 右翼计分牌匾 ---- */
#stage-core {
  display: grid;
  grid-template-columns: 205px minmax(0, 1fr) 230px;
  gap: 16px;
  align-items: start;
  margin-top: 14px;
}

#panel-left, #panel-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-chunk {
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  padding: 10px 12px;
  backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.panel-chunk h3 { margin: 0 0 4px; font-size: 14px; color: var(--cyan); letter-spacing: 1px; }
.panel-chunk p { margin: 2px 0; font-size: 13px; }

.p-label {
  display: block;
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 1px;
  margin-bottom: 3px;
}

.lcd {
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  letter-spacing: 1px;
}

.lcd.big { font-size: 30px; font-weight: 700; text-shadow: 0 0 14px rgba(255, 215, 106, 0.5); }
.lcd.small { font-size: 14px; }

#combo-meter {
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 5px 0;
}

#combo-meter-bar {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  transition: width 0.18s ease;
}

.mult { color: var(--pink); font-weight: 700; font-size: 15px; }

/* 机关灯 */
#mech-lamps { display: flex; flex-wrap: wrap; gap: 6px; }

.lamp {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--dim);
  transition: all 0.2s ease;
}

.lamp.lit {
  color: #10203a;
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(90, 220, 255, 0.8);
}

#effect-lamp.lit {
  color: var(--pink);
  text-shadow: 0 0 12px rgba(255, 120, 200, 0.9);
}

.dim { color: var(--dim); }

/* ---- 中央弹珠机舞台 ---- */
#stage-cabinet {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

.board-wrap {
  position: relative;
  width: min(100%, 460px);
}

#board {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  border: 1px solid rgba(140, 110, 255, 0.5);
  box-shadow: 0 0 40px rgba(90, 220, 255, 0.16), 0 18px 50px rgba(0, 0, 0, 0.5);
  background: #150a2b;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(16, 8, 40, 0.92);
  border: 1px solid rgba(90, 220, 255, 0.55);
  color: #d9f6ff;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 0 20px rgba(90, 220, 255, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 6;
  white-space: nowrap;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 浮层 */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(11, 6, 32, 0.82);
  backdrop-filter: blur(5px);
  border-radius: 18px;
  padding: 20px;
  text-align: center;
  z-index: 5;
}

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

.overlay h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 3px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 215, 106, 0.55);
}

.overlay p { margin: 2px 0; font-size: 13.5px; line-height: 1.55; max-width: 380px; }

.mode-row, .btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.btn {
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(90, 220, 255, 0.22), rgba(90, 220, 255, 0.1));
  border: 1px solid rgba(90, 220, 255, 0.5);
  border-radius: 12px;
  padding: 10px 18px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 5px 0 rgba(0, 0, 0, 0.3); }
.btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(0, 0, 0, 0.4); }

.btn-primary {
  background: linear-gradient(180deg, rgba(255, 120, 200, 0.35), rgba(255, 120, 200, 0.14));
  border-color: rgba(255, 120, 200, 0.6);
}

.stars-line { color: var(--gold); font-size: 22px; letter-spacing: 4px; text-shadow: 0 0 16px rgba(255, 215, 106, 0.6); }

/* 选关网格 */
#level-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  width: min(100%, 420px);
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}

.level-chapter {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 2px;
  margin-top: 6px;
  text-align: left;
  border-bottom: 1px dashed rgba(90, 220, 255, 0.3);
  padding-bottom: 4px;
}

.level-cell {
  font-family: var(--font);
  background: rgba(90, 220, 255, 0.12);
  border: 1px solid rgba(90, 220, 255, 0.35);
  border-radius: 10px;
  color: var(--text);
  padding: 6px 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.08s ease, background 0.15s ease;
}

.level-cell:hover { transform: translateY(-2px); background: rgba(90, 220, 255, 0.24); }
.level-cell:active { transform: translateY(1px); }
.level-cell.locked { opacity: 0.35; cursor: default; background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.15); }

.level-num { font-size: 15px; font-weight: 700; }
.level-stars { font-size: 10px; color: var(--gold); letter-spacing: 1px; }
.level-stars i { color: rgba(255, 255, 255, 0.22); font-style: normal; }

.start-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--dim);
}

/* ---- 机台底座实体操作台 ---- */
#deck {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  width: min(100%, 460px);
  margin-top: 10px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(70, 34, 130, 0.75), rgba(34, 16, 70, 0.75));
  border: 1px solid rgba(140, 110, 255, 0.4);
  border-radius: 16px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.flip-btn, .launch-btn, .nudge-btn {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  color: #0c1a2e;
  border-radius: 14px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  min-height: 54px;
  letter-spacing: 1px;
}

.flip-btn {
  flex: 1;
  background: linear-gradient(180deg, #a6ffd8, #5ecfa4);
  border: 1px solid rgba(126, 240, 192, 0.9);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 4px 0 rgba(0, 0, 0, 0.35);
}

.flip-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 1px 0 rgba(0, 0, 0, 0.4); }

.launch-btn {
  flex: 1.4;
  background: linear-gradient(180deg, #ffe9a8, #f2b84b);
  border: 1px solid rgba(255, 215, 106, 0.95);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.7), 0 4px 0 rgba(0, 0, 0, 0.35);
}

.launch-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 1px 0 rgba(0, 0, 0, 0.4); }

.nudge-btn {
  flex: 0.8;
  background: linear-gradient(180deg, #c9a4ff, #8f6ae0);
  border: 1px solid rgba(201, 164, 255, 0.9);
  color: #1c0c38;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.6), 0 4px 0 rgba(0, 0, 0, 0.35);
}

.nudge-btn:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 1px 0 rgba(0, 0, 0, 0.4); }

#key-tip, #touch-tip { font-size: 12px; margin: 6px 0 0; text-align: center; }

#touch-tip { display: none; }

/* 移动端紧凑 HUD */
#mobile-hud {
  display: none;
  width: min(100%, 460px);
  gap: 8px;
  margin-bottom: 8px;
}

.mh-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  padding: 5px 2px;
}

.mh-item b { font-size: 16px; color: var(--gold); font-variant-numeric: tabular-nums; }
.mh-item i { font-style: normal; font-size: 10px; color: var(--dim); }

/* ---- 响应式：桌面（≥900px）双栏 / 平板收窄 / 移动端一体掌机 ---- */
@media (max-width: 1080px) and (min-width: 900px) {
  #stage-core { grid-template-columns: 175px minmax(0, 1fr) 195px; }
}

@media (max-width: 899px) {
  #stage-core {
    grid-template-columns: 1fr;
  }
  #panel-left, #panel-right { display: none; }
  #mobile-hud { display: flex; }
  #touch-tip { display: block; }
  #key-tip { display: none; }
}

/* 移动端：底部广告安全避让区（严禁贴底操作键） */
@media (max-width: 768px) {
  #game-app {
    padding: 8px 12px max(68px, calc(16px + env(safe-area-inset-bottom)));
  }
  #deck {
    padding-bottom: 6px;
  }
  #stage-bar { padding: 6px 10px; }
  #stage-title { font-size: 16px; }
  #board { border-radius: 14px; }
}

@media (max-width: 420px) {
  .flip-btn, .launch-btn, .nudge-btn { min-height: 48px; font-size: 14px; }
  #level-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ---- 动效降级 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
