:root {
  --ink: #0b1724;
  --night: #102337;
  --night-deep: #07111c;
  --paper: #f5e6c4;
  --paper-dark: #d8bf8a;
  --cinnabar: #df5a42;
  --gold: #f6c65b;
  --jade: #55af83;
  --water: #5aa7c7;
  --shadow: rgba(2, 9, 16, 0.48);
  font-family: "FZKai-Z03", "STKaiti", "KaiTi", "Noto Serif SC", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--paper);
  background:
    radial-gradient(circle at 20% 15%, rgba(246, 198, 91, 0.08), transparent 25%),
    linear-gradient(135deg, #06101b 0%, #172b3d 48%, #08121d 100%);
}

button {
  font: inherit;
}

.stage-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 24px;
}

.stage-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.25;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  z-index: 10;
}

.game {
  width: min(100%, 430px);
  height: min(920px, calc(100vh - 32px));
  min-height: 720px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(246, 198, 91, 0.25);
  border-radius: 34px;
  background:
    linear-gradient(rgba(10, 27, 42, 0.3), rgba(7, 17, 28, 0.92)),
    var(--night);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.52), inset 0 0 70px rgba(6, 15, 24, 0.72);
}

.game::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  border-radius: inherit;
  box-shadow: inset 0 0 0 7px rgba(245, 230, 196, 0.025);
}

.night-sky {
  position: absolute;
  inset: 0 0 auto;
  height: 45%;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(circle at 62% 16%, rgba(246, 198, 91, 0.1), transparent 18%),
    linear-gradient(180deg, #18334c 0%, rgba(16, 35, 55, 0) 100%);
}

.moon {
  position: absolute;
  width: 72px;
  height: 72px;
  right: 54px;
  top: 76px;
  border-radius: 50%;
  background: #f8e8b8;
  box-shadow: 0 0 38px rgba(248, 232, 184, 0.35);
  opacity: 0.14;
}

.moon::after {
  content: "";
  position: absolute;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #18334c;
  transform: translate(-18px, -8px);
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 7px var(--paper);
  animation: twinkle 2.6s ease-in-out infinite alternate;
}

.star-a { left: 17%; top: 22%; }
.star-b { left: 78%; top: 35%; animation-delay: -1s; }
.star-c { left: 44%; top: 13%; animation-delay: -1.8s; }

.roof {
  position: absolute;
  bottom: 0;
  width: 210px;
  height: 68px;
  background: rgba(5, 15, 25, 0.52);
  clip-path: polygon(0 58%, 18% 58%, 24% 38%, 41% 38%, 47% 0, 53% 38%, 80% 38%, 84% 58%, 100% 58%, 100% 100%, 0 100%);
}

.roof-left { left: -60px; }
.roof-right { right: -70px; transform: scaleX(-1); }

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  padding: max(20px, env(safe-area-inset-top)) 20px 10px;
}

.round-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--paper);
  border: 1px solid rgba(245, 230, 196, 0.25);
  border-radius: 50%;
  background: rgba(7, 17, 28, 0.45);
  cursor: pointer;
  transition: 180ms ease;
}

.round-icon:hover,
.round-icon:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  transform: rotate(-6deg) scale(1.05);
  outline: none;
}

.round-icon.boss-mode {
  position: relative;
  color: #e5e1d0;
  border-color: rgba(166, 199, 204, 0.72);
  background:
    radial-gradient(circle at 50% 38%, rgba(178, 211, 213, 0.2), transparent 48%),
    #354f5c;
  box-shadow: 0 0 0 3px rgba(134, 171, 177, 0.08), 0 5px 18px rgba(0, 0, 0, 0.24);
  font-size: 19px;
}

.round-icon.boss-mode::after {
  content: "规则";
  position: absolute;
  right: -5px;
  bottom: -5px;
  padding: 2px 4px;
  color: #17303d;
  border: 1px solid rgba(228, 219, 194, 0.8);
  border-radius: 7px;
  background: #ddd3ba;
  font: 700 8px/1 "FZSong-Z01", "STSong", serif;
  letter-spacing: 0.04em;
}

.chapter-mark {
  text-align: center;
  line-height: 1;
}

.chapter-mark strong {
  display: block;
  margin-top: 5px;
  color: #fff4d5;
  font-size: 28px;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  font-weight: 700;
  text-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}

.round-dots {
  height: 6px;
  margin-top: 6px;
  display: flex;
  justify-content: center;
  gap: 7px;
}

.round-dots i {
  width: 13px;
  height: 3px;
  border-radius: 4px;
  background: rgba(245, 230, 196, 0.2);
  transition: 260ms ease;
}

.round-dots i.active {
  width: 22px;
  background: var(--gold);
  box-shadow: 0 0 9px rgba(246, 198, 91, 0.42);
}

.round-dots i.done {
  background: var(--cinnabar);
}

