/* 天干地支 · 五行合局 —— 深色墨金主题 */
:root {
  --bg: #090c10;
  --bg-2: #10151c;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.055);
  --line: rgba(232, 222, 196, 0.11);
  --line-strong: rgba(232, 222, 196, 0.24);
  --ink: #e9e2d0;
  --muted: #9a927f;
  --muted-2: #6d6659;
  --gold: #d7b25c;
  --gold-2: #f1d795;
  --red: #cf5a48;
  --blue: #8bb6d8;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(1100px 640px at 12% -8%, rgba(215, 178, 92, 0.10), transparent 62%),
    radial-gradient(900px 560px at 92% 0%, rgba(90, 132, 166, 0.10), transparent 58%),
    radial-gradient(900px 700px at 50% 110%, rgba(120, 52, 44, 0.07), transparent 60%),
    linear-gradient(180deg, #0b0f14 0%, #07090c 72%);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(232, 222, 196, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 222, 196, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 78%);
}
[hidden] { display: none !important; }
button, select { font-family: inherit; }

.app {
  position: relative;
  width: min(1460px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 2px 2px 11px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 268px; }
.brand-seal {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border: 1px solid rgba(215, 178, 92, 0.55);
  border-radius: 11px;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.12em;
  background:
    linear-gradient(135deg, rgba(215, 178, 92, 0.18), transparent 55%),
    rgba(215, 178, 92, 0.04);
  box-shadow: inset 0 0 0 3px rgba(9, 12, 16, 0.55), 0 6px 18px rgba(0, 0, 0, 0.3);
}
.brand-text h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.brand-text h1 i { color: var(--gold); font-style: normal; margin: 0 2px; }
.brand-text p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.2em;
}

.month-card {
  display: flex; align-items: center; gap: 11px;
  padding: 5px 14px 5px 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  min-width: 176px;
}
.month-glyph {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--edge, var(--line-strong));
  color: var(--edge, var(--gold-2));
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.22), transparent 55%),
    color-mix(in srgb, var(--el, #d7b25c) 22%, #0a0d11);
  font-family: var(--serif);
  font-size: 25px;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45);
}
.month-meta { display: flex; flex-direction: column; gap: 3px; }
.month-meta b { font-size: 13.5px; font-weight: 600; letter-spacing: 0.04em; }
.month-meta small { font-size: 10.5px; color: var(--muted); letter-spacing: 0.06em; }

.scoreboard { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.score-side { display: flex; flex-direction: row; align-items: baseline; min-width: 0; gap: 6px; }
.score-label { color: var(--muted); font-size: 10.5px; letter-spacing: 0.1em; white-space: nowrap; }
.score-side b { font-size: 25px; line-height: 1; font-variant-numeric: tabular-nums; }
.score-side b.lead { color: var(--gold-2); text-shadow: 0 0 18px rgba(215, 178, 92, 0.35); }
.score-colon { color: var(--muted-2); font-size: 17px; }
.round-tag {
  margin-left: 5px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.top-actions { display: flex; align-items: center; gap: 8px; }
.time-select {
  display: flex; align-items: center; gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.05em;
}
.time-select select {
  appearance: none;
  padding: 6px 22px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 12px) 50% / 4px 4px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--muted) 50%) calc(100% - 8px) 50% / 4px 4px no-repeat,
    rgba(255, 255, 255, 0.04);
  font-size: 11.5px;
  cursor: pointer;
}
.time-select select:focus-visible { outline: 1px solid var(--gold); }

/* ---------- 主体 ---------- */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 312px;
  gap: 13px;
  flex: 1;
  min-height: 0;
}
.table {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1.1fr) minmax(0, 0.85fr);
  grid-template-areas: "self center opp";
  align-items: stretch;
  gap: 10px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 42%, rgba(215, 178, 92, 0.055), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
  min-height: 560px;
}
.table::before,
.table::after {
  content: "";
  position: absolute;
  width: 44px; height: 44px;
  border-color: rgba(215, 178, 92, 0.28);
  border-style: solid;
  pointer-events: none;
}
.table::before { top: 9px; left: 9px; border-width: 1px 0 0 1px; }
.table::after { bottom: 9px; right: 9px; border-width: 0 1px 1px 0; }

.opponent-row {
  grid-area: opp;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  min-height: 0;
  min-width: 0;
}
.row-label { display: flex; flex-direction: column; gap: 4px; min-width: 108px; }
.who {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.count { color: var(--muted); font-size: 10.5px; letter-spacing: 0.04em; }
.legend {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}
.legend-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(90deg, #3f8a58 50%, #c39527 50%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.opp-hand { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; min-height: 46px; }
.card-back {
  width: 29px; height: 43px;
  border-radius: 5px;
  border: 1px solid rgba(215, 178, 92, 0.22);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, #1c2530, #141b24);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 4px 8px rgba(0, 0, 0, 0.28);
  flex: 0 0 auto;
}
.card-back.tall { width: 58px; height: 84px; border-radius: 8px; }
.empty-note { color: var(--muted-2); font-size: 11px; letter-spacing: 0.08em; }

.center-stage {
  position: relative;
  grid-area: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 300px;
  min-width: 0;
  padding: 12px 10px;
  border-left: 1px solid rgba(232, 222, 196, 0.08);
  border-right: 1px solid rgba(232, 222, 196, 0.08);
  background: radial-gradient(ellipse at 50% 50%, rgba(215, 178, 92, 0.04), transparent 64%);
}
.stage-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  z-index: 0;
  color: var(--gold);
  opacity: 0.055;
  font-family: var(--serif);
  font-size: clamp(150px, 21vw, 250px);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  text-shadow: 0 0 60px rgba(215, 178, 92, 0.2);
}
.phase-banner, .duel, .round-summary { position: relative; z-index: 1; }
.phase-clock {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 78px;
  height: 78px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin: 0;
  z-index: 3;
}
.phase-clock svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.phase-clock .ring-bg {
  fill: none;
  stroke: rgba(232, 222, 196, 0.12);
  stroke-width: 3;
}
.phase-clock .ring-fg {
  fill: none;
  stroke: var(--gold-2);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(215, 178, 92, 0.35));
  transition: stroke-dashoffset 0.12s linear, stroke 0.3s ease;
}
.phase-clock span {
  position: relative;
  z-index: 1;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.1em;
  text-shadow: 0 0 14px rgba(215, 178, 92, 0.22);
}
.phase-clock.is-warning .ring-fg { stroke: #e08765; }

.phase-banner {
  color: var(--gold-2);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 10px;
}
.phase-banner::before,
.phase-banner::after {
  content: "";
  width: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(215, 178, 92, 0.55));
}
.phase-banner::after { transform: scaleX(-1); }
.phase-banner.subtle { color: var(--muted); }
.phase-banner.subtle::before,
.phase-banner.subtle::after { background: linear-gradient(90deg, transparent, var(--line-strong)); }

.duel { position: relative; display: flex; align-items: center; justify-content: center; gap: 30px; width: 100%; min-height: 188px; }
.duel-slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.duel-slot.is-winner { z-index: 2; animation: winnerLift 0.78s cubic-bezier(0.16, 0.8, 0.24, 1) both; }
.duel-slot.is-loser { /* 败方不再播放受击动画 */ }
.duel-slot.is-winner .outcome { box-shadow: 0 0 44px rgba(241, 215, 149, 0.6), 0 14px 26px rgba(0, 0, 0, 0.42), inset 0 0 0 1px var(--edge); }
.duel-slot.is-loser .outcome { /* 败方不扣血、不变暗 */ }
.duel-slot.is-tie .outcome { animation: tiePulse 0.9s ease-in-out 2; }

.damage-float {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 6;
  pointer-events: none;
  color: #ff7a64;
  font-family: var(--sans);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.55);
  animation: damageFloat 1.25s cubic-bezier(0.18, 0.8, 0.25, 1) forwards;
}
.damage-float.plus { top: 62%; color: var(--gold-2); font-size: 30px; animation-delay: 0.08s; }
.damage-float.tie { top: 44%; color: var(--gold-2); font-size: 28px; letter-spacing: 0.12em; animation: damageFloat 1.1s ease-out forwards; }

.impact-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, #fff 0%, #ffd88a 35%, rgba(255, 160, 90, 0.45) 55%, transparent 72%);
  box-shadow: 0 0 22px rgba(255, 210, 140, 0.9);
  transform: translate(-50%, -50%);
  animation: impactBurst 0.6s ease-out forwards;
}

.battle-flash {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 210, 140, 0.22), transparent 42%),
    radial-gradient(circle at 50% 44%, rgba(255, 80, 55, 0.12), transparent 65%);
}
.battle-flash.show { animation: battleFlash 0.5s ease-out; }

.table.battle-shake { animation: tableShake 0.35s ease-out; }
.score-side b { display: inline-block; }
.score-side.is-hit b { color: #ff8c78; animation: scoreHit 0.7s ease-out; }
.score-side.is-win b { animation: scoreWin 0.8s ease-out; }
.duel-name { color: var(--muted); font-size: 10.5px; letter-spacing: 0.15em; }
.duel-name.ai { color: var(--blue); }
.vs {
  font-family: var(--serif);
  font-size: 15px;
  color: var(--muted-2);
  letter-spacing: 0.18em;
  padding-bottom: 20px;
}
.duel-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 144px;
  padding: 10px;
  border: 1px dashed rgba(232, 222, 196, 0.2);
  border-radius: 12px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-align: center;
}
.card-back.tall.duel-hidden {
  width: 104px;
  height: 144px;
  border-radius: 12px;
}
.duel-placeholder {
  display: flex; align-items: center; gap: 30px;
  color: var(--muted-2); font-size: 11px; letter-spacing: 0.14em;
}

