:root {
  --bg: #151016;
  --panel: rgba(33, 27, 30, 0.92);
  --panel-strong: #25191d;
  --text: #fff8ee;
  --muted: #d3c3ad;
  --line: rgba(255, 248, 238, 0.16);
  --gold: #f5bd45;
  --red: #d94a3b;
  --green: #3ca66a;
  --ink: #1a1113;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 18%, rgba(245, 189, 69, 0.16), transparent 28rem),
    radial-gradient(circle at 78% 72%, rgba(60, 166, 106, 0.13), transparent 24rem),
    linear-gradient(135deg, #151016 0%, #2a171a 54%, #101c18 100%);
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.82rem 1rem;
  color: var(--text);
  background: #35262a;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(245, 189, 69, 0.75);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  color: var(--ink);
  background: linear-gradient(135deg, #f5bd45, #e56b45);
}

.ghost {
  background: rgba(255, 255, 255, 0.06);
}

.app {
  position: relative;
  min-height: 100vh;
}

.screen {
  position: relative;
  min-height: 100vh;
  display: none;
  padding: clamp(0.75rem, 1.8vw, 1.25rem);
}

.screen.active {
  display: flex;
  animation: fadeIn 0.22s ease both;
}

#pickScreen.active,
#revealScreen.active,
#switchScreen.active,
#challengeScreen.active,
#jackpotScreen.active {
  flex-direction: column;
}

.screen-head,
.bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.screen-head {
  position: relative;
  height: 6.8rem;
  justify-content: center;
  flex-shrink: 0;
}

.screen-head h2,
.hero-copy h1,
.decision-card h2,
.result-card h2,
.final-card h2 {
  margin: 0;
}

.screen-head h2 {
  font-size: clamp(1.9rem, 3.8vw, 3.4rem);
}

.screen-title {
  max-width: 720px;
  text-align: center;
}

.screen-instruction {
  margin: 0.35rem 0 0;
  color: #fff1d3;
  font-size: clamp(1.1rem, 1.7vw, 1.45rem);
  font-weight: 1000;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

.rules-button {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.screen-head > .pill,
.screen-head > #cancelSwitchBtn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.92rem;
  font-weight: 900;
}

.lead {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.7;
}

.pill {
  min-width: 8.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-align: center;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.06);
}

.rules-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  align-items: center;
  gap: 2rem;
  width: min(1180px, 100%);
  margin: auto;
}

.hero-copy h1 {
  font-size: clamp(3.2rem, 8vw, 6.6rem);
  line-height: 0.96;
}

.rule-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1.2rem 0 0.8rem;
}

.rule-steps article,
.rule-options section {
  min-height: 7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.rule-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rule-options section {
  min-height: 0;
  padding: 0.8rem;
}

.rule-options h2 {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-size: 0.98rem;
}

.rule-steps strong {
  display: block;
  margin: 0.35rem 0;
  font-size: 1.05rem;
}

.rule-steps p,
.rule-options p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.rule-options p {
  font-size: 0.9rem;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  color: var(--ink);
  background: var(--gold);
  font-weight: 900;
}

.cta {
  min-width: 12rem;
  font-size: 1.1rem;
}

.prize-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 28rem;
}

.big-case {
  display: grid;
  place-items: center;
  width: min(26rem, 70vw);
  aspect-ratio: 1;
  border: 2px solid rgba(245, 189, 69, 0.45);
  border-radius: 8px;
  color: var(--gold);
  font-size: 8rem;
  font-weight: 1000;
  background:
    linear-gradient(135deg, rgba(245, 189, 69, 0.22), transparent 45%),
    linear-gradient(180deg, #472321, #1d1417);
  box-shadow: var(--shadow);
}

.coin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 6.2rem;
  height: 6.2rem;
  border-radius: 50%;
  color: var(--ink);
  background: radial-gradient(circle at 35% 28%, #fff0b3, #f5bd45 62%, #b36d20);
  font-weight: 1000;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
}

.coin-a { left: 5%; top: 8%; }
.coin-b { right: 8%; top: 20%; }
.coin-c { right: 16%; bottom: 8%; width: 7rem; height: 7rem; }

.boxes {
  display: grid;
  grid-template-columns: repeat(7, minmax(92px, 1fr));
  gap: min(1vw, 0.95rem);
  width: min(980px, 100%);
  margin: 0 auto;
  flex: 1;
  align-content: center;
  justify-content: center;
}

#revealScreen .boxes {
  flex: 0;
  margin-top: clamp(1.2rem, 3vh, 2.4rem);
}