.eyebrow {
  font-family: "FZSong-Z01", "STSong", "SimSun", serif;
  color: var(--paper-dark);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.score-panel {
  margin: 0 18px;
  padding: 13px 16px 10px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  border: 1px solid rgba(246, 198, 91, 0.2);
  border-radius: 16px;
  background: linear-gradient(110deg, rgba(7, 17, 28, 0.76), rgba(28, 48, 62, 0.58));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03), 0 12px 26px rgba(0, 0, 0, 0.12);
}

.score-copy span,
.turn-copy span {
  display: block;
  color: var(--paper-dark);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.score-copy strong {
  display: block;
  margin-top: 2px;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.score-copy small {
  color: rgba(245, 230, 196, 0.5);
  font-size: 12px;
  font-weight: 400;
}

.turn-copy {
  min-width: 50px;
  text-align: center;
}

.turn-copy strong {
  display: block;
  color: var(--gold);
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.score-track {
  grid-column: 1 / -1;
  height: 5px;
  margin-top: 8px;
  position: relative;
  overflow: visible;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
}

.score-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cinnabar), var(--gold));
  box-shadow: 0 0 15px rgba(246, 198, 91, 0.5);
  transition: width 600ms cubic-bezier(.2, .9, .25, 1);
}

.score-spark {
  position: absolute;
  left: 0;
  top: 50%;
  width: 10px;
  height: 10px;
  border: 2px solid var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
  transition: left 600ms cubic-bezier(.2, .9, .25, 1);
}

.streak-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(64px, 1fr) minmax(66px, auto) minmax(102px, auto);
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: rgba(245, 230, 196, 0.7);
  font-size: 11px;
}

.core-status {
  min-height: 25px;
  padding: 3px 8px;
  max-width: 90px;
  overflow: hidden;
  color: var(--gold);
  border: 1px solid transparent;
  border-radius: 10px 3px 10px 3px;
  background: transparent;
  font: inherit;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: 180ms ease;
}

.core-status.is-selected {
  border-color: rgba(246, 198, 91, 0.3);
  background: rgba(246, 198, 91, 0.08);
  cursor: pointer;
}

.core-status.is-selected::after {
  content: " · 查看";
  color: rgba(245, 230, 196, 0.52);
  font-size: 8px;
}

.core-status.is-selected:hover,
.core-status.is-selected:focus-visible {
  color: #fff0bd;
  border-color: var(--gold);
  outline: none;
  background: rgba(246, 198, 91, 0.14);
}

.core-status:disabled {
  opacity: 0.72;
}

.power-status {
  min-height: 31px;
  padding: 4px 9px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  border: 1px solid rgba(245, 230, 196, 0.12);
  border-radius: 12px 3px 12px 3px;
  background: rgba(2, 11, 19, 0.28);
  transition: 220ms ease;
}