.outcome {
  position: relative;
  width: 104px; height: 144px;
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink, #fff);
  background:
    radial-gradient(120% 80% at 24% 0%, rgba(255, 255, 255, 0.3), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.22)),
    var(--el, #555);
  box-shadow:
    0 0 34px color-mix(in srgb, var(--el, #555) 40%, transparent),
    0 14px 26px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px var(--edge, rgba(255, 255, 255, 0.3));
}
.outcome.reveal-in { animation: revealIn 0.62s cubic-bezier(0.2, 0.8, 0.25, 1) both; }
.outcome.empty {
  background: rgba(255, 255, 255, 0.025);
  border: 1px dashed var(--line-strong);
  box-shadow: none;
  color: var(--muted);
}
.outcome-el { font-family: var(--serif); font-size: 46px; line-height: 1; text-shadow: 0 3px 10px rgba(0, 0, 0, 0.3); }
.outcome-label { margin-top: 8px; font-size: 10.5px; letter-spacing: 0.1em; opacity: 0.85; }
.outcome-score { margin-top: 6px; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.outcome-score small { font-size: 10px; font-weight: 500; opacity: 0.7; margin-left: 2px; }
.outcome-note { margin-top: 7px; font-size: 9.5px; letter-spacing: 0.04em; opacity: 0.72; text-align: center; padding: 0 8px; }
.outcome.mini { width: 84px; height: 116px; }
.outcome.mini .outcome-el { font-size: 34px; }

.draw-pool {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
}
.draw-pool-head {
  width: min(100%, 620px);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}
.draw-pool-head .pool-title { color: var(--gold-2); font-family: var(--serif); font-size: 12px; letter-spacing: 0.08em; }
.pool-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  margin-top: -8px;
}
.pool-row { display: flex; align-items: center; gap: 8px; }
.pool-row-label {
  width: 24px;
  flex: 0 0 24px;
  text-align: right;
  color: var(--muted-2);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.pool-slots { display: flex; gap: 8px; }
.pool-slot {
  position: relative;
  width: 66px;
  height: 92px;
  border-radius: 10px;
}
.pool-slot .card { width: 66px; height: 92px; }
.pool-slot.is-empty,
.pool-slot.is-hidden {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px dashed rgba(232, 222, 196, 0.22);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 6px),
    rgba(10, 13, 17, 0.35);
  color: var(--muted-2);
}
.pool-slot.is-hidden {
  border-style: solid;
  border-color: rgba(215, 178, 92, 0.18);
  background:
    repeating-linear-gradient(45deg, rgba(215, 178, 92, 0.05) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #1a222c, #121820);
}
.slot-kind { font-size: 8px; letter-spacing: 0.14em; opacity: 0.7; }
.slot-taken { font-size: 9px; letter-spacing: 0.04em; color: var(--muted); }
.pool-back {
  display: grid;
  place-items: center;
  width: 30px; height: 40px;
  border: 1px solid rgba(215, 178, 92, 0.2);
  border-radius: 5px;
  color: rgba(215, 178, 92, 0.5);
  font-family: var(--serif);
  font-size: 17px;
}
@media (max-width: 1200px) {
  .pool-row { gap: 5px; }
  .pool-row-label { width: 16px; flex-basis: 16px; font-size: 9px; }
  .pool-slots { gap: 5px; }
  .pool-slot, .pool-slot .card { width: 50px; height: 70px; }
  .pool-slot .card-kind { font-size: 7px; }
  .pool-slot .card-score { font-size: 11px; right: 5px; }
  .slot-kind { font-size: 7px; }
  .slot-taken { font-size: 8px; }
}
@media (max-width: 640px) {
  .pool-slot, .pool-slot .card { width: 54px; height: 76px; }
  .pool-row-label { width: 18px; flex-basis: 18px; }
}
@media (max-height: 820px) and (min-width: 761px) {
  .pool-slot, .pool-slot .card { width: 50px; height: 70px; }
}
.center-stage.is-draw .round-summary { display: none; }
.pool-empty { color: var(--muted-2); font-size: 11px; padding: 28px 6px; letter-spacing: 0.06em; }

.round-summary {
  width: 100%;
  max-width: 690px;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}
.round-summary .verdict { font-family: var(--serif); font-size: 15px; letter-spacing: 0.08em; color: var(--ink); }
.round-summary .verdict.win { color: var(--gold-2); }
.round-summary .verdict.lose { color: var(--blue); }
.round-summary .detail { color: var(--muted); font-size: 11.5px; }
.round-summary .detail b { color: var(--ink); font-weight: 600; }
.round-summary .hint { color: var(--muted-2); font-size: 11px; }

.self-row {
  grid-area: self;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
  justify-content: flex-start;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.hand {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 2px 0;
  scrollbar-width: thin;
}
.element-row { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.element-row + .element-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(232, 222, 196, 0.08);
}
.element-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted-2);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.08em;
}
.element-row-head small {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 8.5px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.element-slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: start;
  gap: 4px;
  min-width: 0;
}
.element-slot {
  min-width: 0;
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--el) 44%, transparent);
  border-radius: 8px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--el) 16%, transparent), color-mix(in srgb, var(--el) 5%, transparent)),
    rgba(8, 11, 15, 0.42);
}
.element-slot.is-empty {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--el) 34%, transparent);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--el) 12%, transparent), color-mix(in srgb, var(--el) 4%, transparent)),
    rgba(8, 11, 15, 0.28);
}
.element-slot-head {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--ink);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.9;
}
.el-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--el);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.element-slot-head b {
  margin-left: auto;
  color: var(--muted-2);
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.slot-cards {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 0;
  padding-top: 3px;
}
.slot-cards .card { flex: 0 0 auto; width: 70px; height: 98px; z-index: 1; }
.slot-cards .card + .card { margin-top: -68px; }
.slot-cards .card:hover { transform: translateX(2px); z-index: 3; }
.slot-cards .card.is-selected { transform: translateX(4px) scale(1.03); z-index: 20; }
.slot-cards .card.is-discard-selected { z-index: 19; }
.slot-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 46px;
  color: color-mix(in srgb, var(--el) 52%, var(--ink));
  font-size: 9.5px;
  letter-spacing: 0.08em;
}
.hand-empty { color: var(--muted-2); font-size: 11.5px; padding: 30px 4px; letter-spacing: 0.08em; }

/* ---------- 卡牌 ---------- */
.card {
  --el: #888;
  --ink: #fff;
  --edge: #fff;
  position: relative;
  width: 80px;
  height: 112px;
  padding: 7px 8px 6px;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font-family: var(--serif);
  text-align: left;
  cursor: pointer;
  user-select: none;
  background:
    radial-gradient(120% 80% at 22% 0%, rgba(255, 255, 255, 0.28), transparent 55%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.10), rgba(0, 0, 0, 0.22)),
    var(--el);
  box-shadow:
    0 9px 18px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px var(--edge);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 24px rgba(0, 0, 0, 0.42), inset 0 0 0 1px var(--edge); }
.card:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.card.is-selected {
  transform: translateY(-12px);
  box-shadow:
    0 0 0 2px var(--gold),
    0 0 26px rgba(215, 178, 92, 0.3),
    0 16px 26px rgba(0, 0, 0, 0.45);
}
.card.is-discard-selected {
  filter: saturate(0.55) brightness(0.7);
  box-shadow: 0 0 0 2px var(--red), 0 8px 16px rgba(0, 0, 0, 0.35);
}
.card.is-discard-selected::after {
  content: "弃";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(20, 5, 4, 0.42);
  color: #ffd7cd;
  font-family: var(--sans);
  font-size: 17px;
  letter-spacing: 0.1em;
}
.card.is-new { animation: newGlow 1.6s ease-out 1; }
.card.is-month {
  box-shadow:
    0 9px 18px rgba(0, 0, 0, 0.38),
    inset 0 0 0 1px var(--edge),
    inset 0 0 22px rgba(215, 178, 92, 0.18);
}
.card-month {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 3px;
  border: 1px solid rgba(215, 178, 92, 0.55);
  border-radius: 20px;
  color: var(--gold-2);
  font-family: var(--sans);
  font-size: 7px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0;
  pointer-events: none;
  white-space: nowrap;
}
.card-kind { display: block; font-family: var(--sans); font-size: 8.5px; letter-spacing: 0.16em; opacity: 0.7; }
.card-score {
  position: absolute; top: 5px; right: 8px;
  font-family: var(--sans); font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
.card-char {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 37px;
  line-height: 1.1;
  font-weight: 500;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}
.card-foot {
  position: absolute;
  left: 8px; right: 8px; bottom: 6px;
  display: flex; align-items: baseline; justify-content: space-between;
  font-family: var(--sans); font-size: 9.5px; font-weight: 600;
  opacity: 0.9;
}
.card-el { letter-spacing: 0.08em; }
.card-state { font-size: 9px; font-weight: 500; opacity: 0.75; white-space: nowrap; letter-spacing: 0.02em; }
.card-subs {
  position: absolute;
  right: 7px; bottom: 19px;
  display: flex; gap: 3px;
}
.sub {
  width: 11px; height: 11px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--sub);
  color: var(--sub-ink, #fff);
  font-family: var(--sans);
  font-size: 7.5px;
  font-style: normal;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.22);
}

