:root {
  color-scheme: dark;
  --night: #0c0a0d;
  --wood: #1a1114;
  --paper: #ede0c8;
  --muted: #b6a491;
  --gold: #e9b949;
  --light-gold: #ffd97d;
  --red: #c92a2a;
  --light-red: #ff807a;
  --rule: #80654a55;
  --ink: #351f23;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 128'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.71' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' filter='url(%23n)' opacity='.25' d='M0 0h128v128H0z'/%3E%3C/svg%3E");
  font-family: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, STSong, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  background: radial-gradient(ellipse at 50% 42%, #2b1c22, var(--night) 68%);
  color: var(--paper);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; }
button:focus-visible, .panel:focus-visible { outline: 2px solid var(--light-gold); outline-offset: 2px; }
button:active:enabled { filter: brightness(1.18); }
svg { display: block; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
h1, h2, p { margin: 0; }

.game {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: 52px 140px minmax(0, 1fr) auto;
  width: min(100%, 460px, max(320px, 64vh));
  width: min(100%, 460px, max(320px, 64dvh));
  height: min(100vh, 818px);
  height: min(100dvh, 818px);
  min-height: 450px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 48%, #46303989, transparent 67%), linear-gradient(166deg, #1e171d, #0c0a10 83%);
  border: 1px solid #69503973;
  border-radius: 4px;
  box-shadow: inset 0 0 38px #080609b8, 0 16px 80px #050405;
}
.game::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--noise) 0 0 / 128px;
  opacity: .25;
}
.masthead, .dealer-zone, .table, .player-zone { position: relative; z-index: 2; min-width: 0; }