.power-status small {
  color: rgba(245, 230, 196, 0.5);
  font: inherit;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.power-status b {
  color: rgba(245, 230, 196, 0.5);
  font: 700 13px/1 Georgia, "Times New Roman", serif;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.power-status.is-active {
  border-color: rgba(246, 198, 91, 0.58);
  background:
    radial-gradient(circle at 82% 40%, rgba(246, 198, 91, 0.2), transparent 42%),
    linear-gradient(135deg, rgba(112, 55, 25, 0.42), rgba(7, 17, 28, 0.52));
  box-shadow: inset 0 1px rgba(255, 244, 205, 0.12), 0 0 18px rgba(246, 198, 91, 0.1);
}

.power-status.is-active small {
  color: #e7c77f;
}

.power-status.is-active b {
  color: #ffe08a;
  font-size: 19px;
  text-shadow: 0 0 13px rgba(246, 198, 91, 0.48);
}

.score-panel.power-rise {
  animation: powerRise 520ms ease;
}

.streak-row b {
  color: #fff4d5;
}

.mini-flame {
  display: inline-block;
  width: 8px;
  height: 11px;
  margin-right: 3px;
  border-radius: 8px 0 8px 8px;
  background: var(--cinnabar);
  transform: rotate(-20deg);
}

.lantern-zone {
  flex: 1;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 15px 0;
}

.guide-line {
  margin: 4px 0 22px;
  color: rgba(245, 230, 196, 0.62);
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  transition: color 160ms ease;
}

.guide-line.ready {
  color: var(--gold);
}

.lanterns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 8px;
}

.lantern {
  min-width: 0;
  position: relative;
  padding: 0 3px;
  color: var(--paper);
  border: 0;
  background: none;
  cursor: pointer;
  animation: lanternEnter 600ms both cubic-bezier(.2, .8, .2, 1);
  animation-delay: calc(var(--i) * 90ms);
}

.lantern::before {
  content: "";
  width: 1px;
  height: 28px;
  display: block;
  margin: -22px auto 0;
  background: linear-gradient(transparent, rgba(216, 191, 138, 0.6));
}

.lantern-knot {
  width: 34px;
  height: 8px;
  margin: 0 auto -2px;
  position: relative;
  z-index: 2;
  border-radius: 2px;
  background: #201b19;
  box-shadow: 0 2px 0 #9d573a;
}

.lantern-body {
  min-height: 146px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  clip-path: polygon(17% 0, 83% 0, 100% 14%, 94% 86%, 80% 100%, 20% 100%, 6% 86%, 0 14%);
  background:
    repeating-linear-gradient(90deg, transparent 0 17%, rgba(110, 39, 26, 0.17) 18%, transparent 20%),
    linear-gradient(180deg, #b94131 0%, #dc5a3c 45%, #a9342a 100%);
  box-shadow: inset 0 0 35px rgba(65, 11, 8, 0.52);
  transition: 220ms ease;
}

.lantern-body::after {
  content: "";
  position: absolute;
  inset: 9px 12px;
  border: 1px solid rgba(255, 225, 151, 0.22);
  clip-path: inherit;
  pointer-events: none;
}

.lantern-target-label {
  position: relative;
  z-index: 1;
  color: rgba(255, 239, 199, 0.66);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.lantern-number {
  position: relative;
  z-index: 1;
  color: #fff0bf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 45px;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(98, 25, 16, 0.3), 0 0 20px rgba(255, 208, 94, 0.36);
}

.lantern-total {
  min-width: 58px;
  margin-top: 9px;
  padding: 4px 7px;
  position: relative;
  z-index: 1;
  border-radius: 20px;
  color: #fff4d5;
  background: rgba(75, 19, 15, 0.36);
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 10px;
}

.lantern-cards {
  height: 22px;
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 3px;
  position: relative;
  z-index: 1;
}

.lantern-ban {
  min-height: 15px;
  margin-top: 3px;
  position: relative;
  z-index: 2;
  color: rgba(255, 240, 199, 0.72);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.lantern:not(.has-ban) .lantern-ban {
  visibility: hidden;
}

.lantern-chip {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font: 700 11px Georgia, serif;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.lantern-tail {
  width: 14px;
  height: 27px;
  margin: -1px auto 0;
  border-top: 5px solid #251918;
  background: repeating-linear-gradient(90deg, #c9583c 0 2px, transparent 2px 4px);
}

.lantern:hover .lantern-body,
.lantern:focus-visible .lantern-body,
.lantern.is-ready .lantern-body {
  filter: brightness(1.12);
  transform: translateY(-5px);
  box-shadow: 0 0 34px rgba(223, 90, 66, 0.32), inset 0 0 35px rgba(65, 11, 8, 0.42);
}

.lantern:focus-visible {
  outline: none;
}

.lantern.will-light .lantern-body {
  background:
    repeating-linear-gradient(90deg, transparent 0 17%, rgba(110, 39, 26, 0.12) 18%, transparent 20%),
    linear-gradient(180deg, #c75a36, #f09a45 55%, #ba3e2f);
  box-shadow: 0 0 38px rgba(246, 198, 91, 0.52), inset 0 0 35px rgba(137, 51, 17, 0.28);
}

.lantern.will-overload .lantern-body {
  filter: saturate(0.65) brightness(0.76);
}

.lantern.is-blocked .lantern-body {
  filter: grayscale(0.72) brightness(0.64);
  transform: translateY(0);
  box-shadow: inset 0 0 35px rgba(10, 18, 25, 0.58);
}

.lantern.is-blocked .lantern-total {
  color: #ffd2c4;
  background: rgba(42, 16, 18, 0.62);
}

.lantern.celebrate .lantern-body {
  animation: lanternLight 650ms ease;
}

.lantern.triple .lantern-body {
  animation: tripleGlow 850ms cubic-bezier(.2, .8, .2, 1);
}

.lantern.overload .lantern-body {
  animation: lanternShake 420ms ease;
}

.hand-zone {
  padding: 14px 15px 12px;
  position: relative;
  background:
    linear-gradient(180deg, rgba(9, 23, 35, 0) 0%, rgba(7, 17, 28, 0.95) 22%),
    radial-gradient(ellipse at 50% 100%, rgba(93, 53, 31, 0.24), transparent 68%);
}

.hand-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 3px;
}

.hand-heading strong {
  display: block;
  margin-top: 3px;
  color: #fff4d5;
  font-size: 14px;
  font-weight: 600;
}

.combo-legend {
  min-height: 27px;
  padding: 4px 7px;
  color: rgba(245, 230, 196, 0.56);
  border: 1px solid rgba(245, 230, 196, 0.14);
  border-radius: 11px 3px 11px 3px;
  background: rgba(7, 17, 28, 0.32);
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 9px;
  cursor: pointer;
  transition: 180ms ease;
}

.combo-legend i {
  margin: 0 4px;
  color: var(--cinnabar);
  font-style: normal;
}

.combo-legend b {
  margin-left: 6px;
  padding: 2px 4px;
  color: #17303d;
  border-radius: 6px;
  background: var(--paper-dark);
  font-size: 8px;
  letter-spacing: 0.05em;
}

.combo-legend:hover,
.combo-legend:focus-visible {
  color: var(--paper);
  border-color: rgba(246, 198, 91, 0.62);
  outline: none;
  background: rgba(246, 198, 91, 0.08);
}

.cards {
  height: 112px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 7px;
  perspective: 700px;
}

.card {
  width: min(68px, 18vw);
  height: 98px;
  padding: 7px;
  position: relative;
  flex: 0 1 68px;
  overflow: hidden;
  color: var(--ink);
  border: 0;
  border-radius: 7px 7px 14px 7px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35), transparent 32%),
    var(--paper);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(82, 51, 29, 0.18);
  cursor: pointer;
  transform-origin: 50% 110%;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
  animation: cardDeal 450ms backwards cubic-bezier(.2, .85, .2, 1);
  animation-delay: calc(var(--i) * 55ms);
}

.card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid color-mix(in srgb, var(--card-color), transparent 50%);
  border-radius: 5px 5px 11px 5px;
}

.card::after {
  content: "";
  position: absolute;
  width: 48px;
  height: 48px;
  right: -20px;
  bottom: -17px;
  border: 9px double color-mix(in srgb, var(--card-color), transparent 38%);
  border-radius: 50%;
}

.card:hover,
.card:focus-visible {
  z-index: 3;
  outline: none;
  transform: translateY(-9px) rotate(-1deg);
  box-shadow: 0 15px 24px rgba(0, 0, 0, 0.38), 0 0 0 2px var(--card-color);
}

.card.selected {
  z-index: 4;
  transform: translateY(-9px);
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.4), 0 0 0 3px var(--gold), 0 0 18px rgba(246, 198, 91, 0.2);
}

.card.swap-selected {
  filter: grayscale(0.35) brightness(0.68);
  transform: translateY(-12px) rotate(-2deg);
}

.card-corner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--card-color);
  font: 700 18px/1 Georgia, "Times New Roman", serif;
}