/* ---------- 侧栏 ---------- */
.sidebar { display: flex; flex-direction: column; justify-content: center; gap: 13px; min-height: 0; }
.panel {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.016));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.month-panel { flex: 0 0 auto; }
.month-wheel {
  position: relative;
  width: 190px;
  height: 190px;
  margin: 10px auto 4px;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.24);
  background:
    radial-gradient(circle at 50% 50%, rgba(215, 178, 92, 0.07), transparent 58%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.025), transparent 70%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.2);
}
.month-wheel::before {
  content: "";
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  border: 1px dashed rgba(232, 222, 196, 0.12);
  pointer-events: none;
}
.wheel-ring { position: absolute; inset: 0; }
.wheel-node {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.22);
  font-family: var(--serif);
  font-size: 12px;
  line-height: 1;
  transform: rotate(var(--a)) translateY(-78px) rotate(calc(-1 * var(--a)));
  transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease, opacity 0.4s ease;
  z-index: 1;
}
.wheel-node.passed {
  color: #b7d0d8;
  background: rgba(64, 103, 118, 0.38);
  border-color: rgba(139, 188, 201, 0.42);
  opacity: 0.8;
}
.wheel-node.future {
  color: #e1d6ba;
  background: rgba(215, 178, 92, 0.12);
  border-color: rgba(215, 178, 92, 0.38);
}
.wheel-node.current {
  color: #21170a;
  background: linear-gradient(160deg, #efd489, #b88922);
  border-color: #f7e2a8;
  box-shadow: 0 0 18px rgba(215, 178, 92, 0.55);
  transform: rotate(var(--a)) translateY(-78px) rotate(calc(-1 * var(--a))) scale(1.16);
}
.wheel-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 2px;
  height: 70px;
  transform-origin: 50% 100%;
  transform: translateX(-1px) rotate(var(--hand-angle));
  background: linear-gradient(0deg, rgba(215, 178, 92, 0.15), rgba(231, 200, 115, 0.95));
  transition: transform 0.75s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 0;
}
.wheel-hand::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 10px rgba(231, 200, 115, 0.8);
}
.wheel-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.4);
  background: radial-gradient(circle at 40% 30%, #1e2731, #0d1218 70%);
  box-shadow: 0 0 0 5px rgba(215, 178, 92, 0.045), 0 6px 18px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.wheel-center b {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1;
  color: var(--gold-2);
  font-weight: 500;
}
.wheel-center span { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: 0.06em; }
.wheel-caption { text-align: center; color: var(--muted-2); font-size: 9.5px; letter-spacing: 0.04em; margin-bottom: 3px; }
.wheel-legend {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 2px 0 4px;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.04em;
}
.wheel-legend span { display: inline-flex; align-items: center; gap: 4px; }
.wheel-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.wheel-dot.passed { background: #6f9aa8; box-shadow: 0 0 0 1px rgba(139, 188, 201, 0.45); }
.wheel-dot.current { background: linear-gradient(160deg, #efd489, #b88922); box-shadow: 0 0 0 1px #f7e2a8; }
.wheel-dot.future { background: rgba(215, 178, 92, 0.18); box-shadow: 0 0 0 1px rgba(215, 178, 92, 0.5); }

.panel-note, .seed { color: var(--muted-2); font-size: 9.5px; letter-spacing: 0.04em; }
.seed { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.panel-foot { margin: 9px 0 0; color: var(--muted-2); font-size: 9.5px; letter-spacing: 0.03em; }

.fortune-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 10px; }
.fortune-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}
.fortune-item.is-wang { border-color: rgba(215, 178, 92, 0.5); background: rgba(215, 178, 92, 0.09); }
.fortune-el {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--el-ink, #111);
  background: var(--el, #888);
  font-family: var(--serif);
  font-size: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.fortune-state { color: var(--ink); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; }
.fortune-delta { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }

.log-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log {
  list-style: none;
  margin: 9px 0 0;
  padding: 0 2px 0 0;
  overflow-y: auto;
  flex: 1;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 222, 196, 0.18) transparent;
}
.log li {
  display: flex;
  gap: 7px;
  padding: 5px 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.021);
  color: var(--muted);
  font-size: 10.8px;
  line-height: 1.45;
}
.log .r { flex: 0 0 auto; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.log li.you { color: var(--gold-2); background: rgba(215, 178, 92, 0.055); }
.log li.ai { color: #a9c8e0; }
.log li.score { color: var(--gold-2); }
.log li:last-child { outline: 1px solid rgba(215, 178, 92, 0.1); }

/* ---------- 操作栏 ---------- */
.actionbar {
  position: sticky;
  bottom: 10px;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 11px 15px;
  border: 1px solid rgba(215, 178, 92, 0.22);
  border-radius: 18px;
  background: rgba(11, 15, 20, 0.88);
  backdrop-filter: blur(16px);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.35), 0 14px 34px rgba(0, 0, 0, 0.3);
}
.selection-info {
  min-height: 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.selection-info .line { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.selection-info b { color: var(--ink); font-weight: 600; }
.selection-info .combo-name { color: var(--gold-2); font-family: var(--serif); font-size: 13.5px; letter-spacing: 0.05em; }
.selection-info .warn { color: #e0a08f; }
.selection-info .ok { color: #9ec9a7; }
.action-buttons { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 10px 17px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s, filter 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--gold); background: rgba(215, 178, 92, 0.11); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.32; cursor: not-allowed; }
.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, #ecd28c, #c89f4a);
  color: #241b08;
  box-shadow: 0 7px 20px rgba(215, 178, 92, 0.24);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); background: linear-gradient(135deg, #f2db9a, #d0a750); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 7px 10px; border-radius: 9px; font-size: 11.5px; }
.btn.danger { border-color: rgba(207, 90, 72, 0.5); color: #ffc9bd; }
.btn .kbd {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.18);
  font-size: 9px;
  font-weight: 500;
  opacity: 0.7;
}

.timer { position: relative; width: 60px; height: 60px; display: grid; place-items: center; flex: 0 0 auto; }
.timer-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.09); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 4; stroke-linecap: round; transition: stroke 0.25s; }
.timer span { position: relative; z-index: 1; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.warning .ring-fg { stroke: var(--red); }
.timer.warning span { color: #ff9b8b; animation: pulse 1s ease-in-out infinite; }
.timer.idle { opacity: 0.35; }

/* ---------- Toast / Dialog / Overlay ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 76px;
  z-index: 120;
  transform: translate(-50%, -10px);
  max-width: min(520px, 86vw);
  padding: 10px 16px;
  border: 1px solid rgba(215, 178, 92, 0.35);
  border-radius: 11px;
  background: rgba(16, 21, 27, 0.96);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 12.5px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.rules-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
  padding: 0;
  border: 1px solid rgba(215, 178, 92, 0.3);
  border-radius: 18px;
  background: linear-gradient(180deg, #10161d, #0a0e13);
  color: var(--ink);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.65);
}
.rules-dialog::backdrop { background: rgba(4, 6, 9, 0.72); backdrop-filter: blur(5px); }
.rules-head {
  position: sticky; top: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 18, 24, 0.95);
}
.rules-head h2 { margin: 0; font-family: var(--serif); font-size: 17px; letter-spacing: 0.1em; }
.rules-body { padding: 6px 22px 24px; overflow-y: auto; max-height: calc(min(82vh, 760px) - 60px); font-size: 12.5px; line-height: 1.7; color: var(--muted); }
.rules-body h3 { margin: 18px 0 6px; color: var(--gold-2); font-family: var(--serif); font-size: 14px; letter-spacing: 0.06em; }
.rules-body p, .rules-body ul, .rules-body ol { margin: 4px 0; padding-left: 20px; }
.rules-body p { padding-left: 0; }
.rules-body b { color: var(--ink); font-weight: 600; }
.rules-body table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11.5px; }
.rules-body th, .rules-body td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.rules-body th { color: var(--muted-2); font-weight: 500; }
.rules-body td:first-child { color: var(--ink); }

.swap-dialog {
  width: min(620px, calc(100vw - 24px));
  padding: 0;
  border: 1px solid rgba(215, 178, 92, 0.32);
  border-radius: 18px;
  background: linear-gradient(180deg, #111820, #090d12);
  color: var(--ink);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.7);
}
.swap-dialog::backdrop { background: rgba(4, 6, 9, 0.76); backdrop-filter: blur(5px); }
.swap-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.swap-head h2 { margin: 0; font-family: var(--serif); font-size: 17px; letter-spacing: 0.1em; }
.swap-head span { color: var(--muted-2); font-size: 10.5px; letter-spacing: 0.08em; }
.swap-body { padding: 16px 20px 18px; }
.swap-body p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.swap-body p b { color: var(--gold-2); }
.swap-pool { display: flex; flex-direction: column; gap: 13px; }
.swap-row { display: flex; align-items: center; gap: 10px; }
.swap-row-label { width: 34px; flex: 0 0 auto; color: var(--muted-2); font-size: 10px; letter-spacing: 0.1em; }
.swap-backs { display: flex; gap: 7px; flex-wrap: nowrap; }
.swap-back {
  appearance: none;
  width: 58px; height: 82px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(215, 178, 92, 0.24);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, #1c2530, #141b24);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 5px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.swap-back:hover { transform: translateY(-3px); border-color: var(--gold-2); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4); }
.swap-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
@media (max-width: 640px) {
  .swap-back { width: 50px; height: 72px; }
  .swap-backs { gap: 5px; }
  .swap-row { gap: 7px; }
  .swap-body { padding: 14px 16px 16px; }
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 7, 10, 0.72);
  backdrop-filter: blur(6px);
}
.overlay-card {
  width: min(440px, 100%);
  padding: 28px 26px 24px;
  border: 1px solid rgba(215, 178, 92, 0.35);
  border-radius: 20px;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(215, 178, 92, 0.12), transparent 60%),
    linear-gradient(180deg, #12181f, #0b0f14);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7);
  text-align: center;
}
.overlay-card .eyebrow { color: var(--gold); font-size: 10px; letter-spacing: 0.28em; }
.overlay-card h2 { margin: 10px 0 4px; font-family: var(--serif); font-size: 27px; font-weight: 600; letter-spacing: 0.08em; }
.overlay-card .overlay-sub { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.final-score {
  display: flex; align-items: center; justify-content: center; gap: 18px;
  margin: 22px 0 6px;
  font-variant-numeric: tabular-nums;
}
.final-score .side { display: flex; flex-direction: column; gap: 4px; min-width: 72px; }
.final-score .name { color: var(--muted); font-size: 10.5px; letter-spacing: 0.12em; }
.final-score .num { font-size: 40px; font-weight: 700; line-height: 1; }
.final-score .num.win { color: var(--gold-2); text-shadow: 0 0 30px rgba(215, 178, 92, 0.4); }
.final-score .colon { color: var(--muted-2); font-size: 24px; padding-top: 14px; }
.overlay-stats { margin: 16px 0 22px; color: var(--muted-2); font-size: 11px; line-height: 1.8; }
.overlay-card .btn.primary { width: 100%; padding: 12px; }

/* ---------- 动画 ---------- */
@keyframes revealIn {
  0% { opacity: 0; transform: translateY(16px) rotateY(38deg) scale(0.9); filter: brightness(1.7); }
  60% { opacity: 1; transform: translateY(0) rotateY(-3deg) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) rotateY(0) scale(1); filter: brightness(1); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.92); }
}
@keyframes newGlow {
  0% { box-shadow: 0 0 0 2px rgba(215, 178, 92, 0.85), 0 10px 22px rgba(0, 0, 0, 0.4); }
  100% { box-shadow: 0 9px 18px rgba(0, 0, 0, 0.38), inset 0 0 0 1px var(--edge); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes winnerLift {
  0% { transform: translateY(0) scale(1); }
  38% { transform: translateY(-10px) scale(1.06); }
  68% { transform: translateY(-3px) scale(1.02); }
  100% { transform: translateY(0) scale(1.01); }
}
@keyframes cardStrike {
  0% { transform: translateX(0) scale(1); }
  32% { transform: translateX(calc(26px * var(--dir, 1))) scale(1.06); }
  52% { transform: translateX(calc(-5px * var(--dir, 1))) scale(1.01); }
  100% { transform: translateX(0) scale(1); }
}
@keyframes cardHit {
  0%, 100% { transform: translateX(0) rotate(0); }
  18% { transform: translateX(-9px) rotate(-2.2deg); }
  36% { transform: translateX(8px) rotate(1.8deg); }
  55% { transform: translateX(-6px) rotate(-1.2deg); }
  74% { transform: translateX(4px) rotate(0.7deg); }
}
@keyframes tiePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes damageFloat {
  0% { opacity: 0; transform: translate(-50%, 8px) scale(0.65); }
  18% { opacity: 1; transform: translate(-50%, -4px) scale(1.18); }
  100% { opacity: 0; transform: translate(-50%, -58px) scale(1); }
}
@keyframes impactBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.3); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(13); }
}
@keyframes battleFlash {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes tableShake {
  0%, 100% { transform: translate(0, 0); }
  22% { transform: translate(-3px, 1px); }
  44% { transform: translate(3px, -1px); }
  66% { transform: translate(-2px, 0); }
  82% { transform: translate(1px, 0); }
}
@keyframes scoreHit {
  0% { transform: scale(1); }
  30% { transform: scale(1.35); color: #ff8c78; }
  100% { transform: scale(1); }
}
@keyframes scoreWin {
  0% { transform: scale(1); }
  30% { transform: scale(1.22); color: var(--gold-2); text-shadow: 0 0 24px rgba(215, 178, 92, 0.7); }
  100% { transform: scale(1); }
}
.round-summary, .duel { animation: fadeUp 0.3s ease both; }

/* ---------- 响应式 ---------- */
@media (max-width: 1180px) {
  .board { grid-template-columns: minmax(0, 1fr) 282px; }
  .brand { min-width: 240px; }
  .brand-text h1 { font-size: 19px; }
  .card { width: 74px; height: 104px; }
  .card-char { font-size: 33px; margin-top: 8px; }
  .slot-cards .card { width: 60px; height: 84px; }
  .slot-cards .card + .card { margin-top: -58px; }
  .slot-cards .card-char { font-size: 30px; margin-top: 5px; }
  .slot-cards .card-kind { font-size: 7px; }
  .slot-cards .card-score { font-size: 12px; }
  .slot-cards .card-foot { font-size: 8px; }
}

@media (max-width: 1100px) {
  .table {
    grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr) minmax(0, 0.6fr);
    gap: 6px;
    padding: 12px 12px 10px;
  }
  .card { width: 60px; height: 84px; padding: 5px 6px; border-radius: 8px; }
  .card-char { font-size: 26px; margin-top: 5px; }
  .card-kind { font-size: 7.5px; }
  .card-score { font-size: 12px; top: 4px; right: 6px; }
  .card-foot { left: 6px; right: 6px; bottom: 5px; font-size: 8.5px; }
  .card-state { font-size: 7.5px; }
  .slot-cards { gap: 2px; padding-top: 14px; margin-top: -12px; }
  .slot-cards .card { width: 50px; height: 70px; }
  .slot-cards .card + .card { margin-top: -48px; }
  .slot-cards .card-char { font-size: 24px; margin-top: 3px; }
  .slot-cards .card-kind { font-size: 6.5px; }
  .slot-cards .card-score { font-size: 10px; top: 4px; right: 5px; }
  .slot-cards .card-foot { left: 4px; right: 4px; bottom: 4px; font-size: 7px; }
  .slot-cards .card-state { font-size: 6.5px; }
  .slot-cards .card-subs { right: 4px; bottom: 14px; gap: 2px; }
  .slot-cards .sub { width: 8px; height: 8px; font-size: 6px; }
  .element-slot { padding: 2px; border-radius: 6px; }
  .element-slot-head { font-size: 8px; }
  .element-row-head { font-size: 9px; }
  .pool-row { gap: 4px; }
  .pool-slots { gap: 4px; }
  .pool-row-label { width: 15px; flex-basis: 15px; font-size: 8.5px; }
  .pool-slot, .pool-slot .card { width: 46px; height: 66px; }
  .pool-slot .card-kind { font-size: 6.5px; }
  .pool-slot .card-score { font-size: 10px; }
  .slot-kind { font-size: 6.5px; }
  .slot-taken { font-size: 7.5px; }
  .center-stage { padding: 8px 4px; }
}

@media (max-width: 760px) {
  .phase-clock { position: relative; top: auto; left: auto; transform: none; margin: 2px 0; }
  .self-row { height: auto; }
  .hand { overflow-y: visible; }
  .table {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 10px 10px;
  }
  .opponent-row {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .center-stage {
    min-height: 205px;
    padding: 6px 2px;
    gap: 6px;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid rgba(232, 222, 196, 0.08);
    border-bottom: 1px solid rgba(232, 222, 196, 0.08);
  }
}

@media (max-width: 960px) {
  .board { display: contents; }
  .table { order: 1; }
  .actionbar { order: 2; position: static; bottom: auto; }
  .sidebar { order: 3; }
  .topbar { gap: 12px; }
  .scoreboard { margin-left: 0; }
  .board { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; }
  .log-panel { min-height: 200px; }
  .log { max-height: 200px; }
  .actionbar { grid-template-columns: 1fr auto; }
  .timer { grid-row: span 2; }
  .selection-info { grid-column: 1 / -1; }
  .action-buttons { justify-content: flex-start; }
  .table { min-height: 520px; }
}

@media (max-width: 640px) {
  .phase-clock { width: 64px; height: 64px; }
  .phase-clock span { font-size: 15px; }
  .app { padding: 8px 10px 6px; gap: 7px; }
  .topbar { gap: 6px; padding: 0 0 6px; }
  .brand { min-width: 0; flex: 1 1 100%; }
  .brand-seal { width: 34px; height: 34px; font-size: 10px; }
  .brand-text h1 { font-size: 16px; }
  .brand-text p { display: none; }
  .month-card { min-width: 0; padding: 4px 10px 4px 5px; }
  .month-glyph { width: 36px; height: 36px; font-size: 20px; }
  .month-meta b { font-size: 12px; }
  .month-meta small { font-size: 9.5px; }
  .scoreboard { margin-left: auto; }
  .score-side b { font-size: 21px; }
  .score-side { gap: 4px; }
  .score-label { font-size: 10px; }
  .round-tag { display: none; }
  .top-actions { flex: 1 1 100%; justify-content: flex-end; }
  .table { padding: 12px 10px 10px; min-height: 0; }
  .row-label { min-width: 88px; }
  .opponent-row { gap: 8px; }
  .card-back { width: 22px; height: 33px; }
  .card-back.tall { width: 46px; height: 66px; }
  .center-stage { min-height: 205px; padding: 6px 2px; gap: 6px; }
  .duel { gap: 14px; min-height: 128px; }
  .draw-pool-head { width: 100%; font-size: 9.5px; }
  .pool-row { gap: 5px; }
  .pool-slots { gap: 5px; }
  .pool-row-label { width: 18px; flex-basis: 18px; font-size: 8.5px; }
  .pool-slot, .pool-slot .card { width: 50px; height: 70px; }
  .pool-slot .card-kind { font-size: 6.5px; }
  .pool-slot .card-score { font-size: 10px; }
  .pool-slot .card-char { font-size: 24px; margin-top: 3px; }
  .pool-slot .card-foot { font-size: 7.5px; left: 4px; right: 4px; bottom: 4px; }
  .pool-slot .card-subs { right: 3px; bottom: 14px; }
  .slot-kind { font-size: 6.5px; }
  .slot-taken { font-size: 7.5px; }
  .pool-row { gap: 4px; }
  .pool-slots { gap: 4px; }
  .pool-grid { gap: 4px; padding-top: 6px; margin-top: -4px; }
  .outcome { width: 84px; height: 116px; }
  .outcome-el { font-size: 36px; }
  .outcome-label { font-size: 9px; }
  .outcome-score { font-size: 17px; }
  .vs { font-size: 12px; }
  .card { width: 62px; height: 89px; padding: 5px 6px; border-radius: 8px; }
  .card-kind { font-size: 7.5px; }
  .card-score { font-size: 12px; top: 4px; right: 6px; }
  .card-char { font-size: 28px; margin-top: 6px; }
  .card-foot { left: 6px; right: 6px; bottom: 5px; font-size: 8.5px; }
  .card-state { font-size: 7.5px; }
  .card-subs { right: 5px; bottom: 16px; gap: 2px; }
  .sub { width: 9px; height: 9px; font-size: 6.5px; }
  .hand {
    gap: 4px;
    min-height: 0;
    height: auto;
    overflow-y: visible;
    padding: 2px 0 0;
  }
  .self-row { height: auto; }
  .slot-cards .card { width: 62px; height: 89px; }
  .slot-cards .card + .card { margin-top: -61px; }
  .slot-cards .card-char { font-size: 28px; margin-top: 5px; }
  .slot-cards .card-kind { font-size: 7.5px; }
  .slot-cards .card-score { font-size: 12px; top: 4px; right: 6px; }
  .slot-cards .card-foot { left: 6px; right: 6px; bottom: 5px; font-size: 8px; }
  .slot-cards .card-state { font-size: 7px; }
  .slot-cards .card-subs { right: 5px; bottom: 16px; gap: 2px; }
  .slot-cards .sub { width: 9px; height: 9px; font-size: 6.5px; }
  .element-slot { padding: 2px; }
  .element-slot-head { font-size: 8px; }
  .element-row-head { font-size: 9px; }
  .legend { display: none; }
  .sidebar { grid-template-columns: 1fr; }
  .log { max-height: 170px; }
  .actionbar { bottom: 5px; gap: 7px; padding: 8px 9px; border-radius: 14px; }
  .selection-info { font-size: 10.5px; min-height: 29px; }
  .btn { padding: 8px 11px; font-size: 11px; }
  .timer { width: 48px; height: 48px; }
  .timer span { font-size: 13px; }
  .toast { top: 10px; bottom: auto; }
  .duel-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 144px;
  padding: 10px;
  border: 1px dashed rgba(232, 222, 196, 0.2);
  border-radius: 12px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-align: center;
}
.card-back.tall.duel-hidden {
  width: 104px;
  height: 144px;
  border-radius: 12px;
}
.duel-placeholder { gap: 16px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


/* 桌面端锁一屏：日志内部滚动，避免换月后页面变长出现页面滚轮 */
@media (min-width: 961px) {
  html, body { height: 100%; overflow: hidden; }
  .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .board { min-height: 0; overflow: hidden; }
  .table { min-height: 0; }
  .sidebar { min-height: 0; overflow: hidden; }
  .log-panel { min-height: 0; }
  .log { min-height: 0; }
}

@media (min-width: 961px) and (max-height: 950px) {
  .center-stage { min-height: 240px; padding: 8px 10px; gap: 8px; }
  .duel { min-height: 150px; }
  .round-summary { min-height: 48px; }
}

@media (min-width: 961px) and (max-height: 820px) {
  .phase-clock { width: 64px; height: 64px; }
  .phase-clock span { font-size: 15px; }
  .month-wheel { width: 150px; height: 150px; margin: 6px auto 2px; }
  .wheel-node {
    width: 22px; height: 22px; margin: -11px;
    font-size: 10.5px;
    transform: rotate(var(--a)) translateY(-61px) rotate(calc(-1 * var(--a)));
  }
  .wheel-node.current {
    transform: rotate(var(--a)) translateY(-61px) rotate(calc(-1 * var(--a))) scale(1.14);
  }
  .wheel-hand { height: 54px; }
  .wheel-center { width: 52px; height: 52px; }
  .wheel-center b { font-size: 20px; }
  .wheel-center span { font-size: 8px; }
  .wheel-caption { font-size: 8.5px; }
  .month-wheel::before { inset: 13px; }
  .topbar { gap: 10px; padding-bottom: 5px; }
  .brand-seal { width: 36px; height: 36px; }
  .brand-text h1 { font-size: 18px; }
  .brand-text p { display: none; }
  .center-stage { min-height: 180px; padding: 6px 8px; gap: 6px; }
  .duel { min-height: 120px; }
  .round-summary { min-height: 40px; }
  .card { width: 68px; height: 92px; }
  .card-char { font-size: 29px; margin-top: 6px; }
  .hand { min-height: 0; }
  .slot-cards .card { width: 60px; height: 84px; }
  .slot-cards .card + .card { margin-top: -58px; }
  .slot-cards .card-char { font-size: 28px; margin-top: 4px; }
  .legend { display: none; }
  .table { gap: 6px; }

}

/* ============================================================
   v3.4 视觉与动效层：环境光、卡牌质感、转化/出牌演出
   ============================================================ */

:root {
  --gold-line: rgba(215, 178, 92, 0.34);
  --glass: rgba(13, 18, 24, 0.72);
  --glow-gold: 0 0 26px rgba(215, 178, 92, 0.28);
}

body { isolation: isolate; }
body::after {
  content: "";
  position: fixed;
  inset: -18%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 34% 30% at 20% 30%, rgba(63, 138, 88, 0.12), transparent 66%),
    radial-gradient(ellipse 30% 34% at 82% 20%, rgba(215, 178, 92, 0.12), transparent 66%),
    radial-gradient(ellipse 38% 30% at 72% 88%, rgba(59, 94, 130, 0.12), transparent 68%);
  filter: blur(34px);
  animation: ambientDrift 28s ease-in-out infinite alternate;
}
.app { z-index: 1; animation: appIn 0.9s ease both; }
.app::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.022;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.topbar { border-bottom-color: rgba(215, 178, 92, 0.16); }
.brand-seal {
  box-shadow:
    inset 0 0 0 3px rgba(9, 12, 16, 0.55),
    0 6px 18px rgba(0, 0, 0, 0.3),
    0 0 22px rgba(215, 178, 92, 0.16);
  animation: sealBreath 6s ease-in-out infinite;
}
.brand-text h1 { text-shadow: 0 0 26px rgba(215, 178, 92, 0.16); }
.brand-text h1 i { text-shadow: 0 0 18px rgba(215, 178, 92, 0.4); }

.month-card,
.scoreboard {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    radial-gradient(80% 100% at 0% 0%, rgba(215, 178, 92, 0.07), transparent 60%);
  border-color: rgba(215, 178, 92, 0.16);
}
.month-glyph { animation: glyphBreath 4.5s ease-in-out infinite; }

.table {
  background:
    radial-gradient(ellipse 72% 58% at 50% 44%, rgba(215, 178, 92, 0.07), transparent 72%),
    radial-gradient(ellipse 90% 80% at 50% 110%, rgba(63, 138, 88, 0.045), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.042), rgba(255, 255, 255, 0.008));
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    inset 0 0 80px rgba(215, 178, 92, 0.025);
}
.table::before,
.table::after {
  filter: drop-shadow(0 0 8px rgba(215, 178, 92, 0.25));
}
.panel {
  position: relative;
  border-color: rgba(215, 178, 92, 0.17);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012)),
    radial-gradient(100% 60% at 50% 0%, rgba(215, 178, 92, 0.055), transparent 70%);
  box-shadow:
    0 16px 38px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
}
.panel::before {
  content: "";
  position: absolute;
  left: 14px; right: 14px; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(241, 215, 149, 0.45), transparent);
  pointer-events: none;
}

.phase-clock {
  filter: drop-shadow(0 0 16px rgba(215, 178, 92, 0.12));
}
.phase-clock::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.14);
  animation: phaseBreath 3.8s ease-in-out infinite;
  pointer-events: none;
}
.phase-clock span { text-shadow: 0 0 20px rgba(215, 178, 92, 0.4); }
.phase-clock .ring-fg { filter: drop-shadow(0 0 7px rgba(241, 215, 149, 0.7)); }