.box {
  position: relative;
  min-height: 6.8rem;
  aspect-ratio: 1.15 / 1;
  border: 1px solid rgba(255, 248, 238, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(245, 189, 69, 0.22), transparent 46%),
    linear-gradient(180deg, #4a2426, #211619);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.04), 0 14px 24px rgba(0, 0, 0, 0.25);
}

.box::before {
  content: "";
  position: absolute;
  inset: 48% 0 auto;
  border-top: 1px solid rgba(255, 248, 238, 0.14);
}

.box-no,
.box-state {
  position: relative;
  display: block;
}

.box-no {
  font-size: 2rem;
  font-weight: 1000;
}

.box-state {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.2;
}

.box.selected {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 189, 69, 0.28), 0 18px 30px rgba(0, 0, 0, 0.36);
}

.box.opened {
  background: linear-gradient(180deg, #244034, #17201b);
}

.box.final {
  color: var(--ink);
  background: linear-gradient(135deg, #f5bd45, #e56b45);
}

.box.blocked {
  opacity: 0.38;
}

.box.readonly {
  cursor: default;
  opacity: 0.7;
}

.box.readonly .box-state {
  color: var(--muted);
}

.prize-pool {
  width: min(980px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(245, 189, 69, 0.36);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(245, 189, 69, 0.12), rgba(217, 74, 59, 0.08)),
    rgba(28, 20, 23, 0.9);
  box-shadow: var(--shadow);
}

.prize-pool-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.8rem;
  align-items: center;
  padding: 0.55rem 0.9rem;
  text-align: center;
  border-bottom: 1px solid rgba(245, 189, 69, 0.28);
  background: rgba(245, 189, 69, 0.1);
}

.prize-pool-callout strong {
  color: #fff4cf;
  font-size: clamp(1rem, 1.35vw, 1.18rem);
  font-weight: 1000;
}

.prize-pool-callout span {
  color: var(--muted);
  font-size: clamp(0.86rem, 1.05vw, 0.98rem);
  font-weight: 800;
  text-align: left;
}

.prize-col {
  display: grid;
  grid-template-columns: 12rem 1fr;
  align-items: center;
  min-height: 2.75rem;
  border-bottom: 1px solid rgba(255, 248, 238, 0.1);
}

.prize-col:last-child {
  border-bottom: 0;
}

.prize-col-header {
  height: 100%;
  display: grid;
  place-items: center;
  color: #fff4cf;
  font-size: 1.05rem;
  font-weight: 1000;
  background: rgba(255, 255, 255, 0.04);
}

.prize-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  padding: 0.48rem 0.75rem;
}

.prize-chip {
  min-width: 4.1rem;
  padding: 0.28rem 0.6rem;
  border: 1px solid rgba(245, 189, 69, 0.5);
  border-radius: 6px;
  text-align: center;
  color: var(--gold);
  background: rgba(245, 189, 69, 0.1);
  font-weight: 1000;
}

.prize-chip.dimmed {
  opacity: 0.35;
  color: var(--muted);
  border-color: var(--line);
}

.reveal-summary {
  width: min(980px, 100%);
  margin: 1rem auto 0;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.75rem;
  align-items: stretch;
}

.reveal-summary > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.05);
}

.reveal-summary span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.reveal-summary strong {
  color: #fff4cf;
  font-size: 1rem;
  line-height: 1.45;
}

.buyout-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0;
}

.buyout-summary-grid h3 {
  margin: 0 0 0.5rem;
  color: var(--gold);
  font-size: 1rem;
}

.compact-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-list .opened-item strong {
  font-size: 1.4rem;
}