.card-symbol {
  font-size: 11px;
}

.card-art {
  height: 60px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  color: var(--card-color);
  font-size: 38px;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}

.action-row {
  min-height: 42px;
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.swap-button,
.primary-button {
  min-width: 128px;
  height: 40px;
  border-radius: 22px;
  cursor: pointer;
  transition: 160ms ease;
}

.swap-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--paper);
  border: 1px solid rgba(245, 230, 196, 0.28);
  background: rgba(21, 40, 53, 0.72);
}

.swap-button b {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper-dark);
  font: 700 11px Georgia, serif;
}

.swap-button:hover:not(:disabled),
.swap-button:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
  outline: none;
}

.swap-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.swap-symbol {
  color: var(--gold);
  font-size: 22px;
}

.primary-button,
.dialog-primary {
  color: #3d2418;
  border: 1px solid #ffe09a;
  background: linear-gradient(180deg, #f9d77e, #d99a42);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.5), 0 8px 20px rgba(0, 0, 0, 0.2);
  font-weight: 700;
}

.primary-button:hover,
.dialog-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.dock {
  min-height: 63px;
  display: flex;
  justify-content: center;
  gap: 54px;
  padding: 8px 20px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(245, 230, 196, 0.1);
  background: rgba(5, 14, 23, 0.92);
}

.dock-item {
  width: 38px;
  color: rgba(245, 230, 196, 0.38);
  border: 0;
  background: none;
}

.dock-item span {
  width: 29px;
  height: 29px;
  margin: auto;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  font-size: 13px;
}

.dock-item span::first-letter {
  transform: rotate(-45deg);
}

.dock-item small {
  display: block;
  margin-top: 4px;
  font-size: 9px;
}

.dock-item.active {
  color: var(--gold);
}

.toast {
  min-width: 150px;
  max-width: 78%;
  padding: 10px 16px;
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 30;
  color: #3f251a;
  border: 1px solid #ffe29a;
  border-radius: 4px;
  background: rgba(249, 220, 156, 0.96);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.35);
  text-align: center;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
}

.toast.show {
  animation: toastIn 1.7s ease both;
}

.tutorial-scrim {
  position: absolute;
  inset: 0;
  z-index: 34;
  pointer-events: none;
  background: rgba(2, 10, 17, 0.58);
  backdrop-filter: blur(1.5px);
}

.tutorial-coach {
  width: calc(100% - 40px);
  padding: 15px 17px 13px;
  position: absolute;
  left: 20px;
  z-index: 46;
  color: #40261c;
  border: 1px solid #edca78;
  border-radius: 14px 4px 14px 4px;
  background:
    linear-gradient(90deg, transparent 23px, rgba(183, 77, 56, 0.12) 24px, transparent 25px),
    #f5e6c4;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.46), inset 0 1px rgba(255, 255, 255, 0.55);
}

.tutorial-coach.coach-top {
  top: 218px;
}

.tutorial-coach.coach-bottom {
  bottom: 196px;
}

.tutorial-coach::after {
  content: "";
  width: 16px;
  height: 16px;
  position: absolute;
  left: 50%;
  background: #f5e6c4;
  transform: translateX(-50%) rotate(45deg);
}

.tutorial-coach.coach-top::after {
  top: -9px;
  border-top: 1px solid #edca78;
  border-left: 1px solid #edca78;
}

.tutorial-coach.coach-bottom::after {
  bottom: -9px;
  border-right: 1px solid #edca78;
  border-bottom: 1px solid #edca78;
}

