* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%;
  overflow: hidden;
  background: #07040F;
  color: #EAF6FF;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 12% 0%, rgba(255, 138, 61, 0.20), transparent 58%),
    radial-gradient(110% 80% at 92% 100%, rgba(0, 229, 255, 0.18), transparent 60%),
    linear-gradient(160deg, #0B0620 0%, #120A2A 46%, #06030F 100%);
}

#bgfx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
  pointer-events: none;
}

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 5;
  pointer-events: none;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-main {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.22em;
  color: #FF8A3D;
  text-shadow: 0 0 12px rgba(255, 138, 61, 0.75);
}
.brand-sub {
  font-size: 8px;
  letter-spacing: 0.16em;
  color: rgba(0, 229, 255, 0.72);
  margin-top: 2px;
}
.hud-right { display: flex; gap: 8px; }
.stat {
  min-width: 58px;
  padding: 4px 9px 5px;
  border-radius: 10px;
  background: rgba(18, 12, 40, 0.72);
  border: 1px solid rgba(0, 229, 255, 0.28);
  box-shadow: inset 0 0 14px rgba(0, 229, 255, 0.10), 0 4px 14px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.stat-label { font-size: 8px; letter-spacing: 0.14em; color: rgba(160, 200, 235, 0.75); }
.stat-value {
  font-size: 14px;
  font-weight: 800;
  color: #EAF6FF;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.55);
}

/* ---------- 棋盘 ---------- */
.board-wrap {
  position: absolute;
  top: 46px;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 8px;
  padding-right: 132px;
  z-index: 3;
}
.board-frame {
  position: relative;
  height: 100%;
  aspect-ratio: 1 / 2;
  max-width: 100%;
  border-radius: 14px;
  padding: 3px;
  background: linear-gradient(150deg, rgba(255, 138, 61, 0.85), rgba(0, 229, 255, 0.75));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.10),
    0 0 26px rgba(255, 138, 61, 0.30),
    0 0 60px rgba(0, 229, 255, 0.20),
    0 18px 40px rgba(0, 0, 0, 0.55);
}
#board {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 11px;
  background: #08051A;
}
.scanlines {
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.045) 0px,
    rgba(255, 255, 255, 0.045) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
}
.board-glow {
  position: absolute;
  inset: 3px;
  border-radius: 11px;
  pointer-events: none;
  box-shadow: inset 0 0 40px rgba(0, 229, 255, 0.16), inset 0 0 90px rgba(255, 138, 61, 0.10);
}