.atmosphere {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
.market-distance {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: min(52%, 300px);
  opacity: .68;
  transition: filter .65s, opacity .65s;
}
.hanging-charms {
  position: absolute;
  top: 25px;
  width: 100%;
  opacity: .54;
}
.hanging-strip { animation: hanging-paper 5.4s ease-in-out infinite alternate; }
.hanging-ribbon { animation-delay: -2.2s; animation-duration: 7.6s; }
.hanging-charms > g:nth-child(3) .hanging-strip { animation-delay: -1.7s; }
.hanging-charms > g:nth-child(4) .hanging-strip { animation-delay: -4.1s; }
@keyframes hanging-paper {
  from { transform: rotate(-5deg) skewX(-3deg); }
  to { transform: rotate(7deg) skewX(3deg); }
}
.spirit-papers { position: absolute; inset: 0; }
.spirit-paper {
  position: absolute;
  left: var(--left, 14%);
  top: -18px;
  width: var(--size, 9px);
  height: calc(var(--size, 9px) + 4px);
  border: 1px solid #d5c5ab52;
  background: linear-gradient(135deg, #e5d8c075, #98867226);
  opacity: 0;
  animation: paper-fall var(--fall, 12s) var(--delay, 0s) linear infinite;
}
.spirit-paper::after { content: ""; position: absolute; inset: 2px; border: 1px solid #d9c9af39; }
.p2 { --left: 34%; --fall: 14s; --delay: -3s; --size: 6px; }
.p3 { --left: 61%; --fall: 11s; --delay: -7s; --size: 11px; }
.p4 { --left: 83%; --fall: 15s; --delay: -2s; --size: 6px; }
.p5 { --left: 48%; --delay: -8s; --size: 5px; }
.p6 { --left: 76%; --fall: 10s; --delay: -6s; --size: 3px; }
.p7 { --left: 22%; --fall: 13s; --delay: -10s; --size: 2px; }
.p8 { --left: 92%; --fall: 9s; --delay: -4s; --size: 3px; }
@keyframes paper-fall {
  0% { opacity: 0; transform: translate3d(0, -10px, 0) rotate(0); }
  14% { opacity: .49; }
  53% { opacity: .36; transform: translate3d(18px, 47vh, 0) rotate(148deg); }
  87% { opacity: .25; }
  100% { opacity: 0; transform: translate3d(-14px, 103vh, 0) rotate(290deg); }
}
.fog-layer, .fog-layer::before, .fog-layer::after {
  position: absolute;
  inset: 31% -30% -8%;
  pointer-events: none;
}
.fog-layer::before, .fog-layer::after {
  content: "";
  inset: 0;
  filter: blur(12px);
  animation: fog-drift 14s ease-in-out infinite alternate;
}
.fog-layer::before {
  background: radial-gradient(ellipse at 35% 80%, #baccc33e, transparent 52%),
              radial-gradient(ellipse at 75% 60%, #8c9d9a27, transparent 55%);
}
.fog-layer::after {
  background: radial-gradient(ellipse at 45% 76%, #b61a365e, transparent 58%),
              radial-gradient(ellipse at 69% 50%, #a1273d4a, transparent 48%);
  visibility: hidden;
  animation-duration: 7.5s;
  animation-direction: alternate-reverse;
}
@keyframes fog-drift {
  from { transform: translateX(-8%) rotate(-4deg); opacity: .55; }
  to { transform: translateX(8%) rotate(2deg) scale(1.08); opacity: .95; }
}
.game[data-phase2="true"] .market-distance { filter: sepia(.55) hue-rotate(315deg) saturate(1.7); opacity: .83; }
.game[data-phase2="true"] .hanging-charms { filter: sepia(.86) hue-rotate(305deg) saturate(3); opacity: .75; }
.game[data-phase2="true"] .hanging-strip { animation-duration: 1.4s; }
.game[data-phase2="true"] .spirit-paper {
  border-color: #f365646e;
  background: linear-gradient(135deg, #eb435d90, #58112175);
  animation-duration: 6.2s;
}
.game[data-phase2="true"] .spirit-paper:nth-child(n+6) { box-shadow: 0 0 5px #e22b46; }
.game[data-phase2="true"] .fog-layer::before { visibility: hidden; }
.game[data-phase2="true"] .fog-layer::after { visibility: visible; }

.vignette {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  box-shadow: inset 0 0 58px #05030794;
  transition: box-shadow .5s ease;
}
.game[data-phase2="true"] .vignette { box-shadow: inset 0 0 94px #3f0715da, inset 0 0 30px #ab172d45; }
.game[data-danger="critical"] .vignette { animation: danger-pulse 1.65s ease-in-out infinite; }
@keyframes danger-pulse {
  0%, 100% { box-shadow: inset 0 0 70px #58091899, inset 0 0 25px #bd142a40; }
  45% { box-shadow: inset 0 0 112px #8d0d23d6, inset 0 0 38px #ed334a65; }
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px 0 15px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(90deg, #622c315f, #1b101600 76%);
}
.brand, .utility, .name-line, .life-line, .player-status { display: flex; align-items: center; }
.brand { min-width: 0; gap: 10px; }
.brand-seal {
  flex: 0 0 24px;
  height: 30px;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px solid #d9796d;
  outline: 1px solid #8c3c3a;
  outline-offset: 2px;
  border-radius: 2px 1px 3px 2px;
  background: var(--noise), #77252d;
  color: #fadbcd;
  font-size: 11px;
  line-height: 1;
  transform: rotate(-5deg);
}
h1 {
  color: #ebd7be;
  font-size: clamp(17px, 5.4vw, 24px);
  letter-spacing: .13em;
  white-space: nowrap;
  text-shadow: 0 2px 10px #bd575664;
}
.utility { gap: 2px; flex: none; }
.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 3px;
  color: #d4b88c;
}
.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) {
  .icon-button:hover, .slot:not(:disabled):hover { background-color: #90623a29; }
}

.dealer-zone {
  display: grid;
  grid-template: minmax(0, 1fr) 44px / minmax(94px, 32%) minmax(0, 1fr);
  gap: 0 8px;
  padding: 2px 12px 3px 7px;
  background: radial-gradient(ellipse at 19% 40%, #6d2a2b43, transparent 58%);
}
.dealer-portrait {
  --eye-light: #f4455b;
  --aura: #8a293d;
  position: relative;
  grid-row: 1 / span 2;
  display: grid;
  place-items: end center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  cursor: pointer;
}
.dealer-art { width: 100%; height: 100%; max-height: 138px; filter: drop-shadow(0 2px 7px var(--aura)); }
.dealer-aura { fill: var(--aura); opacity: .26; }
.dealer-portrait[data-form="opera"] { --eye-light: #91fbdc; --aura: #2c6968; }
.dealer-portrait[data-form="judge"] { --eye-light: #eea36a; --aura: #75443a; }
.dealer-form, .dealer-backdrop { display: none; }
.dealer-portrait[data-form="paper"] :is(.form-paper, .paper-backdrop),
.dealer-portrait[data-form="opera"] :is(.form-opera, .opera-backdrop),
.dealer-portrait[data-form="judge"] :is(.form-judge, .judge-backdrop) { display: inline; }
.dealer-phase2, .dealer-cracks, .dealer-sigil, .portrait-seal { opacity: 0; }
.dealer-phase1, .dealer-phase2, .dealer-cracks, .dealer-sigil { transition: opacity .34s ease; }
.dealer-body, .dealer-head, .dealer-mouth, .dealer-hands, .dealer-props, .dealer-pupils,
.dealer-sigil, .judge-flames, .portrait-drop {
  transform-box: fill-box;
  transform-origin: center;
}
.dealer-body {
  transform-origin: center bottom;
  transition: transform .28s ease, opacity .52s ease, filter .36s ease;
  animation: dealer-breathe 4.9s ease-in-out infinite;
}
.dealer-head {
  transform-origin: center 77%;
  transition: transform .27s ease;
  animation: head-twitch 7.7s ease-in-out infinite;
}
.dealer-neck {
  transform-box: view-box;
  transform-origin: 70px 80px;
  transform: rotate(-5deg);
  transition: transform .46s cubic-bezier(.18,.75,.3,1.25);
}
.dealer-pupils {
  opacity: .69;
  animation: pupil-watch 6.2s ease-in-out infinite;
  transition: opacity .18s ease, filter .18s ease;
}
.dealer-mouth, .dealer-hands { transition: transform .27s ease, filter .23s ease; }
.dealer-hands { transform-origin: center bottom; }
.dealer-props { transform-origin: center top; }
.paper-charm { animation: paper-charm 3.1s ease-in-out infinite alternate; }
.opera-plumes {
  transform-box: view-box;
  transform-origin: 70px 27px;
  animation: plume-shiver 3.9s ease-in-out infinite;
}
.judge-ribbons { animation: paper-charm 4.1s ease-in-out infinite alternate; }
.dealer-sigil { color: #db3951; }
.dealer-portrait[data-form="judge"] .portrait-bagua { opacity: .42; }
.dealer-portrait[data-form="judge"] .portrait-seal { opacity: 1; }

.game[data-phase2="true"] .dealer-portrait { --aura: #97213c; }
.game[data-phase2="true"] .dealer-portrait[data-form="opera"] { --aura: #437971; }
.game[data-phase2="true"] .dealer-portrait[data-form="judge"] { --eye-light: #ff3b4d; }
.game[data-phase2="true"] .dealer-phase1 { opacity: 0; }
.game[data-phase2="true"] :is(.dealer-phase2, .dealer-cracks) { opacity: 1; }
.game[data-phase2="true"] .dealer-backdrop { opacity: .74; }
.game[data-phase2="true"] .dealer-sigil { opacity: .82; animation: sigil-spin 13s linear infinite; }
.game[data-phase2="true"] .dealer-portrait[data-pose="idle"] .dealer-body { animation: dealer-agitated 2.8s ease-in-out infinite; }
.game[data-phase2="true"] .dealer-pupils { opacity: 1; filter: drop-shadow(0 0 2px var(--eye-light)); }
.game[data-phase2="true"] .form-paper .dealer-pupils circle { r: 2.2px; fill: #ff5968; }
.game[data-phase2="true"] .form-opera .dealer-pupils ellipse { rx: 2px; ry: 2.15px; fill: #99ffe0; }
.game[data-phase2="true"] .form-judge .dealer-pupils { fill: #fff2d9; }
.game[data-phase2="true"] .dealer-neck { transform: translate(-4px, 2px) rotate(-22deg); }
.game[data-phase2="true"] .form-opera .dealer-head { animation: broken-neck-twitch 4.1s ease-in-out infinite; }
.game[data-phase2="true"] .opera-plumes { animation: plume-shiver .91s ease-in-out infinite; }
.game[data-phase2="true"] .paper-charm { animation-duration: .82s; }
.game[data-phase2="true"] .judge-flames {
  transform-origin: center bottom;
  filter: drop-shadow(0 0 3px #ff233d);
  animation: flame-eyes .76s ease-in-out infinite alternate;
}
.game[data-phase2="true"] .portrait-drop { animation: portrait-tear 1.9s ease-in infinite; }
.game[data-phase2="true"] .judge-robe-veins { animation: robe-embers 2s ease-in-out infinite alternate; }

.dealer-portrait:is([data-pose="think"], [data-pose="peek"], [data-pose="reach"], [data-pose="enter"], [data-pose="loom"], [data-pose="rage"]) .dealer-pupils {
  opacity: 1;
  filter: drop-shadow(0 0 2px var(--eye-light));
}
.dealer-portrait:is([data-pose="think"], [data-pose="peek"], [data-pose="reach"]) .dealer-pupils {
  animation: none;
  transform: translate(.6px, 1.15px);
}
.dealer-portrait[data-pose="think"] .dealer-body { animation: none; transform: translateY(3px) scale(.98, .95); }
.dealer-portrait[data-pose="think"] .dealer-props { animation-duration: .72s; }
.dealer-portrait[data-pose="peek"] .dealer-body { animation: none; transform: translate(2px, 3px) skewX(-3deg); }
.game .dealer-portrait[data-pose="peek"] .dealer-head { animation: none; transform: translate(3px, 2px) rotate(13deg); }
.dealer-portrait[data-pose="reach"] .dealer-body { animation: none; transform: translateY(2px) scale(1.045); }
.dealer-portrait[data-pose="reach"] .dealer-hands { transform: translateY(-12px) scale(1.17); }
.game .dealer-portrait[data-pose="taunt"] .dealer-head { animation: none; transform: rotate(11deg); }
.dealer-portrait[data-pose="taunt"] .dealer-body { animation: taunt-shudder .24s ease-in-out 3; }
.dealer-portrait[data-pose="taunt"] .dealer-mouth { transform: scale(1.09, 1.28); filter: brightness(.67); }
.dealer-portrait[data-pose="hurt"] .dealer-body { animation: dealer-recoil .46s ease-out both; }
.dealer-portrait:is([data-pose="hurt"], [data-pose="fallen"]) .dealer-cracks { opacity: 1; }
.dealer-portrait[data-pose="rage"] .dealer-body { animation: rage-burst .68s ease-out both; }
.game .dealer-portrait[data-pose="rage"] .dealer-sigil { opacity: .9; animation: sigil-spin .8s linear infinite; }
.dealer-portrait[data-pose="loom"] .dealer-body {
  animation: none;
  transform: translateY(7px) scale(1.23);
  filter: drop-shadow(0 0 7px #140308);
  transition-duration: .72s;
}
.dealer-portrait[data-pose="enter"] .dealer-body { animation: dealer-arrive .7s ease-out both; }
.dealer-portrait[data-pose="fallen"] .dealer-body {
  animation: none;
  transform: translate(-3px, 9px) rotate(-15deg) scale(.96, .89);
  filter: grayscale(.88) brightness(.66);
  opacity: .46;
}

@keyframes dealer-breathe {
  0%, 100% { transform: rotate(-.8deg); }
  50% { transform: translateY(-1.25px) rotate(1.1deg) scaleY(1.02); }
}
@keyframes head-twitch {
  0%, 83%, 95%, 100% { transform: rotate(0); }
  86% { transform: rotate(-4deg); }
  90% { transform: translateX(.7px) rotate(3deg); }
}
@keyframes pupil-watch {
  0%, 100% { transform: translateX(-1.2px); }
  32%, 39% { transform: translateX(1.05px); }
  55%, 80% { transform: translate(.15px, .65px); }
  82% { transform: translate(.9px, 0); }
}
@keyframes paper-charm {
  from { transform: rotate(-8deg); }
  to { transform: rotate(8deg); }
}
@keyframes plume-shiver {
  0%, 100% { transform: scaleX(1) skewX(-2deg); }
  42% { transform: scaleX(1.06) skewX(3deg) rotate(2deg); }
  57% { transform: scaleX(.98) skewX(-2deg) rotate(-1deg); }
}
@keyframes broken-neck-twitch {
  0%, 66%, 77%, 100% { transform: rotate(0); }
  69% { transform: translateY(1.5px) rotate(-5deg); }
  72% { transform: translateX(1.2px) rotate(3deg); }
  74% { transform: rotate(-1.8deg); }
}
@keyframes dealer-agitated {
  0%, 100% { transform: rotate(-1.35deg); }
  46% { transform: translateY(-1.8px) rotate(1.55deg); }
  51% { transform: translate(.8px, -1.8px) rotate(.5deg); }
}
@keyframes flame-eyes {
  from { transform: scaleY(.79) skewX(-6deg); }
  to { transform: scaleY(1.07) skewX(4deg); }
}
@keyframes portrait-tear {
  0%, 20% { opacity: 0; transform: translateY(-2px); }
  50% { opacity: 1; }
  90%, 100% { opacity: 0; transform: translateY(8px); }
}
@keyframes robe-embers { from { opacity: .39; } to { opacity: 1; } }
@keyframes taunt-shudder {
  0%, 100% { transform: translateY(0) rotate(1deg); }
  56% { transform: translateY(-2.7px) rotate(-1.5deg); }
}
@keyframes dealer-recoil {
  20% { transform: translate(-4px, 1px) rotate(-7deg); filter: drop-shadow(0 0 5px #e43b53); }
  43% { transform: translate(3px, 2px) rotate(4deg); }
  65% { transform: translateX(-2px) rotate(-3deg); }
  100% { transform: none; }
}
@keyframes rage-burst {
  18% { transform: translate(-3px, -2px) rotate(-4deg) scale(1.08); }
  33% { transform: translate(2px, -2px) rotate(4deg) scale(1.16); filter: drop-shadow(0 0 7px var(--eye-light)); }
  61% { transform: translate(-2px, 0) rotate(-3deg) scale(1.09); }
  100% { transform: scale(1.03); }
}
@keyframes dealer-arrive {
  from { opacity: 0; transform: translateY(10px) scale(.94); }
  to { opacity: 1; transform: none; }
}
@keyframes sigil-spin { to { transform: rotate(360deg); } }

.game[data-form="opera"] {
  background: radial-gradient(ellipse at 49% 42%, #1d40428c, transparent 66%), linear-gradient(166deg, #10191c, #0d0a11 82%);
}
.game[data-form="opera"] .masthead { background: linear-gradient(90deg, #1f545269, #1b101600 73%); }
.game[data-form="opera"] .dealer-zone { background: radial-gradient(ellipse at 19% 40%, #2c7a7240, transparent 58%); }
.game[data-form="opera"] .table { border-color: #528f857a; }
.game[data-form="judge"] {
  background: radial-gradient(ellipse at 50% 44%, #4f251b8f, transparent 66%), linear-gradient(166deg, #191012, #09080c 84%);
}
.game[data-form="judge"] .masthead { background: linear-gradient(90deg, #73391e6b, #1b101600 72%); }
.game[data-form="judge"] .dealer-zone { background: radial-gradient(ellipse at 19% 40%, #90573b3e, transparent 58%); }
.game[data-form="judge"] .table { border-color: #a77a5490; }
.game[data-phase2="true"] {
  background: radial-gradient(ellipse at 50% 44%, #661522ac, transparent 71%), linear-gradient(166deg, #210c12, #090509 84%);
}
.game[data-phase2="true"][data-form="opera"] {
  background: radial-gradient(ellipse at 50% 44%, #6c172bae, #26363d68 47%, transparent 73%), #100a11;
}
.game[data-phase2="true"][data-form="judge"] {
  background: radial-gradient(ellipse at 50% 46%, #7d1c27a6, transparent 66%), #13090c;
}

.dealer-status { min-width: 0; align-self: end; }
.name-line { gap: 5px; min-width: 0; flex-wrap: wrap; }
.name-line h2 { font-size: 14px; letter-spacing: .1em; font-weight: 700; line-height: 1.2; }
.dealer-status h2 { color: #e0bc9c; }
.dealer-tier {
  padding: 1px 5px;
  border: 1px solid #8a6a4d7d;
  border-radius: 2px;
  background: #271a1f;
  color: #cfb292;
  font-size: 10px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.game[data-form="opera"] .dealer-tier { border-color: #5aa99b7d; background: #142b2d; color: #9ee0d0; }
.game[data-form="judge"] .dealer-tier { border-color: #b7864f8c; background: #331e14; color: #f3c495; }
.game[data-phase2="true"] .dealer-tier { border-color: #ff5b54a8; background: #471219; color: #ffb5ab; }
.dealer-speech {
  position: relative;
  margin-top: 3px;
  min-height: 24px;
  padding: 4px 6px;
  border: 1px solid #6b4c4377;
  border-radius: 1px 4px 4px;
  background: #281b21;
  color: #e1c8ae;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.dealer-speech::before {
  content: "";
  position: absolute;
  top: 7px;
  left: -4px;
  width: 6px;
  height: 6px;
  transform: rotate(45deg);
  border-left: 1px solid #6b4c4377;
  border-bottom: 1px solid #6b4c4377;
  background: inherit;
}
.game[data-phase2="true"] .dealer-speech { border-color: #b83b449e; background: #36141e; color: #ffd3c9; }
.life-line { gap: 6px; height: 31px; }
.life-label { flex: none; color: var(--muted); font-size: 11px; }
.candles { display: flex; gap: 1px; min-width: 0; align-items: center; height: 34px; }
.candle { width: 24px; min-width: 0; height: 36px; overflow: visible; }
.candle-glow { fill: #ffb653; opacity: .22; filter: blur(3px); }
.candle-flame { transform-origin: 13.5px 15px; animation: flicker 1.07s ease-in-out infinite alternate; }
.candle:nth-child(2n) .candle-flame { animation-delay: -.63s; }
.candle:nth-child(3n) .candle-flame { animation-duration: 1.43s; }
.candle:nth-child(4n) .candle-flame { animation-delay: -.95s; }
.candle-smoke { opacity: 0; fill: none; stroke: #a4c2b7; stroke-width: 1.2; stroke-linecap: round; }
.candle.is-out :is(.candle-flame, .candle-glow) { visibility: hidden; }
.candle.is-out .candle-base { filter: grayscale(.66) brightness(.63); }
.candle.just-out .candle-smoke { animation: smoke-rise 2.25s ease-out both; }
.candle.just-out .smoke-wisp { animation-delay: .12s; }
@keyframes flicker {
  0%, 100% { transform: scale(.96, 1.04) skewX(-5deg); }
  29% { transform: scale(1.08, .89) skewX(9deg); }
  64% { transform: scale(.92, 1.11) skewX(-8deg); }
}
@keyframes smoke-rise {
  0% { opacity: 0; transform: translateY(6px); }
  20% { opacity: .74; }
  100% { opacity: 0; transform: translate(4px, -17px) scale(1.18); }
}
.bound {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
  border: 1px solid #a44e4a75;
  border-radius: 3px;
  background: #442328;
  color: #ffc1a8;
  font-size: 10px;
  white-space: nowrap;
}
.bound svg { width: 17px; height: 16px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.inventory { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; min-width: 0; }
.slot, .slot-empty {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  min-height: 46px;
  padding: 2px 1px;
  border-radius: 4px;
  border: 1px solid #8a6648a8;
  background: radial-gradient(circle at 50% 25%, #5b3b2c78, #1a1117 82%);
  box-shadow: inset 0 1px 0 #f5cf9333, inset 0 0 8px #0a060b88;
  transition: transform .16s ease, border-color .2s ease, box-shadow .2s ease;
}
.slot::before {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid #d9b27a1c;
  border-radius: 2px;
  pointer-events: none;
}
.slot svg, .item-emblem svg {
  width: 28px;
  max-width: 100%;
  height: 28px;
  fill: none;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 3px #09050ab8);
}
.slot-name {
  display: block;
  max-width: 100%;
  font-size: 9px;
  line-height: 1.05;
  letter-spacing: .02em;
  color: #e8cfa9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot[data-item="peek"] { border-color: #d6aa558f; background: radial-gradient(circle at 50% 25%, #66491f7a, #191216 84%); }
.slot[data-item="burn"] { border-color: #cf7a4c8f; background: radial-gradient(circle at 50% 25%, #5c2e227a, #191115 84%); }
.slot[data-item="bell"] { border-color: #d95d548f; background: radial-gradient(circle at 50% 25%, #5f22287a, #181016 84%); }
.slot[data-item="invert"] { border-color: #b79c7b94; background: radial-gradient(circle at 50% 25%, #463a4c7a, #16111b 84%); }
.slot[data-item="rope"] { border-color: #db4b5494; background: radial-gradient(circle at 50% 25%, #631c297a, #180f16 84%); }
.slot[data-item="tea"] { border-color: #6ab5968f; background: radial-gradient(circle at 50% 25%, #204c417a, #111819 84%); }
@media (hover: hover) {
  .slot:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 #ffe2a854, 0 4px 12px #00000099, 0 0 10px #d9a05940;
  }
}
.slot-empty { border-color: #61493668; background: #0c090d66; box-shadow: none; }
.slot-empty::after { content: ""; width: 4px; height: 4px; border: 1px solid #98755852; transform: rotate(45deg); }
.slot:disabled { opacity: .66; }
.dealer-inventory { gap: 2px; }
.dealer-inventory .slot { min-height: 44px; padding: 1px; }
.dealer-inventory .slot svg { width: 26px; height: 26px; }
.player-inventory .slot { min-height: 50px; padding: 3px 1px 2px; }
.player-inventory .slot svg { width: 29px; height: 29px; }

.table {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  margin: 3px 12px 0;
  border: 1px solid #89614092;
  background:
    var(--noise) 0 0 / 128px,
    repeating-linear-gradient(96deg, transparent 0 18px, #b7906813 19px, transparent 21px 43px),
    repeating-linear-gradient(91deg, #26121728 0 1px, transparent 2px 8px, #ad745413 9px, transparent 10px 19px),
    radial-gradient(ellipse at 50% 64%, #54372c, #251719 73%, #180f15);
  box-shadow: inset 0 0 34px #0e080aa1;
}
.table::after { content: ""; position: absolute; inset: 3px; border: 1px solid #a97d5033; pointer-events: none; }
.game[data-phase2="true"] .table {
  border-color: #b43a4ec7;
  box-shadow: inset 0 0 48px #4d0716da, 0 0 22px #b01e2b4a;
}
.table-corners { position: absolute; inset: 2px; z-index: 4; color: #ad855b; pointer-events: none; opacity: .79; }
.table-corners i {
  position: absolute;
  width: 15px;
  height: 15px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  background: linear-gradient(135deg, #ab785947, transparent 68%);
}
.table-corners i::before, .table-corners i::after { content: ""; position: absolute; }
.table-corners i::before {
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border: 1px solid currentColor;
  border-right-color: transparent;
}
.table-corners i::after {
  top: 4px;
  left: 4px;
  width: 4px;
  height: 4px;
  border: 1px solid currentColor;
  border-bottom-color: transparent;
}
.table-corners i:nth-child(1) { top: 0; left: 0; }
.table-corners i:nth-child(2) { top: 0; right: 0; transform: rotate(90deg); }
.table-corners i:nth-child(3) { bottom: 0; right: 0; transform: rotate(180deg); }
.table-corners i:nth-child(4) { bottom: 0; left: 0; transform: rotate(270deg); }
.game[data-phase2="true"] .table-corners { color: #b65c5c; }
.table-top { position: relative; z-index: 2; min-width: 0; padding: 2px 9px 0; background: #171015ba; }
.stakes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) minmax(0, .86fr);
  align-items: stretch;
  min-height: 34px;
  border-bottom: 1px solid #87654946;
}
.stake { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; text-align: center; font-size: 12px; }
.stake + .stake { border-left: 1px solid #87654935; }
.stake:first-child { flex-wrap: wrap; align-content: center; row-gap: 0; }
.stake strong {
  min-width: 0;
  color: var(--light-gold);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.stake-name { color: var(--muted); font-size: 10px; white-space: nowrap; }
.stakes #prize { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.lot-ledger { display: flex; align-items: center; gap: 7px; min-height: 29px; font-size: 11px; color: var(--muted); }
.ledger-counts, .ledger-left { flex: none; white-space: nowrap; }
.ledger-left strong { color: var(--paper); }
.ink-good { color: var(--light-gold); }
.ink-bad { color: var(--light-red); }
.history {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  list-style: none;
  min-width: 0;
  max-height: 66px;
  margin: 0;
  padding: 2px 0;
  overflow: auto;
}
.history:empty::after { content: "尚未开签"; font-size: 10px; opacity: .8; }
.history-lot {
  position: relative;
  min-width: 15px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0 1px;
  background: #322328;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 10px;
  line-height: 1;
}
.history-lot.is-burnt { border-style: dashed; background: #1c181a; }
.history-lot.is-inverted::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 4px;
  height: 4px;
  background: #a1c8b5;
  transform: rotate(45deg);
}

.stage { position: relative; isolation: isolate; min-height: 0; display: grid; place-items: end center; overflow: hidden; }
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background: radial-gradient(ellipse at 50% 66%, #b88b5f33, transparent 69%);
  pointer-events: none;
}
.stage.is-charged::before { background: radial-gradient(ellipse at 50% 62%, #e634407d, #751d2f31 45%, transparent 75%); }
.game[data-phase2="true"] .stage::after {
  content: "";
  position: absolute;
  inset: 7% -12% -13%;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 27% 86%, #a6243b54, transparent 48%),
              radial-gradient(ellipse at 76% 27%, #7c16284d, transparent 45%);
  mix-blend-mode: screen;
  filter: blur(9px);
  animation: fog-drift 5.9s ease-in-out infinite alternate;
}
.lantern {
  position: absolute;
  top: -1px;
  z-index: 2;
  width: clamp(34px, 10%, 44px);
  aspect-ratio: 48 / 80;
  transform-origin: top center;
  color: #2d141a;
  filter: drop-shadow(0 4px 8px #e3c4a15c);
  opacity: .92;
  pointer-events: none;
  animation: lantern-sway 5.2s ease-in-out infinite alternate;
  transition: filter .53s ease, opacity .62s ease;
}
.lantern svg { width: 100%; height: 100%; }
.lantern span {
  position: absolute;
  inset: 23% 0 auto;
  height: 44%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.lantern-left { left: 8px; animation-delay: -1.2s; }
.lantern-right { right: 8px; animation-duration: 6.1s; }
.lantern-seep { opacity: 0; }
.game[data-form="opera"] .lantern {
  color: #112b2b;
  filter: sepia(.51) hue-rotate(112deg) saturate(1.26) drop-shadow(0 3px 9px #638c724a);
}
.game[data-form="judge"] .lantern {
  color: #42141a;
  filter: sepia(.53) saturate(1.71) drop-shadow(0 4px 9px #ad5b497c);
}
.game[data-phase2="true"] .lantern {
  color: #36080e;
  filter: sepia(1) hue-rotate(304deg) saturate(4.3) drop-shadow(0 4px 10px #d2223d95);
  animation-name: lantern-blood-sway;
  animation-duration: 1.7s;
}
.game[data-phase2="true"] .lantern-right { animation-duration: 1.43s; }
.game[data-phase2="true"] .lantern-seep { opacity: .92; }
.game.is-dying .lantern { opacity: .08; filter: brightness(.13); }
@keyframes lantern-sway {
  from { transform: rotate(-6deg); }
  to { transform: rotate(6deg); }
}
@keyframes lantern-blood-sway {
  0% { transform: rotate(-13deg); }
  54% { transform: rotate(6deg); }
  73% { transform: rotate(2deg); }
  100% { transform: rotate(15deg); }
}

.stage-ring {
  position: absolute;
  z-index: -1;
  bottom: 3%;
  left: 50%;
  width: min(83%, 315px);
  height: 54%;
  transform: translateX(-50%);
  border: 1px solid #ba825045;
  border-radius: 50%;
  color: #b38966;
  box-shadow: inset 0 0 0 5px #22151972, inset 0 0 0 6px #d3a36430, 0 0 24px #2a1016;
  pointer-events: none;
}
.stage-ring svg { width: 100%; height: 100%; opacity: .39; }
.stage-ring::before, .stage-ring::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  top: 56%;
  border: 1px solid #bc8a577f;
  transform: rotate(45deg);
}
.stage-ring::before { left: 10%; }
.stage-ring::after { right: 10%; }
.stage.is-good .stage-ring { animation: gold-ring .92s ease-out both; }
@keyframes gold-ring {
  0% { box-shadow: 0 0 0 #ffd97d00; }
  30% { border-color: #ffe8a3; box-shadow: 0 0 38px #e4bd729e, inset 0 0 45px #e9dca45d; }
}
.ritual-circle {
  position: absolute;
  z-index: -2;
  left: 50%;
  top: 53%;
  width: min(86%, 270px);
  aspect-ratio: 1;
  color: #fa4358;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.76);
  transition: opacity .65s ease, transform .65s ease;
  pointer-events: none;
}
.ritual-circle svg { width: 100%; height: 100%; filter: drop-shadow(0 0 5px #ce213c); }
.game[data-phase2="true"] .ritual-circle { opacity: .77; transform: translate(-50%, -50%); }
.game[data-phase2="true"] .ritual-circle svg { animation: sigil-spin 16s linear infinite; }
.stage-chains {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0;
  filter: blur(.45px) drop-shadow(2px 3px 1px #16060c);
  transition: opacity .6s ease;
  pointer-events: none;
}
.game[data-phase2="true"] .stage-chains { opacity: .8; animation: chain-drift 4.6s ease-in-out infinite alternate; }
@keyframes chain-drift { to { transform: translate(2px, -5px) rotate(-.8deg); } }
.incense {
  position: absolute;
  z-index: -1;
  left: 11%;
  bottom: 6%;
  width: min(16%, 68px);
  max-height: 75%;
  overflow: visible;
  opacity: .8;
  pointer-events: none;
}
.incense-smoke path {
  stroke: #b0cdc5;
  stroke-width: 2;
  opacity: .46;
  filter: blur(.8px);
  transform-origin: center bottom;
  animation: incense-drift 5.1s ease-in-out infinite alternate;
}
.incense-smoke path:nth-child(2) { animation-delay: -2.3s; }
.incense-smoke path:nth-child(3) { animation-delay: -3.5s; }
.game[data-phase2="true"] .incense-smoke path { stroke: #da586c; }
@keyframes incense-drift {
  from { opacity: .14; transform: skewX(-7deg) translateY(2px); }
  to { opacity: .62; transform: skewX(9deg) translateY(-3px); }
}

.particles { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.particle {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  opacity: 0;
  animation: particle-burst var(--dur, .85s) cubic-bezier(.16,.84,.32,1) both;
}
.particle--good { background: radial-gradient(circle, #fff3d0, #caa96a 70%); box-shadow: 0 0 8px #e2ce96; border-radius: 2px; }
.particle--bad { background: radial-gradient(circle, #ff8b73, #b81926 70%); box-shadow: 0 0 8px #ff3b30; }
.particle--phase2 {
  width: 10px;
  height: 15px;
  border-radius: 1px;
  border: 1px solid #ff8b6b;
  background: #a82028cc;
  box-shadow: 0 0 10px #ff383888;
}
.particle--blood {
  width: 5px;
  height: 10px;
  background: linear-gradient(#f04054, #6f081a 82%);
  box-shadow: 0 0 6px #a91535;
  border-radius: 68% 30% 60% 39%;
}
.particle--blood:nth-child(3n) { width: 3px; height: 6px; }
.particle--blood:nth-child(4n) { width: 8px; height: 4px; }
@keyframes particle-burst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(.5) rotate(0); }
  75% { opacity: .95; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(1.1) rotate(var(--rot, 0deg));
  }
}
.tube {
  position: absolute;
  bottom: 0;
  left: 50%;
  z-index: 1;
  width: min(196px, 65%);
  height: min(90%, 190px);
  transform: translateX(-50%);
  transform-origin: 50% 83%;
}
.tube-art { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tube-letter { fill: #301821; font-size: 15px; font-family: inherit; }
.tube.is-shaking { animation: tube-shake .72s ease both; }
.tube.is-shaking .tube-sticks { transform-origin: 98px 88px; animation: stick-shake .13s linear alternate 5; }
@keyframes tube-shake {
  0%, 100% { transform: translateX(-50%); }
  15%, 44%, 72% { transform: translate(-54%, -3%) rotate(-12deg); }
  29%, 58%, 85% { transform: translate(-46%, -2%) rotate(11deg); }
}
@keyframes stick-shake { to { transform: translateY(-4px) rotate(6deg); } }
.lot {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 29%;
  width: 34px;
  height: 66%;
  min-height: 48px;
  max-height: 110px;
  opacity: 0;
  perspective: 450px;
  transform: translate(-50%, 35%);
}
.tube-cover { z-index: 2; pointer-events: none; }
.lot.is-rising { animation: lot-rise .36s cubic-bezier(.18,.69,.26,1) both; }
.lot.is-hiding { animation: lot-hide .28s ease-in both; }
@keyframes lot-rise {
  0% { opacity: 0; transform: translate(-50%, 35%) rotate(-5deg); }
  36% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -30%) rotate(-2deg); }
}
@keyframes lot-hide {
  0% { opacity: 1; transform: translate(-50%, -30%) rotate(-2deg); }
  100% { opacity: 0; transform: translate(-50%, 12%) scale(.92); }
}
.lot-turn { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .32s cubic-bezier(.3,.66,.4,1); }
.lot.is-revealed .lot-turn { transform: rotateY(180deg); }
.lot-face {
  position: absolute;
  inset: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 3px;
  border-radius: 4px 4px 2px 2px;
  border: 1px solid #e0b47d;
  background: var(--noise), linear-gradient(90deg, #7d4d30, #c38e57 12%, #edc68b 46%, #a96d3f);
  color: #55302a;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.lot-back { box-shadow: 0 0 16px #ecac6a38; font-size: 13px; line-height: 1.08; }
.lot-back i { width: 5px; height: 5px; transform: rotate(45deg); border: 1px solid #8f523c; }
.lot-front { transform: rotateY(180deg); }
.lot-front small { font-size: 9px; }
.lot-front strong { font-size: 25px; line-height: 1; }
.lot-front span { writing-mode: vertical-rl; font-size: 7px; letter-spacing: .08em; }
.lot[data-kind="good"] .lot-front { color: #623e06; box-shadow: 0 0 28px #ffd97d9e; }
.lot[data-kind="bad"] .lot-front { color: #7b1724; box-shadow: 0 0 24px #d534456b; }
.lot.is-burnt .lot-face { border-color: #f3af6c; box-shadow: 0 -5px 17px #ef704e91; }
.peek-mark, .bell-mark {
  position: absolute;
  z-index: 3;
  top: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: calc(50% - 47px);
  padding: 2px 4px 2px 2px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: #211a1d;
  font-size: 11px;
  line-height: 1.2;
}
.peek-mark { left: 44px; color: #d5cf9e; animation: spirit-float 2.8s ease-in-out infinite; }
.peek-mark[data-kind="bad"] { color: #f7988d; }
.bell-mark { right: 44px; color: #ffaaa1; box-shadow: 0 0 13px #c92a2a7f; }
.peek-mark svg, .bell-mark svg { flex: 0 0 17px; width: 17px; height: 17px; fill: none; stroke-width: 1.25; stroke-linejoin: round; }
#peek-text { min-width: 0; overflow-wrap: anywhere; }
@keyframes spirit-float { 50% { transform: translateY(-3px); } }
.float-text {
  position: absolute;
  z-index: 4;
  right: 6%;
  bottom: 47%;
  max-width: 49%;
  color: var(--light-gold);
  font-size: 15px;
  font-weight: bold;
  text-align: right;
  text-shadow: 0 2px 5px #0a080a, 0 0 10px currentColor;
  overflow-wrap: anywhere;
  pointer-events: none;
  opacity: 0;
}
.float-text.is-floating { animation: float-up .79s ease-out both; }
.float-text[data-tone="bad"] { color: var(--light-red); }
@keyframes float-up {
  0% { opacity: 0; transform: translateY(10px); }
  20%, 70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-27px); }
}
.table-note {
  position: relative;
  z-index: 3;
  min-height: 29px;
  display: grid;
  place-items: center;
  padding: 4px 7px;
  text-align: center;
  border-top: 1px solid #9e754841;
  background: #1a1218db;
  color: #e5c8a5;
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.flash, .flash-good { position: absolute; z-index: 7; inset: 0; pointer-events: none; opacity: 0; }
.flash { background: radial-gradient(ellipse, #c92a2a54, #ff4d4fbb 75%, #8a1623ed); }
.flash-good { background: radial-gradient(ellipse at 50% 56%, #dbdfad57, #b4ad6d29 58%, transparent 82%); }
.flash.is-flashing { animation: flash-red .52s ease-out both; }
.flash-good.is-flashing { animation: flash-gold .85s ease-out both; }
.game:has(.cinema.is-victory) :is(.flash-good, .stage-ring) { animation: none; }
.game.is-hit { animation: screen-shake .48s ease-out both; }
.game.is-good-pulse .candle:not(.is-out) .candle-glow { opacity: .55; transform: scale(1.35); transition: opacity .25s, transform .25s; }
@keyframes flash-red { 0%, 100% { opacity: 0; } 14% { opacity: .82; } 44% { opacity: .36; } }
@keyframes flash-gold { 0%, 100% { opacity: 0; } 22% { opacity: .82; } 60% { opacity: .34; } }
@keyframes screen-shake {
  10%, 48% { transform: translate(-5px, 2px); }
  24%, 64% { transform: translate(5px, -2px); }
  38%, 80% { transform: translate(-3px, 1px); }
}

#death-veil {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  background-color: transparent;
  transition: opacity .28s ease, background-color .9s ease-in;
}
#death-veil::before, #death-veil::after { content: ""; position: absolute; inset: -8%; }
#death-veil::before {
  background: radial-gradient(ellipse at 50% 48%, #9d092b1a 12%, #9d0a333d 37%, #bf103fe6 72%, #260008 98%);
  opacity: 0;
}
#death-veil::after {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 620' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%23380011' stroke-linecap='round'%3E%3Cpath stroke-width='4' d='M0 37l34 21 12 37 27 15 8 25 23 19M0 515l32-31 24-3 12-32 36-28M340 72l-44 22-8 30-26 18-11 31M340 543l-38-28-8-30-26-8-14-33'/%3E%3Cpath stroke-width='1.6' d='M34 58 16 81l2 34-18 27m46-47 13-24-3-31M73 110l33-7 13-12m-38 44-13 17 2 20M32 484l-3-33-15-20m42 50 16 19 20 4m-24-55-8-25 10-25m226-305 2-30-19-19m9 79 28 8 24 30m-78-20-18-5-9-19m67 397-7 32 11 28m-12-90 22-11 10-31m-58 34-24 14-17-10'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
  opacity: 0;
}
#death-veil.is-red {
  opacity: 1;
  background-color: #51001235;
  -webkit-backdrop-filter: blur(2.5px) saturate(1.35);
  backdrop-filter: blur(2.5px) saturate(1.35);
}
#death-veil.is-red::before { animation: death-red-pulse .95s ease-in-out both; }
#death-veil.is-red::after { animation: death-veins .95s ease-out both; }
#death-veil.is-black {
  opacity: 1;
  background-color: #000;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#death-veil.is-black::before { animation: red-to-black .94s ease-in both; }
.game.is-dying :is(.masthead, .dealer-zone, .table, .player-zone) { animation: death-scene-lean .95s ease-in both; }
@keyframes death-red-pulse {
  0% { opacity: .14; transform: scale(1.12); }
  23% { opacity: 1; transform: scale(1.02); }
  45% { opacity: .55; }
  69% { opacity: 1; transform: scale(.95); }
  100% { opacity: .89; transform: scale(1); }
}
@keyframes death-veins {
  from { opacity: 0; transform: scale(1.15); }
  to { opacity: .87; transform: scale(.96) rotate(-1.3deg); }
}
@keyframes death-scene-lean {
  from { transform: none; filter: none; }
  to { transform: scale(1.018) rotate(-.85deg); filter: blur(1.45px) brightness(.81); }
}
@keyframes red-to-black {
  0% { opacity: .88; }
  60% { opacity: .31; }
  100% { opacity: 0; }
}

.cinema {
  position: absolute;
  inset: 0;
  z-index: 9;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .34s ease;
}
.cinema-inner { width: min(100%, 350px); text-align: center; transform: scale(.94); transition: transform .55s ease; }
.cinema strong {
  display: block;
  color: #ff565e;
  font-size: clamp(26px, 8vw, 38px);
  letter-spacing: .11em;
  line-height: 1.24;
  overflow-wrap: anywhere;
}
.cinema span { display: block; margin-top: 10px; font-size: 13px; letter-spacing: .15em; line-height: 1.45; }
.cinema.is-death {
  opacity: 1;
  background: radial-gradient(ellipse at 50% 47%, #2c030dcc, #000 72%);
  animation: death-title-in 1.25s ease-out both;
}
.cinema.is-death .cinema-inner { transform: scale(1); }
.cinema.is-death strong { color: #e5374c; text-shadow: 0 2px #650d1c, 0 6px 5px #630719, 0 0 22px #9e0d28; }
.cinema.is-death span { color: #e39aa5; }
@keyframes death-title-in {
  from { opacity: 0; }
  42% { opacity: .63; }
  to { opacity: 1; }
}
.cinema.is-phase2 {
  opacity: 1;
  background: radial-gradient(ellipse at 50% 48%, #610d17bf, #0b050ce3 75%);
  animation: cinema-flash 1.55s ease-out both;
}
.cinema.is-phase2 .cinema-inner { transform: scale(1); }
.cinema.is-phase2 strong { color: #ff7478; text-shadow: 0 0 22px #d91c2b, 0 3px 10px #000; }
.cinema.is-phase2 span { color: #f5cbd0; }
.cinema.is-victory {
  opacity: 1;
  background: radial-gradient(ellipse at 50% 48%, #2b0509e6, #070306f7 78%);
  animation: cinema-flash 1.55s ease-out both;
}
.cinema.is-victory .cinema-inner { transform: scale(1); }
.cinema.is-victory strong {
  color: #ff3b3b;
  text-shadow: 0 1px #d91e2b, 0 3px #8d101e, 0 8px 5px #650817, 0 0 25px #ca102ac2;
}
.cinema.is-victory span { color: #ff7a84; text-shadow: 0 2px 5px #590917; }
@keyframes cinema-flash {
  0% { opacity: 0; }
  18%, 77% { opacity: 1; }
  100% { opacity: 0; }
}
#cinema-drips {
  position: relative;
  display: none;
  width: min(67%, 196px);
  height: 30px;
  margin: -3px auto 0;
}
.cinema:is(.is-death, .is-victory) #cinema-drips { display: block; }
.blood-drip {
  position: absolute;
  top: 0;
  left: var(--drip-left);
  width: var(--drip-width, 3px);
  height: var(--drip-length);
  transform: scaleY(0);
  transform-origin: top center;
  border-radius: 40% 35% 55% 63%;
  background: linear-gradient(90deg, #5c0612, #c32237 48%, #790a19 85%);
  box-shadow: 0 1px 5px #9e0e27a3;
}
.blood-drip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 93%;
  width: calc(100% + 2px);
  height: 7px;
  border-radius: 61% 62% 63% 60% / 78% 78% 41% 41%;
  background: radial-gradient(ellipse at 38% 34%, #e13948, #7b0c1e 62%, #360410 99%);
  transform: translateX(-50%);
  opacity: 0;
}
.d1 { --drip-left: 7%; --drip-length: 14px; --drip-delay: .19s; }
.d2 { --drip-left: 26%; --drip-length: 24px; --drip-delay: .29s; --drip-width: 4px; }
.d3 { --drip-left: 48%; --drip-length: 17px; --drip-delay: .15s; }
.d4 { --drip-left: 70%; --drip-length: 27px; --drip-delay: .23s; --drip-width: 4px; }
.d5 { --drip-left: 91%; --drip-length: 18px; --drip-delay: .34s; }
.cinema:is(.is-death, .is-victory) .blood-drip { animation: blood-thread 1.07s var(--drip-delay) ease-out both; }
.cinema:is(.is-death, .is-victory) .blood-drip::after { animation: blood-bead 1.26s var(--drip-delay) ease-in both; }
@keyframes blood-thread {
  0% { transform: scaleY(.03); opacity: 0; }
  20% { opacity: .97; }
  58% { transform: scaleY(.62); }
  100% { transform: scaleY(1); opacity: 1; }
}
@keyframes blood-bead {
  0%, 17% { opacity: 0; transform: translate(-50%, 0) scale(.6); }
  61% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  79% { opacity: .95; transform: translate(-50%, 4px) scale(.86, 1.12); }
  100% { opacity: 0; transform: translate(-50%, 16px) scale(.83, 1.3); }
}

.player-zone {
  padding: 3px 12px 12px;
  background: linear-gradient(0deg, #271922d9, #18101765 83%, transparent);
}
.player-status { justify-content: space-between; gap: 4px; min-height: 36px; padding: 0 3px; }
.player-status h2 { color: #f1d5a8; }
.player-inventory .slot svg { width: 30px; height: 30px; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 7px; }
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  min-height: 52px;
  padding: 4px 6px;
  border-radius: 3px;
  border: 1px solid;
  box-shadow: inset 0 0 0 2px #0b070962, 0 3px 9px #08060987;
  text-align: center;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.action strong { font-size: 18px; letter-spacing: .12em; }
.action span { color: inherit; font-size: 10px; letter-spacing: .035em; }
.action-gold { border-color: #cb9a4c; background: linear-gradient(125deg, #584024, #33231c); color: var(--light-gold); }
.action-red { border-color: #b5534e; background: linear-gradient(125deg, #5b2b30, #341c26); color: #ffc1b7; }
.action:disabled { filter: saturate(.61); opacity: .62; }
@media (hover: hover) { .action:hover:enabled { filter: brightness(1.14); } }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  padding: 13px;
  background: #08060ae3;
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
}
.overlay--deal { background: #0e0a10c4; cursor: pointer; }
.panel {
  position: relative;
  width: min(100%, 357px);
  max-height: 100%;
  overflow: auto;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
  padding: 21px 16px 16px;
  background-color: #e2c89c;
  background-image: var(--noise), radial-gradient(ellipse at 45% 35%, #f0deb6, #d7ba8e 78%, #b3885f);
  color: var(--ink);
  color-scheme: light;
  outline: 1px solid #ce9c6c;
  border: 3px double #8a5345;
  border-radius: 4px 2px 5px 2px;
  text-align: center;
  box-shadow: 0 12px 55px #000b;
  animation: paper-open .23s ease-out both;
}
@keyframes paper-open { from { opacity: 0; transform: translateY(6px) scale(.985); } }
.title-sub { margin-top: 4px; color: #7a3e38; font-size: 12px; letter-spacing: .2em; }
.story-box {
  margin: 10px 0 0;
  padding: 10px 11px;
  text-align: left;
  background: #23141914;
  border-left: 2px solid #963938;
  border-radius: 2px;
}
.story-line { margin: 0; font-size: 12.5px; line-height: 1.62; color: #361d21; animation: story-fade .65s ease-out both; }
.story-line + .story-line { margin-top: 6px; }
.story-line:nth-child(2) { animation-delay: .18s; }
.story-line:nth-child(3) { animation-delay: .36s; }
.story-line em { font-style: normal; color: #8c2224; font-weight: 700; }
@keyframes story-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.title-tips {
  margin: 9px 0 0;
  padding: 7px 10px 7px 22px;
  text-align: left;
  font-size: 11.5px;
  line-height: 1.46;
  background: #88584718;
  border: 1px solid #98695149;
  border-radius: 3px;
}
.title-tips li + li { margin-top: 3px; }
.overlay--title .actions, .overlay--shift .actions, .overlay--lost .actions, .overlay--report .actions, .overlay--rules .actions, .overlay--steal .actions { grid-template-columns: minmax(0, 1fr); margin-top: 12px; }
.panel h2 { font-size: clamp(21px, 6vw, 29px); line-height: 1.15; letter-spacing: .12em; color: #512c2d; }
.panel p { margin-top: 8px; font-size: 13px; line-height: 1.5; }
.panel .action { text-shadow: 0 1px 2px #0b0809; }
.panel .action:focus-visible { outline-color: #6a3433; }
.panel .actions .action { min-height: 49px; }
.panel .actions .action strong { font-size: 16px; letter-spacing: .06em; }
.overlay--shift .panel {
  color-scheme: dark;
  background-color: #1c131a;
  background-image: var(--noise), linear-gradient(155deg, #382029, #120d15);
  color: var(--paper);
  border-color: #9d5c57;
}
.overlay--shift h2 { color: #ffd0c7; }
.overlay--shift .shift-quote {
  margin-top: 10px;
  padding: 8px 10px;
  border-block: 1px solid #a9784c52;
  color: #ebc9be;
  font-size: 13px;
  font-style: italic;
}
.overlay--item .panel { width: min(100%, 294px); }
.item-emblem {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  width: 68px;
  height: 68px;
  border: 1px solid #b58457;
  outline: 1px solid #784c3e80;
  outline-offset: 2px;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 35%, #462d32, #1b1118 82%);
  box-shadow: inset 0 0 18px #0b060bc4, 0 0 18px #b57b4642;
}
.item-emblem[data-item="peek"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #eab95066; }
.item-emblem[data-item="burn"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #e66a3c66; }
.item-emblem[data-item="bell"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #e03c456b; }
.item-emblem[data-item="invert"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #c8b6d959; }
.item-emblem[data-item="rope"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #e6394670; }
.item-emblem[data-item="tea"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #5ad4a266; }
.item-emblem svg { width: 52px; height: 52px; }
.panel-close { position: absolute; right: 3px; top: 3px; color: #6c3c36; font-size: 22px; }
.overlay--deal .panel {
  color-scheme: dark;
  background: var(--noise), linear-gradient(148deg, #402828ef, #1b131ced);
  color: var(--paper);
  border-color: #a77951;
}
.overlay--deal h2 { color: #f4d6a3; }
.deal-lots { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 11px; }
.deal-lot {
  display: grid;
  place-items: center;
  width: 29px;
  height: 46px;
  border-radius: 3px;
  border: 1px solid currentColor;
  background: var(--noise), #261a21;
  font-size: 18px;
}
.panel .panel-hint { color: #754b43; font-size: 12px; }
:is(.overlay--shift, .overlay--deal) .panel .panel-hint { color: #d8b7a3; }
.deal-dismiss {
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: #e4c7a2;
  font-size: 12px;
}
.rules-list { margin: 12px 0; padding-left: 20px; text-align: left; font-size: 13px; line-height: 1.51; }
.rules-list li + li { margin-top: 5px; }
.panel .rule-record { border-top: 1px solid #83534a6e; padding-top: 7px; overflow-wrap: anywhere; }
.panel button[data-command="replay-tutorial"] {
  min-height: 44px;
  padding: 5px 10px;
  border: 1px solid #912b36;
  border-radius: 3px;
  background: #f0dcc2;
  color: #751c2b;
  font-weight: 700;
  text-shadow: none;
}
.overlay--lost { background: #050205f5; }
.overlay--report .panel, .overlay--lost .panel {
  background-color: #dfc29e;
  background-image: var(--noise), radial-gradient(ellipse at 47% 35%, #f0dbc1, #d9b692 77%, #b38067);
  outline-color: #aa7164;
  border-color: #793e42;
}
:is(.overlay--lost, .overlay--report) .panel h2 { color: #7d1c2b; }
:is(.overlay--lost, .overlay--report) .panel .panel-hint { color: #712532; }
:is(.overlay--lost, .overlay--report) .panel .action {
  border-color: #8e3541;
  background: linear-gradient(128deg, #672334, #3a121e);
  color: #ffd2ca;
}
.receipt-seal {
  display: grid;
  place-items: center;
  margin: 1px auto 12px;
  width: 49px;
  height: 47px;
  background: var(--noise), #972940;
  color: #fbe0d3;
  border: 3px double #df9b91;
  outline: 1px solid #a73546;
  border-radius: 3px 1px 6px 2px;
  font-size: 13px;
  line-height: 1.05;
  text-align: center;
  transform: rotate(-9deg);
}
.payout { margin-top: 11px; padding: 7px 5px; border-block: 1px solid #8c3c4774; }
.payout span { display: block; color: #702533; font-size: 12px; overflow-wrap: anywhere; }
.payout strong {
  display: block;
  margin-top: 3px;
  color: #85192e;
  font-size: clamp(23px, 6.5vw, 35px);
  line-height: 1.14;
  overflow-wrap: anywhere;
}
.receipt-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; margin: 10px 0 0; }
.receipt-stats div { background: #88584718; padding: 5px 3px; border: 1px solid #98695149; }
.receipt-stats dt { font-size: 11px; }
.receipt-stats dd { margin: 2px 0 0; color: #782738; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.receipt-record { overflow-wrap: anywhere; }

#tutorial {
  position: absolute;
  inset: 0;
  z-index: 12;
  overflow: hidden;
  pointer-events: auto;
  touch-action: manipulation;
}
.tut-spot {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border: 1px solid #d69066;
  border-radius: 5px;
  box-shadow: 0 0 0 9999px rgba(6,4,8,.82);
  pointer-events: none;
}
.tut-spot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 1px solid #e65e64;
  border-radius: inherit;
  box-shadow: 0 0 13px #c44a4f91, inset 0 0 6px #cf7c61a8;
  animation: spotlight-breathe 2.1s ease-in-out infinite alternate;
}
@keyframes spotlight-breathe {
  from { opacity: .38; }
  to { opacity: 1; }
}
.tut-card {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 12px;
  width: min(calc(100% - 24px), 332px);
  max-width: calc(100% - 16px);
  max-height: calc(100% - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 11px 12px 10px;
  border: 3px double #915454;
  border-radius: 3px 2px 5px 2px;
  background: var(--noise), radial-gradient(ellipse at 43% 20%, #f1debd, #d5b28e);
  color: #371c24;
  color-scheme: light;
  box-shadow: 0 6px 20px #070307c9;
  overflow-wrap: anywhere;
}
.tut-step { color: #7b2735; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.tut-card h2 { margin-top: 4px; color: #681c2c; font-size: 17px; line-height: 1.3; }
#tut-body { margin-top: 6px; font-size: 13px; line-height: 1.55; }
.tut-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.tut-actions button { min-height: 44px; padding: 4px 10px; border: 1px solid #964753; border-radius: 3px; font-size: 13px; font-weight: 700; }
.tut-actions button:focus-visible { outline-color: #5e1b2d; }
#tut-skip { color: #692733; background: #f2dabb; }
#tut-next { color: #ffe3dc; background: linear-gradient(#7a293a, #541928); }

@media (max-width: 600px) {
  .game {
    width: min(100%, 460px);
    height: 100vh;
    height: 100dvh;
    min-height: 480px;
    border: 0;
    border-radius: 0;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .player-zone {
    padding-bottom: max(68px, calc(58px + env(safe-area-inset-bottom, 0px)));
  }
  .overlay {
    padding-top: max(13px, env(safe-area-inset-top, 0px));
    padding-bottom: max(68px, env(safe-area-inset-bottom));
  }
  .tut-card { max-height: calc(100% - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
}
@media (max-height: 737px) {
  .game { grid-template-rows: 46px 126px minmax(0, 1fr) auto; }
}
@media (max-height: 560px) {
  .game { grid-template-rows: 44px 109px minmax(0, 1fr) auto; }
  .dealer-zone { padding-top: 0; }
  .dealer-speech { min-height: 18px; padding-block: 2px; font-size: 11px; }
  .life-line { height: 24px; }
  .candle { width: 21px; height: 31px; }
  .actions { margin-top: 4px; }
  .action { min-height: 44px; }
  .lantern { width: 29px; }
  .lantern span { font-size: 11px; }
  .lot { width: 28px; min-height: 37px; }
  .lot-face { gap: 1px; }
  .lot-front strong { font-size: 19px; }
  .lot-front span { font-size: 6px; }
}
@media (max-width: 345px) {
  .masthead { padding-inline: 10px 5px; }
  .dealer-zone { grid-template-columns: minmax(76px, 29%) minmax(0, 1fr); gap: 0 5px; padding-right: 8px; }
  .table { margin-inline: 7px; }
  .player-zone { padding-inline: 7px; }
  .lot-ledger { gap: 4px; }
  .stake { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .lot.is-rising { opacity: 1; transform: translate(-50%, -30%); }
  .cinema:is(.is-phase2, .is-victory) { animation: none; opacity: 1; }
  .float-text.is-floating, .candle.just-out .candle-smoke { animation-duration: .67s !important; }
  #death-veil.is-red::before { animation: none; opacity: .67; }
  #death-veil.is-red::after { animation: none; opacity: .62; }
  .game.is-dying :is(.masthead, .dealer-zone, .table, .player-zone) { animation: none; }
  .tut-spot::after { opacity: .74; }
}

/* === DEATH SHAKE & GUIDED TUTORIAL APPEND === */
#game.is-death-shake {
  animation: death-shake 620ms ease-out;
}

@keyframes death-shake {
  0%, 100% { transform: none; }
  6% { transform: translate3d(-21px, 13px, 0) rotate(-3deg) scale(1.045); }
  13% { transform: translate3d(21px, -16px, 0) rotate(2.8deg) scale(1.045); }
  22% { transform: translate3d(-17px, -11px, 0) rotate(-2deg) scale(1.035); }
  31% { transform: translate3d(14px, 13px, 0) rotate(1.7deg) scale(1.03); }
  41% { transform: translate3d(-11px, 8px, 0) rotate(-1.2deg) scale(1.025); }
  52% { transform: translate3d(10px, -8px, 0) rotate(1deg) scale(1.02); }
  64% { transform: translate3d(-7px, -5px, 0) rotate(-0.7deg) scale(1.015); }
  77% { transform: translate3d(5px, 4px, 0) rotate(0.4deg) scale(1.01); }
  89% { transform: translate3d(-2px, 1px, 0) rotate(-0.2deg); }
}

@media (prefers-reduced-motion: reduce) {
  #game.is-death-shake {
    animation: none;
  }
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 9px;
  border: 1px solid #80643c;
  border-radius: 4px;
  background: #211912;
  color: #f1d9a7;
  font: inherit;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.text-button:hover:not(:disabled) {
  border-color: #c8a36b;
  background: #37291a;
}

.text-button:focus-visible {
  outline: 2px solid #f1d9a7;
  outline-offset: 2px;
}

.text-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.overlay--title #panel {
  box-sizing: border-box;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
}

.overlay--title .actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.overlay--title .actions .action {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  white-space: normal;
}

.overlay--deal .deal-guide {
  padding: 9px 11px;
  border-inline-start: 3px solid #aa2137;
  background: #f4d9d4;
  color: #801427;
  font-weight: 700;
  line-height: 1.5;
}

.overlay--deal.is-guided-deal .deal-dismiss {
  min-height: 44px;
}

#tut-body {
  white-space: pre-line;
}

#tutorial.is-draw-step,
#tutorial.is-draw-step * {
  pointer-events: none;
}

#tutorial.is-draw-step .tut-card,
#tutorial.is-draw-step .tut-card * {
  pointer-events: auto;
}

/* === 6 套法器专属施法特效演出 === */
.fx-stage {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.fx-node {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.fx-emblem {
  width: 78px;
  height: 78px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 14px currentColor);
}
.fx-emblem svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 1. 天眼符：灵瞳显现 + 金红透视扫描光束 */
.fx-peek .fx-emblem { color: #ffd97d; animation: fx-peek-eye .95s ease-out both; }
.fx-scan-beam {
  position: absolute;
  top: 28%;
  left: 50%;
  width: 170px;
  height: 62%;
  transform-origin: 50% 0%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ffdf8e85, #e6394633 55%, transparent 96%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  filter: blur(1.5px);
  animation: fx-beam-sweep .92s ease-in-out both;
}
@keyframes fx-peek-eye {
  0% { opacity: 0; transform: translateY(18px) scale(.45); }
  22% { opacity: 1; transform: translateY(-24px) scale(1.16); }
  74% { opacity: 1; transform: translateY(-28px) scale(1.04); }
  100% { opacity: 0; transform: translateY(-40px) scale(.86); }
}
@keyframes fx-beam-sweep {
  0% { opacity: 0; transform: translateX(-50%) rotate(-18deg) scaleY(.4); }
  22% { opacity: .92; transform: translateX(-50%) rotate(-10deg) scaleY(1); }
  58% { opacity: .88; transform: translateX(-50%) rotate(12deg) scaleY(1.04); }
  100% { opacity: 0; transform: translateX(-50%) rotate(4deg) scaleY(.9); }
}

/* 2. 燃香：业火光环 + 青碧香烟气柱 */
.fx-burn .fx-emblem { color: #ff7a45; animation: fx-burn-rise .95s ease-out both; }
.fx-fire-ring {
  position: absolute;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 2px solid #ff7b47b8;
  background: radial-gradient(circle, #ff5e2b54, #8a1d1924 58%, transparent 76%);
  box-shadow: 0 0 28px #ff5a2b80;
  animation: fx-fire-expand .95s ease-out both;
}
@keyframes fx-burn-rise {
  0% { opacity: 0; transform: translateY(24px) scale(.55); }
  26% { opacity: 1; transform: translateY(-8px) scale(1.12); }
  78% { opacity: .95; transform: translateY(-16px) scale(1); }
  100% { opacity: 0; transform: translateY(-34px) scale(.85); }
}
@keyframes fx-fire-expand {
  0% { opacity: 0; transform: scale(.35); }
  30% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.42); }
}

/* 3. 招魂铃：铃影狂摇 + 三重扩散血红音波 */
.fx-bell .fx-emblem { color: #ff565e; transform-origin: 50% 18%; animation: fx-bell-ring .96s ease-out both; }
.fx-ring {
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid #ff4752cc;
  box-shadow: 0 0 18px #d91c2b88, inset 0 0 12px #ff5c664d;
  animation: fx-sonic-wave .9s ease-out both;
}
.fx-ring.r2 { animation-delay: .16s; border-color: #ffa366aa; }
.fx-ring.r3 { animation-delay: .32s; border-color: #d91c2b8c; }
@keyframes fx-bell-ring {
  0% { opacity: 0; transform: scale(.5) rotate(-18deg); }
  16% { opacity: 1; transform: scale(1.16) rotate(18deg); }
  32% { transform: scale(1.12) rotate(-16deg); }
  48% { transform: scale(1.1) rotate(14deg); }
  64% { transform: scale(1.04) rotate(-9deg); }
  82% { opacity: .95; transform: scale(1) rotate(3deg); }
  100% { opacity: 0; transform: scale(.86) rotate(0deg); }
}
@keyframes fx-sonic-wave {
  0% { opacity: .95; transform: scale(.55); }
  100% { opacity: 0; transform: scale(3.25); }
}

/* 4. 阴阳令：巨型太极 3D 180° 翻转改命 */
.fx-invert { perspective: 520px; }
.fx-invert .fx-emblem { color: #f5dfb0; width: 92px; height: 92px; animation: fx-taiji-flip .98s cubic-bezier(.22,.72,.28,1) both; }
.fx-yin-halo {
  position: absolute;
  width: 146px;
  height: 146px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #f6e4ba88 0 180deg, #2b172c88 180deg 360deg);
  filter: blur(8px);
  animation: fx-halo-spin .98s ease-out both;
}
@keyframes fx-taiji-flip {
  0% { opacity: 0; transform: scale(.42) rotateY(0deg) rotate(0deg); }
  25% { opacity: 1; transform: scale(1.18) rotateY(90deg) rotate(90deg); }
  62% { opacity: 1; transform: scale(1.1) rotateY(180deg) rotate(180deg); }
  100% { opacity: 0; transform: scale(.78) rotateY(360deg) rotate(220deg); }
}
@keyframes fx-halo-spin {
  0% { opacity: 0; transform: scale(.4) rotate(0deg); }
  35% { opacity: .88; transform: scale(1.08) rotate(130deg); }
  100% { opacity: 0; transform: scale(1.4) rotate(290deg); }
}

/* 5. 红绳：双道朱砂锁魂红绳交叉抽紧 + 同心锁结 */
.fx-rope .fx-emblem { color: #ff4752; animation: fx-rope-knot .95s ease-out both; }
.fx-rope-band {
  position: absolute;
  width: 145%;
  height: 7px;
  background: repeating-linear-gradient(60deg, #820d1b 0 6px, #ff565e 6px 12px, #c9202e 12px 18px);
  box-shadow: 0 0 16px #ff3344aa;
  border-radius: 4px;
}
.fx-rope-band.b1 { animation: fx-band-l .92s cubic-bezier(.16,.84,.3,1) both; }
.fx-rope-band.b2 { animation: fx-band-r .92s cubic-bezier(.16,.84,.3,1) both; }
@keyframes fx-band-l {
  0% { opacity: 0; transform: rotate(24deg) scaleX(.08); }
  28% { opacity: 1; transform: rotate(24deg) scaleX(1.05); }
  75% { opacity: .95; transform: rotate(24deg) scaleX(1); }
  100% { opacity: 0; transform: rotate(24deg) scaleX(1.1); }
}
@keyframes fx-band-r {
  0% { opacity: 0; transform: rotate(-24deg) scaleX(.08); }
  28% { opacity: 1; transform: rotate(-24deg) scaleX(1.05); }
  75% { opacity: .95; transform: rotate(-24deg) scaleX(1); }
  100% { opacity: 0; transform: rotate(-24deg) scaleX(1.1); }
}
@keyframes fx-rope-knot {
  0% { opacity: 0; transform: scale(1.7) rotate(-20deg); }
  30% { opacity: 1; transform: scale(.96) rotate(4deg); }
  45% { transform: scale(1.1) rotate(-3deg); }
  78% { opacity: 1; transform: scale(1.02) rotate(0deg); }
  100% { opacity: 0; transform: scale(.82); }
}

/* 6. 续命茶：温润青碧灵雾上升回春 */
.fx-tea .fx-emblem { color: #7be8b8; animation: fx-tea-rise .98s ease-out both; }
.fx-jade-aura {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, #8ff7c866, #2d876a33 54%, transparent 76%);
  border: 1px solid #9df5ce88;
  box-shadow: 0 0 28px #4ed19d66;
  animation: fx-jade-swell .98s ease-out both;
}
@keyframes fx-tea-rise {
  0% { opacity: 0; transform: translateY(26px) scale(.58); }
  30% { opacity: 1; transform: translateY(-4px) scale(1.12); }
  78% { opacity: .95; transform: translateY(-18px) scale(1.03); }
  100% { opacity: 0; transform: translateY(-38px) scale(.88); }
}
@keyframes fx-jade-swell {
  0% { opacity: 0; transform: scale(.45); }
  36% { opacity: .95; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.48); }
}

/* 新增法器粒子色系 */
.particle--ember {
  background: radial-gradient(circle, #fff0b3, #ff5a26 65%, #8a1610);
  box-shadow: 0 0 9px #ff622e;
}
.particle--jade {
  background: radial-gradient(circle, #e5fff2, #5ad9a4 68%);
  box-shadow: 0 0 10px #63e6ae;
}
.particle--yin {
  background: radial-gradient(circle, #fff3d1, #e8c77b 72%);
  box-shadow: 0 0 8px #ffd97d;
}
.particle--yang {
  background: radial-gradient(circle, #7a688c, #181121 72%);
  border: 1px solid #e6c280a6;
}
.particle--rope {
  background: radial-gradient(circle, #ff8f87, #d91c2b 70%);
  box-shadow: 0 0 9px #ff3b47;
  border-radius: 2px;
}

/* === 模块 1 + 2 + 4：二阶段被动、紫色诡签、妙手符/替身纸人、抽签方向指向 === */
.ink-weird { color: #d39eff; }
.peek-mark[data-kind="weird"] { color: #deb2ff; box-shadow: 0 0 12px #8a2be27a; }
.lot[data-kind="weird"] .lot-face {
  border-color: #c88cff;
  background: var(--noise), linear-gradient(90deg, #321647, #642d8a 18%, #9051ba 50%, #3d1b57 100%);
  color: #f4dfff;
  box-shadow: 0 0 28px #a54cffad;
}
.lot[data-kind="weird"] .lot-front { color: #f6e4ff; text-shadow: 0 0 12px #b65cff; }
.history-lot.is-blotted {
  background: radial-gradient(circle at 45% 45%, #070508, #1a1119 72%);
  border-color: #5e3d4c;
  color: #8f7786;
  text-shadow: 0 0 4px #000;
}

.ward {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px 0 2px;
  border: 1px solid #d4b06a8a;
  border-radius: 3px;
  background: #382a1e;
  color: #ffe2a3;
  font-size: 10px;
  white-space: nowrap;
}
.ward svg { width: 15px; height: 15px; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.phase2-rule {
  margin-left: auto;
  padding: 1px 5px;
  border: 1px solid #d63c488f;
  border-radius: 3px;
  background: #42111ab8;
  color: #ffb8c0;
  font-size: 10px;
  letter-spacing: .04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 112px;
}

.slot[data-item="steal"] { border-color: #b478e68f; background: radial-gradient(circle at 50% 25%, #4b23697a, #17101f 84%); }
.slot[data-item="doll"] { border-color: #d6b6768f; background: radial-gradient(circle at 50% 25%, #5944267a, #191315 84%); }
.item-emblem[data-item="steal"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #b366ff70; }
.item-emblem[data-item="doll"] { box-shadow: inset 0 0 18px #0b060bc4, 0 0 22px #f0c97966; }

/* 妙手符抢宝选择网格 */
.steal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.steal-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 1px solid #8a4a6b;
  border-radius: 5px;
  background: radial-gradient(circle at 50% 30%, #3d2138, #1a1019 88%);
  color: #f6e2c8;
  min-height: 76px;
}
.steal-choice svg { width: 34px; height: 34px; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.steal-choice span { font-size: 11px; font-weight: 700; }
.steal-choice:hover { filter: brightness(1.18); border-color: #d9a0ff; }

/* 妙手符 & 替身纸人 & 诡签特效 */
.fx-steal .fx-emblem { color: #d599ff; animation: fx-steal-swoop .95s cubic-bezier(.18,.78,.26,1) both; }
.fx-steal-arc {
  position: absolute;
  width: 175px;
  height: 175px;
  border-radius: 50%;
  border-top: 3px solid #d79eff;
  border-right: 2px solid #ffd97d88;
  border-bottom: 2px solid transparent;
  border-left: 2px solid transparent;
  filter: drop-shadow(0 0 12px #a64dff);
  animation: fx-arc-slash .9s ease-out both;
}
@keyframes fx-steal-swoop {
  0% { opacity: 0; transform: translate(-48px, 34px) scale(.5) rotate(-25deg); }
  28% { opacity: 1; transform: translate(0, -6px) scale(1.18) rotate(8deg); }
  75% { opacity: 1; transform: translate(18px, -16px) scale(1.04) rotate(0deg); }
  100% { opacity: 0; transform: translate(42px, -32px) scale(.82) rotate(14deg); }
}
@keyframes fx-arc-slash {
  0% { opacity: 0; transform: scale(.45) rotate(-75deg); }
  30% { opacity: .95; transform: scale(1.05) rotate(30deg); }
  100% { opacity: 0; transform: scale(1.38) rotate(145deg); }
}

.fx-doll .fx-emblem { color: #ffe199; animation: fx-doll-guard .98s ease-out both; }
.fx-doll-shield {
  position: absolute;
  width: 158px;
  height: 158px;
  border-radius: 50%;
  border: 2px dashed #f5cf7a;
  background: radial-gradient(circle, #ffe49c45, #a8323222 55%, transparent 76%);
  box-shadow: 0 0 26px #f0be596e;
  animation: fx-fire-expand .96s ease-out both;
}
@keyframes fx-doll-guard {
  0% { opacity: 0; transform: translateY(22px) scale(.55); }
  26% { opacity: 1; transform: translateY(-4px) scale(1.15); }
  74% { opacity: 1; transform: translateY(-10px) scale(1.04); }
  100% { opacity: 0; transform: translateY(-24px) scale(.88); }
}

.fx-doll-break .fx-emblem { color: #ff7b54; animation: fx-doll-shatter .95s ease-out both; }
@keyframes fx-doll-shatter {
  0% { opacity: 0; transform: scale(.7); }
  20% { opacity: 1; transform: scale(1.25) rotate(-6deg); filter: drop-shadow(0 0 18px #ff5a36); }
  45% { transform: scale(1.18) rotate(7deg); opacity: .95; }
  100% { opacity: 0; transform: scale(1.55) translateY(-18px) rotate(-14deg); filter: blur(3px); }
}

.particle--weird {
  background: radial-gradient(circle, #f5d9ff, #9b4dff 68%, #3c0e6b);
  box-shadow: 0 0 10px #b366ff;
}

/* === 模块 4：抽签目标视觉指向标与竹签飞向目标 === */
.draw-banner {
  position: absolute;
  left: 50%;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 18px #000000bf;
  transform: translateX(-50%);
}
.draw-banner[data-target="dealer"] {
  top: 10px;
  animation: banner-up .4s ease-out both;
}
.draw-banner[data-target="player"] {
  bottom: 10px;
  animation: banner-down .4s ease-out both;
}
.draw-banner[data-tone="attack"] {
  background: #3d0f19eb;
  color: #ff9c9e;
  box-shadow: 0 0 18px #d91c2b80, 0 4px 16px #000c;
}
.draw-banner[data-tone="self"] {
  background: #2b2116eb;
  color: #ffe094;
  box-shadow: 0 0 16px #d49b3b66, 0 4px 16px #000c;
}
.draw-banner[data-tone="danger"] {
  background: #4f0915f2;
  color: #ff696e;
  box-shadow: 0 0 22px #ff2938a8, 0 4px 16px #000c;
}
.draw-arrow {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
}
.draw-banner[data-target="dealer"] .draw-arrow {
  border-bottom: 8px solid currentColor;
  animation: arrow-bob-up .55s ease-in-out infinite alternate;
}
.draw-banner[data-target="player"] .draw-arrow {
  border-top: 8px solid currentColor;
  animation: arrow-bob-down .55s ease-in-out infinite alternate;
}
@keyframes banner-up { from { opacity: 0; transform: translate(-50%, 10px) scale(.92); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes banner-down { from { opacity: 0; transform: translate(-50%, -10px) scale(.92); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes arrow-bob-up { from { transform: translateY(2px); } to { transform: translateY(-3px); } }
@keyframes arrow-bob-down { from { transform: translateY(-2px); } to { transform: translateY(3px); } }

/* 竹签揭示后朝目标明显偏移/逼近 */
.lot.to-dealer { animation: lot-to-dealer .42s cubic-bezier(.2,.75,.3,1) both; }
.lot.to-player { animation: lot-to-player .42s cubic-bezier(.2,.75,.3,1) both; }
.lot.to-dealer.is-hiding { animation: lot-hide-dealer .28s ease-in both; }
.lot.to-player.is-hiding { animation: lot-hide-player .28s ease-in both; }
@keyframes lot-to-dealer {
  0% { opacity: 1; transform: translate(-50%, -30%) rotate(-2deg) scale(1); }
  100% { opacity: 1; transform: translate(-50%, -62%) rotate(6deg) scale(.96); }
}
@keyframes lot-to-player {
  0% { opacity: 1; transform: translate(-50%, -30%) rotate(-2deg) scale(1); }
  100% { opacity: 1; transform: translate(-50%, -6%) rotate(-5deg) scale(1.16); }
}
@keyframes lot-hide-dealer {
  0% { opacity: 1; transform: translate(-50%, -62%) rotate(6deg) scale(.96); }
  100% { opacity: 0; transform: translate(-50%, -78%) rotate(8deg) scale(.86); }
}
@keyframes lot-hide-player {
  0% { opacity: 1; transform: translate(-50%, -6%) rotate(-5deg) scale(1.16); }
  100% { opacity: 0; transform: translate(-50%, 16%) rotate(-6deg) scale(1.02); }
}

/* 目标区域短暂瞄准锁框高光 */
.dealer-zone.is-targeted {
  box-shadow: inset 0 0 0 2px #ff565eb0, inset 0 0 26px #b8192859;
  transition: box-shadow .22s ease;
}
.player-zone.is-targeted {
  box-shadow: inset 0 0 0 2px #ff565ec4, inset 0 0 28px #c4182669;
  transition: box-shadow .22s ease;
}
.player-zone.is-targeted-self {
  box-shadow: inset 0 0 0 2px #f0c264a8, inset 0 0 24px #c894324a;
  transition: box-shadow .22s ease;
}

.sound-link {
  color: #673c30;
  background: transparent;
  border: 0;
  padding: 7px 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  font: inherit;
}
.sound-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin: 18px 0;
  color: #502d26;
  text-align: left;
}
.sound-row output { font-variant-numeric: tabular-nums; }
.sound-row input { grid-column: 1 / -1; width: 100%; margin: 0; height: 36px; accent-color: #843d37; }