.wheel-hand { filter: drop-shadow(0 0 5px rgba(241, 215, 149, 0.55)); }
.wheel-node.current { animation: wheelCurrent 3.2s ease-in-out infinite; }
.wheel-center { box-shadow: 0 0 0 5px rgba(215, 178, 92, 0.055), 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 26px rgba(215, 178, 92, 0.14); }

.duel::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 340px; height: 220px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(215, 178, 92, 0.1), transparent 66%);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}
.duel > .duel-slot, .duel > .vs { position: relative; z-index: 1; }
.duel-name { color: rgba(233, 226, 208, 0.72); }
.duel-name.ai { color: rgba(139, 182, 216, 0.88); }
.vs {
  color: rgba(215, 178, 92, 0.62);
  text-shadow: 0 0 18px rgba(215, 178, 92, 0.35);
  animation: vsBreath 4s ease-in-out infinite;
}
.card-back.tall.duel-hidden {
  animation: hiddenCard 3.4s ease-in-out infinite;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.45),
    0 12px 30px rgba(0, 0, 0, 0.42),
    0 0 28px rgba(139, 182, 216, 0.12);
}
.duel.is-casting .card-back.tall.duel-hidden { animation: hiddenTremble 0.55s ease-out; }
.duel.is-revealing { animation: revealSpot 0.85s ease-out; }
.duel.is-revealing .outcome.reveal-in { animation: revealUpgrade 0.78s cubic-bezier(0.18, 0.8, 0.22, 1) both; }