/* ---------- 侧栏 ---------- */
.side {
  position: absolute;
  top: 46px;
  right: 8px;
  bottom: 8px;
  width: 118px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 4;
}
.panel {
  border-radius: 12px;
  padding: 8px 9px 9px;
  background: linear-gradient(160deg, rgba(24, 16, 52, 0.92), rgba(12, 8, 28, 0.92));
  border: 1px solid rgba(0, 229, 255, 0.26);
  box-shadow: inset 0 0 18px rgba(0, 229, 255, 0.08), 0 8px 22px rgba(0, 0, 0, 0.45);
}
.panel-title {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #FF8A3D;
  margin-bottom: 6px;
  text-shadow: 0 0 10px rgba(255, 138, 61, 0.6);
}
.next-panel { display: flex; flex-direction: column; align-items: stretch; }
#next {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  border-radius: 8px;
  background: rgba(6, 4, 18, 0.85);
  border: 1px solid rgba(255, 138, 61, 0.22);
}
.goal-panel { flex: 1; min-height: 0; }
.goal-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 6px;
}
.goal-key { font-size: 9px; color: rgba(160, 200, 235, 0.8); letter-spacing: 0.08em; }
.goal-val {
  font-size: 10px;
  font-weight: 700;
  color: #EAF6FF;
  font-variant-numeric: tabular-nums;
}
.bar {
  margin-top: 4px;
  height: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, #FF8A3D, #FFD166);
  box-shadow: 0 0 10px rgba(255, 138, 61, 0.8);
  transition: width 0.22s ease;
}
.bar > i.cyan { background: linear-gradient(90deg, #00E5FF, #7CFFCB); box-shadow: 0 0 10px rgba(0, 229, 255, 0.8); }
.player-panel {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
}
.avatar {
  width: 26px; height: 26px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 138, 61, 0.25);
  border: 1px solid rgba(255, 138, 61, 0.5);
  flex: 0 0 auto;
}
.player-meta { display: flex; flex-direction: column; min-width: 0; }
.player-name {
  font-size: 10px;
  font-weight: 700;
  color: #EAF6FF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-tip { font-size: 8px; color: rgba(160, 200, 235, 0.6); margin-top: 1px; }

/* ---------- 触控 ---------- */
.controls {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: flex;
  gap: 8px;
  z-index: 6;
}
.ctrl {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(0, 229, 255, 0.42);
  background: linear-gradient(160deg, rgba(30, 20, 62, 0.94), rgba(12, 8, 28, 0.94));
  color: #9FE9FF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5), inset 0 0 16px rgba(0, 229, 255, 0.10);
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.ctrl .mp-icon { width: 22px; height: 22px; color: #9FE9FF; }
.ctrl:active, .ctrl.pressed {
  transform: scale(0.94);
  background: linear-gradient(160deg, rgba(255, 138, 61, 0.30), rgba(0, 229, 255, 0.22));
  box-shadow: 0 0 22px rgba(255, 138, 61, 0.55), inset 0 0 18px rgba(255, 138, 61, 0.35);
}
.ctrl-drop {
  width: 62px;
  border-color: rgba(255, 138, 61, 0.55);
  color: #FFC79A;
}
.ctrl-drop .mp-icon { color: #FFC79A; }

/* ---------- 遮罩 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(80% 80% at 50% 50%, rgba(10, 6, 26, 0.72), rgba(4, 2, 12, 0.94));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.22s ease;
}
.overlay.hidden { opacity: 0; pointer-events: none; }
.ov-card {
  width: min(420px, 92%);
  border-radius: 18px;
  padding: 18px 20px 20px;
  text-align: center;
  background: linear-gradient(165deg, rgba(32, 20, 66, 0.96), rgba(10, 7, 26, 0.96));
  border: 1px solid rgba(255, 138, 61, 0.45);
  box-shadow: 0 0 34px rgba(255, 138, 61, 0.28), 0 0 70px rgba(0, 229, 255, 0.18), 0 22px 50px rgba(0, 0, 0, 0.6);
}
.ov-tag {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: #00E5FF;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0, 229, 255, 0.4);
  background: rgba(0, 229, 255, 0.08);
}
.ov-title {
  margin: 10px 0 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #FFF3E6;
  text-shadow: 0 0 18px rgba(255, 138, 61, 0.7);
}
.ov-desc {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(200, 220, 240, 0.82);
}
.ov-goal {
  margin: 12px 0 0;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.ov-goal span {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 999px;
  color: #FFD9BC;
  background: rgba(255, 138, 61, 0.14);
  border: 1px solid rgba(255, 138, 61, 0.35);
}
.ov-btn {
  margin-top: 16px;
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #1A0B02;
  background: linear-gradient(120deg, #FF8A3D, #FFC15E);
  box-shadow: 0 10px 26px rgba(255, 138, 61, 0.42), inset 0 -2px 0 rgba(0, 0, 0, 0.18);
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}
.ov-btn:active { transform: scale(0.97); box-shadow: 0 4px 14px rgba(255, 138, 61, 0.5); }

@media (max-height: 380px) {
  .hud { height: 40px; }
  .board-wrap { top: 40px; padding-right: 116px; }
  .side { top: 40px; width: 104px; }
  .ctrl { width: 46px; height: 46px; border-radius: 12px; }
  .ctrl-drop { width: 56px; }
  .ov-title { font-size: 19px; }
  .ov-card { padding: 14px 16px 16px; }
  .ov-btn { height: 42px; margin-top: 12px; }
}
