:root {
  --bg1: #090c1e;
  --bg2: #151a3d;
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: #eef1ff;
  --muted: #9aa3c7;
  --accent-stay: #f5a524;
  --accent-switch: #2dd4bf;
  --gold: #ffd97a;
  --mono: Consolas, "SF Mono", Menlo, "Courier New", monospace;
}

* { box-sizing: border-box; }

/* ---------- 舞台背景：暗场 + 细网格 + 金紫光晕 ---------- */
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1000px 520px at 88% -8%, rgba(255, 217, 122, 0.09), transparent 60%),
    radial-gradient(1100px 620px at -8% 22%, rgba(124, 77, 255, 0.16), transparent 60%),
    radial-gradient(900px 480px at 50% 118%, rgba(255, 217, 122, 0.07), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(192deg, var(--bg1) 0%, var(--bg2) 52%, #0b0f26 100%);
  background-size: auto, auto, auto, 42px 42px, 42px 42px, auto;
  background-attachment: fixed;
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  line-height: 1.6;
}

.container { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; }

.hub-link { text-align: center; margin: 0 0 8px; }
.hub-link a { color: var(--muted); font-size: 13px; text-decoration: none; }
.hub-link a:hover { color: var(--gold); }

.hero h1 {
  margin: 0 0 8px;
  font-size: 32px;
  text-align: center;
  letter-spacing: 2px;
  text-shadow: 0 0 26px rgba(255, 217, 122, 0.3);
}
.subtitle { color: var(--muted); text-align: center; max-width: 580px; margin: 0 auto 32px; }

.card {
  background: linear-gradient(170deg, rgba(255, 217, 122, 0.04), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h2::before {
  content: '';
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold), #c9992e);
  box-shadow: 0 0 8px rgba(255, 217, 122, 0.5);
}

/* ---------- 门 ---------- */
.doors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 24px;
  perspective: 900px;
  margin: 8px 0 20px;
  padding-top: 12px;
}

.door {
  position: relative;
  width: 140px;
  height: 190px;
  border: none;
  padding: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.door:disabled { cursor: default; color: inherit; opacity: 1; }

/* 门后的暗处 + 一束追光 */
.door-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  background:
    radial-gradient(90px 90px at 50% 42%, rgba(255, 235, 170, 0.18), transparent 70%),
    #10142c;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
}

.door-panel {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  /* 丝绒紫门板：顶部高光 + 底部厚度 */
  background: linear-gradient(165deg, #8a79f2 0%, #5b4bd4 48%, #3b2f96 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 12px 22px rgba(255, 255, 255, 0.1),
    inset 0 -16px 30px rgba(0, 0, 0, 0.42),
    0 10px 22px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: left center;
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.3, 1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.door-number {
  font-family: var(--mono);
  font-size: 40px;
  font-weight: 700;
  opacity: 0.92;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.door-knob {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9ad, #f0b93c 55%, #a97a14);
  box-shadow: 0 0 8px rgba(255, 217, 122, 0.6), 0 1px 2px rgba(0, 0, 0, 0.5);
  transform: translateY(-50%);
}

.door:not(.open):not(:disabled):hover .door-panel {
  transform: translateY(-6px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 12px 22px rgba(255, 255, 255, 0.1),
    inset 0 -16px 30px rgba(0, 0, 0, 0.42),
    0 16px 28px rgba(0, 0, 0, 0.6);
}

.door.open .door-panel { transform: rotateY(-105deg); }
.door.open { cursor: default; }

/* 你的选择：金色描边 + 呼吸灯 */
.door.picked .door-panel,
.door.picked .door-content {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.door.picked:not(.open) { animation: pickedBreath 2s ease-in-out infinite; }

@keyframes pickedBreath {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(255, 217, 122, 0.4)); }
  50% { filter: drop-shadow(0 0 16px rgba(255, 217, 122, 0.85)); }
}

.door:focus-visible .door-panel { outline: 3px solid #fff; outline-offset: 3px; }

/* ---------- 提示与按钮 ---------- */
.message {
  text-align: center;
  min-height: 30px;
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 217, 122, 0.25);
}

.actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  min-height: 46px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: #10132b;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.btn-stay { background: linear-gradient(180deg, #ffcf5c, #e8a412); box-shadow: 0 0 16px rgba(245, 165, 36, 0.35); }
.btn-switch { background: linear-gradient(180deg, #5eead4, #14b8a6); box-shadow: 0 0 16px rgba(45, 212, 191, 0.35); }
.btn-again { background: linear-gradient(180deg, #aab1ff, #7c84f0); box-shadow: 0 0 16px rgba(139, 147, 255, 0.35); }
.btn-sim { background: linear-gradient(180deg, #8a79f2, #6d5bd0); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }

/* ---------- 手动战绩 ---------- */
.manual-score { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 30px; margin: 18px 0 0; }
.manual-score div { text-align: center; }
.manual-score dt { font-size: 12px; color: var(--muted); }
.manual-score dd {
  margin: 2px 0 0;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

/* ---------- 批量模拟 ---------- */
.hint { color: var(--muted); font-size: 14px; margin: -8px 0 16px; }

.sim-buttons { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

.sim-results { display: grid; gap: 14px; }

.sim-row {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  align-items: center;
  gap: 12px;
}

.sim-label { font-size: 14px; color: var(--muted); }

.bar {
  height: 16px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.bar-fill { height: 100%; width: 0; border-radius: 999px; transition: width 0.5s ease; }
.fill-stay {
  background: linear-gradient(90deg, #f5a524, #ffcf5c);
  box-shadow: 0 0 12px rgba(245, 165, 36, 0.5);
}
.fill-switch {
  background: linear-gradient(90deg, #14b8a6, #5eead4);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.5);
}

.sim-stat {
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  min-width: 160px;
  text-align: right;
}

.theory { margin: 6px 0 0; color: var(--muted); font-size: 13px; text-align: right; }

.foot { text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 台头：标题 + 门数选择 ---------- */
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.stage-head h2 { margin: 0; }

.door-count {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.door-count button {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.door-count button.active { background: linear-gradient(180deg, #8a79f2, #6d5bd0); color: #fff; }
.door-count button:not(.active):hover { color: var(--text); }

/* ---------- 悬念与胜负消息 ---------- */
.message.suspense { animation: suspensePulse 1.1s ease-in-out infinite; }

@keyframes suspensePulse {
  50% { opacity: 0.55; }
}

.message.win { color: var(--gold); }
.message.lose { color: #ff9fb0; }

/* 主持人即将开门前的晃动 */
.door.soon { animation: doorWiggle 0.45s ease-in-out infinite; }

@keyframes doorWiggle {
  0%, 100% { transform: rotate(0deg); }
  30% { transform: rotate(-1.6deg); }
  70% { transform: rotate(1.4deg); }
}

/* 揭示：最终门金框、中奖门金光 */
.door.final .door-panel,
.door.final .door-content {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.door.win .door-content {
  border-color: rgba(245, 165, 36, 0.85);
  box-shadow: 0 0 26px rgba(245, 165, 36, 0.75), inset 0 0 20px rgba(245, 165, 36, 0.25);
}

/* ---------- 徽标：你的选择 / 最终选择 ---------- */
.doors.phase-offer .door.picked::after,
.doors.phase-reveal .door.final::after {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 2;
}

.doors.phase-offer .door.picked::after {
  content: '你的选择';
  background: var(--accent-switch);
  color: #07211d;
}

.doors.phase-reveal .door.final::after {
  content: '最终选择';
  background: var(--accent-stay);
  color: #241703;
}

/* ---------- 多门尺寸 ---------- */
.doors.count-10 { gap: 14px; }
.doors.count-10 .door { width: 92px; height: 132px; }
.doors.count-10 .door-number { font-size: 28px; }
.doors.count-10 .door-content { font-size: 36px; }
.doors.count-10 .door-knob { width: 10px; height: 10px; right: 7px; }

.doors.count-26 { gap: 10px; }
.doors.count-26 .door { width: 66px; height: 96px; }
.doors.count-26 .door-panel,
.doors.count-26 .door-content { border-radius: 8px; }
.doors.count-26 .door-number { font-size: 20px; }
.doors.count-26 .door-content { font-size: 26px; }
.doors.count-26 .door-knob { width: 7px; height: 7px; right: 5px; }
.doors.count-26 .door.picked::after,
.doors.count-26 .door.final::after { font-size: 10px; padding: 1px 6px; top: -12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .container { padding: 24px 14px 48px; }
  .hero h1 { font-size: 24px; }
  .subtitle { font-size: 14px; }
  .message { font-size: 15px; min-height: 26px; }
  .card { padding: 18px 14px; }
  .doors { gap: 12px; }
  .door { width: 96px; height: 140px; }
  .door-number { font-size: 28px; }
  .door-content { font-size: 40px; }
  .doors.count-10 { gap: 10px; }
  .doors.count-10 .door { width: 74px; height: 108px; }
  .doors.count-10 .door-number { font-size: 22px; }
  .doors.count-10 .door-content { font-size: 30px; }
  .doors.count-26 { gap: 8px; }
  .doors.count-26 .door { width: 48px; height: 74px; }
  .doors.count-26 .door-number { font-size: 14px; }
  .doors.count-26 .door-content { font-size: 20px; }
  .sim-row { grid-template-columns: 90px 1fr; }
  .sim-stat { grid-column: 1 / -1; text-align: left; min-width: 0; }
  .manual-score { flex-wrap: wrap; gap: 10px 22px; }
  .manual-score dd { font-size: 15px; }
  .actions { gap: 10px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-sim { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .door-panel, .bar-fill, .btn { transition: none; }
  .door.picked:not(.open), .door.soon, .message.suspense { animation: none; }
}