.outcome {
  box-shadow:
    0 0 34px color-mix(in srgb, var(--el, #555) 42%, transparent),
    0 16px 34px rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px var(--edge, rgba(255, 255, 255, 0.3)),
    inset 0 0 28px rgba(255, 255, 255, 0.06);
}
.outcome::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16), transparent 36%, transparent 70%, rgba(0, 0, 0, 0.12));
  pointer-events: none;
}
.outcome-el { text-shadow: 0 0 22px color-mix(in srgb, var(--edge, #fff) 60%, transparent), 0 3px 10px rgba(0, 0, 0, 0.3); }

/* 手牌：底色槽、卡面高光、选中光环 */
.element-slot {
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 8px 18px rgba(0, 0, 0, 0.16);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.element-slot:hover {
  border-color: color-mix(in srgb, var(--el) 62%, transparent);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.22),
    0 0 20px color-mix(in srgb, var(--el) 12%, transparent);
}
.element-slot.is-empty::after {
  content: attr(data-element);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding-bottom: 8px;
  color: color-mix(in srgb, var(--el) 11%, transparent);
  font-family: var(--serif);
  font-size: 36px;
  line-height: 1;
  pointer-events: none;
}
.element-slot.is-empty .element-slot-head,
.element-slot.is-empty .slot-empty { position: relative; z-index: 1; }
.element-slot-head { text-shadow: 0 0 10px color-mix(in srgb, var(--el) 28%, transparent); }
.el-dot { box-shadow: 0 0 8px var(--el); }

.card {
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  transition: transform 0.2s cubic-bezier(.2,.8,.2,1), box-shadow 0.2s ease, filter 0.2s ease;
}
.card::before {
  content: "";
  position: absolute;
  top: -60%; bottom: -60%; left: -80%;
  width: 55%;
  transform: rotate(16deg) translateX(-40%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  opacity: 0;
  transition: transform 0.65s ease, opacity 0.3s ease;
  pointer-events: none;
  z-index: 3;
}
.card:hover::before { transform: rotate(16deg) translateX(360%); opacity: 0.7; }
.card:hover { transform: translateY(-5px) scale(1.01); filter: brightness(1.04); }
.card-char { text-shadow: 0 0 18px color-mix(in srgb, var(--edge) 30%, transparent), 0 3px 10px rgba(0, 0, 0, 0.32); }
.card.is-selected {
  animation: selectedAura 2.6s ease-in-out infinite;
  filter: brightness(1.06);
}
.card.is-selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--edge) 28%, transparent);
  pointer-events: none;
}
.card.is-new { animation: newGlow 1.8s ease-out 1, newShimmer 1.4s ease-out 1; }
.card.is-new::before { animation: cardShimmer 1.2s ease-out 1; }

.btn {
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.18) 48%, transparent 72%);
  transform: translateX(-120%);
  transition: transform 0.55s ease;
  pointer-events: none;
}
.btn:hover:not(:disabled)::before { transform: translateX(120%); }
.btn.primary {
  background: linear-gradient(135deg, #f0d795, #c99b3e 55%, #e8cb80);
  box-shadow:
    0 8px 24px rgba(215, 178, 92, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.btn.primary:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow: 0 10px 30px rgba(215, 178, 92, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* 演出层 */
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: hidden;
}
.fx-forge-card {
  position: fixed;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 38px;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  will-change: transform, opacity;
}
.fx-spark {
  position: fixed;
  width: 4px; height: 4px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
  will-change: transform, opacity;
}
.fx-ring {
  position: fixed;
  width: 64px; height: 64px;
  border: 1.5px solid rgba(241, 215, 149, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(241, 215, 149, 0.45), inset 0 0 20px rgba(241, 215, 149, 0.2);
  will-change: transform, opacity;
}
.fx-cast-card {
  position: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5), 0 0 36px rgba(241, 215, 149, 0.3);
  font-family: var(--serif);
  will-change: transform, opacity;
}
.fx-cast-card b { font-size: 44px; line-height: 1; font-weight: 500; }
.fx-cast-card span { margin-top: 7px; font-family: var(--sans); font-size: 10px; letter-spacing: 0.12em; opacity: 0.8; }
.fx-cast-card em { margin-top: 7px; font-family: var(--sans); font-size: 18px; font-style: normal; font-weight: 700; }
.fx-cast-trail {
  position: fixed;
  height: 2px;
  transform-origin: 0 50%;
  border-radius: 99px;
  filter: blur(0.2px);
  box-shadow: 0 0 12px currentColor;
  will-change: transform, opacity;
}
.preview-card.is-forged {
  box-shadow:
    0 0 58px color-mix(in srgb, var(--el, #555) 75%, transparent),
    0 0 0 1px var(--edge, rgba(255, 255, 255, 0.3)),
    0 18px 38px rgba(0, 0, 0, 0.48);
}
.preview-card.is-forged::before {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--edge, #fff) 60%, transparent);
  opacity: 0;
  animation: forgeHalo 0.8s ease-out 1;
  pointer-events: none;
}

/* 动效关键帧 */
@keyframes ambientDrift {
  0% { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  50% { transform: translate3d(1.5%, 1.5%, 0) scale(1.04); }
  100% { transform: translate3d(2%, -1%, 0) scale(1.02); }
}
@keyframes appIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sealBreath {
  0%, 100% { box-shadow: inset 0 0 0 3px rgba(9, 12, 16, 0.55), 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 20px rgba(215, 178, 92, 0.12); }
  50% { box-shadow: inset 0 0 0 3px rgba(9, 12, 16, 0.55), 0 6px 22px rgba(0, 0, 0, 0.35), 0 0 32px rgba(215, 178, 92, 0.24); }
}
@keyframes glyphBreath {
  0%, 100% { box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45), 0 0 0 rgba(215, 178, 92, 0); }
  50% { box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45), 0 0 18px rgba(215, 178, 92, 0.16); }
}
@keyframes phaseBreath {
  0%, 100% { opacity: 0.35; transform: scale(0.96); }
  50% { opacity: 0.9; transform: scale(1.04); }
}
@keyframes wheelCurrent {
  0%, 100% { box-shadow: 0 0 14px rgba(215, 178, 92, 0.42); }
  50% { box-shadow: 0 0 26px rgba(241, 215, 149, 0.68); }
}
@keyframes vsBreath {
  0%, 100% { opacity: 0.68; }
  50% { opacity: 1; }
}
@keyframes hiddenCard {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 12px 30px rgba(0, 0, 0, 0.42), 0 0 22px rgba(139, 182, 216, 0.1); }
  50% { transform: translateY(-4px) rotate(0.6deg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 18px 34px rgba(0, 0, 0, 0.46), 0 0 32px rgba(139, 182, 216, 0.18); }
}
@keyframes hiddenTremble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-1deg); }
  50% { transform: translateX(2px) rotate(1deg); }
  75% { transform: translateX(-1px); }
}
@keyframes revealSpot {
  0% { filter: brightness(1); }
  20% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}
@keyframes revealUpgrade {
  0% { opacity: 0; transform: translateY(20px) rotateY(52deg) scale(0.82); filter: brightness(2.2); }
  55% { opacity: 1; transform: translateY(0) rotateY(-5deg) scale(1.04); filter: brightness(1.25); }
  100% { opacity: 1; transform: translateY(0) rotateY(0) scale(1); filter: brightness(1); }
}
@keyframes selectedAura {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(215, 178, 92, 0.28), 0 16px 26px rgba(0, 0, 0, 0.45); }
  50% { box-shadow: 0 0 0 2px var(--gold-2), 0 0 34px rgba(215, 178, 92, 0.5), 0 18px 30px rgba(0, 0, 0, 0.48); }
}
@keyframes newShimmer {
  0% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}
@keyframes cardShimmer {
  0% { transform: rotate(16deg) translateX(-80%); opacity: 0.8; }
  100% { transform: rotate(16deg) translateX(420%); opacity: 0; }
}
@keyframes forgeHalo {
  0% { opacity: 0; transform: scale(0.6); }
  35% { opacity: 0.85; }
  100% { opacity: 0; transform: scale(1.5); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
  .fx-layer { display: none !important; }
  body::after { animation: none !important; }
  .app { animation: none !important; }
}

/* 顶栏字标与操作栏的收口 */
.brand-text h1 {
  background: linear-gradient(100deg, #f7eed9 0%, #d7b25c 48%, #f1d795 72%, #d7b25c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.brand-text h1 i { color: var(--gold-2); -webkit-text-fill-color: var(--gold-2); }
.top-actions .btn.tiny { background: rgba(255, 255, 255, 0.02); backdrop-filter: blur(8px); }

.actionbar {
  background:
    linear-gradient(180deg, rgba(20, 27, 35, 0.94), rgba(9, 13, 18, 0.94)),
    radial-gradient(80% 100% at 50% 0%, rgba(215, 178, 92, 0.06), transparent 70%);
  border-color: rgba(215, 178, 92, 0.26);
  box-shadow:
    0 -16px 46px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 30px rgba(215, 178, 92, 0.045);
}
.selection-info .combo-name { text-shadow: 0 0 18px rgba(215, 178, 92, 0.25); }

.draw-pool-head { border-bottom: 1px solid rgba(215, 178, 92, 0.12); padding-bottom: 7px; }
.pool-title { color: var(--gold-2); font-family: var(--serif); letter-spacing: 0.12em; }
.pool-slot { transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; }
.pool-slot:hover { transform: translateY(-3px); border-color: rgba(215, 178, 92, 0.42); box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28); }
.pool-slot .card { box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4), inset 0 0 0 1px var(--edge); }
.swap-dialog { box-shadow: 0 46px 120px rgba(0, 0, 0, 0.78), 0 0 40px rgba(215, 178, 92, 0.08); }
.swap-back:hover { box-shadow: 0 12px 26px rgba(0, 0, 0, 0.48), 0 0 20px rgba(215, 178, 92, 0.18); }

.toast {
  background: linear-gradient(180deg, rgba(23, 30, 38, 0.98), rgba(12, 17, 23, 0.98));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.5), 0 0 24px rgba(215, 178, 92, 0.08);
}

.month-panel .panel-head h2 { text-shadow: 0 0 16px rgba(215, 178, 92, 0.15); }
.fortune-item { transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease; }
.fortune-item:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.045); }
.fortune-item.is-wang { box-shadow: 0 0 0 1px rgba(215, 178, 92, 0.08), 0 6px 18px rgba(0, 0, 0, 0.2); }

.opp-hand .card-back:nth-child(3n + 1) { transform: translateY(1px); }
.opp-hand .card-back:nth-child(3n + 2) { transform: translateY(-2px); }
.duel-wait { background: radial-gradient(circle at 50% 50%, rgba(215, 178, 92, 0.03), transparent 70%); }
.outcome.empty { background: rgba(255, 255, 255, 0.018); }

@media (max-width: 640px) {
  .app::after { opacity: 0.016; }
  .duel::before { width: 240px; height: 160px; }
}

.draw-pool { animation: fadeUp 0.42s ease both; }
.phase-banner { animation: fadeUp 0.5s ease both; }
.swap-dialog[open] { animation: dialogIn 0.28s cubic-bezier(.2,.8,.2,1) both; }
.swap-dialog[open] .swap-back { animation: backDeal 0.42s cubic-bezier(.2,.8,.2,1) backwards; }
.swap-dialog[open] .swap-row:nth-child(2) .swap-back:nth-child(1) { animation-delay: 0.04s; }
.swap-dialog[open] .swap-row:nth-child(2) .swap-back:nth-child(2) { animation-delay: 0.08s; }
.swap-dialog[open] .swap-row:nth-child(2) .swap-back:nth-child(3) { animation-delay: 0.12s; }
.swap-dialog[open] .swap-row:nth-child(2) .swap-back:nth-child(4) { animation-delay: 0.16s; }
@keyframes dialogIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes backDeal { from { opacity: 0; transform: translateY(10px) rotateY(35deg); } to { opacity: 1; transform: translateY(0) rotateY(0); } }

/* ============================================================
   月令合局 · 封面 / 大厅
   ============================================================ */
.landing {
  position: relative;
  z-index: 1;
  width: min(1460px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 30px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  animation: landingIn 0.8s cubic-bezier(.2,.8,.2,1) both;
}
.landing::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(920px, 92vw);
  height: min(920px, 92vw);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(215, 178, 92, 0.075), transparent 62%);
  pointer-events: none;
  z-index: -1;
}
.landing-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(215, 178, 92, 0.15);
}
.landing-top .brand { animation: fadeUp 0.7s 0.1s ease both; }
.landing-top .btn { background: rgba(255, 255, 255, 0.025); backdrop-filter: blur(8px); }