.bottom-bar {
  height: 5.8rem;
  width: min(1060px, 100%);
  margin: 0 auto;
  padding-top: 0.8rem;
}

.hint {
  color: var(--muted);
  font-weight: 700;
}

.decision-screen,
.result-screen,
.final-screen,
.stats-screen {
  align-items: center;
  justify-content: center;
}

.stats-screen {
  flex-direction: column;
}

.decision-card,
.result-card,
.final-card {
  width: min(780px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(1.2rem, 3vw, 2rem);
  text-align: center;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.decision-card h2,
.result-card h2,
.final-card h2 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.opened-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.opened-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: #2b2225;
}

.opened-item strong {
  display: block;
  color: var(--gold);
  font-size: 1.8rem;
}

.decision-actions,
.final-actions,
.sim-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.amount {
  margin: 0.8rem 0;
  color: var(--gold);
  font-size: clamp(4rem, 12vw, 8rem);
  line-height: 0.95;
  font-weight: 1000;
}

.result-card p,
.final-card p,
.sim-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.form-card {
  text-align: left;
}

.form-card h2 {
  text-align: center;
}

.player-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1rem 0 0.4rem;
}

.player-form label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-weight: 800;
}

.player-form input,
.auto-number {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  color: var(--text);
  background: #1e1518;
  font: inherit;
  font-weight: 800;
  outline: none;
}

.player-form input:focus {
  border-color: var(--gold);
}

.auto-number {
  color: var(--gold);
}

.form-error {
  min-height: 1.5rem;
  margin: 0 0 0.6rem;
  color: #ffb0a8;
}

.original-box-note {
  min-height: 1.6rem;
  margin: 0.25rem 0 0;
  color: var(--gold);
  font-weight: 900;
}

.center-note {
  width: min(980px, 100%);
  margin: 0 auto 0.75rem;
  text-align: center;
}

.challenge-grid,
.jackpot-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  gap: 1rem;
  width: min(1040px, 100%);
  margin: auto;
}

.challenge-card,
.jackpot-card {
  min-height: 11rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(245, 189, 69, 0.18), transparent),
    #2c2024;
  font-size: 1.6rem;
}

.jackpot-card {
  min-height: 7.8rem;
  font-size: 1.18rem;
}

.challenge-card.revealed,
.jackpot-card.revealed {
  color: var(--ink);
  background: linear-gradient(135deg, #f5bd45, #fff0b3);
}

.final-screen.gold-500 .final-card {
  border-color: rgba(245, 189, 69, 0.7);
  animation: pulseGold 1.2s ease infinite alternate;
}

.final-screen.gold-2000 {
  background: radial-gradient(circle, rgba(245, 189, 69, 0.28), transparent 60%);
}

.final-screen.gold-2000 .final-card {
  border-color: #fff0b3;
  background: linear-gradient(135deg, rgba(245, 189, 69, 0.18), rgba(217, 74, 59, 0.18)), var(--panel);
  animation: grandPulse 0.9s ease infinite alternate;
}

.celebrate {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.spark {
  position: absolute;
  width: 0.55rem;
  height: 1.1rem;
  border-radius: 2px;
  background: var(--gold);
  animation: fall 1.8s linear infinite;
}

.stats-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: min(900px, 100%);
}

.stats-list,
.sim-panel,
.records-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
}

.stats-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.6rem;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  font-weight: 1000;
}

.sim-actions {
  grid-template-columns: repeat(3, 1fr);
}

.records-panel {
  width: min(900px, 100%);
  max-height: 34vh;
  margin-top: 1rem;
  overflow: hidden;
}

.records-panel h3 {
  margin: 0 0 0.75rem;
}

.records-table {
  display: grid;
  gap: 0.4rem;
  max-height: 24vh;
  overflow: auto;
  padding-right: 0.25rem;
}

.record-row {
  display: grid;
  grid-template-columns: 0.9fr 1fr 0.9fr 0.9fr 1.3fr;
  gap: 0.6rem;
  border-bottom: 1px solid var(--line);
  padding: 0.5rem 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.record-row.header {
  color: var(--gold);
  font-weight: 900;
}

.record-row strong {
  color: var(--text);
}

.rules-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 6, 8, 0.72);
  backdrop-filter: blur(8px);
  overflow: auto;
}

