:root {
  --bg: #08110f;
  --felt-light: #267158;
  --felt-mid: #185340;
  --felt-dark: #0a261d;
  --gold: #d8b76e;
  --gold-bright: #f0d79a;
  --gold-soft: rgba(216, 183, 110, 0.14);
  --text: #efe8d8;
  --muted: #a3b0a6;
  --panel: rgba(12, 27, 22, 0.8);
  --line: rgba(216, 183, 110, 0.18);
  --red: #b62f3f;
  --ink: #1b1b18;
  --radius: 18px;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(1100px 620px at 50% -14%, rgba(52, 103, 83, 0.55), transparent 65%),
    radial-gradient(900px 700px at 112% 112%, rgba(123, 92, 47, 0.18), transparent 62%),
    var(--bg);
  overflow-x: hidden;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 4px 4px;
}

.app {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 30px) 0 42px;
}

/* ---------- 顶部 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(12px, 2vw, 20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--gold);
  font-size: 26px;
  background: linear-gradient(145deg, rgba(216, 183, 110, 0.22), rgba(216, 183, 110, 0.04));
  border: 1px solid rgba(216, 183, 110, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 26px rgba(0, 0, 0, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  margin-left: auto;
}

.audio-control {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 22, 18, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.audio-volume {
  width: 86px;
  height: 16px;
  margin: 0;
  accent-color: var(--gold-bright);
  cursor: pointer;
}

.audio-volume-value {
  width: 28px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.scoreboard {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 22, 18, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.score-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.score-label {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.score-item strong {
  color: var(--gold);
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.score-divider {
  width: 1px;
  height: 26px;
  background: var(--line);
}

/* ---------- 模式选择 ---------- */

.menu-screen {
  padding-top: clamp(6px, 2vw, 18px);
  animation: screenIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.menu-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(24px, 4vw, 56px);
  margin-bottom: clamp(22px, 4vw, 34px);
}

.menu-intro {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 760px;
}

.menu-intro h2 {
  margin: 10px 0 12px;
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.04em;
}

.menu-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

/* ---------- 牌桌战绩 ---------- */

.arena-stats {
  flex: 0 0 auto;
  max-width: 46%;
  padding-bottom: 6px;
  text-align: right;
  animation: screenIn 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.arena-stats-line {
  margin: 0;
  color: var(--text);
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.65;
  letter-spacing: 0.04em;
  text-wrap: balance;
}

.arena-stats-line strong {
  display: inline-block;
  margin: 0 0.12em;
  color: var(--gold-bright);
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.01em;
  text-shadow: 0 0 30px rgba(240, 215, 154, 0.45);
}

.arena-stats-line strong.is-challengers {
  font-size: clamp(24px, 3vw, 36px);
}

.mode-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(0, 0.84fr);
  gap: 18px;
  align-items: stretch;
}

.mode-card {
  display: flex;
  flex-direction: column;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(20, 38, 32, 0.88), rgba(9, 22, 18, 0.94));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mode-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.mode-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(216, 183, 110, 0.35);
  border-radius: 14px;
  background: rgba(216, 183, 110, 0.07);
  color: var(--gold);
}

.mode-icon svg {
  width: 25px;
  height: 25px;
}

.mode-card h3 {
  margin: 2px 0 6px;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.mode-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.mode-points {
  display: grid;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.mode-points li::before {
  content: "—";
  margin-right: 9px;
  color: var(--gold);
}

.mode-actions {
  margin-top: auto;
  padding-top: 24px;
}

.mode-actions .button {
  width: 100%;
  padding: 13px;
}

.menu-quick-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: -10px 0 20px;
}

.menu-quick-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 20px;
}

.menu-quick-icon {
  color: var(--gold);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

.menu-leaderboard-modal {
  width: min(620px, 100%);
}

/* ---------- 游戏 HUD ---------- */

.game-screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-hud {
  position: sticky;
  top: 8px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
  padding: 10px 18px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 22, 18, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hud-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.mode-badge {
  padding: 4px 10px;
  border: 1px solid rgba(216, 183, 110, 0.32);
  border-radius: 999px;
  background: rgba(216, 183, 110, 0.08);
  color: var(--gold-bright);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.hud-progress {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.timer-box {
  width: 100%;
  min-width: 0;
}

.timer-copy {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 7px;
}

.timer-label {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.14em;
}

#timerValue {
  display: inline-block;
  color: var(--gold-bright);
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.timer-unit {
  color: var(--muted);
  font-size: 12px;
}

.timer-track {
  height: 6px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

#timerBar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b68e45, var(--gold-bright));
  transition: width 0.12s linear, background 0.25s ease, box-shadow 0.25s ease;
}

.timer-box.is-safe #timerValue {
  color: #7ee2a5;
}

.timer-box.is-safe #timerBar {
  background: linear-gradient(90deg, #2f9e63, #7ee2a5);
  box-shadow: 0 0 12px rgba(90, 220, 150, 0.25);
}

.timer-box.is-warning #timerValue {
  color: #f0d36a;
}

.timer-box.is-warning #timerBar {
  background: linear-gradient(90deg, #b98d2e, #f0d36a);
  box-shadow: 0 0 12px rgba(240, 211, 106, 0.25);
}

.timer-box.is-critical #timerValue {
  color: #ff8e99;
  animation: timerShake 0.42s ease-in-out infinite;
}

.timer-box.is-paused #timerValue {
  animation: none;
}