.coach-step {
  color: #a44d38;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 9px;
  letter-spacing: 0.15em;
}

.tutorial-coach h3 {
  margin: 4px 0;
  font-size: 17px;
}

.tutorial-coach p {
  margin: 0;
  color: #76604c;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 11px;
  line-height: 1.65;
}

.coach-actions {
  margin-top: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.coach-skip,
.coach-next {
  min-height: 30px;
  border-radius: 16px;
  cursor: pointer;
}

.coach-skip {
  color: #88715d;
  border: 0;
  background: none;
  font-size: 10px;
}

.coach-next {
  min-width: 86px;
  color: #f8e9c9;
  border: 1px solid #9c4131;
  background: #ad4b38;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.2);
  font-size: 11px;
}

.coach-next[hidden] {
  display: none;
}

.tutorial-focus {
  z-index: 40 !important;
  filter: none !important;
}

.tutorial-focus::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: -1;
  pointer-events: none;
  border: 2px solid var(--gold);
  border-radius: 18px;
  box-shadow: 0 0 0 5px rgba(246, 198, 91, 0.08), 0 0 30px rgba(246, 198, 91, 0.22);
  animation: tutorialPulse 1.4s ease-in-out infinite;
}

dialog {
  max-width: calc(100% - 36px);
  color: var(--ink);
  border: 1px solid #d5ae62;
  border-radius: 18px 5px 18px 5px;
  background:
    linear-gradient(90deg, transparent 29px, rgba(191, 66, 45, 0.12) 30px, transparent 31px),
    repeating-linear-gradient(0deg, rgba(91, 61, 34, 0.025) 0 1px, transparent 1px 5px),
    #f3e6c9;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.56);
}

dialog::backdrop {
  background: rgba(4, 11, 18, 0.76);
  backdrop-filter: blur(5px);
}

.rules-dialog {
  width: 356px;
  padding: 0;
}

.core-review-dialog,
.combo-rules-dialog {
  width: min(356px, calc(100% - 28px));
  padding: 0;
}

.rules-dialog form,
.core-review-dialog form,
.combo-rules-dialog form,
.result-dialog form {
  padding: 29px 25px 24px;
  position: relative;
}

.rules-dialog .eyebrow,
.core-review-dialog .eyebrow,
.combo-rules-dialog .eyebrow,
.result-dialog .eyebrow {
  color: #a7523c;
}

.core-review-dialog form {
  padding-top: 23px;
  text-align: center;
}

.core-review-seal {
  width: 58px;
  height: 58px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  color: #f8e8c6;
  border: 4px double #f0d09a;
  border-radius: 50% 50% 50% 12%;
  background: #a84535;
  box-shadow: 0 8px 19px rgba(91, 37, 27, 0.24);
  font-size: 25px;
  transform: rotate(-3deg);
}

.core-review-dialog h2 {
  margin-bottom: 8px;
}

.core-review-dialog p {
  margin: 0;
  color: #6f5a47;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 13px;
  line-height: 1.75;
}

.core-live-state {
  margin-top: 13px;
  padding: 8px 10px;
  color: #8c4b34;
  border: 1px solid rgba(169, 74, 51, 0.2);
  border-radius: 9px 3px 9px 3px;
  background: rgba(185, 83, 55, 0.08);
  font-size: 11px;
}

.combo-rules-dialog form {
  padding-top: 26px;
}

.combo-rules-dialog h2 {
  margin-bottom: 13px;
}

.combo-rule-list {
  display: grid;
  gap: 7px;
}

.combo-rule-list article {
  min-height: 56px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(130, 82, 48, 0.17);
  border-radius: 10px 3px 10px 3px;
  background: rgba(255, 252, 238, 0.38);
}

.combo-rule-list article > i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #f8e7c7;
  border-radius: 50% 50% 50% 9px;
  background: #ad4b38;
  font-style: normal;
  font-size: 16px;
}

.combo-rule-list article div b,
.combo-rule-list article div span {
  display: block;
}

.combo-rule-list article div b {
  color: #44271c;
  font-size: 13px;
}

.combo-rule-list article div span {
  margin-top: 2px;
  color: #796653;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 10px;
  line-height: 1.45;
}

.combo-rule-list article > strong {
  color: #ad4b38;
  font: 700 18px/1 Georgia, serif;
}

.combo-formula {
  margin: 12px 0 5px;
  padding: 8px;
  color: #583b28;
  border-top: 1px solid rgba(128, 78, 45, 0.16);
  border-bottom: 1px solid rgba(128, 78, 45, 0.16);
  text-align: center;
  font-size: 11px;
}

.combo-note {
  display: block;
  color: #8a715b;
  text-align: center;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 9px;
  line-height: 1.5;
}

dialog h2 {
  margin: 5px 0 20px;
  font-size: 23px;
  letter-spacing: 0.04em;
}

.dialog-close {
  position: absolute;
  right: 12px;
  top: 10px;
  color: #6f5b45;
  border: 0;
  background: none;
  font-size: 25px;
  cursor: pointer;
}