.rules-modal.open {
  display: flex;
}

.rules-dialog {
  position: relative;
  width: min(880px, 100%);
  border: 1px solid rgba(245, 189, 69, 0.35);
  border-radius: 8px;
  padding: clamp(1.2rem, 3vw, 2rem);
  background:
    linear-gradient(135deg, rgba(245, 189, 69, 0.12), rgba(217, 74, 59, 0.08)),
    #21191d;
  box-shadow: var(--shadow);
}

.rules-dialog h2 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.modal-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  font-size: 1.6rem;
}

.modal-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.modal-rule-grid section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
}

.modal-rule-grid strong {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--gold);
}

.modal-rule-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.decision-dialog {
  text-align: center;
}

.small-dialog {
  width: min(560px, 100%);
}

.modal-intro {
  margin: 0 0 1rem;
  color: var(--muted);
  font-weight: 800;
}

.reset-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGold {
  from { box-shadow: 0 0 0 rgba(245, 189, 69, 0), var(--shadow); }
  to { box-shadow: 0 0 38px rgba(245, 189, 69, 0.42), var(--shadow); }
}

@keyframes grandPulse {
  from { transform: scale(1); box-shadow: 0 0 36px rgba(245, 189, 69, 0.25), var(--shadow); }
  to { transform: scale(1.02); box-shadow: 0 0 86px rgba(245, 189, 69, 0.65), var(--shadow); }
}

@keyframes fall {
  from { transform: translateY(-12vh) rotate(0deg); opacity: 1; }
  to { transform: translateY(112vh) rotate(540deg); opacity: 0.15; }
}

/* ===== 翻牌动效 ===== */
.challenge-card, .jackpot-card {
  transition: transform 0.5s ease, background 0.3s ease;
}

.challenge-card.revealed {
  animation: cardFlip 0.55s ease both;
}

.jackpot-card.revealed {
  animation: cardFlip 0.55s ease both;
}

@keyframes cardFlip {
  0% { transform: rotateY(0deg) scale(1); }
  40% { transform: rotateY(90deg) scale(1.06); }
  60% { transform: rotateY(90deg) scale(1.06); }
  100% { transform: rotateY(0deg) scale(1); }
}

/* ===== 开箱阶段原箱高亮 ===== */
#revealBoxes .box.selected.blocked {
  opacity: 1;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245, 189, 69, 0.28);
}

#revealBoxes .box.selected .box-state {
  color: var(--gold);
  font-weight: 900;
}

#revealBoxes .box.opened .box-state {
  color: var(--green);
  font-weight: 900;
}

/* ===== 统计面板：真实/模拟数据分离 ===== */
.stats-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.stats-sub-box {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
}

.stats-sub-box h4 {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}

.stats-sub-box .stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  padding: 0.2rem 0;
}

.stats-sub-box .stat-row .label {
  color: var(--muted);
}

.sim-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(245, 189, 69, 0.15);
  color: var(--gold);
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ===== 图表 ===== */
.stats-chart-wrap {
  width: min(900px, 100%);
  margin-top: 1rem;
}

.stats-chart-wrap h3 {
  margin: 0 0 0.5rem;
}

#statsChart {
  width: 100%;
  height: 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: block;
}

/* ===== 模拟记录样式 ===== */
.record-row.simulated {
  opacity: 0.55;
}

.record-row.simulated strong {
  color: var(--muted);
}

.record-row.simulated-bigwin {
  opacity: 1 !important;
}

.record-row.simulated-bigwin .amount-cell {
  color: var(--gold);
}

.bigwin-tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  background: var(--gold);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.3;
  vertical-align: middle;
}

/* ===== 移动端保留金币装饰 ===== */
@media (max-width: 900px) {
  .prize-visual {
    display: flex;
    flex-direction: row;
    min-height: auto;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0.5rem 0;
  }
  .big-case { display: none; }
  .coin {
    position: static;
    width: 3.2rem;
    height: 3.2rem;
    font-size: 0.85rem;
  }
  .coin-c {
    width: 3.2rem;
    height: 3.2rem;
  }
}

