:root {
  --gold-dark: #745015;
  --gold-mid: #c78a25;
  --gold-light: #ffe49a;
  --paper: #f4f3ed;
  --ink: #282624;
  --blue: #29385d;
  --orange: #f17820;
  --navy-0: #0c1930;
  --navy-1: #132642;
  --navy-2: #1b3354;
  --font-song: "SimSun", "宋体", "Songti SC", "STSong", serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-song);
  background:
    radial-gradient(1400px 700px at 50% -12%, #1d3357 0%, transparent 62%),
    radial-gradient(900px 500px at 84% 4%, rgba(255, 170, 80, .10), transparent 55%),
    radial-gradient(720px 460px at 8% 34%, rgba(120, 170, 255, .08), transparent 55%),
    linear-gradient(180deg, #0c1930 0%, #132642 42%, #1b3354 78%, #23405f 100%);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(120% 92% at 50% 42%, transparent 58%, rgba(4, 10, 22, .42) 100%);
}
button, img { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 背景粒子画布 ---------- */
.particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- 页面标题 ---------- */
.game-page {
  position: relative;
  z-index: 1;
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 8px 14px 56px;
}
.page-head {
  position: relative;
  text-align: center;
  margin: 2px 0 16px;
  padding: 0 52px;
}
.page-eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .9em;
  margin: 0 0 6px;
  color: #d9c48f;
  font-family: var(--font-song);
  font-size: clamp(10px, 1.5vw, 13px);
  letter-spacing: .5em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.page-eyebrow span {
  width: clamp(26px, 6vw, 64px);
  height: 1px;
  background: linear-gradient(90deg, transparent, #d9b25f);
}
.page-eyebrow span:last-child { transform: scaleX(-1); }
.page-title {
  margin: 0;
  font-family: var(--font-song);
  font-size: clamp(26px, 4.8vw, 42px);
  font-weight: 900;
  letter-spacing: .26em;
  padding-left: .26em;
  background: linear-gradient(180deg, #fff6cd 0%, #ffd97a 40%, #e2a63c 64%, #b97c1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 2px rgba(5, 12, 26, .6)) drop-shadow(0 0 18px rgba(255, 200, 100, .30));
}
.page-sub {
  margin: 8px 0 0;
  color: #9fb2d0;
  font-family: var(--font-song);
  font-size: clamp(10px, 1.5vw, 13px);
  letter-spacing: .3em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

/* ---------- 音效开关 ---------- */
.sound-toggle {
  position: fixed;
  z-index: 50;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #f4d78e;
  cursor: pointer;
  border: 1px solid rgba(214, 171, 84, .55);
  border-radius: 50%;
  background: rgba(16, 29, 54, .72);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4), inset 0 1px rgba(255, 255, 255, .08);
  transition: transform .15s ease, filter .15s ease;
}
.sound-toggle:hover { filter: brightness(1.18); transform: scale(1.07); }
.sound-toggle:active { transform: scale(.96); }
.sound-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound-toggle .icon-sound-off { display: none; }
.sound-toggle.muted { color: #8b96ad; border-color: rgba(140, 150, 175, .4); }
.sound-toggle.muted .icon-sound-on { display: none; }
.sound-toggle.muted .icon-sound-off { display: block; }

/* ---------- 抽取场景 ---------- */
.draw-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 872 / 554;
  overflow: hidden;
  border-radius: 4px;
  background: url('./assets/ui/draw-panel.png') center / 100% 100% no-repeat;
  box-shadow:
    0 0 0 1px rgba(255, 215, 130, .22),
    0 26px 46px rgba(5, 12, 26, .55),
    0 0 64px rgba(255, 190, 90, .10);
  isolation: isolate;
}
.draw-scene::before {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  box-shadow:
    inset 0 0 64px rgba(18, 38, 68, .28),
    inset 0 0 6px rgba(255, 230, 170, .26);
}
.draw-scene::after {
  content: "";
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 43%, rgba(255, 255, 255, .15) 50%, transparent 57%);
  background-size: 260% 100%;
  animation: panel-sweep 7.5s ease-in-out infinite;
}
@keyframes panel-sweep {
  0%, 52% { background-position: 130% 0; }
  100% { background-position: -130% 0; }
}

/* ---------- 全屏闪光 ---------- */
.draw-flash {
  position: absolute;
  z-index: 9;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.draw-flash.quick {
  background: radial-gradient(52% 44% at 50% 46%, rgba(255, 252, 235, .95), rgba(255, 252, 235, .4) 55%, transparent 76%);
  animation: flash-pop .55s ease-out both;
}
.draw-flash.open {
  background: radial-gradient(52% 44% at 50% 46%, rgba(255, 252, 235, .95), rgba(255, 252, 235, .4) 55%, transparent 76%);
  animation: flash-pop .28s ease-out both;
}
.draw-flash.premium {
  background: radial-gradient(62% 56% at 50% 45%, rgba(255, 240, 200, .98), rgba(255, 172, 60, .55) 55%, transparent 78%);
  animation: flash-big 1.05s ease-out both;
}
.draw-flash.rare {
  background: radial-gradient(62% 56% at 50% 45%, rgba(255, 228, 195, .95), rgba(255, 132, 42, .5) 55%, transparent 78%);
  animation: flash-big .95s ease-out both;
}
@keyframes flash-pop { from { opacity: 1; } to { opacity: 0; } }
@keyframes flash-big { 0% { opacity: 0; } 18% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- 揭示横幅 ---------- */
.reveal-banner {
  position: absolute;
  z-index: 12;
  left: 50%;
  top: 14%;
  padding: .48em 1.5em;
  border-radius: 2px;
  font-family: var(--font-song);
  font-size: clamp(13px, 2.4vw, 26px);
  font-weight: 900;
  letter-spacing: .32em;
  padding-left: calc(1.5em + .32em);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -10%) scale(.6);
}
.reveal-banner::before,
.reveal-banner::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 2.4em;
  height: 1px;
  background: currentColor;
  opacity: .75;
}
.reveal-banner::before { right: calc(100% + .8em); }
.reveal-banner::after { left: calc(100% + .8em); }
.reveal-banner.show { animation: banner-in 1.35s cubic-bezier(.2, .7, .3, 1) both; }
.reveal-banner.premium {
  color: #ffeeb0;
  border: 1px solid #ffc94d;
  background: linear-gradient(90deg, rgba(120, 50, 4, .12), rgba(120, 50, 4, .72), rgba(120, 50, 4, .12));
  box-shadow: 0 0 26px rgba(255, 140, 20, .65), inset 0 0 20px rgba(255, 220, 140, .32);
  text-shadow: 0 2px 8px rgba(70, 30, 0, .6);
}
.reveal-banner.rare {
  color: #ffd9b0;
  border: 1px solid #ff9a3c;
  background: linear-gradient(90deg, rgba(140, 55, 4, .12), rgba(140, 55, 4, .66), rgba(140, 55, 4, .12));
  box-shadow: 0 0 20px rgba(255, 120, 20, .5), inset 0 0 18px rgba(255, 200, 140, .25);
  text-shadow: 0 2px 8px rgba(70, 30, 0, .6);
}
.reveal-banner.gold3 {
  color: #fff1c0;
  border: 1px solid #e8bd4d;
  background: linear-gradient(90deg, rgba(96, 60, 4, .12), rgba(96, 60, 4, .62), rgba(96, 60, 4, .12));
  box-shadow: 0 0 18px rgba(232, 189, 77, .45), inset 0 0 16px rgba(255, 230, 160, .22);
  text-shadow: 0 2px 8px rgba(60, 35, 0, .6);
}
.reveal-banner.gold2 {
  color: #f4ecd6;
  border: 1px solid rgba(190, 160, 90, .75);
  background: rgba(70, 55, 20, .58);
  box-shadow: 0 0 14px rgba(0, 0, 0, .3);
  text-shadow: 0 2px 8px rgba(40, 25, 0, .7);
  font-size: clamp(11px, 1.9vw, 20px);
}
@keyframes banner-in {
  0% { opacity: 0; transform: translate(-50%, -12%) scale(.55); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
  24% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  76% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 5%) scale(.96); }
}

/* ---------- 结果区 ---------- */
.result-area {
  position: absolute;
  z-index: 3;
  left: 26.5%;
  top: 23.5%;
  width: 47%;
  height: 43.5%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  align-items: center;
  justify-items: center;
  gap: 2.2% 1.8%;
  perspective: 900px;
}
.result-area.empty {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
}
.result-area.single-result {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  place-items: center;
}

/* ---------- 待机提示 ---------- */
.idle-hint {
  grid-row: 1;
  margin: 0;
  color: #6b4a14;
  font-family: var(--font-song);
  font-size: clamp(10px, 1.3vw, 15px);
  font-weight: 700;
  letter-spacing: .32em;
  padding-left: .32em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .85);
  animation: hint-pulse 2.2s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { opacity: .72; }
  50% { opacity: 1; }
}

/* ---------- 石头卡牌 ---------- */
.stone-card {
  position: relative;
  width: 100%;
  min-width: 0;
  display: grid;
  place-items: center;
  align-self: center;
  opacity: 0;
  transform: translateY(12px) scale(.82);
  transition: opacity .32s ease, transform .42s cubic-bezier(.2, .8, .3, 1.15);
  will-change: transform, opacity;
}
.stone-card.revealed {
  opacity: 1;
  transform: none;
}
.stone-card.highlight { z-index: 4; }
.stone-frame {
  position: relative;
  width: min(70%, 58px);
  aspect-ratio: 1;
  padding: 4%;
  overflow: hidden;
  border: clamp(1px, .2vw, 2px) solid #e8bd4d;
  background: linear-gradient(145deg, #5b5422, #202d26);
  box-shadow:
    inset 0 0 0 clamp(1px, .18vw, 2px) rgba(255, 255, 255, .18),
    0 0 0 1px #6a5115,
    0 4px 8px rgba(0, 0, 0, .25);
  transform: rotateY(58deg);
  transition: transform .5s cubic-bezier(.25, .75, .3, 1.1) .06s;
  transform-style: preserve-3d;
  will-change: transform;
}
.stone-card.revealed .stone-frame { transform: rotateY(0deg); }
.stone-card.highlight .stone-frame { width: min(84%, 72px); }
.stone-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .25s ease .2s;
}
.stone-card.revealed .stone-frame img { opacity: 1; }
.mystery-tile {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #ffe9a8;
  font-family: var(--font-song);
  font-size: clamp(15px, 2.5vw, 28px);
  font-weight: 900;
  text-shadow: 0 0 10px rgba(255, 210, 100, .85);
  background:
    radial-gradient(circle at 40% 32%, rgba(255, 230, 160, .3), transparent 42%),
    linear-gradient(145deg, #7a5a16, #3d2c08 62%, #1f1704);
  opacity: 1;
  transition: opacity .18s ease .15s;
}
.stone-card.revealed .mystery-tile { opacity: 0; }
.frame-gold .stone-frame {
  border-color: #ffd76e;
  box-shadow:
    inset 0 0 0 clamp(1px, .18vw, 2px) rgba(255, 255, 255, .24),
    0 0 0 1px #755814,
    0 0 11px rgba(219, 169, 52, .38);
}
.frame-orange .stone-frame {
  border-color: #ff8b2d;
  box-shadow:
    inset 0 0 0 clamp(1px, .18vw, 2px) rgba(255, 235, 211, .28),
    0 0 0 1px #9a3d0a,
    0 0 15px rgba(255, 106, 20, .58);
}
.frame-orange-flow .stone-frame {
  overflow: visible;
  border-color: #ff9b38;
  box-shadow:
    inset 0 0 0 clamp(1px, .18vw, 2px) rgba(255, 246, 223, .3),
    0 0 0 1px #a7430b,
    0 0 18px rgba(255, 99, 8, .72);
}
.frame-orange-flow .stone-frame::before {
  content: "";
  position: absolute;
  inset: -7%;
  z-index: -1;
  padding: clamp(2px, .32vw, 4px);
  background: conic-gradient(from 0deg, transparent 0 9%, #fff1b7 15%, #ff6f00 27%, transparent 39% 57%, #ffd169 68%, #ff6900 82%, transparent 94%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  filter: drop-shadow(0 0 3px rgba(255, 99, 8, .75));
  animation: flow-spin 1.9s linear infinite;
}
.shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.shine::after {
  content: "";
  position: absolute;
  top: -30%;
  left: -82%;
  width: 34%;
  height: 170%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent);
  animation: shimmer 2.5s ease-in-out infinite;
}
.stone-meta {
  width: 100%;
  margin-top: 3%;
  text-align: center;
  line-height: 1.08;
  text-shadow: 0 1px 0 #fff;
}
.stone-stars {
  display: block;
  height: 1em;
  color: #c48621;
  font-family: var(--font-song);
  font-size: clamp(6px, .86vw, 11px);
  letter-spacing: 0;
}
.frame-gold .stone-stars { text-shadow: 0 0 5px rgba(255, 205, 100, .55); }
.frame-orange .stone-stars,
.frame-orange-flow .stone-stars {
  color: #e85f13;
  text-shadow: 0 0 6px rgba(255, 120, 20, .6);
}
.stone-name {
  display: block;
  overflow: hidden;
  color: #453a2a;
  font-size: clamp(6px, .85vw, 10px);
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- 揭示粒子 ---------- */
.fx-particle {
  position: absolute;
  left: 50%;
  top: 55%;
  z-index: 9;
  pointer-events: none;
  animation: fx-fly .9s cubic-bezier(.2, .6, .4, 1) forwards;
}
@keyframes fx-fly {
  from { transform: translate(0, 0) scale(1); opacity: 1; }
  to { transform: translate(var(--dx), var(--dy)) scale(.25) rotate(240deg); opacity: 0; }
}

/* ---------- 余额行 ---------- */
.balance-line {
  position: absolute;
  z-index: 5;
  left: 41.8%;
  top: 73.7%;
  width: 17%;
  height: 5.4%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3.5%;
  color: #2b2926;
  font-family: var(--font-song);
  font-size: clamp(8px, 1.45vw, 16px);
  font-weight: 700;
  white-space: nowrap;
}
.balance-line strong {
  display: inline-block;
  color: #c46e18;
  font-family: var(--font-song);
  font-size: 1.06em;
  text-shadow: 0 0 6px rgba(255, 190, 90, .35);
}
#stageBalance.pop { animation: num-pop .45s cubic-bezier(.2, .8, .3, 1.2); }
@keyframes num-pop {
  40% { transform: scale(1.28); color: #ff9a1f; }
  100% { transform: scale(1); }
}
.balance-gem {
  flex: 0 0 auto;
  width: .72em;
  height: .72em;
  background: linear-gradient(135deg, #fff6d8 0%, #f3c969 42%, #b8860b 100%);
  clip-path: polygon(50% 0, 100% 34%, 100% 66%, 50% 100%, 0 66%, 0 34%);
  filter: drop-shadow(0 1px 1px rgba(90, 60, 10, .5));
  transform: translateY(-3%);
}
.button-chest {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 1.25em;
  height: .78em;
  border: 1px solid #5d350c;
  border-radius: 15% 15% 7% 7%;
  background:
    linear-gradient(90deg, transparent 42%, #e0ad4e 43% 57%, transparent 58%),
    linear-gradient(180deg, #6d3d0f 0 35%, #b87521 36% 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 215, 111, .28), 0 1px 2px rgba(0, 0, 0, .3);
  transform: rotate(-4deg);
}
.button-chest::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 42%;
  height: 1px;
  background: #4c2d0c;
}

/* ---------- 抽取按钮 ---------- */
.draw-actions {
  position: absolute;
  z-index: 6;
  left: 33.1%;
  top: 79.7%;
  width: 34.3%;
  height: 6.5%;
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 7.2%;
}
.draw-button {
  position: relative;
  min-width: 0;
  padding: 0 6%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4%;
  overflow: hidden;
  color: #684414;
  cursor: pointer;
  border: 1px solid #8a5d0e;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .28), transparent 26% 74%, rgba(122, 74, 8, .12)),
    linear-gradient(180deg, #ffe9a8 0%, #f7d273 45%, #e3ae43 100%);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .65),
    inset 0 -3px 3px rgba(142, 84, 8, .28),
    0 2px 4px rgba(40, 24, 4, .3),
    0 0 14px rgba(255, 205, 110, .22);
  font-family: var(--font-song);
  font-size: clamp(8px, 1.55vw, 18px);
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 255, 255, .65);
  transition: filter .15s ease, transform .15s ease, box-shadow .2s ease;
}
.draw-button::after {
  content: "";
  position: absolute;
  inset: 9% 8%;
  border: 1px solid rgba(147, 89, 12, .22);
  border-radius: 3px;
  pointer-events: none;
}
.draw-button.ten {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .3), transparent 26% 74%, rgba(122, 74, 8, .14)),
    linear-gradient(180deg, #ffeebb 0%, #f8d47c 45%, #e7b44a 100%);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .7),
    inset 0 -3px 3px rgba(142, 84, 8, .3),
    0 2px 4px rgba(40, 24, 4, .3),
    0 0 18px rgba(255, 210, 120, .38);
}
.btn-shine {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -70%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
  animation: btn-sweep 3.6s ease-in-out infinite;
}
@keyframes btn-sweep {
  0%, 55% { left: -70%; }
  85%, 100% { left: 135%; }
}
.draw-button:hover:not(:disabled) {
  filter: brightness(1.09) saturate(1.08);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, .7),
    inset 0 -3px 3px rgba(142, 84, 8, .28),
    0 3px 6px rgba(40, 24, 4, .35),
    0 0 22px rgba(255, 214, 120, .5);
}
.draw-button:active:not(:disabled) { transform: translateY(1px) scale(.99); filter: brightness(.97); }
.draw-button:disabled { cursor: wait; filter: grayscale(.45) brightness(.88); opacity: .75; }
.draw-button:disabled .btn-shine { animation: none; }
.button-count {
  margin-left: -2%;
  padding: 2% 4%;
  color: #82602a;
  background: rgba(111, 70, 15, .12);
  border-radius: 3px;
  font-family: var(--font-song);
  font-size: .72em;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(122, 76, 12, .18);
}
.button-label { white-space: nowrap; }

/* ---------- 消耗说明 ---------- */
.cost-note {
  position: absolute;
  z-index: 5;
  left: 16.8%;
  top: 88.2%;
  display: flex;
  align-items: center;
  gap: .42em;
  padding: .5em .9em;
  color: #6f675c;
  border: 1px solid rgba(120, 90, 40, .3);
  border-radius: 3px;
  background: rgba(255, 250, 235, .5);
  box-shadow: inset 0 1px rgba(255, 255, 255, .7), 0 1px 2px rgba(80, 55, 20, .15);
  font-family: var(--font-song);
  font-size: clamp(6px, 1.05vw, 12px);
  font-weight: 700;
  white-space: nowrap;
}
.cost-gem {
  width: .84em;
  height: .84em;
  background: linear-gradient(135deg, #eef2fa, #8a95ab 55%, #4d5a72);
  clip-path: polygon(50% 0, 100% 34%, 100% 66%, 50% 100%, 0 66%, 0 34%);
  filter: drop-shadow(0 1px 1px rgba(60, 70, 95, .45));
}

/* ---------- 记录面板 ---------- */
.ledger {
  position: relative;
  width: 86%;
  margin: 26px auto 0;
  padding: 22px 24px 24px;
  color: #eee9dc;
  border: 1px solid #8a6a2e;
  border-radius: 6px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, .09), transparent 26%),
    linear-gradient(148deg, #22355a 0%, #182a4a 45%, #101d36 100%);
  box-shadow:
    0 24px 48px rgba(5, 12, 26, .5),
    inset 0 0 0 3px rgba(255, 255, 255, .03),
    inset 0 0 44px rgba(0, 0, 0, .22);
}
.corner {
  position: absolute;
  width: 16px;
  height: 16px;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(255, 200, 110, .4));
}
.corner-tl { top: -1px; left: -1px; border-top: 2px solid #d8ad58; border-left: 2px solid #d8ad58; border-top-left-radius: 6px; }
.corner-tr { top: -1px; right: -1px; border-top: 2px solid #d8ad58; border-right: 2px solid #d8ad58; border-top-right-radius: 6px; }
.corner-bl { bottom: -1px; left: -1px; border-bottom: 2px solid #d8ad58; border-left: 2px solid #d8ad58; border-bottom-left-radius: 6px; }
.corner-br { bottom: -1px; right: -1px; border-bottom: 2px solid #d8ad58; border-right: 2px solid #d8ad58; border-bottom-right-radius: 6px; }
.ledger-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(229, 196, 126, .28);
}
.ledger-head p,
.ledger-head h2 { margin: 0; }
.ledger-head p {
  color: #d8c89f;
  font-size: 11px;
  letter-spacing: .24em;
}
.ledger-head h2 {
  margin-top: 5px;
  color: #f3d897;
  font-size: 21px;
  letter-spacing: .08em;
  text-shadow: 0 0 12px rgba(243, 200, 110, .25);
}
.ledger-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}
.ledger-stats {
  display: flex;
  gap: 10px;
  font-family: var(--font-song);
  font-size: 12px;
}
.ledger-stats span {
  padding: 7px 12px;
  color: #c4ccdc;
  border: 1px solid rgba(226, 190, 110, .28);
  border-radius: 4px;
  background: rgba(8, 16, 32, .35);
  box-shadow: inset 0 1px rgba(255, 255, 255, .04);
}
.ledger-stats strong {
  color: #f3c969;
  font-family: var(--font-song);
  font-size: 16px;
  text-shadow: 0 0 8px rgba(243, 201, 105, .35);
}
.ledger-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  font-family: var(--font-song);
}
.fragment-topup {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #c4ccdc;
  font-size: 11px;
  white-space: nowrap;
}
.fragment-topup input {
  width: 106px;
  height: 31px;
  padding: 0 9px;
  color: #f6dd9e;
  border: 1px solid rgba(225, 187, 105, .42);
  border-radius: 3px;
  outline: none;
  background: rgba(12, 24, 45, .44);
  font-family: var(--font-song);
  font-size: 12px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.fragment-topup input:focus {
  border-color: #e4bc67;
  box-shadow: 0 0 0 2px rgba(228, 188, 103, .12);
}
.ledger-button {
  min-height: 31px;
  padding: 0 13px;
  color: #e9e4d8;
  cursor: pointer;
  border: 1px solid rgba(218, 183, 108, .36);
  border-radius: 3px;
  background: rgba(255, 255, 255, .055);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform .15s ease, filter .15s ease, border-color .15s ease;
}
.ledger-button.primary {
  color: #52350d;
  border-color: #bd872b;
  background: linear-gradient(180deg, #f5dc91, #dcae50);
  box-shadow: inset 0 1px rgba(255, 255, 255, .45), 0 0 10px rgba(245, 220, 145, .15);
}
.ledger-button.danger {
  color: #f4d8d1;
  border-color: rgba(207, 113, 91, .48);
  background: rgba(131, 54, 45, .28);
}
.ledger-button:hover { filter: brightness(1.1); }
.ledger-button:active { transform: translateY(1px); }
.ledger-button:disabled,
.fragment-topup input:disabled {
  cursor: wait;
  opacity: .58;
  filter: grayscale(.35);
}
.history-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  max-height: min(56vh, 430px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(226, 190, 110, .5) transparent;
}
.history-list::-webkit-scrollbar { width: 8px; }
.history-list::-webkit-scrollbar-thumb {
  background: rgba(226, 190, 110, .45);
  border-radius: 4px;
}
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-empty {
  padding: 27px;
  text-align: center;
  color: #aeb8ca;
  border: 1px dashed rgba(231, 199, 130, .28);
  border-radius: 4px;
}
.history-empty::before {
  content: "◇";
  display: block;
  margin-bottom: 8px;
  color: #7d8aa3;
  font-size: 26px;
}
.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 135px 104px 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 14px 12px 16px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-left: 3px solid #c9a24d;
  border-radius: 0 4px 4px 0;
  background: rgba(255, 255, 255, .045);
}
.history-item.has-orange { border-left-color: #ff8a2a; }
.history-item.has-premium {
  border-left: 3px solid;
  border-image: linear-gradient(180deg, #ffd15c, #ff7a00) 1;
}
.history-time {
  color: #a7b1c3;
  font-family: var(--font-song);
  font-size: 11px;
}
.history-cost {
  color: #ebc374;
  font-size: 12px;
}
.history-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.history-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 7px;
  color: #e9e4d8;
  border: 1px solid rgba(222, 181, 94, .34);
  border-radius: 3px;
  background: rgba(255, 255, 255, .055);
  font-size: 11px;
}
.history-chip::before {
  content: "◆";
  margin-right: 5px;
  color: #e5bf6b;
  font-size: .8em;
}
.history-chip.orange {
  color: #ffd4ad;
  border-color: rgba(255, 128, 37, .58);
}
.history-chip.orange::before { color: #ff9838; }
.history-chip.premium {
  color: #ffe9b8;
  border-color: #ff8a25;
  animation: premium-chip 1.6s ease-in-out infinite;
}
.history-chip.premium::before {
  color: #ffc14d;
  text-shadow: 0 0 6px rgba(255, 140, 30, .8);
}
@keyframes premium-chip {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 120, 20, .22); }
  50% { box-shadow: 0 0 16px rgba(255, 140, 30, .55); }
}

/* ---------- 提示浮层 ---------- */
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 14px);
  padding: 10px 18px;
  color: #fff4db;
  border: 1px solid rgba(232, 194, 112, .62);
  border-radius: 4px;
  background: linear-gradient(160deg, rgba(30, 44, 74, .96), rgba(16, 25, 44, .96));
  box-shadow: 0 12px 26px rgba(0, 0, 0, .3);
  font-family: var(--font-song);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: .22s ease;
}
.toast::before {
  content: "✦";
  margin-right: 8px;
  color: #f3c969;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.rare {
  border-color: #ff9a3c;
  box-shadow: 0 0 22px rgba(255, 120, 20, .35), 0 12px 26px rgba(0, 0, 0, .3);
  color: #ffe3c2;
}
.toast.rare::before { color: #ff9838; }
.toast.premium {
  border-color: #ffd15c;
  box-shadow: 0 0 26px rgba(255, 160, 30, .5), 0 12px 26px rgba(0, 0, 0, .3);
  color: #ffedc4;
  animation: toast-glow 1.2s ease-in-out 2;
}
.toast.premium::before { color: #ffc14d; text-shadow: 0 0 8px rgba(255, 160, 30, .9); }
.toast.error {
  border-color: rgba(255, 120, 110, .7);
  color: #ffd9d2;
}
.toast.error::before { content: "⚠"; color: #ff9c8e; }
@keyframes toast-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 160, 30, .25), 0 12px 26px rgba(0, 0, 0, .3); }
  50% { box-shadow: 0 0 34px rgba(255, 180, 40, .65), 0 12px 26px rgba(0, 0, 0, .3); }
}

@keyframes shimmer {
  0%, 28% { left: -82%; }
  72%, 100% { left: 140%; }
}
@keyframes flow-spin { to { transform: rotate(360deg); } }

.result-area.single-result .stone-card { width: 34%; }
.result-area.single-result .stone-frame { width: min(76%, 86px); }
.result-area.single-result .stone-card.highlight .stone-frame { width: min(92%, 104px); }
.result-area.single-result .stone-stars { font-size: clamp(8px, 1.2vw, 14px); }
.result-area.single-result .stone-name { font-size: clamp(8px, 1.15vw, 13px); }
.result-area.single-result .mystery-tile { font-size: clamp(18px, 3vw, 34px); }

/* ---------- 响应式 ---------- */
@media (max-width: 700px) {
  .game-page { padding: 4px 4px 30px; }
  .page-head { margin-bottom: 10px; padding: 0 46px; }
  .sound-toggle { width: 34px; height: 34px; top: 8px; right: 8px; }
  .sound-toggle svg { width: 17px; height: 17px; }
  .ledger { width: calc(100% - 12px); margin-top: 14px; padding: 16px 12px; }
  .ledger-head { align-items: flex-start; flex-direction: column; }
  .ledger-side { width: 100%; justify-items: stretch; }
  .ledger-stats { width: 100%; justify-content: space-between; gap: 8px; }
  .ledger-stats span { flex: 1; text-align: center; padding: 6px 4px; }
  .ledger-tools { justify-content: flex-start; flex-wrap: wrap; }
  .fragment-topup { flex: 1 1 180px; }
  .fragment-topup input { flex: 1; width: auto; min-width: 92px; }
  .history-item { grid-template-columns: 1fr; gap: 6px; }
  .corner { width: 12px; height: 12px; }
  .idle-hint { letter-spacing: .2em; padding-left: .2em; }
  .reveal-banner { letter-spacing: .2em; padding-left: calc(1.5em + .2em); }
  .reveal-banner::before, .reveal-banner::after { width: 1.6em; }
}

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