.rules-dialog ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: steps;
}

.rules-dialog li {
  margin: 12px 0;
  padding-left: 40px;
  position: relative;
  counter-increment: steps;
}

.rules-dialog li::before {
  content: counter(steps);
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  position: absolute;
  left: 0;
  top: 0;
  color: #f7e9cc;
  border-radius: 50% 50% 50% 10%;
  background: #ae4938;
  font: 700 13px Georgia, serif;
}

.rules-dialog li b,
.rules-dialog li span {
  display: block;
}

.rules-dialog li b {
  font-size: 14px;
}

.rules-dialog li span {
  margin-top: 2px;
  color: #786650;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 12px;
}

.dialog-primary {
  width: 100%;
  height: 43px;
  margin-top: 12px;
  border-radius: 24px;
  cursor: pointer;
}

.result-dialog {
  width: 330px;
  text-align: center;
}

.privacy-dialog {
  width: min(365px, calc(100% - 28px));
  padding: 0;
  border-color: #ba8647;
}

.privacy-content {
  padding: 24px 23px 21px;
  text-align: center;
}

.privacy-seal {
  width: 56px;
  height: 56px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  color: #f7e7c5;
  border: 4px double #efd09b;
  border-radius: 50% 50% 50% 12px;
  background: #a84836;
  box-shadow: 0 8px 20px rgba(92, 38, 26, 0.22);
  font-size: 25px;
  transform: rotate(-3deg);
}

.privacy-content h2 {
  margin: 6px 0 9px;
  font-size: 21px;
}

.privacy-content > p {
  margin: 0;
  color: #755f4c;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 12px;
  line-height: 1.7;
}

.privacy-content ul {
  margin: 14px 0 0;
  padding: 10px 13px;
  color: #5e635d;
  border-top: 1px solid rgba(137, 89, 51, 0.17);
  border-bottom: 1px solid rgba(137, 89, 51, 0.17);
  background: rgba(255, 252, 239, 0.3);
  text-align: left;
  list-style: none;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 10px;
  line-height: 1.9;
}

.privacy-content li::before {
  content: "灯";
  margin-right: 7px;
  color: #aa4a38;
  font-size: 9px;
}

.privacy-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.privacy-actions .dialog-primary {
  margin-top: 0;
}

.privacy-local {
  height: 43px;
  color: #766a5e;
  border: 1px solid rgba(107, 91, 70, 0.23);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
}

.test-dialog {
  width: min(380px, calc(100% - 24px));
  padding: 0;
  border-color: #687f89;
  background:
    linear-gradient(90deg, transparent 27px, rgba(62, 100, 109, 0.1) 28px, transparent 29px),
    repeating-linear-gradient(0deg, rgba(54, 79, 87, 0.035) 0 1px, transparent 1px 5px),
    #e8e2d2;
}

.test-content {
  padding: 25px 20px 19px;
  position: relative;
}

.test-content h2 {
  margin: 4px 0 13px;
}

.test-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 8px;
}

.test-status span {
  padding: 8px 10px;
  color: #657177;
  border: 1px solid rgba(61, 87, 96, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.28);
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 10px;
}

.test-status b {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #253941;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-strip {
  min-height: 43px;
  margin-bottom: 8px;
  padding: 6px 7px 6px 10px;
  display: grid;
  grid-template-columns: 9px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(61, 87, 96, 0.18);
  border-radius: 9px 3px 9px 3px;
  background: rgba(255, 255, 255, 0.23);
}

.sync-strip > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8e9695;
  box-shadow: 0 0 0 3px rgba(109, 126, 128, 0.08);
}

.sync-strip span {
  color: #768083;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 9px;
}

.sync-strip span b {
  display: block;
  margin-top: 1px;
  color: #2d4248;
  font-size: 12px;
}

.sync-strip button {
  min-height: 29px;
  padding: 4px 10px;
  color: #34535b;
  border: 1px solid rgba(56, 102, 112, 0.3);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.38);
  font-size: 9px;
  cursor: pointer;
}

.sync-strip button:disabled {
  opacity: 0.46;
  cursor: default;
}

.sync-strip[data-state="synced"] > i {
  background: #4c9b78;
  box-shadow: 0 0 0 3px rgba(76, 155, 120, 0.12), 0 0 9px rgba(76, 155, 120, 0.34);
}

.sync-strip[data-state="syncing"] > i {
  background: #d49a3b;
  animation: syncPulse 900ms ease-in-out infinite;
}

.sync-strip[data-state="pending"] > i,
.sync-strip[data-state="failed"] > i {
  background: #c55a42;
  box-shadow: 0 0 0 3px rgba(197, 90, 66, 0.12);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.metric-grid span {
  padding: 8px 4px;
  color: #6f7777;
  border: 1px solid rgba(61, 87, 96, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.22);
  text-align: center;
  font-size: 9px;
}

.metric-grid b {
  display: block;
  margin-top: 2px;
  color: #2e4248;
  font: 700 16px Georgia, serif;
}

.test-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 11px;
}