.landing-main {
  flex: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
  align-items: center;
  gap: clamp(24px, 5vw, 80px);
  padding: 10px 0 8px;
}
.landing-copy { max-width: 640px; animation: landingCopyIn 0.85s 0.08s cubic-bezier(.2,.8,.2,1) both; }
.landing-eyebrow {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}
.landing-title-row { display: flex; align-items: center; gap: 18px; }
.landing-seal {
  width: 62px; height: 62px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  border: 1px solid rgba(215, 178, 92, 0.6);
  border-radius: 50%;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 28px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.18), transparent 55%),
    rgba(215, 178, 92, 0.08);
  box-shadow: inset 0 0 0 4px rgba(9, 12, 16, 0.5), 0 0 34px rgba(215, 178, 92, 0.18);
  animation: sealBreath 6s ease-in-out infinite;
}
.landing-copy h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(56px, 6.4vw, 92px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.1em;
  background: linear-gradient(105deg, #f8efdc 0%, #d7b25c 46%, #f3dfaa 72%, #d7b25c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 60px rgba(215, 178, 92, 0.14);
}
.landing-lead {
  margin: 24px 0 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(19px, 2vw, 26px);
  line-height: 1.6;
  letter-spacing: 0.12em;
}
.landing-desc {
  max-width: 490px;
  margin: 17px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
  letter-spacing: 0.03em;
}
.landing-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 23px; }
.landing-tags span {
  padding: 6px 10px;
  border: 1px solid rgba(215, 178, 92, 0.2);
  border-radius: 20px;
  color: rgba(233, 226, 208, 0.74);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  background: rgba(215, 178, 92, 0.035);
}
.landing-actions { display: flex; align-items: center; gap: 16px; margin-top: 32px; flex-wrap: wrap; }
.landing-start {
  padding: 15px 26px;
  border-radius: 13px;
  font-size: 14px;
  letter-spacing: 0.06em;
  box-shadow: 0 12px 34px rgba(215, 178, 92, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.landing-start:hover:not(:disabled) { transform: translateY(-2px); }
.landing-arrow { display: inline-block; margin-left: 8px; transition: transform 0.2s ease; }
.landing-start:hover .landing-arrow { transform: translateX(4px); }
.landing-mode-note { color: var(--muted-2); font-size: 10.5px; letter-spacing: 0.12em; }

.landing-orbit {
  position: relative;
  width: min(440px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
  animation: landingOrbitIn 1.1s 0.18s cubic-bezier(.2,.8,.2,1) both;
}
.landing-orbit::before,
.landing-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.landing-orbit::before {
  inset: 5%;
  border: 1px solid rgba(215, 178, 92, 0.13);
  box-shadow: 0 0 60px rgba(215, 178, 92, 0.06), inset 0 0 60px rgba(215, 178, 92, 0.035);
}
.landing-orbit::after {
  inset: 14%;
  border: 1px dashed rgba(232, 222, 196, 0.1);
  animation: orbitSpin 70s linear infinite;
}
.landing-wheel {
  --r: 150px;
  position: relative;
  width: min(382px, 86%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.3);
  background:
    radial-gradient(circle at 50% 45%, rgba(215, 178, 92, 0.08), transparent 58%),
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.04), transparent 55%);
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.35), 0 20px 60px rgba(0, 0, 0, 0.26);
}
.landing-wheel::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 1px dashed rgba(215, 178, 92, 0.15);
}
.landing-branch {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.22);
  color: rgba(233, 226, 208, 0.82);
  background: rgba(215, 178, 92, 0.055);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1;
  transform:
    rotate(calc(var(--i) * 30deg))
    translateY(calc(-1 * var(--r)))
    rotate(calc(var(--i) * -30deg));
  z-index: 2;
}
.landing-branch:nth-child(3n + 1) { border-color: rgba(139, 188, 201, 0.22); }
.landing-branch:nth-child(3n + 2) { border-color: rgba(215, 178, 92, 0.32); }
.landing-needle {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 2px;
  height: calc(var(--r) - 22px);
  transform: translateX(-1px) rotate(22deg);
  transform-origin: 50% 100%;
  background: linear-gradient(0deg, rgba(215, 178, 92, 0.15), rgba(241, 215, 149, 0.9));
  box-shadow: 0 0 14px rgba(241, 215, 149, 0.5);
  animation: needleSway 7s ease-in-out infinite;
  z-index: 1;
}
.landing-needle::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 9px; height: 9px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 18px rgba(241, 215, 149, 0.8);
}
.landing-wheel-center {
  position: absolute;
  left: 50%; top: 50%;
  width: 104px; height: 104px;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.46);
  background: radial-gradient(circle at 38% 28%, #202a34, #0c1117 72%);
  box-shadow: 0 0 0 6px rgba(215, 178, 92, 0.045), 0 12px 30px rgba(0, 0, 0, 0.48), 0 0 30px rgba(215, 178, 92, 0.14);
  z-index: 3;
}
.landing-wheel-center b {
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1;
}
.landing-wheel-center span { margin-top: 6px; color: var(--muted-2); font-size: 9px; letter-spacing: 0.3em; }
.landing-orbit-caption {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.24em;
  white-space: nowrap;
}
.landing-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding-top: 11px;
  border-top: 1px solid rgba(232, 222, 196, 0.07);
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}
.landing.is-leaving { animation: landingOut 0.38s cubic-bezier(.4,0,.6,1) forwards; pointer-events: none; }

@keyframes landingIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes landingCopyIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes landingOrbitIn { from { opacity: 0; transform: scale(.92) rotate(-4deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes landingOut { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(.985); } }
@keyframes orbitSpin { to { transform: rotate(360deg); } }
@keyframes needleSway { 0%, 100% { transform: translateX(-1px) rotate(17deg); } 50% { transform: translateX(-1px) rotate(28deg); } }

@media (max-width: 960px) {
  .landing { padding: 16px 20px 12px; }
  .landing-main { grid-template-columns: 1fr; gap: 22px; padding-top: 8px; }
  .landing-copy { max-width: 720px; }
  .landing-orbit { width: min(330px, 72vw); justify-self: start; margin-left: 6vw; }
  .landing-copy h1 { font-size: clamp(52px, 11vw, 74px); }
}
@media (max-width: 640px) {
  .landing { padding: 12px 14px 10px; gap: 10px; }
  .landing-top { gap: 10px; }
  .landing-top .brand { min-width: 0; }
  .landing-top .brand-text h1 { font-size: 15px; white-space: normal; }
  .landing-top .brand-text p { font-size: 8px; letter-spacing: 0.12em; }
  .landing-top .brand-seal { width: 38px; height: 38px; font-size: 10px; }
  .landing-main { gap: 8px; padding: 4px 0; }
  .landing-eyebrow { margin-bottom: 12px; font-size: 9px; letter-spacing: 0.22em; }
  .landing-title-row { gap: 10px; }
  .landing-seal { width: 42px; height: 42px; font-size: 19px; }
  .landing-copy h1 { font-size: 43px; letter-spacing: 0.06em; }
  .landing-lead { margin-top: 16px; font-size: 17px; }
  .landing-desc { font-size: 11.5px; line-height: 1.7; margin-top: 11px; }
  .landing-tags { margin-top: 15px; gap: 5px; }
  .landing-tags span { padding: 4px 7px; font-size: 8.5px; }
  .landing-actions { margin-top: 20px; gap: 10px; }
  .landing-start { padding: 12px 16px; font-size: 12px; }
  .landing-mode-note { font-size: 9px; }
  .landing-orbit { width: 240px; margin: 0 auto; }
  .landing-wheel { --r: 94px; }
  .landing-branch { width: 24px; height: 24px; margin: -12px; font-size: 11px; }
  .landing-wheel-center { width: 70px; height: 70px; }
  .landing-wheel-center b { font-size: 19px; }
  .landing-wheel-center span { font-size: 7px; margin-top: 3px; }
  .landing-orbit-caption { display: none; }
  .landing-foot { font-size: 8px; padding-top: 8px; }
}

/* 出牌后的两段式揭示：己方落牌，敌方暗牌翻面 */
.outcome.player-slam { animation: playerSlam 0.5s cubic-bezier(.16,.8,.24,1) both; }
.ai-await { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ai-await .card-back.tall {
  width: 104px; height: 144px; border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 12px 30px rgba(0, 0, 0, 0.42), 0 0 28px rgba(139, 182, 216, 0.14);
}
.ai-await-label { color: var(--muted-2); font-size: 9px; letter-spacing: 0.2em; }
.duel.is-focus-a .duel-slot[data-side="a"] .card-back { animation: focusBack 0.9s ease-out; }
.duel.is-focus-a .duel-slot[data-side="a"] .ai-await-label { color: var(--blue); text-shadow: 0 0 14px rgba(139, 182, 216, 0.35); }

.ai-flip { width: 104px; height: 144px; perspective: 760px; }
.ai-flip-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  animation: aiFlipIn 0.82s cubic-bezier(.2,.72,.18,1) both;
}
.ai-flip-back,
.ai-flip-front {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  border-radius: 12px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.ai-flip-back {
  border: 1px solid rgba(215, 178, 92, 0.24);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, #1c2530, #141b24);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 12px 30px rgba(0, 0, 0, 0.42);
}
.ai-flip-front { transform: rotateY(180deg); }
.ai-flip-front .outcome { width: 100%; height: 100%; animation: none !important; }
.ai-flip-front .outcome.reveal-in { animation: none !important; }

@keyframes playerSlam {
  0% { opacity: 0; transform: translateY(-18px) scale(1.08) rotate(-2deg); filter: brightness(1.5); }
  60% { opacity: 1; transform: translateY(2px) scale(.99) rotate(0); filter: brightness(1.1); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); filter: brightness(1); }
}
@keyframes focusBack {
  0%, 100% { transform: translateY(0) rotate(0); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 12px 30px rgba(0, 0, 0, 0.42), 0 0 22px rgba(139, 182, 216, 0.16); }
  35% { transform: translateY(-3px) rotate(-1.2deg); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.45), 0 18px 36px rgba(0, 0, 0, 0.48), 0 0 40px rgba(139, 182, 216, 0.4); }
  70% { transform: translateY(0) rotate(0.8deg); }
}
@keyframes aiFlipIn {
  0% { transform: rotateY(0deg); }
  38% { transform: rotateY(0deg); }
  100% { transform: rotateY(180deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ai-flip-inner { animation: none !important; transform: rotateY(180deg); }
  .player-slam { animation: none !important; }
}

/* ============================================================
   开局定月 · 拨月盘
   ============================================================ */
.spin-stage {
  position: relative;
  z-index: 1;
  width: min(1460px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 30px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  animation: landingIn 0.6s ease both;
}
.spin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(215, 178, 92, 0.15);
}
.spin-step {
  padding: 6px 12px;
  border: 1px solid rgba(215, 178, 92, 0.28);
  border-radius: 20px;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 11px;
  letter-spacing: 0.18em;
  background: rgba(215, 178, 92, 0.055);
}
.spin-main {
  flex: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(400px, 1.3fr) minmax(160px, 0.7fr);
  align-items: center;
  gap: clamp(10px, 3vw, 40px);
  padding: 4px 0;
}
.spin-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.spin-who { color: var(--muted); font-family: var(--serif); font-size: 14px; letter-spacing: 0.14em; }
.spin-side-p .spin-who { color: var(--gold-2); }
.spin-side-a .spin-who { color: var(--blue); }
.spin-role { color: var(--muted-2); font-size: 9px; letter-spacing: 0.12em; }
.spin-result {
  width: 138px;
  min-height: 176px;
  padding: 16px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(215, 178, 92, 0.17);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.01)),
    radial-gradient(100% 70% at 50% 0%, rgba(215, 178, 92, 0.06), transparent 70%);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.spin-result b {
  color: var(--muted-2);
  font-family: var(--serif);
  font-size: 52px;
  font-weight: 500;
  line-height: 1;
}
.spin-result small { color: var(--muted-2); font-size: 9px; letter-spacing: 0.1em; }
.spin-result.is-set b { color: var(--gold-2); text-shadow: 0 0 24px rgba(215, 178, 92, 0.28); }
.spin-result.is-set { border-color: rgba(215, 178, 92, 0.34); }
.spin-result.is-chosen {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 1px var(--gold), 0 0 34px rgba(215, 178, 92, 0.28), 0 16px 34px rgba(0, 0, 0, 0.3);
  transform: translateY(-3px);
}
.spin-result.is-chosen small { color: var(--gold-2); }

.spin-core { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.spin-turn {
  min-height: 22px;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.16em;
  text-shadow: 0 0 18px rgba(215, 178, 92, 0.25);
}
.spin-wheel-shell {
  position: relative;
  width: min(448px, 100%);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.spin-wheel-shell::before {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.12);
  box-shadow: 0 0 70px rgba(215, 178, 92, 0.07), inset 0 0 70px rgba(215, 178, 92, 0.04);
  pointer-events: none;
}
.spin-wheel {
  --r: 172px;
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.32);
  background:
    radial-gradient(circle at 50% 50%, rgba(215, 178, 92, 0.08), transparent 58%),
    repeating-conic-gradient(from 0deg, rgba(215, 178, 92, 0.035) 0deg 15deg, transparent 15deg 30deg),
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.045), transparent 55%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.38), 0 20px 50px rgba(0, 0, 0, 0.24);
  cursor: grab;
  touch-action: none;
  user-select: none;
  will-change: transform;
}
.spin-wheel:active,
.spin-wheel.is-dragging { cursor: grabbing; }
.spin-wheel::before {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  border: 1px dashed rgba(215, 178, 92, 0.16);
}
.spin-wheel.is-spinning { cursor: default; }
.spin-wheel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.18));
  pointer-events: none;
}
.spin-branch {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.22);
  background: rgba(13, 18, 24, 0.78);
  color: rgba(233, 226, 208, 0.88);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
  transform:
    rotate(calc(var(--i) * 30deg))
    translateY(calc(-1 * var(--r)))
    rotate(calc(var(--i) * -30deg));
  z-index: 2;
}
.spin-branch small { color: var(--muted-2); font-family: var(--sans); font-size: 7.5px; letter-spacing: 0; }
.spin-branch.is-current { border-color: var(--gold-2); box-shadow: 0 0 16px rgba(215, 178, 92, 0.34); }
.spin-hub {
  position: absolute;
  left: 50%; top: 50%;
  width: 104px; height: 104px;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.45);
  background: radial-gradient(circle at 36% 28%, #212b35, #0b1016 72%);
  box-shadow: 0 0 0 6px rgba(215, 178, 92, 0.04), 0 12px 28px rgba(0, 0, 0, 0.45), 0 0 28px rgba(215, 178, 92, 0.12);
  z-index: 4;
}
.spin-hub b { color: var(--gold-2); font-family: var(--serif); font-size: 24px; font-weight: 500; letter-spacing: 0.1em; line-height: 1; }
.spin-hub span { margin-top: 5px; color: var(--muted-2); font-size: 8px; letter-spacing: 0.2em; }
.spin-pointer {
  position: absolute;
  left: 50%;
  top: 1.5%;
  z-index: 6;
  width: 0; height: 0;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 17px solid var(--gold-2);
  filter: drop-shadow(0 0 8px rgba(241, 215, 149, 0.7));
}
.spin-agent {
  position: absolute;
  right: -6%;
  top: 48%;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--gold-2);
  font-size: 9px;
  letter-spacing: 0.1em;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.spin-agent i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 12px rgba(241, 215, 149, 0.8);
  animation: agentPulse 1.2s ease-in-out infinite;
}
.spin-agent.is-ai { color: var(--blue); right: auto; left: -5%; flex-direction: row-reverse; }
.spin-agent.is-ai i { background: var(--blue); box-shadow: 0 0 12px rgba(139, 182, 216, 0.8); }
.spin-hint { margin: 3px 0 0; color: var(--muted-2); font-size: 9.5px; letter-spacing: 0.1em; text-align: center; }