@media (max-width: 620px) {
  .stats-sub { grid-template-columns: 1fr; }
  .stats-chart-wrap { margin-top: 0.75rem; }
  #statsChart { height: 150px; }
}

@media (max-width: 900px) {
  .rules-layout,
  .stats-layout {
    grid-template-columns: 1fr;
  }

  .prize-visual {
    display: none;
  }

  .boxes {
    grid-template-columns: repeat(5, minmax(76px, 1fr));
  }
}

@media (max-width: 620px) {
  html,
  body {
    height: auto;
    min-height: 100%;
  }

  body {
    overflow-y: auto;
  }

  .app {
    height: auto;
    max-height: none;
    min-height: 100vh;
  }

  .screen {
    position: relative;
    inset: auto;
    min-height: 100vh;
    padding: 0.65rem;
  }

  .screen-head {
    height: 6.2rem;
  }

  .boxes {
    grid-template-columns: repeat(4, minmax(64px, 1fr));
    flex: 0 0 auto;
    align-content: start;
    padding-bottom: 0.75rem;
  }

  .box {
    min-height: 5.4rem;
  }

  .bottom-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
    height: auto;
    min-height: 5rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(21, 16, 22, 0.94);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
  }

  .rules-button,
  .screen-head > .pill,
  .screen-head > #cancelSwitchBtn {
    position: static;
    transform: none;
  }

  .screen-head {
    align-items: center;
  }

  .rule-steps,
  .rule-options,
  .player-form,
  .opened-list,
  .decision-actions,
  .final-actions,
  .sim-actions {
    grid-template-columns: 1fr;
  }

  .challenge-grid,
  .jackpot-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-rule-grid {
    grid-template-columns: 1fr;
  }

  .record-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .prize-pool {
    margin-top: 0.4rem;
  }
  .prize-pool-callout,
  .reveal-summary,
  .buyout-summary-grid {
    grid-template-columns: 1fr;
  }
  .prize-pool-callout span {
    text-align: center;
  }
  .prize-col {
    grid-template-columns: 1fr;
  }
  .prize-col-header {
    min-height: 2.25rem;
  }
  .prize-chip {
    min-width: 3.5rem;
    font-size: 0.9rem;
  }
}

/* 返回查看模式底部栏 */
.review-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--panel-strong);
  border-top: 1px solid var(--gold);
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.review-bar span {
  color: var(--gold);
  font-weight: 700;
}

.review-bar .primary {
  font-size: 0.9rem;
  padding: 0.5rem 1.2rem;
}