.test-controls button {
  min-height: 37px;
  padding: 5px 8px;
  color: #344b53;
  border: 1px solid rgba(59, 92, 102, 0.25);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.32);
  font-size: 10px;
  cursor: pointer;
}

.test-controls button:hover,
.test-controls button:focus-visible {
  border-color: #3c7180;
  outline: none;
  background: rgba(255, 255, 255, 0.62);
}

.test-controls button.danger {
  color: #963e32;
  border-color: rgba(164, 65, 51, 0.26);
}

.privacy-note {
  margin: 10px 0 0;
  color: #7a8383;
  text-align: center;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 9px;
}

.choice-dialog,
.boss-dialog {
  width: min(380px, calc(100% - 26px));
  padding: 0;
}

.choice-content,
.boss-content {
  padding: 28px 22px 22px;
  text-align: center;
}

.boss-content {
  padding-top: 18px;
}

.choice-content h2,
.boss-content h2 {
  margin: 5px 0 7px;
}

.choice-content > p,
.boss-content > p {
  margin: 0 auto 17px;
  color: #786650;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 12px;
  line-height: 1.65;
}

.core-choices {
  display: grid;
  gap: 9px;
}

.core-choice {
  min-height: 72px;
  padding: 10px 12px 10px 65px;
  position: relative;
  color: var(--ink);
  border: 1px solid rgba(137, 82, 46, 0.28);
  border-radius: 10px 4px 10px 4px;
  background: rgba(255, 250, 233, 0.46);
  text-align: left;
  cursor: pointer;
  transition: 180ms ease;
}

.core-choice:hover,
.core-choice:focus-visible {
  border-color: #b44c37;
  outline: none;
  background: rgba(255, 250, 233, 0.82);
  transform: translateX(4px);
  box-shadow: -5px 5px 0 rgba(180, 76, 55, 0.12);
}

.core-choice i {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  position: absolute;
  left: 13px;
  top: 15px;
  color: #f8e7c7;
  border: 2px double #f8e7c7;
  background: #a84535;
  font-size: 20px;
  font-style: normal;
  transform: rotate(-3deg);
}

.core-choice b,
.core-choice span {
  display: block;
}

.core-choice b {
  color: #44271c;
  font-size: 15px;
}

.core-choice span {
  margin-top: 4px;
  color: #76604c;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 11px;
  line-height: 1.45;
}

.boss-dialog {
  border-color: #768994;
  background:
    radial-gradient(circle at 50% 10%, rgba(77, 112, 123, 0.16), transparent 32%),
    repeating-linear-gradient(0deg, rgba(63, 84, 91, 0.035) 0 1px, transparent 1px 5px),
    #e5dfcf;
}

.boss-seal {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  color: #e8e0cc;
  border: 3px double #c8d3d3;
  border-radius: 50%;
  background: #415965;
  box-shadow: 0 9px 22px rgba(26, 45, 53, 0.28);
  font-size: 27px;
}

.ban-preview {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
}

.ban-preview span {
  padding: 6px 8px;
  border: 1px solid rgba(55, 78, 87, 0.18);
  border-radius: 16px;
  color: #485a60;
  background: rgba(255, 255, 255, 0.32);
  font-size: 10px;
}

.ban-preview i {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 4px;
  border-radius: 50%;
}

.red-dot { background: var(--cinnabar); }
.blue-dot { background: var(--water); }
.green-dot { background: var(--jade); }

.result-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0 3px;
}

.result-breakdown:empty {
  display: none;
}

.result-breakdown span {
  padding: 8px 4px;
  border: 1px solid rgba(142, 86, 48, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.27);
  color: #7a604b;
  font-size: 10px;
}

.result-breakdown b {
  display: block;
  margin-top: 2px;
  color: #3e261c;
  font: 700 16px Georgia, serif;
}

.result-seal {
  width: 62px;
  height: 62px;
  margin: -59px auto 18px;
  display: grid;
  place-items: center;
  color: #f4dcb1;
  border: 4px double #f4dcb1;
  background: #b74d38;
  box-shadow: 0 9px 20px rgba(91, 37, 27, 0.25);
  font-size: 31px;
  transform: rotate(-4deg);
}

.result-dialog p {
  margin: -10px 0 12px;
  color: #786650;
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 13px;
  line-height: 1.7;
}

.desktop-note {
  width: 180px;
  margin-left: 54px;
  position: absolute;
  left: calc(50% + 230px);
  top: 50%;
  color: rgba(245, 230, 196, 0.5);
  transform: translateY(-50%);
}

.desktop-note span {
  color: rgba(246, 198, 91, 0.75);
  font: 700 18px/1.2 Georgia, serif;
  letter-spacing: 0.12em;
}

.desktop-note p {
  padding-top: 12px;
  border-top: 1px solid rgba(245, 230, 196, 0.18);
  font-family: "FZSong-Z01", "STSong", serif;
  font-size: 12px;
  line-height: 1.8;
}

@keyframes twinkle {
  to { opacity: 0.25; transform: scale(0.6); }
}