.timer-box.is-critical #timerBar {
  background: linear-gradient(90deg, #b9323f, #ff8e99);
  box-shadow: 0 0 16px rgba(255, 80, 100, 0.45);
}

@keyframes timerShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
}

/* ---------- 结算 ---------- */

.summary-screen {
  display: flex;
  justify-content: center;
  padding-top: clamp(8px, 2.5vw, 26px);
  animation: screenIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.summary-card {
  width: min(920px, 100%);
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(216, 183, 110, 0.28);
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(22, 43, 36, 0.95), rgba(9, 22, 18, 0.97));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
}

.summary-card h2 {
  margin: 10px 0 8px;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: 0.04em;
}

.summary-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 620px;
  margin: clamp(22px, 3vw, 32px) auto;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 16px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.summary-stat span {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.1em;
}

.summary-stat strong {
  color: var(--text);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.summary-stat-main {
  border-color: rgba(216, 183, 110, 0.4);
  background: rgba(216, 183, 110, 0.08);
}

.summary-stat-main strong {
  color: var(--gold-bright);
  font-size: clamp(26px, 3.4vw, 38px);
}

.summary-extras {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
  text-align: left;
}

.summary-section {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
}

.records-section {
  margin-top: 20px;
  margin-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.section-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.section-tag {
  padding: 3px 8px;
  border: 1px solid rgba(216, 183, 110, 0.28);
  border-radius: 999px;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.section-tag.is-positive {
  border-color: rgba(126, 226, 165, 0.35);
  color: #7ee2a5;
}

.section-tag.is-negative {
  border-color: rgba(255, 142, 153, 0.3);
  color: #ff9aa3;
}

.section-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.score-form {
  display: flex;
  gap: 8px;
}

.text-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.text-input::placeholder {
  color: rgba(163, 176, 166, 0.7);
}

.text-input:focus {
  border-color: rgba(216, 183, 110, 0.6);
  box-shadow: 0 0 0 2px rgba(216, 183, 110, 0.12);
}

.form-message {
  min-height: 17px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-message.is-success {
  color: #7ee2a5;
}

.form-message.is-error {
  color: #ff9aa3;
}

.leaderboard-head {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 84px 84px;
  gap: 10px;
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.leaderboard-head[hidden] {
  display: none;
}

.leaderboard-head span:nth-child(n + 3) {
  text-align: right;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-row {
  --medal-accent: var(--gold-bright);
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 84px 84px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 16px;
}

.leaderboard-row.is-gold {
  --medal-accent: #e7bd5b;
  --medal-sheen: rgba(255, 240, 180, 0.3);
  background: linear-gradient(
    90deg,
    rgba(232, 190, 90, 0.2),
    rgba(232, 190, 90, 0.05) 58%,
    rgba(232, 190, 90, 0.12)
  );
  box-shadow:
    inset 0 0 0 1px rgba(255, 224, 150, 0.35),
    0 0 22px rgba(216, 183, 110, 0.12);
}

.leaderboard-row.is-silver {
  --medal-accent: #cbd6df;
  --medal-sheen: rgba(235, 245, 255, 0.24);
  background: linear-gradient(
    90deg,
    rgba(205, 216, 226, 0.18),
    rgba(205, 216, 226, 0.04) 58%,
    rgba(205, 216, 226, 0.1)
  );
  box-shadow:
    inset 0 0 0 1px rgba(225, 234, 241, 0.26),
    0 0 18px rgba(190, 205, 218, 0.08);
}

.leaderboard-row.is-bronze {
  --medal-accent: #c98353;
  --medal-sheen: rgba(255, 210, 170, 0.24);
  background: linear-gradient(
    90deg,
    rgba(205, 134, 85, 0.2),
    rgba(205, 134, 85, 0.04) 58%,
    rgba(205, 134, 85, 0.1)
  );
  box-shadow:
    inset 0 0 0 1px rgba(228, 158, 106, 0.28),
    0 0 18px rgba(190, 110, 60, 0.09);
}

.leaderboard-row.is-gold,
.leaderboard-row.is-silver,
.leaderboard-row.is-bronze {
  position: relative;
  overflow: hidden;
}

.leaderboard-row.is-gold::before,
.leaderboard-row.is-silver::before,
.leaderboard-row.is-bronze::before {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: 0;
  width: 42%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--medal-sheen),
    transparent
  );
  transform: translateX(-180%) skewX(-18deg);
  animation: leaderboardSheen 4.8s ease-in-out infinite;
  pointer-events: none;
}

.leaderboard-row.is-gold::before {
  animation-delay: 0s;
}

.leaderboard-row.is-silver::before {
  animation-delay: 0.5s;
}

.leaderboard-row.is-bronze::before {
  animation-delay: 1s;
}

@keyframes leaderboardSheen {
  0%,
  58% {
    transform: translateX(-180%) skewX(-18deg);
    opacity: 0;
  }
  63% {
    opacity: 1;
  }
  92%,
  100% {
    transform: translateX(440%) skewX(-18deg);
    opacity: 0;
  }
}

.leaderboard-row.is-you {
  position: relative;
  background-color: rgba(216, 183, 110, 0.09);
}

.leaderboard-row.is-you::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(216, 183, 110, 0.72);
  border-radius: inherit;
  box-shadow: 0 0 18px rgba(216, 183, 110, 0.18);
  pointer-events: none;
}

.leaderboard-row.is-you .leaderboard-name {
  color: var(--gold-bright);
}

.leaderboard-rank {
  color: var(--gold);
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.leaderboard-row.is-gold .leaderboard-rank,
.leaderboard-row.is-silver .leaderboard-rank,
.leaderboard-row.is-bronze .leaderboard-rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
}

.leaderboard-row.is-gold .leaderboard-rank {
  background: linear-gradient(145deg, #fff4c9, #e7bd5b 46%, #a9791f);
  color: #2a1d07;
  box-shadow:
    0 0 12px rgba(232, 190, 90, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  animation: goldMedalPulse 3.4s ease-in-out infinite;
}

.leaderboard-row.is-silver .leaderboard-rank {
  background: linear-gradient(145deg, #ffffff, #cbd6df 48%, #8d9aa7);
  color: #1f262c;
  box-shadow:
    0 0 10px rgba(200, 215, 228, 0.32),
    inset 0 1px 0 #ffffff;
}

.leaderboard-row.is-bronze .leaderboard-rank {
  background: linear-gradient(145deg, #f4c9a5, #c98353 48%, #8a4e2a);
  color: #2a170b;
  box-shadow:
    0 0 10px rgba(205, 130, 80, 0.3),
    inset 0 1px 0 rgba(255, 240, 230, 0.55);
}

@keyframes goldMedalPulse {
  0%,
  100% {
    box-shadow:
      0 0 10px rgba(232, 190, 90, 0.35),
      inset 0 1px 0 rgba(255, 255, 255, 0.68);
  }
  50% {
    box-shadow:
      0 0 18px rgba(232, 190, 90, 0.6),
      inset 0 1px 0 rgba(255, 255, 255, 0.88);
  }
}

.leaderboard-name {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-crown {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
}

.leaderboard-row.is-gold .leaderboard-crown {
  color: #ffe08a;
  filter: drop-shadow(0 0 4px rgba(232, 190, 90, 0.5));
}

.leaderboard-row.is-silver .leaderboard-crown {
  color: #e4edf4;
  filter: drop-shadow(0 0 4px rgba(200, 215, 228, 0.35));
}

.leaderboard-row.is-bronze .leaderboard-crown {
  color: #e6a06e;
  filter: drop-shadow(0 0 4px rgba(205, 130, 80, 0.35));
}

.leaderboard-time {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.leaderboard-time.is-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  color: var(--gold-bright);
  font-weight: 600;
}

.leaderboard-row.is-gold .leaderboard-time.is-total {
  color: #ffe08a;
}

.leaderboard-row.is-silver .leaderboard-time.is-total {
  color: #dce7ef;
}

.leaderboard-row.is-bronze .leaderboard-time.is-total {
  color: #e6a06e;
}

.leaderboard-time-value {
  line-height: 1;
}

.leaderboard-time-bar {
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.leaderboard-time-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(216, 183, 110, 0.22),
    var(--medal-accent)
  );
  transition: width 0.3s ease;
}


.leaderboard-self {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(216, 183, 110, 0.16);
}

.leaderboard-self-heading {
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0.1em;
}

.leaderboard-self-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.leaderboard-self .leaderboard-row {
  background-color: rgba(216, 183, 110, 0.08);
}

.section-empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.record-table {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
}

.record-head,
.record-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 16px 74px 60px;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}

.record-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.record-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  min-height: 64px;
}

.record-row:last-child {
  border-bottom: none;
}

.record-empty {
  padding: 16px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.record-row.is-correct {
  box-shadow: inset 2px 0 0 rgba(126, 226, 165, 0.5);
}

.record-row.is-wrong {
  box-shadow: inset 2px 0 0 rgba(255, 142, 153, 0.55);
}

.record-index {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.record-hand {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.record-arrow {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.record-answer {
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-mini-card {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(20px, 2.2vw, 32px);
  aspect-ratio: 5 / 7;
  border-radius: 4px;
  background: linear-gradient(145deg, #fffdf6 0%, #efe6d4 100%);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1;
}

.record-mini-card.is-red {
  color: #b62f3f;
}

.record-mini-card.is-black {
  color: #1b1b18;
}

.record-mini-card.is-hidden-card {
  z-index: 2;
  box-shadow:
    0 0 0 2px #d8b76e,
    0 0 14px rgba(216, 183, 110, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.35);
}

.record-mini-card.is-hidden-card::after {
  content: "隐";
  position: absolute;
  top: -6px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #d8b76e;
  color: #241a09;
  font-family: inherit;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

.record-mini-corner {
  position: absolute;
  top: 6%;
  left: 9%;
  font-size: clamp(7px, 0.9vw, 10px);
  line-height: 1;
}

.record-mini-center {
  font-size: clamp(10px, 1.5vw, 18px);
  line-height: 1;
}

.record-guess-card {
  width: clamp(24px, 2.6vw, 38px);
}

.record-mini-card.is-correct {
  box-shadow:
    0 0 0 2px #78e2a7,
    0 0 16px rgba(90, 220, 150, 0.6),
    0 3px 8px rgba(0, 0, 0, 0.35);
}

.record-mini-card.is-wrong {
  box-shadow:
    0 0 0 2px #ff7c89,
    0 0 16px rgba(255, 80, 100, 0.6),
    0 3px 8px rgba(0, 0, 0, 0.35);
}

.record-no-entry {
  position: relative;
  flex: none;
  width: clamp(24px, 2.6vw, 38px);
  aspect-ratio: 1;
  border: 2px solid #ff7c89;
  border-radius: 50%;
  background: rgba(255, 80, 100, 0.08);
  box-shadow: 0 0 16px rgba(255, 80, 100, 0.35);
}

.record-no-entry::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62%;
  height: 2px;
  border-radius: 2px;
  background: #ff7c89;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.record-time {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.record-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.record-page-label {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- 牌桌 ---------- */

.table-stack {
  position: relative;
}

.table-shell {
  position: relative;
  padding: 10px;
  border-radius: 30px;
  background: linear-gradient(150deg, #6b5233 0%, #2f2418 32%, #1b150e 65%, #5a4327 100%);
  box-shadow:
    0 44px 90px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -2px 6px rgba(0, 0, 0, 0.6);
}

.prep-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  border-radius: 30px;
  background: rgba(3, 13, 10, 0.58);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.32);
  pointer-events: none;
}

.prep-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.prep-label {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

#prepCount {
  color: var(--gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(72px, 10vw, 120px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 34px rgba(216, 183, 110, 0.55);
  animation: prepPulse 1s ease-in-out infinite;
}

@keyframes prepPulse {
  0% {
    opacity: 0.55;
    transform: scale(0.88);
  }
  35% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0.75;
    transform: scale(1.06);
  }
}

.felt {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: clamp(16px, 2.6vw, 28px) clamp(12px, 2.4vw, 26px) clamp(14px, 2.4vw, 24px);
  background: radial-gradient(
    ellipse at 50% 35%,
    var(--felt-light) 0%,
    var(--felt-mid) 42%,
    #0f3528 78%,
    var(--felt-dark) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(216, 183, 110, 0.22), inset 0 0 90px rgba(0, 0, 0, 0.5);
}

.felt::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(216, 183, 110, 0.12);
  border-radius: 16px;
  pointer-events: none;
}

.felt::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(74%, 760px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(216, 183, 110, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.table-status {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-bottom: clamp(10px, 1.8vw, 16px);
  color: #dce8dc;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-align: center;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 14px var(--gold);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

.card-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(6px, 1vw, 12px);
  min-height: calc(clamp(54px, 7.8vw, 104px) * 7 / 5 + 24px);
}

.card-slot {
  width: clamp(54px, 7.8vw, 104px);
  text-align: center;
  animation: deal 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--delay, 0ms);
}

@keyframes deal {
  from {
    opacity: 0;
    transform: translateY(24px) rotate(-3deg) scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.slot-label {
  display: block;
  margin-top: 10px;
  color: rgba(239, 232, 216, 0.68);
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ---------- 扑克牌 ---------- */

.playing-card {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  perspective: 900px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.2, 0.75, 0.25, 1);
}

.playing-card.is-face-down .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: clamp(6px, 0.9vw, 11px);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-front {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 9% 8%;
  color: var(--ink);
  background: linear-gradient(145deg, #fffdf6 0%, #f7f0df 55%, #ece2cc 100%);
  box-shadow:
    0 14px 26px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 #fff;
  transform: rotateY(0deg);
}

.card-front.red {
  color: var(--red);
}

.card-front .corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: flex-start;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(12px, 2vw, 21px);
  font-weight: 700;
  line-height: 0.85;
}

.card-front .corner .suit {
  margin-top: 2px;
  font-size: 0.8em;
}

.card-front .corner.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

.card-front .center-suit {
  align-self: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 5.4vw, 54px);
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.card-back {
  transform: rotateY(180deg);
  background:
    radial-gradient(circle at 50% 42%, rgba(88, 152, 184, 0.22), transparent 55%),
    repeating-linear-gradient(45deg, rgba(216, 183, 110, 0.07) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(-45deg, rgba(216, 183, 110, 0.055) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 50% 45%, #2c5e7f, #17364c 60%, #0d2333 100%);
  border: 1px solid rgba(216, 183, 110, 0.55);
  box-shadow:
    inset 0 0 0 3px #0d2333,
    inset 0 0 0 4px rgba(216, 183, 110, 0.38),
    inset 0 0 22px rgba(0, 0, 0, 0.45),
    0 14px 26px rgba(0, 0, 0, 0.4);
}

.card-back::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px solid rgba(216, 183, 110, 0.28);
  border-radius: 4px;
  background:
    radial-gradient(circle at 0 0, rgba(216, 183, 110, 0.18) 0 6px, transparent 7px),
    radial-gradient(circle at 100% 0, rgba(216, 183, 110, 0.18) 0 6px, transparent 7px),
    radial-gradient(circle at 0 100%, rgba(216, 183, 110, 0.18) 0 6px, transparent 7px),
    radial-gradient(circle at 100% 100%, rgba(216, 183, 110, 0.18) 0 6px, transparent 7px),
    radial-gradient(circle at 50% 50%, rgba(216, 183, 110, 0.05), transparent 65%);
  pointer-events: none;
}

.card-back::after {
  content: "?";
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 52%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(216, 183, 110, 0.55);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(9, 29, 42, 0.82) 0 42%, transparent 43%),
    repeating-conic-gradient(
      from 0deg,
      rgba(216, 183, 110, 0.18) 0deg 3deg,
      transparent 3deg 15deg
    ),
    radial-gradient(circle, #1a3d54 0%, #0d2333 100%);
  box-shadow:
    inset 0 0 0 3px rgba(216, 183, 110, 0.14),
    0 0 0 3px rgba(13, 35, 51, 0.92),
    0 0 0 4px rgba(216, 183, 110, 0.38),
    0 0 26px rgba(216, 183, 110, 0.22);
  color: #f0d79a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(16px, 3.8vw, 34px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 0 18px rgba(216, 183, 110, 0.5);
}

.card-slot.is-revealed .card-front {
  animation: revealGlow 0.9s ease;
}

@keyframes revealGlow {
  0% {
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.38);
  }
  45% {
    box-shadow:
      0 0 0 3px rgba(216, 183, 110, 0.85),
      0 0 46px rgba(216, 183, 110, 0.45);
  }
  100% {
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.38);
  }
}

/* ---------- 结果 ---------- */

.result-panel {
  position: absolute;
  left: 50%;
  top: calc(100% + 12px);
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(460px, calc(100vw - 24px));
  max-height: min(46vh, 340px);
  overflow-y: auto;
  margin: 0;
  padding: 16px 20px;
  border: 1px solid rgba(216, 183, 110, 0.32);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(30, 58, 47, 0.96), rgba(11, 28, 22, 0.98));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  transform: translateX(-50%);
  animation: resultInCentered 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.result-panel[hidden] {
  display: none;
}

@keyframes resultInCentered {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.result-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(143, 224, 174, 0.45);
  background: rgba(96, 180, 128, 0.16);
  color: #8fe0ae;
  font-size: 22px;
  font-weight: 700;
}

.result-panel.is-wrong {
  border-color: rgba(255, 130, 140, 0.62);
  background: linear-gradient(135deg, rgba(74, 30, 34, 0.98), rgba(28, 12, 15, 0.99));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.56),
    0 0 42px rgba(198, 73, 83, 0.2);
  animation:
    resultInCentered 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both,
    wrongFlash 1.1s ease-out;
}

.result-panel.is-wrong h2 {
  color: #ffb3ba;
}

.result-panel.is-wrong .result-detail strong {
  color: #ff9aa3;
}

@keyframes wrongFlash {
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 92, 106, 0.5),
      0 24px 60px rgba(0, 0, 0, 0.56);
  }
  70% {
    box-shadow:
      0 0 0 16px rgba(255, 92, 106, 0),
      0 24px 60px rgba(0, 0, 0, 0.56);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(255, 92, 106, 0),
      0 24px 60px rgba(0, 0, 0, 0.56);
  }
}

.result-panel.is-wrong .result-icon {
  border-color: rgba(255, 154, 163, 0.6);
  background: rgba(198, 73, 83, 0.24);
  color: #ff9aa3;
  box-shadow: 0 0 24px rgba(255, 92, 106, 0.28);
}

.result-panel.is-wrong .button.primary {
  background: linear-gradient(135deg, #d65b66, #9d303a);
  color: #fff3f4;
  box-shadow:
    0 12px 26px rgba(198, 73, 83, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.result-panel.is-wrong .button.primary:hover:not(:disabled) {
  box-shadow: 0 16px 32px rgba(198, 73, 83, 0.36);
}

.result-panel.is-timeout {
  border-color: rgba(230, 169, 86, 0.42);
}

.result-panel.is-timeout .result-icon {
  border-color: rgba(240, 192, 115, 0.5);
  background: rgba(230, 169, 86, 0.14);
  color: #f0c073;
}

.result-body {
  flex: 1;
  min-width: 0;
}

.result-body h2 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: 0.04em;
}

.result-detail {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-detail strong {
  color: var(--gold-bright);
  font-size: 15px;
}

.result-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #cfd8cf;
  font-size: 12px;
}

.chip.accent {
  border-color: rgba(216, 183, 110, 0.35);
  background: rgba(216, 183, 110, 0.09);
  color: var(--gold-bright);
}

.result-evaluation {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.result-evaluation:empty {
  display: none;
}

.result-evaluation.is-amazing {
  color: var(--gold-bright);
  text-shadow: 0 0 18px rgba(216, 183, 110, 0.35);
}

.result-evaluation.is-fast {
  color: #8fe0ae;
}

.result-evaluation.is-steady {
  color: #cfd8cf;
}

.result-evaluation.is-calm {
  color: var(--muted);
}

.result-evaluation.is-encouraging {
  color: #f0c073;
}

/* ---------- 操作区 ---------- */

.play-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(100%, 900px);
  margin: 0 auto;
}

.panel {
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(20, 38, 32, 0.84), rgba(9, 22, 18, 0.9));
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.panel h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

#guessHint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.selection-preview {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 58px;
  aspect-ratio: 5 / 7;
  overflow: hidden;
  border: 1px dashed rgba(216, 183, 110, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
}

.selection-preview.has-card {
  border-style: solid;
  border-color: rgba(216, 183, 110, 0.5);
  background: linear-gradient(145deg, #fffdf6, #eee4d2);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.mini-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 8%;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.mini-card.red {
  color: var(--red);
}

.mini-rank {
  font-size: 16px;
  line-height: 1;
}

.mini-suit {
  align-self: center;
  font-size: 18px;
  line-height: 1;
}

.picker-group {
  margin-top: 12px;
}

.picker-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.suit-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.suit-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  appearance: none;
  padding: 9px 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.suit-tab span {
  font-size: 16px;
}

.suit-tab.red span {
  color: #e2767f;
}

.suit-tab:hover:not(:disabled) {
  border-color: rgba(216, 183, 110, 0.4);
  background: rgba(216, 183, 110, 0.08);
}

.suit-tab[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(216, 183, 110, 0.16);
  box-shadow: inset 0 0 0 1px rgba(216, 183, 110, 0.2);
  color: #fff3d7;
}

.suit-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 6px;
}

.rank-button {
  appearance: none;
  min-height: 42px;
  padding: 10px 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease,
    transform 0.18s ease;
}

.rank-button:hover:not(:disabled) {
  border-color: rgba(216, 183, 110, 0.4);
  background: rgba(216, 183, 110, 0.08);
  transform: translateY(-1px);
}

.rank-button[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(216, 183, 110, 0.18);
  color: #fff3d7;
  box-shadow: inset 0 0 0 1px rgba(216, 183, 110, 0.22);
}

.rank-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 11px;
  padding: 12px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.button.primary {
  background: linear-gradient(135deg, var(--gold-bright), #b68e45);
  color: #241a09;
  box-shadow:
    0 12px 26px rgba(182, 142, 69, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.button.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(182, 142, 69, 0.3);
}

.button.primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.button.ghost {
  border: 1px solid rgba(216, 183, 110, 0.28);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

.button.ghost:hover:not(:disabled) {
  border-color: rgba(216, 183, 110, 0.55);
  background: rgba(216, 183, 110, 0.08);
  transform: translateY(-1px);
}

.button.ghost:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.button.small {
  padding: 8px 12px;
  font-size: 12px;
}

.button.danger {
  background: linear-gradient(135deg, #e6606d, #a82635);
  color: #fff5f5;
  box-shadow:
    0 12px 26px rgba(180, 45, 60, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.button.danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(180, 45, 60, 0.36);
}

.button.danger:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

.guess-button {
  width: 100%;
  margin-top: 16px;
  padding: 18px;
  font-size: 17px;
  border-radius: 13px;
}

/* ---------- 怎么玩入口与弹层 ---------- */

.help-panel {
  display: flex;
}

.hint-trigger {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px dashed rgba(216, 183, 110, 0.3);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 38%, rgba(216, 183, 110, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.02);
  color: var(--gold);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.hint-trigger:hover:not(:disabled) {
  border-color: rgba(216, 183, 110, 0.6);
  background:
    radial-gradient(circle at 50% 38%, rgba(216, 183, 110, 0.18), transparent 58%),
    rgba(255, 255, 255, 0.035);
  transform: translateY(-1px);
}

.hint-trigger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint-question {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(216, 183, 110, 0.55);
  border-radius: 50%;
  background: rgba(216, 183, 110, 0.06);
  box-shadow:
    0 0 22px rgba(216, 183, 110, 0.12),
    inset 0 0 16px rgba(216, 183, 110, 0.08);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.hint-caption {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.hint-trigger:focus-visible,
.hint-close:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- 序章 ---------- */

.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 44px);
  background:
    radial-gradient(circle at 50% 18%, rgba(38, 78, 62, 0.32), transparent 55%),
    rgba(2, 8, 6, 0.82);
  backdrop-filter: blur(12px) saturate(0.85);
  -webkit-backdrop-filter: blur(12px) saturate(0.85);
  animation: overlayIn 0.3s ease both;
}

.intro-overlay[hidden] {
  display: none;
}

.intro-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(700px, 100%);
  max-height: min(88vh, 780px);
  overflow: hidden;
  padding: clamp(22px, 3.4vw, 36px) clamp(20px, 3.4vw, 38px) 0;
  border: 1px solid rgba(216, 183, 110, 0.4);
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(25, 48, 40, 0.98), rgba(8, 21, 17, 0.99));
  box-shadow:
    0 42px 110px rgba(0, 0, 0, 0.66),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: modalIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.intro-top,
.intro-chapter,
.intro-actions {
  position: relative;
  z-index: 1;
}

.intro-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.intro-eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.intro-progress {
  display: flex;
  gap: 6px;
}

.intro-progress span {
  width: 26px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.25s ease, box-shadow 0.25s ease;
}

.intro-progress span.is-active {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(216, 183, 110, 0.45);
}

.intro-skip {
  appearance: none;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.18s ease;
}

.intro-skip:hover {
  color: var(--gold-bright);
}

.intro-chapter {
  flex: 1;
  overflow-y: auto;
  padding: clamp(20px, 3vw, 34px) 4px 24px;
  scrollbar-width: thin;
}

.intro-chapter-index {
  margin: 0;
  color: rgba(216, 183, 110, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 7vw, 72px);
  line-height: 0.9;
}

.intro-chapter h2 {
  margin: 2px 0 18px;
  font-size: clamp(24px, 3.4vw, 34px);
  letter-spacing: 0.08em;
}

.intro-copy {
  max-width: 620px;
}

.intro-copy p {
  margin: 0 0 12px;
  color: #cfdad2;
  font-size: clamp(14px, 1.3vw, 15.5px);
  line-height: 1.95;
}

.intro-copy p:last-child {
  margin-bottom: 0;
}

.intro-copy p.is-warning {
  padding: 6px 12px;
  border-left: 3px solid rgba(255, 120, 135, 0.7);
  border-radius: 0 8px 8px 0;
  background: rgba(255, 90, 105, 0.07);
  color: #ff9aa3;
  font-weight: 600;
}

.intro-copy p.is-danger {
  padding: 8px 12px;
  border-left: 3px solid #ff3d52;
  border-radius: 0 8px 8px 0;
  background: linear-gradient(
    90deg,
    rgba(255, 45, 65, 0.16),
    rgba(255, 45, 65, 0.02)
  );
  color: #ff3d52;
  font-weight: 700;
  text-shadow: 0 0 16px rgba(255, 45, 65, 0.35);
}

.intro-copy p.is-final {
  margin-top: 22px;
  color: var(--gold-bright);
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
}

.intro-chapter.is-entering {
  animation: introChapterIn 0.38s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes introChapterIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.intro-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 0 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.intro-actions #introBack {
  grid-column: 1;
  justify-self: start;
}

.intro-actions #introNext {
  grid-column: 3;
  justify-self: end;
  min-width: 118px;
}

.intro-page-label {
  grid-column: 2;
  justify-self: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
}

.howto-intro {
  margin: 2px 0 18px;
  padding: 0 2px;
  color: #dce6de;
  font-size: clamp(13.5px, 1.3vw, 15px);
  line-height: 1.85;
}

.howto-example {
  margin: 2px 0 20px;
  padding: 16px clamp(12px, 2vw, 18px) 14px;
  border: 1px solid rgba(216, 183, 110, 0.22);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.16);
}

.howto-cards {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(5px, 1vw, 10px);
  padding-top: 12px;
}

.howto-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: clamp(42px, 8.5vw, 58px);
  aspect-ratio: 5 / 7;
  padding: 5px;
  border: 1px solid rgba(216, 183, 110, 0.28);
  border-radius: 7px;
  background: linear-gradient(145deg, #f8f1df, #e7ddc6);
  color: #241a12;
  font-family: Georgia, "Times New Roman", serif;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.26);
}

.howto-card.is-red {
  color: #b83a45;
}

.howto-card.is-bottom-card {
  border-color: var(--gold-bright);
  box-shadow:
    0 0 0 1px rgba(216, 183, 110, 0.55),
    0 0 22px rgba(216, 183, 110, 0.3),
    0 10px 22px rgba(0, 0, 0, 0.32);
  transform: translateY(-5px);
}

.howto-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--gold-bright);
  color: #241a09;
  font-family: inherit;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}

.howto-corner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1;
}

.howto-rank {
  font-size: clamp(13px, 1.8vw, 17px);
  font-weight: 700;
}

.howto-suit {
  font-size: clamp(9px, 1.2vw, 11px);
}

.howto-center {
  align-self: center;
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1;
}

.howto-positions {
  display: flex;
  justify-content: center;
  gap: clamp(5px, 1vw, 10px);
  margin-top: 8px;
}

.howto-positions span {
  width: clamp(42px, 8.5vw, 58px);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.howto-positions .is-bottom {
  color: var(--gold-bright);
}

.howto-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
}

.hint-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  background: rgba(3, 10, 8, 0.5);
  backdrop-filter: blur(14px) saturate(0.9);
  -webkit-backdrop-filter: blur(14px) saturate(0.9);
  animation: overlayIn 0.22s ease both;
}

.hint-overlay[hidden] {
  display: none;
}

@keyframes overlayIn {
  from {
    opacity: 0;
  }
}

.hint-modal {
  width: min(560px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(216, 183, 110, 0.35);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(22, 42, 35, 0.98), rgba(8, 20, 16, 0.99));
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: modalIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hint-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.hint-modal-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.06em;
}

.hint-modal-foot {
  display: flex;
  justify-content: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.hint-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(216, 183, 110, 0.4);
  border-radius: 50%;
  background: rgba(216, 183, 110, 0.08);
  color: var(--gold-bright);
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.hint-close:hover {
  border-color: rgba(216, 183, 110, 0.75);
  background: rgba(216, 183, 110, 0.16);
}

body.modal-open {
  overflow: hidden;
}

/* ---------- 退出挑战二次确认 ---------- */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  background: rgba(3, 10, 8, 0.55);
  backdrop-filter: blur(12px) saturate(0.95);
  -webkit-backdrop-filter: blur(12px) saturate(0.95);
  animation: overlayIn 0.2s ease both;
}

.confirm-modal {
  width: min(420px, 100%);
  padding: clamp(22px, 3.4vw, 30px);
  border: 1px solid rgba(216, 183, 110, 0.32);
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(24, 42, 36, 0.98), rgba(9, 20, 17, 0.99));
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  text-align: center;
  animation: modalIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border: 1px solid rgba(255, 142, 153, 0.45);
  border-radius: 50%;
  background: rgba(255, 80, 100, 0.12);
  color: #ff8e99;
  font-size: 22px;
  font-weight: 700;
}

.confirm-modal h2 {
  margin: 0 0 8px;
  font-size: 20px;
  letter-spacing: 0.05em;
}

.confirm-modal p {
  max-width: 320px;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

.confirm-actions .button {
  flex: 1;
}

/* ---------- 提示面板 ---------- */

.info-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.step-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin: 14px 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  color: #dbe2d7;
  font-size: 12.5px;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.step-list li span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(216, 183, 110, 0.12);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}

.step-list li.is-active {
  border-color: rgba(216, 183, 110, 0.55);
  background: rgba(216, 183, 110, 0.14);
  color: #fff3d7;
  box-shadow: 0 0 18px rgba(216, 183, 110, 0.12);
}

.step-list li.is-active span {
  background: var(--gold);
  color: #241a09;
}

.order-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.order-note-title {
  color: #d9d2c1;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* ---------- 音效开关 ---------- */

.audio-toggle {
  appearance: none;
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--gold-bright);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.audio-toggle:hover {
  background: rgba(216, 183, 110, 0.12);
  color: #fff0bd;
}

.audio-toggle.is-muted {
  color: var(--muted);
}

.audio-toggle.is-muted::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 1px;
  background: currentColor;
  transform: rotate(-45deg);
}

.audio-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  max-width: min(92vw, 520px);
  padding: 11px 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 120, 120, 0.45);
  border-radius: 10px;
  background: rgba(24, 12, 12, 0.95);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  color: #ffd7d7;
  font-size: 13px;
  animation: toastIn 0.25s ease;
}

.toast[hidden] {
  display: none;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .card-row {
    gap: clamp(6px, 1.6vw, 12px);
  }

  .card-slot {
    width: clamp(52px, 11vw, 92px);
  }

  .menu-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .arena-stats {
    max-width: none;
    padding-bottom: 0;
    text-align: left;
  }
}

@media (max-width: 820px) {
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .summary-extras {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .rank-grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

@media (max-width: 640px) {
  .intro-overlay {
    padding: 12px;
  }

  .intro-modal {
    max-height: 90vh;
    padding: 20px 18px 0;
    border-radius: 20px;
  }

  .intro-chapter {
    padding-top: 16px;
  }

  .intro-actions {
    gap: 8px;
    padding: 14px 0 18px;
  }

  .intro-actions #introNext {
    min-width: 100px;
  }

  .app {
    width: min(100% - 20px, 1120px);
    padding-top: 18px;
  }

  .brand p {
    display: none;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    font-size: 23px;
  }

  .scoreboard {
    gap: 10px;
    padding: 8px 12px;
  }

  .score-item strong {
    font-size: 15px;
  }

  .card-row {
    gap: 4px;
  }

  .card-slot {
    width: clamp(48px, 15vw, 86px);
  }

  .slot-label {
    margin-top: 7px;
    font-size: 9.5px;
    letter-spacing: 0;
  }

  .felt {
    padding-left: 10px;
    padding-right: 10px;
  }

  .result-panel {
    top: calc(100% + 10px);
    max-height: 50vh;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
  }

  .result-panel .button {
    width: 100%;
  }

  .rank-grid {
    gap: 5px;
  }

  .rank-button {
    font-size: 14px;
  }

  .suit-tabs {
    gap: 5px;
  }

  .suit-tab {
    padding: 8px 4px;
    font-size: 11px;
  }

  .hint-modal {
    max-height: 86vh;
  }

  .menu-intro h2 {
    font-size: clamp(26px, 8vw, 34px);
  }

  .arena-stats-line {
    font-size: 14px;
  }

  .mode-card {
    padding: 18px;
  }

  .menu-quick-actions .button {
    flex: 1 1 0;
    width: auto;
  }

  .game-hud {
    padding: 12px 14px 14px;
  }

  .hud-top {
    align-items: flex-start;
    gap: 10px;
  }

  #timerValue {
    font-size: 30px;
  }

  .summary-card {
    padding: 24px 18px;
  }

  .summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-actions .button {
    width: 100%;
  }

  .score-form {
    flex-direction: column;
  }

  .score-form .button {
    width: 100%;
  }

  .record-head,
  .record-row {
    grid-template-columns: 24px minmax(0, 1fr) 10px 52px 48px;
    gap: 6px;
    padding: 9px 10px;
  }

  .record-hand {
    gap: 2px;
  }

  .record-arrow {
    font-size: 10px;
  }

  .leaderboard-head {
    grid-template-columns: 32px minmax(0, 1fr) 66px 66px;
    gap: 6px;
  }

  .leaderboard-row {
    grid-template-columns: 32px minmax(0, 1fr) 66px 66px;
    gap: 6px;
    padding: 9px 8px;
  }

  .confirm-actions {
    flex-direction: column;
  }

  .confirm-actions .button {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .topbar {
    gap: 10px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .audio-control {
    gap: 6px;
    padding: 3px 8px 3px 3px;
  }

  .audio-volume {
    width: 64px;
  }

  .audio-volume-value {
    display: none;
  }

  .audio-toggle {
    width: 28px;
    height: 28px;
    font-size: 15px;
  }
}

@media (max-width: 430px) {
  .topbar {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