/* 重置按钮 */
.reset-btn {
  position: fixed;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 200;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(255,248,238,0.2);
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s, transform 0.2s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reset-btn:hover {
  opacity: 0.85;
  transform: scale(1.1);
  border-color: var(--red);
  color: var(--red);
}

@media (max-width: 620px) {
  .reset-btn { width: 2.2rem; height: 2.2rem; font-size: 1.1rem; right: 0.5rem; bottom: 0.5rem; }
}

/* ===== 手机端完整适配 ===== */
@media (max-width: 520px) {
  body {
    background:
      radial-gradient(circle at 20% 8%, rgba(245, 189, 69, 0.16), transparent 15rem),
      linear-gradient(160deg, #151016 0%, #2a171a 58%, #101c18 100%);
  }

  button {
    min-height: 2.9rem;
    padding: 0.72rem 0.78rem;
    font-size: 0.95rem;
  }

  .screen {
    min-height: 100svh;
    padding: 0.75rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  .result-screen,
  .decision-screen,
  .final-screen,
  .stats-screen {
    justify-content: flex-start;
  }

  .screen-head {
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    justify-content: stretch;
    align-items: center;
    margin-bottom: 0.8rem;
  }

  .screen-title {
    grid-column: 1 / -1;
    order: -1;
    max-width: none;
    text-align: left;
  }

  .screen-head h2 {
    font-size: clamp(2rem, 12vw, 3rem);
    line-height: 1.02;
  }

  .screen-instruction {
    font-size: 0.98rem;
    line-height: 1.35;
  }

  .rules-button,
  .screen-head > .pill,
  .screen-head > #cancelSwitchBtn {
    justify-self: stretch;
  }

  .screen-head > .pill {
    min-width: 0;
  }

  .result-card,
  .decision-card,
  .final-card {
    width: 100%;
    padding: 1rem;
  }

  .result-card h2,
  .decision-card h2,
  .final-card h2 {
    font-size: clamp(2rem, 13vw, 3.4rem);
    line-height: 1.05;
  }

  .rules-layout {
    width: 100%;
    display: block;
  }

  .hero-copy h1 {
    font-size: clamp(3rem, 17vw, 4.8rem);
  }

  .rule-steps,
  .rule-options,
  .stats-layout,
  .stats-sub,
  .player-form,
  .decision-actions,
  .final-actions,
  .reset-actions,
  .sim-actions,
  .buyout-summary-grid,
  .reveal-summary {
    grid-template-columns: 1fr;
  }

  .stats-layout,
  .stats-chart-wrap,
  .records-panel {
    width: 100%;
  }

  .stats-screen .screen-head {
    grid-template-columns: 1fr;
  }

  .stats-screen .screen-head > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  #currentAccountName {
    grid-column: 1 / -1;
    font-size: 1rem !important;
  }

  #logoutBtn {
    grid-column: 1 / -1;
  }

  .stats-list,
  .sim-panel,
  .records-panel {
    padding: 0.85rem;
  }

  .stats-chart-wrap {
    order: 3;
  }

  .sim-panel {
    order: 4;
  }

  .records-panel {
    max-height: none;
  }

  .records-table {
    max-height: 16rem;
  }

  .record-row {
    grid-template-columns: 0.8fr 1fr;
    font-size: 0.84rem;
  }

  .prize-pool {
    margin-top: 0.25rem;
  }

  .prize-pool-callout {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    padding: 0.5rem 0.7rem;
  }

  .prize-pool-callout strong,
  .prize-pool-callout span {
    text-align: center;
  }

  .prize-col {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .prize-col-header {
    min-height: 2rem;
    font-size: 0.92rem;
  }

  .prize-items {
    gap: 0.35rem;
    padding: 0.45rem;
  }

  .prize-chip {
    min-width: 3.1rem;
    padding: 0.24rem 0.45rem;
    font-size: 0.86rem;
  }

  .boxes {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    align-content: start;
    margin-top: 0.75rem;
  }

  .box {
    min-height: 5.7rem;
    aspect-ratio: 1 / 0.86;
    padding: 0.55rem 0.35rem;
  }

  .box-no {
    font-size: 1.95rem;
  }

  .box-state {
    font-size: 0.9rem;
  }

  .bottom-bar {
    position: static;
    width: 100%;
    min-height: 0;
    margin-top: 0.75rem;
    padding: 0.75rem;
  }

  .hint {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .reveal-summary {
    margin-top: 0.75rem;
  }

  .reveal-summary > div {
    padding: 0.65rem;
  }

  .opened-list,
  .compact-list {
    grid-template-columns: 1fr;
  }

  .opened-item {
    padding: 0.75rem;
  }

  .opened-item strong {
    font-size: 1.55rem;
  }

  .amount {
    font-size: clamp(4rem, 22vw, 6.8rem);
  }

  .challenge-grid,
  .jackpot-grid {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .challenge-card {
    min-height: 8rem;
    font-size: 1.15rem;
  }

  .jackpot-card {
    min-height: 5.6rem;
    font-size: 0.96rem;
  }

  .rules-modal {
    padding: 0.75rem;
  }

  .rules-dialog {
    max-height: calc(100svh - 1.5rem);
    overflow: auto;
    padding: 1rem;
  }

  .review-bar {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    width: auto;
    padding: 0.6rem;
  }

  .reset-btn {
    right: 0.7rem;
    bottom: calc(0.7rem + env(safe-area-inset-bottom));
  }
}