@keyframes lanternEnter {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cardDeal {
  from { opacity: 0; transform: translateY(70px) rotate(8deg); }
  to { opacity: 1; transform: translateY(0) rotate(0); }
}

@keyframes lanternLight {
  0%, 100% { filter: brightness(1); transform: translateY(0) scale(1); }
  40% { filter: brightness(1.7); transform: translateY(-8px) scale(1.04); }
}

@keyframes lanternShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px) rotate(-2deg); }
  50% { transform: translateX(5px) rotate(2deg); }
  75% { transform: translateX(-3px); }
}

@keyframes toastIn {
  0% { opacity: 0; transform: translate(-50%, 12px); }
  16%, 78% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}

@keyframes powerRise {
  0%, 100% { border-color: rgba(246, 198, 91, 0.2); }
  45% { border-color: var(--gold); box-shadow: 0 0 25px rgba(246, 198, 91, 0.2); }
}

@keyframes tripleGlow {
  0%, 100% { filter: brightness(1); transform: translateY(0) scale(1); }
  28% { filter: brightness(1.8); transform: translateY(-10px) scale(1.06); }
  52% { box-shadow: 0 0 60px rgba(246, 198, 91, 0.82), inset 0 0 34px rgba(255, 238, 170, 0.28); }
  70% { filter: brightness(1.32); transform: translateY(-5px) scale(1.02); }
}

@keyframes tutorialPulse {
  50% { box-shadow: 0 0 0 8px rgba(246, 198, 91, 0.03), 0 0 38px rgba(246, 198, 91, 0.34); }
}

@keyframes syncPulse {
  50% { opacity: 0.42; transform: scale(0.72); }
}

@media (max-width: 760px) {
  .stage-shell { padding: 0; }
  .game {
    width: 100%;
    height: 100svh;
    min-height: 650px;
    border: 0;
    border-radius: 0;
  }
  .desktop-note { display: none; }
}

@media (max-height: 760px) {
  .game { min-height: 650px; }
  .topbar { padding-top: 12px; }
  .score-panel { padding-top: 9px; padding-bottom: 8px; }
  .lantern-zone { min-height: 260px; }
  .lantern-body { min-height: 126px; }
  .cards { height: 102px; }
  .card { height: 91px; }
  .dock { min-height: 54px; padding-top: 5px; padding-bottom: 5px; }
}

@media (max-height: 700px) {
  .game { min-height: 0; }
  .topbar {
    padding: 9px 18px 5px;
  }
  .round-icon {
    width: 38px;
    height: 38px;
  }
  .chapter-mark strong {
    margin-top: 2px;
    font-size: 24px;
  }
  .score-panel {
    margin: 0 18px;
    padding: 7px 14px 6px;
  }
  .score-copy strong,
  .turn-copy strong {
    font-size: 21px;
  }
  .score-track {
    margin-top: 4px;
  }
  .streak-row {
    margin-top: 5px;
  }
  .power-status {
    min-height: 27px;
    padding: 3px 7px;
  }
  .power-status.is-active b {
    font-size: 17px;
  }
  .lantern-zone {
    flex: 1 1 205px;
    min-height: 198px;
    padding-top: 0;
  }
  .guide-line {
    margin: 0 0 10px;
  }
  .lantern::before {
    height: 15px;
    margin-top: -10px;
  }
  .lantern-body {
    min-height: 106px;
  }
  .lantern-number {
    font-size: 36px;
  }
  .lantern-total {
    margin-top: 5px;
  }
  .lantern-cards {
    height: 17px;
    margin-top: 4px;
  }
  .lantern-chip {
    width: 17px;
    height: 17px;
  }
  .lantern-tail {
    height: 18px;
  }
  .hand-zone {
    flex: 0 0 183px;
    padding: 6px 10px 5px;
  }
  .hand-heading {
    margin-bottom: 4px;
  }
  .hand-heading strong {
    margin-top: 1px;
    font-size: 12px;
  }
  .cards {
    height: 80px;
    gap: 6px;
  }
  .card {
    height: 75px;
    padding: 5px;
  }
  .card-corner {
    font-size: 15px;
  }
  .card-art {
    height: 45px;
    font-size: 28px;
  }
  .action-row {
    min-height: 34px;
    margin-top: 3px;
  }
  .swap-button,
  .primary-button {
    height: 34px;
  }
  .dock {
    min-height: 48px;
    gap: 44px;
    padding-top: 3px;
    padding-bottom: 3px;
  }
  .dock-item span {
    width: 25px;
    height: 25px;
  }
  .tutorial-coach {
    padding: 11px 14px 10px;
  }
  .tutorial-coach.coach-top {
    top: 175px;
  }
  .tutorial-coach.coach-bottom {
    bottom: 155px;
  }
  .tutorial-coach h3 {
    font-size: 14px;
  }
  .coach-actions {
    margin-top: 5px;
  }
  .test-content {
    padding-top: 20px;
    padding-bottom: 15px;
  }
  .test-status span,
  .metric-grid span {
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .test-controls button {
    min-height: 32px;
  }
}

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