.spin-verdict {
  width: min(560px, calc(100% - 20px));
  margin: 0 auto;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(215, 178, 92, 0.34);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(28, 36, 45, 0.9), rgba(9, 13, 18, 0.92)),
    radial-gradient(80% 100% at 50% 0%, rgba(215, 178, 92, 0.09), transparent 70%);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38), 0 0 26px rgba(215, 178, 92, 0.08);
  animation: verdictIn 0.5s cubic-bezier(.2,.8,.2,1) both;
}
.spin-verdict-label { color: var(--gold); font-size: 9px; letter-spacing: 0.3em; }
.spin-verdict-main { display: flex; align-items: baseline; gap: 10px; margin-right: auto; }
.spin-verdict-main b { color: var(--gold-2); font-family: var(--serif); font-size: 22px; font-weight: 500; letter-spacing: 0.08em; }
.spin-verdict-main span { color: var(--muted); font-size: 10.5px; letter-spacing: 0.08em; }
.spin-enter { padding: 9px 16px; border-radius: 10px; font-size: 11.5px; }
.spin-foot {
  display: flex;
  justify-content: space-between;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding-top: 9px;
  border-top: 1px solid rgba(232, 222, 196, 0.07);
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.08em;
}
@keyframes agentPulse { 0%, 100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes verdictIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 1000px) {
  .spin-stage { padding: 16px 20px 12px; }
  .spin-main { grid-template-columns: minmax(130px, .6fr) minmax(330px, 1.2fr) minmax(130px, .6fr); gap: 8px; }
  .spin-wheel { --r: 135px; }
  .spin-result { width: 112px; min-height: 150px; }
  .spin-result b { font-size: 42px; }
  .spin-hub { width: 86px; height: 86px; }
  .spin-hub b { font-size: 20px; }
  .spin-branch { width: 40px; height: 40px; margin: -20px; font-size: 17px; }
}
@media (max-width: 760px) {
  .spin-stage { padding: 12px 14px 10px; min-height: 100dvh; overflow-y: auto; }
  .spin-top { padding-bottom: 10px; }
  .spin-step { font-size: 9px; padding: 5px 9px; }
  .spin-main {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "p a" "core core";
    align-items: start;
    gap: 8px 10px;
    padding: 2px 0;
  }
  .spin-side-p { grid-area: p; }
  .spin-side-a { grid-area: a; }
  .spin-core { grid-area: core; }
  .spin-result { width: min(132px, 39vw); min-height: 112px; padding: 9px 6px; }
  .spin-result b { font-size: 38px; }
  .spin-result small { font-size: 8px; }
  .spin-who { font-size: 12px; }
  .spin-role { display: none; }
  .spin-wheel-shell { width: min(340px, 88vw); }
  .spin-wheel { --r: 122px; }
  .spin-branch { width: 34px; height: 34px; margin: -17px; font-size: 15px; }
  .spin-branch small { font-size: 6.5px; }
  .spin-hub { width: 78px; height: 78px; }
  .spin-hub b { font-size: 18px; }
  .spin-hub span { font-size: 7px; }
  .spin-turn { font-size: 12px; }
  .spin-agent { right: -3%; font-size: 8px; }
  .spin-agent.is-ai { left: -3%; }
  .spin-verdict { width: 100%; padding: 10px 12px; gap: 9px; flex-wrap: wrap; }
  .spin-verdict-main b { font-size: 19px; }
  .spin-verdict-main span { font-size: 9px; }
  .spin-enter { padding: 8px 11px; font-size: 10.5px; }
  .spin-foot { font-size: 8px; }
}

/* ============================================================
   入局教程（仅月令合局模式内）
   ============================================================ */
.tutorial-dialog { width: min(900px, calc(100vw - 28px)); max-height: min(88vh, 820px); }
.tutorial-head { align-items: flex-start; }
.tutorial-heading { display: flex; flex-direction: column; gap: 5px; }
.tutorial-eyebrow { color: var(--gold); font-size: 9px; letter-spacing: 0.26em; text-transform: uppercase; }
.tutorial-heading h2 { font-size: 19px; letter-spacing: 0.09em; }
.tutorial-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px 0;
}
.tut-dot {
  appearance: none;
  width: 7px; height: 7px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(232, 222, 196, 0.16);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.tut-dot.is-active { width: 22px; border-radius: 9px; background: var(--gold-2); box-shadow: 0 0 12px rgba(241, 215, 149, 0.5); }
.tut-dot.is-done { background: rgba(215, 178, 92, 0.5); }
.tutorial-body { max-height: calc(min(88vh, 820px) - 150px); min-height: 320px; padding: 12px 26px 20px; }
.tutorial-step { animation: tutorialStepIn 0.35s ease both; }
.tutorial-lead { margin: 0 0 14px; color: var(--ink); font-size: 13px; line-height: 1.8; }
.tutorial-step h3 { margin: 14px 0 8px; }
.tutorial-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 2px solid rgba(215, 178, 92, 0.55);
  background: rgba(215, 178, 92, 0.045);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.tutorial-note b { color: var(--gold-2); }
.tutorial-list { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 11.5px; line-height: 1.8; }
.tutorial-list b { color: var(--ink); }
.tutorial-cycle-wrap {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  margin-top: 6px;
}
.tutorial-cycle {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.22);
  background: radial-gradient(circle, rgba(215, 178, 92, 0.07), transparent 62%);
}
.tutorial-cycle::before {
  content: "";
  position: absolute;
  inset: 17%;
  border: 1px dashed rgba(232, 222, 196, 0.12);
  border-radius: 50%;
}
.cycle-node {
  position: absolute;
  left: 50%; top: 50%;
  width: 44px; height: 44px;
  margin: -22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--tut-el) 70%, transparent);
  background: color-mix(in srgb, var(--tut-el) 76%, #0d1218);
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 19px;
  box-shadow: 0 0 16px color-mix(in srgb, var(--tut-el) 16%, transparent), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  transform: rotate(calc(var(--i) * 72deg)) translateY(-80px) rotate(calc(var(--i) * -72deg));
}
.cycle-center {
  position: absolute;
  left: 50%; top: 50%;
  width: 64px; height: 64px;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.36);
  background: #0d1319;
  color: var(--gold-2);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.25;
  text-align: center;
}
.cycle-center i { color: var(--muted); font-size: 11px; font-style: normal; }
.tutorial-cycle-copy { display: flex; flex-direction: column; gap: 12px; }
.tutorial-cycle-copy div { display: flex; flex-direction: column; gap: 3px; }
.tutorial-cycle-copy b { color: var(--gold-2); font-size: 10px; letter-spacing: 0.16em; }
.tutorial-cycle-copy span { color: var(--muted); font-size: 11.5px; line-height: 1.7; }

[data-el="木"] { --tut-el: #3f8a58; --tut-ink: #f1f8ee; }
[data-el="火"] { --tut-el: #b23a2e; --tut-ink: #ffede7; }
[data-el="土"] { --tut-el: #c39527; --tut-ink: #2a210c; }
[data-el="金"] { --tut-el: #e3dcc9; --tut-ink: #231f18; }
[data-el="水"] { --tut-el: #1b2733; --tut-ink: #dce9f6; }
.tutorial-cards { display: flex; flex-wrap: wrap; gap: 7px; }
.tut-card {
  width: 48px;
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid color-mix(in srgb, var(--tut-el) 72%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tut-el) 76%, #0d1218);
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 5px 12px rgba(0, 0, 0, 0.22);
}
.tut-card small { color: color-mix(in srgb, var(--tut-ink) 68%, transparent); font-family: var(--sans); font-size: 7px; letter-spacing: 0.04em; }
.tutorial-month-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin: 8px 0 12px; }
.tutorial-month-grid span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 1px 5px;
  border: 1px solid color-mix(in srgb, var(--tut-el) 55%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--tut-el) 30%, rgba(13, 18, 24, 0.8));
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 14px;
}
.tutorial-month-grid small { color: color-mix(in srgb, var(--tut-ink) 65%, transparent); font-family: var(--sans); font-size: 6.5px; }
.tutorial-fortune { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tutorial-fortune span {
  padding: 5px 8px;
  border: 1px solid rgba(215, 178, 92, 0.18);
  border-radius: 20px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
}
.tutorial-fortune b { color: var(--gold-2); margin-right: 3px; }
.tutorial-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 11px; }
.tutorial-table th, .tutorial-table td { padding: 6px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tutorial-table th { color: var(--muted-2); font-weight: 500; }
.tutorial-table td:first-child { color: var(--gold-2); }
.tutorial-table td:nth-child(4) { color: var(--gold-2); white-space: nowrap; }
.tutorial-score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.tutorial-score-grid > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px 11px;
  border: 1px solid rgba(215, 178, 92, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}
.tutorial-score-grid span { color: var(--muted-2); font-size: 9px; letter-spacing: 0.1em; }
.tutorial-score-grid b { color: var(--gold-2); font-family: var(--serif); font-size: 13px; font-weight: 500; }
.tutorial-score-grid small { color: var(--muted-2); font-size: 9px; }
.tutorial-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.1em;
}
.tutorial-foot .btn { min-width: 84px; }
.tutorial-foot #tutorial-count { color: var(--muted); }
@keyframes tutorialStepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 680px) {
  .tutorial-dialog { width: calc(100vw - 18px); max-height: 92vh; }
  .tutorial-head { padding: 12px 14px; }
  .tutorial-progress { padding: 9px 12px 0; }
  .tutorial-body { padding: 9px 14px 14px; min-height: 0; max-height: calc(92vh - 145px); }
  .tutorial-cycle-wrap { grid-template-columns: 1fr; gap: 10px; justify-items: center; }
  .tutorial-cycle { width: 200px; height: 200px; }
  .cycle-node { transform: rotate(calc(var(--i) * 72deg)) translateY(-72px) rotate(calc(var(--i) * -72deg)); }
  .tutorial-cycle-copy { width: 100%; }
  .tutorial-month-grid { grid-template-columns: repeat(6, 1fr); }
  .tutorial-score-grid { grid-template-columns: 1fr; }
  .tutorial-cards { gap: 5px; }
  .tut-card { width: 42px; height: 54px; font-size: 19px; }
  .tutorial-table { font-size: 10px; }
  .tutorial-table th, .tutorial-table td { padding: 5px 4px; }
  .tutorial-foot { padding: 9px 12px; }
}

.tutorial-example {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 10px;
  padding: 9px 11px;
  border: 1px solid rgba(215, 178, 92, 0.14);
  border-radius: 8px;
  background: rgba(215, 178, 92, 0.035);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.tutorial-example b { color: var(--gold-2); font-size: 10px; letter-spacing: 0.08em; }
.tutorial-example em { color: var(--gold-2); font-style: normal; }
.tutorial-examples { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 2px 0 10px; }
.tutorial-examples div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid rgba(215, 178, 92, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.022);
}
.tutorial-examples b { color: var(--gold-2); font-family: var(--serif); font-size: 11.5px; font-weight: 500; }
.tutorial-examples span { color: var(--muted); font-size: 10.5px; line-height: 1.65; }
.tutorial-examples em { color: var(--gold-2); font-style: normal; }
@media (max-width: 680px) {
  .tutorial-examples { grid-template-columns: 1fr; }
}

/* 教程第三页之后：少字、多图 */
.lesson-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 18px 12px;
  margin: 8px 0 12px;
  border: 1px solid rgba(215, 178, 92, 0.14);
  border-radius: 12px;
  background: radial-gradient(ellipse at 50% 50%, rgba(215, 178, 92, 0.045), transparent 68%);
  flex-wrap: wrap;
}
.lesson-month,
.lesson-card {
  width: 68px; height: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid color-mix(in srgb, var(--tut-el) 65%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--tut-el) 30%, rgba(13, 18, 24, 0.8));
  color: var(--tut-ink);
}
.lesson-month { border-radius: 50%; width: 78px; height: 78px; border-color: var(--gold); }
.lesson-month b, .lesson-card b { font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1; }
.lesson-month small, .lesson-card small { color: color-mix(in srgb, var(--tut-ink) 62%, transparent); font-size: 7px; letter-spacing: 0.04em; text-align: center; }
.lesson-join { color: var(--gold); font-size: 18px; opacity: 0.6; }
.lesson-result { display: flex; flex-direction: column; gap: 4px; }
.lesson-result b { color: var(--gold-2); font-family: var(--serif); font-size: 18px; font-weight: 500; }
.lesson-result small { color: var(--muted); font-size: 10px; }
.lesson-states { display: flex; flex-wrap: wrap; gap: 5px; margin: 7px 0 4px; }
.lesson-states span { padding: 5px 8px; border: 1px solid rgba(215, 178, 92, 0.16); border-radius: 20px; color: var(--muted); font-size: 10px; }
.lesson-states b { color: var(--gold-2); margin-right: 3px; }

.combo-note {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.combo-note b { color: var(--gold-2); }
.combo-figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.combo-figure {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 142px;
  padding: 9px 10px 8px;
  border: 1px solid rgba(215, 178, 92, 0.14);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.022);
}
.combo-figure-head { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.combo-figure-head b { color: var(--gold-2); font-family: var(--serif); font-size: 12px; font-weight: 500; }
.combo-figure-head span { color: var(--muted-2); font-size: 8px; }
.combo-figure > small { color: var(--muted-2); font-size: 8.5px; line-height: 1.5; }
.fig-line { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; }
.fig-card {
  width: 29px; height: 37px;
  display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--tut-el) 70%, transparent);
  border-radius: 5px;
  background: color-mix(in srgb, var(--tut-el) 78%, #0d1218);
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 16px;
  font-style: normal;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.fig-arrow { color: var(--gold); font-size: 13px; font-style: normal; opacity: 0.7; }
.fig-out {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--tut-el) 75%, transparent);
  background: color-mix(in srgb, var(--tut-el) 68%, #0d1218);
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 0 14px color-mix(in srgb, var(--tut-el) 18%, transparent);
}
.fig-triangle { position: relative; width: 132px; height: 108px; margin: 0 auto; }
.fig-triangle .fig-card { position: absolute; }
.fig-triangle .pos-a { left: 50%; top: 0; transform: translateX(-50%); }
.fig-triangle .pos-b { left: 6%; bottom: 0; }
.fig-triangle .pos-c { right: 6%; bottom: 0; }
.fig-triangle .tri-out { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.fig-triangle::before {
  content: "";
  position: absolute;
  inset: 10px 18px 0;
  border: 1px solid rgba(215, 178, 92, 0.12);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.draw-flow { display: flex; align-items: center; justify-content: center; gap: 7px; flex-wrap: wrap; margin: 12px 0 10px; }
.draw-flow > i { color: var(--gold); font-style: normal; font-size: 14px; opacity: 0.6; }
.flow-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 92px;
  padding: 9px 8px;
  border: 1px solid rgba(215, 178, 92, 0.18);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}
.flow-box b { color: var(--gold-2); font-family: var(--serif); font-size: 12px; font-weight: 500; }
.flow-box span { color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.flow-box.warn b { color: #e0a08f; }
.draw-facts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.draw-facts span { padding: 5px 8px; border-radius: 20px; background: rgba(215, 178, 92, 0.04); color: var(--muted); font-size: 9.5px; }
.score-examples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
.score-example {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  border: 1px solid rgba(215, 178, 92, 0.15);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.022);
}
.score-example span { color: var(--muted-2); font-size: 8px; letter-spacing: 0.12em; }
.score-example b { color: var(--gold-2); font-family: var(--serif); font-size: 11.5px; font-weight: 500; }
.score-example strong { color: var(--muted); font-size: 10px; font-weight: 400; }
.score-example em { color: var(--gold-2); font-style: normal; font-family: var(--serif); font-size: 14px; }
.win-flow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 0 6px; padding: 10px; border: 1px solid rgba(215, 178, 92, 0.14); border-radius: 9px; background: rgba(215, 178, 92, 0.035); flex-wrap: wrap; }
.win-flow span { color: var(--gold-2); font-family: var(--serif); font-size: 12px; }
.win-flow i { color: var(--gold); font-style: normal; opacity: 0.55; }
.tutorial-list.compact { margin-top: 6px; font-size: 11px; line-height: 1.7; }
@media (max-width: 680px) {
  .combo-figures { grid-template-columns: 1fr 1fr; }
  .combo-figure { min-height: 0; padding: 8px; }
  .combo-figure > small { display: none; }
  .score-examples { grid-template-columns: 1fr; }
  .draw-flow { gap: 5px; }
  .flow-box { min-width: 70px; }
  .lesson-stage { gap: 8px; padding: 12px 8px; }
  .lesson-month { width: 62px; height: 62px; }
  .lesson-card { width: 58px; height: 68px; }
}

.swap-lesson {
  margin: 6px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(215, 178, 92, 0.14);
  border-radius: 9px;
  background: rgba(215, 178, 92, 0.025);
}
.swap-flow { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.swap-flow span { color: var(--gold-2); font-family: var(--serif); font-size: 12px; }
.swap-flow i { color: var(--gold); font-style: normal; opacity: 0.55; }
.swap-backs-mini { display: flex; justify-content: center; gap: 5px; margin-top: 9px; }
.swap-backs-mini i {
  width: 20px; height: 28px;
  border-radius: 3px;
  border: 1px solid rgba(215, 178, 92, 0.22);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, #1c2530, #141b24);
}
.swap-lesson p { margin: 8px 0 0; color: var(--muted-2); font-size: 9.5px; line-height: 1.6; text-align: center; }

/* 教程月令试算器 */
.inspect-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 6px 0 12px;
  padding: 12px;
  border: 1px solid rgba(215, 178, 92, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
}
.inspect-block { display: flex; gap: 10px; align-items: flex-start; }
.inspect-label { width: 34px; flex: 0 0 auto; padding-top: 4px; color: var(--muted-2); font-size: 9px; letter-spacing: 0.14em; }
.inspect-months { display: flex; flex-wrap: wrap; gap: 4px; }
.inspect-month-chip {
  appearance: none;
  width: 25px; height: 25px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(215, 178, 92, 0.2);
  background: rgba(215, 178, 92, 0.05);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.inspect-month-chip:hover { transform: translateY(-1px); color: var(--ink); }
.inspect-month-chip.is-active { border-color: var(--gold-2); background: rgba(215, 178, 92, 0.18); color: var(--gold-2); box-shadow: 0 0 12px rgba(215, 178, 92, 0.22); }
.inspect-cards { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.inspect-card-row { display: flex; align-items: center; gap: 6px; }
.inspect-card-row > span { width: 22px; flex: 0 0 auto; color: var(--muted-2); font-size: 8px; letter-spacing: 0.08em; }
.inspect-card-row > div { display: flex; flex-wrap: wrap; gap: 4px; }
.inspect-chip {
  appearance: none;
  width: 27px; height: 29px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--tut-el) 55%, transparent);
  background: color-mix(in srgb, var(--tut-el) 30%, rgba(13, 18, 24, 0.8));
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.inspect-chip:hover { transform: translateY(-1px); }
.inspect-chip.is-active { border-color: var(--gold-2); box-shadow: 0 0 0 1px var(--gold), 0 0 12px rgba(215, 178, 92, 0.22); }
.inspect-output {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid rgba(215, 178, 92, 0.14);
  border-radius: 9px;
  background: rgba(215, 178, 92, 0.032);
}
.inspect-output-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.inspect-month-read { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; }
.inspect-output-top strong { color: var(--gold-2); font-family: var(--serif); font-size: 15px; font-weight: 500; }
.inspect-output-main { display: flex; align-items: center; gap: 14px; }
.inspect-big-card {
  width: 46px; height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 7px;
  border: 1px solid color-mix(in srgb, var(--tut-el) 70%, transparent);
  background: color-mix(in srgb, var(--tut-el) 72%, #0d1218);
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
}
.inspect-big-card small { color: color-mix(in srgb, var(--tut-ink) 65%, transparent); font-family: var(--sans); font-size: 7px; }
.inspect-state-copy { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 10.5px; }
.inspect-state-value { color: var(--gold-2); font-family: var(--serif); font-size: 20px; font-weight: 500; }
.inspect-score b { color: var(--gold-2); font-family: var(--serif); font-size: 16px; }
.inspect-statebar { display: flex; gap: 5px; }
.inspect-state-chip {
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(215, 178, 92, 0.1);
  color: var(--muted-2);
  font-size: 8px;
}
.inspect-state-chip.is-active { border-color: var(--gold); color: var(--gold-2); background: rgba(215, 178, 92, 0.12); }
.inspect-gate { color: #e0a08f; font-size: 9.5px; }
.inspect-gate.is-ok { color: #9ec9a7; }
@media (max-width: 680px) {
  .inspect-block { flex-direction: column; gap: 5px; }
  .inspect-label { width: auto; padding-top: 0; }
  .inspect-month-chip { width: 23px; height: 23px; font-size: 11px; }
  .inspect-chip { width: 25px; height: 27px; font-size: 12px; }
}

/* 胜方只得分的浮字，不做败方掉血 */
.score-side { position: relative; }
.score-gain {
  position: relative;
  display: inline-block;
  z-index: 8;
  margin-left: 2px;
  padding: 1px 6px;
  border-radius: 20px;
  border: 1px solid rgba(241, 215, 149, 0.45);
  background: rgba(20, 26, 33, 0.9);
  color: var(--gold-2);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  box-shadow: 0 0 18px rgba(215, 178, 92, 0.32);
  pointer-events: none;
  animation: scoreGain 1.2s cubic-bezier(.16,.8,.24,1) both;
}
@keyframes scoreGain {
  0% { opacity: 0; transform: translateY(6px) scale(.8); }
  18% { opacity: 1; transform: translateY(0) scale(1.06); }
  75% { opacity: 1; transform: translateY(-4px) scale(1); }
  100% { opacity: 0; transform: translateY(-10px) scale(1); }
}

/* 出牌池 / 拖牌 */
.play-pool-slot { min-width: 0; }
.play-pool {
  min-width: 132px;
  min-height: 144px;
  padding: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px dashed rgba(215, 178, 92, 0.26);
  border-radius: 12px;
  background: radial-gradient(circle at 50% 50%, rgba(215, 178, 92, 0.045), transparent 72%);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.play-pool.is-empty {
  width: 132px;
  flex-direction: column;
  gap: 5px;
}
.play-pool.is-filled {
  border-style: solid;
  border-color: rgba(215, 178, 92, 0.2);
  width: auto;
}
.play-pool.is-over {
  border-color: var(--gold-2);
  background: rgba(215, 178, 92, 0.1);
  box-shadow: 0 0 26px rgba(215, 178, 92, 0.2);
}
.play-pool-empty { color: var(--muted); font-family: var(--serif); font-size: 11px; letter-spacing: 0.06em; }
.play-pool.is-empty small { color: var(--muted-2); font-size: 8px; letter-spacing: 0.03em; }
.pool-minis { display: flex; align-items: center; gap: 3px; }
.pool-mini {
  width: 26px; height: 35px;
  display: grid; place-items: center;
  border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--tut-el) 60%, transparent);
  background: color-mix(in srgb, var(--tut-el) 68%, #0d1218);
  color: var(--tut-ink);
  font-family: var(--serif);
  font-size: 14px;
  font-style: normal;
  line-height: 1;
}
.pool-join { color: var(--gold); font-size: 12px; }
.pool-invalid { color: #e0a08f; font-size: 9px; line-height: 1.4; max-width: 48px; text-align: center; }
.play-pool .preview-card { width: 82px; height: 114px; }
.play-pool .preview-card .outcome-el { font-size: 36px; }
.play-pool .preview-card .outcome-score { font-size: 16px; }
.play-pool .preview-card .outcome-label { font-size: 8.5px; }

.drag-ghost {
  position: fixed;
  z-index: 200;
  transform: translate(-50%, -50%) rotate(-3deg) scale(0.78);
  pointer-events: none;
  opacity: 0.92;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.55), 0 0 34px rgba(215, 178, 92, 0.18);
  filter: brightness(1.08);
}
@media (max-width: 680px) {
  .play-pool { min-height: 120px; }
  .play-pool.is-empty { width: 112px; }
  .play-pool .preview-card { width: 72px; height: 100px; }
  .pool-mini { width: 22px; height: 31px; font-size: 12px; }
}
