/* styles/main.css — 中秋博饼 · 温馨风格 v2 */

/* ===== 主题色 ===== */
:root {
  --bg: #FBF5E9;
  --bg-soft: #F5EFE0;
  --bg-warm: #F0E5C9;
  --ink: #6B4423;
  --ink-soft: #8B5E3C;
  --ink-mute: #A68868;
  --red: #C8482F;
  --red-deep: #9C3320;
  --gold: #E8B84F;
  --gold-deep: #C8902A;
  --jade: #6B8E5A;
  --shadow-sm: 0 2px 6px rgba(107, 68, 35, 0.08), 0 1px 2px rgba(107, 68, 35, 0.06);
  --shadow: 0 8px 24px rgba(107, 68, 35, 0.12), 0 2px 6px rgba(107, 68, 35, 0.06);
  --shadow-lg: 0 16px 48px rgba(107, 68, 35, 0.18), 0 4px 12px rgba(107, 68, 35, 0.08);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -1px 0 rgba(107, 68, 35, 0.04);
  --ease: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font-brush: 'Ma Shan Zheng', 'ZCOOL XiaoWei', 'KaiTi', 'STKaiti', 'Noto Serif SC', serif;
  --font-brush-cursive: 'Long Cang', 'Ma Shan Zheng', 'ZCOOL XiaoWei', 'STKaiti', cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 渐变 + 纸张纹理 + 月晕 ===== */
body {
  background-color: var(--bg);
  background-image:
    /* 月晕右上 */
    radial-gradient(ellipse 600px 400px at 90% -10%, rgba(232, 184, 79, 0.28) 0%, transparent 60%),
    /* 红晕左下 */
    radial-gradient(ellipse 500px 350px at 5% 105%, rgba(200, 72, 47, 0.10) 0%, transparent 55%),
    /* 纸张纤维纹理 */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.27  0 0 0 0 0.14  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>"),
    linear-gradient(180deg, #FCF7EC 0%, #F5EFE0 100%);
  background-attachment: fixed;
}

body::before {
  /* 古典回纹边角 */
  content: '';
  position: fixed;
  inset: 12px;
  border: 1px solid rgba(200, 72, 47, 0.18);
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(200, 72, 47, 0.08), transparent 25%, transparent 75%, rgba(200, 72, 47, 0.08)) 0 0/100% 1px no-repeat,
    linear-gradient(90deg, rgba(200, 72, 47, 0.08), transparent 25%, transparent 75%, rgba(200, 72, 47, 0.08)) 0 100%/100% 1px no-repeat,
    linear-gradient(0deg, rgba(200, 72, 47, 0.08), transparent 25%, transparent 75%, rgba(200, 72, 47, 0.08)) 0 0/1px 100% no-repeat,
    linear-gradient(0deg, rgba(200, 72, 47, 0.08), transparent 25%, transparent 75%, rgba(200, 72, 47, 0.08)) 100% 0/1px 100% no-repeat;
}

body::after {
  /* 顶角古典云纹 */
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 200px; height: 200px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.18;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><path d='M0 0 Q 40 30 30 70 T 80 90 T 60 140 T 110 130' stroke='%23C8482F' stroke-width='2' fill='none' stroke-linecap='round'/><path d='M10 20 Q 60 40 50 80 T 100 100 T 90 150' stroke='%23E8B84F' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
}

/* ===== 装饰 SVG ===== */
#deco-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.deco { position: absolute; opacity: 0; animation: decoFade 2.4s var(--ease) forwards; }
.deco-moon {
  top: -100px;
  right: -100px;
  width: 360px;
  height: 360px;
  filter: drop-shadow(0 0 80px rgba(232, 184, 79, 0.45));
  animation-delay: 0.1s;
}
.deco-moon::after {
  content: '';
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 184, 79, 0.25), transparent 70%);
  animation: moonPulse 4s ease-in-out infinite;
}
@keyframes moonPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.9; }
}
.deco-osmanthus {
  top: 30px;
  left: -50px;
  width: 320px;
  height: 200px;
  opacity: 0;
  transform: rotate(-8deg);
  animation: decoFade 2.6s var(--ease) 0.3s forwards, sway 9s ease-in-out infinite;
}
.deco-rabbit {
  bottom: 20px;
  left: 20px;
  width: 200px;
  height: 200px;
  opacity: 0;
  animation: decoFade 2.8s var(--ease) 0.6s forwards, hop 6s ease-in-out infinite 3s;
}
@keyframes decoFade {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 0.85; }
}
@keyframes sway {
  0%, 100% { transform: rotate(-8deg) translateX(0); }
  50% { transform: rotate(-6deg) translateX(10px); }
}
@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.03); }
}

/* ===== 顶部 ===== */
.app-header {
  position: relative;
  z-index: 5;
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(107, 68, 35, 0.08);
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(252, 247, 236, 0.7), rgba(252, 247, 236, 0.3));
}
.title-block h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 400;
  font-family: var(--font-brush);
  color: var(--red);
  letter-spacing: 8px;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6),
    0 2px 4px rgba(200, 72, 47, 0.18),
    /* 模拟墨痕飞白 */
    1px -1px 0 rgba(156, 51, 32, 0.15),
    -1px 1px 0 rgba(232, 184, 79, 0.1);
  position: relative;
  padding: 0 4px;
}
.title-block h1::before {
  content: '🏮';
  margin-right: 14px;
  filter: drop-shadow(0 2px 3px rgba(200, 72, 47, 0.3));
  font-family: initial;
}
.title-block .subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--ink-mute);
  font-family: var(--font-brush);
  letter-spacing: 4px;
  font-weight: 400;
  opacity: 0.85;
}
.header-actions { display: flex; gap: 10px; }
.icon-btn {
  background: rgba(255, 251, 240, 0.9);
  border: 1px solid rgba(107, 68, 35, 0.15);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: all .25s var(--ease);
  min-height: 44px;
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.icon-btn:hover {
  background: #FFF8EC;
  transform: translateY(-1px);
  box-shadow: var(--shadow), var(--shadow-inset);
  border-color: rgba(200, 72, 47, 0.3);
}

/* ===== 通用面板 ===== */
main {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 24px 100px;
}
.panel {
  background:
    linear-gradient(180deg, rgba(255, 253, 245, 0.92), rgba(252, 247, 236, 0.92)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.27  0 0 0 0 0.14  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-lg), var(--shadow-inset);
  border: 1px solid rgba(232, 184, 79, 0.35);
  margin-bottom: 24px;
  animation: panelIn .6s var(--ease);
  position: relative;
  overflow: hidden;
}
.panel::before {
  /* 顶部细金线 */
  content: '';
  position: absolute;
  top: 0; left: 24px; right: 24px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold-deep) 50%, var(--gold) 70%, transparent);
  opacity: 0.6;
}
.panel::after {
  /* 内部细描边 */
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(200, 72, 47, 0.08);
  border-radius: 14px;
  pointer-events: none;
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel h2 {
  margin: 0 0 16px;
  font-size: 26px;
  color: var(--ink);
  font-weight: 400;
  font-family: var(--font-brush);
  letter-spacing: 4px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5), 1px -1px 0 rgba(156, 51, 32, 0.1);
}
.panel h3 {
  margin: 0 0 14px;
  font-size: 19px;
  color: var(--ink);
  font-weight: 400;
  font-family: var(--font-brush);
  letter-spacing: 3px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.muted { color: var(--ink-mute); font-size: 14px; line-height: 1.8; }
.hidden { display: none !important; }

/* ===== 按钮 ===== */
.primary-btn, .ghost-btn {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  border-radius: 14px;
  padding: 12px 28px;
  cursor: pointer;
  transition: all .25s var(--ease);
  border: 1px solid transparent;
  min-height: 44px;
  position: relative;
  letter-spacing: 1px;
}
.primary-btn {
  background: linear-gradient(180deg, #D55A3F, var(--red) 60%, var(--red-deep));
  color: #FFF8EC;
  box-shadow: 0 4px 14px rgba(200, 72, 47, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
.primary-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #E36448, #C8482F 60%, #A23826);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(200, 72, 47, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.primary-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(200, 72, 47, 0.3), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}
.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.ghost-btn {
  background: linear-gradient(180deg, #FFFCF2, var(--bg-soft));
  color: var(--ink);
  border-color: rgba(107, 68, 35, 0.2);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
}
.ghost-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #FFF8EC, var(--bg-warm));
  transform: translateY(-1px);
  border-color: rgba(200, 72, 47, 0.3);
}

/* ===== 设置面板 ===== */
.setup-panel {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(232, 184, 79, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, rgba(255, 253, 245, 0.94), rgba(252, 247, 236, 0.94)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.27  0 0 0 0 0.14  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.setup-panel h2::after {
  content: '🌕';
  font-size: 22px;
}
.setup-panel textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid rgba(107, 68, 35, 0.2);
  border-radius: 14px;
  background: rgba(255, 251, 240, 0.9);
  color: var(--ink);
  resize: vertical;
  margin: 16px 0;
  transition: all .25s var(--ease);
  box-shadow: inset 0 1px 3px rgba(107, 68, 35, 0.08);
}
.setup-panel textarea:focus {
  outline: none;
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(232, 184, 79, 0.18), inset 0 1px 3px rgba(107, 68, 35, 0.08);
}
.setup-actions { text-align: center; }
.shake { animation: shake .4s var(--ease); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* ===== 游戏面板 ===== */
.current-player-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background:
    linear-gradient(135deg, rgba(232, 184, 79, 0.22), rgba(200, 72, 47, 0.12) 70%, rgba(232, 184, 79, 0.08));
  border-radius: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid rgba(200, 144, 42, 0.25);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  position: relative;
  overflow: hidden;
}
.current-player-block::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  animation: shine 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}
.current-player-text {
  font-size: 28px;
  font-weight: 400;
  color: var(--red);
  font-family: var(--font-brush);
  letter-spacing: 4px;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7),
    1px -1px 0 rgba(156, 51, 32, 0.15);
  position: relative;
  z-index: 1;
}
.player-chips { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 251, 240, 0.8);
  border: 1px solid rgba(107, 68, 35, 0.15);
  font-size: 14px;
  font-weight: 500;
  opacity: 0.55;
  transition: all .35s var(--ease-bounce);
  box-shadow: var(--shadow-sm);
}
.player-chip.current {
  background: linear-gradient(135deg, #FFE7C2, #FFCB7A);
  opacity: 1;
  border-color: var(--gold-deep);
  box-shadow:
    0 0 0 4px rgba(232, 184, 79, 0.18),
    0 0 20px rgba(232, 184, 79, 0.4),
    0 4px 10px rgba(232, 184, 79, 0.3);
  transform: scale(1.08);
  color: var(--red-deep);
  font-weight: 700;
  animation: chipPulse 2.2s ease-in-out infinite;
}
@keyframes chipPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(232, 184, 79, 0.18), 0 0 20px rgba(232, 184, 79, 0.4), 0 4px 10px rgba(232, 184, 79, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(232, 184, 79, 0.28), 0 0 28px rgba(232, 184, 79, 0.55), 0 4px 12px rgba(232, 184, 79, 0.4); }
}
.player-chip-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #FFF8EC;
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}
.player-chip.current .player-chip-avatar {
  background: linear-gradient(135deg, #E26447, var(--red-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 2px 4px rgba(200, 72, 47, 0.3);
}

/* ===== 碗 + 骰子 ===== */
.bowl-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin: 26px 0;
}
.bowl {
  position: relative;
  width: min(440px, 92vw);
  height: min(440px, 92vw);
  max-width: 440px;
  max-height: 440px;
  background:
    radial-gradient(circle at 50% 28%, #6B4423 0%, #3A2410 55%, #1F1408 100%);
  border-radius: 50%;
  border: 5px solid transparent;
  background-clip: padding-box;
  box-shadow:
    inset 0 16px 36px rgba(0, 0, 0, 0.55),
    inset 0 -10px 20px rgba(232, 184, 79, 0.12),
    0 16px 32px rgba(58, 36, 16, 0.5),
    0 0 0 5px #8B5E3C,
    0 0 0 6px rgba(139, 94, 60, 0.4);
  overflow: hidden;
}
.bowl::before {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(232, 184, 79, 0.18) 0%, transparent 60%),
    radial-gradient(circle at 65% 75%, rgba(107, 68, 35, 0.4), transparent 50%);
  pointer-events: none;
}
.bowl::after {
  content: '福';
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 26px;
  color: rgba(232, 184, 79, 0.7);
  font-family: var(--font-brush);
  letter-spacing: 12px;
  padding-left: 12px;
  text-shadow:
    0 0 10px rgba(232, 184, 79, 0.5),
    0 1px 0 rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.bowl-inner {
  position: absolute;
  inset: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dice-bowl {
  position: relative;
  width: 100%;
  height: 100%;
}
.die-slot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rot, 0));
  animation: dieIn .6s var(--ease-bounce);
}
@keyframes dieIn {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(0); }
  100% { opacity: 1; }
}
.die-slot:nth-child(1) { top: 28%; left: 28%; }
.die-slot:nth-child(2) { top: 28%; left: 72%; }
.die-slot:nth-child(3) { top: 72%; left: 28%; }
.die-slot:nth-child(4) { top: 72%; left: 72%; }
.die-slot:nth-child(5) { top: 50%; left: 22%; }
.die-slot:nth-child(6) { top: 50%; left: 78%; }

.dice-bowl.rolling .die-slot {
  animation: dieRoll 0.4s infinite linear;
}
.dice-bowl.rolling .die-slot:nth-child(2n) { animation-duration: 0.35s; animation-direction: reverse; }
.dice-bowl.rolling .die-slot:nth-child(3n) { animation-duration: 0.45s; }
.dice-bowl.rolling .die-slot:nth-child(5n) { animation-duration: 0.3s; animation-direction: reverse; }
@keyframes dieRoll {
  0% { transform: translate(var(--tx), var(--ty)) rotate(0deg) scale(1); }
  25% { transform: translate(calc(var(--tx) + 22px), calc(var(--ty) - 18px)) rotate(180deg) scale(0.88); }
  50% { transform: translate(calc(var(--tx) - 18px), calc(var(--ty) + 22px)) rotate(360deg) scale(1.08); }
  75% { transform: translate(calc(var(--tx) + 26px), calc(var(--ty) + 12px)) rotate(540deg) scale(0.92); }
  100% { transform: translate(var(--tx), var(--ty)) rotate(720deg) scale(1); }
}

.die {
  display: inline-block;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45));
  transition: filter .3s var(--ease);
}
.die-four {
  filter: drop-shadow(0 0 8px rgba(200, 72, 47, 0.7));
}
.die.glow {
  animation: dieGlow 1.4s ease-in-out infinite;
}
@keyframes dieGlow {
  0%, 100% { filter: drop-shadow(0 0 5px rgba(200, 72, 47, 0.55)); }
  50% { filter: drop-shadow(0 0 16px rgba(200, 72, 47, 1)) brightness(1.15); }
}

/* 福星特效已移除 — 概率加成保留,视觉无差异 */

.bowl-actions { display: flex; gap: 14px; }
.roll-btn {
  font-size: 18px;
  padding: 16px 36px;
  min-width: 180px;
}

/* ===== 结果 ===== */
.result-block {
  text-align: center;
  margin: 22px 0;
  min-height: 110px;
  position: relative;
}
.roll-result {
  font-size: 56px;
  font-weight: 400;
  letter-spacing: 10px;
  margin-bottom: 10px;
  font-family: var(--font-brush);
  color: var(--ink);
  animation: resultPop .8s var(--ease-bounce);
  text-shadow:
    0 2px 4px rgba(107, 68, 35, 0.18),
    2px -2px 0 rgba(156, 51, 32, 0.12),
    -1px 1px 0 rgba(232, 184, 79, 0.1);
  padding: 0 6px;
}
@keyframes resultPop {
  0% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.15) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}
.roll-subtitle {
  font-size: 18px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  min-height: 26px;
  letter-spacing: 2px;
  font-family: var(--font-brush);
}
.rank-六红, .rank-五红, .rank-五子登科, .rank-状元插金花, .rank-四红 {
  color: var(--red);
  text-shadow:
    0 0 24px rgba(200, 72, 47, 0.5),
    0 2px 0 rgba(255, 255, 255, 0.4),
    3px -3px 0 rgba(156, 51, 32, 0.18);
  animation: resultPop .8s var(--ease-bounce), rankGlow 2s ease-in-out infinite 0.8s;
}
@keyframes rankGlow {
  0%, 100% {
    text-shadow:
      0 0 24px rgba(200, 72, 47, 0.5),
      0 2px 0 rgba(255, 255, 255, 0.4),
      3px -3px 0 rgba(156, 51, 32, 0.18);
  }
  50% {
    text-shadow:
      0 0 36px rgba(200, 72, 47, 0.8),
      0 2px 0 rgba(255, 255, 255, 0.5),
      0 0 50px rgba(232, 184, 79, 0.4),
      4px -4px 0 rgba(156, 51, 32, 0.22);
  }
}
.rank-对堂 { color: var(--gold-deep); text-shadow: 0 0 16px rgba(200, 144, 42, 0.3); }
.rank-三红 { color: var(--red); text-shadow: 0 0 12px rgba(200, 72, 47, 0.3); }
.rank-一秀, .rank-二举, .rank-四进 { color: var(--ink); }
.rank-未中奖, .rank-再接再厉 { color: var(--ink-mute); }

.prize-popup {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.cake {
  display: inline-block;
}
.cake-fly {
  animation: cakeFly 1.4s var(--ease-bounce);
}
@keyframes cakeFly {
  0% { transform: translateY(0) scale(0.3); opacity: 0; }
  40% { transform: translateY(-40px) scale(1.3) rotate(-18deg); opacity: 1; }
  70% { transform: translateY(-12px) scale(1) rotate(6deg); }
  100% { transform: translateY(0) scale(1) rotate(0); }
}

/* 彩带特效(状元博中时) */
.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.confetti {
  position: absolute;
  width: 10px;
  height: 14px;
  top: -20px;
  opacity: 0;
  animation: confettiFall 2.4s ease-out forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

/* ===== 状态网格 ===== */
.state-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 26px;
}
.state-card {
  background:
    linear-gradient(180deg, rgba(255, 253, 245, 0.95), rgba(252, 247, 236, 0.85));
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(107, 68, 35, 0.1);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  position: relative;
  transition: transform .25s var(--ease);
}
.state-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow), var(--shadow-inset);
}
.history-card { grid-column: 1 / -1; }

/* 库存条 */
.stock-panel { display: flex; flex-direction: column; gap: 10px; }
.stock-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  transition: all .3s var(--ease);
  border: 1px solid transparent;
}
.stock-bar:hover { background: rgba(232, 184, 79, 0.08); border-color: rgba(232, 184, 79, 0.15); }
.stock-bar.empty { opacity: 0.4; }
.stock-bar.champ-bar {
  background: linear-gradient(90deg, rgba(200, 72, 47, 0.08), rgba(232, 184, 79, 0.12));
  border-color: rgba(200, 72, 47, 0.18);
}
.stock-label {
  width: 48px;
  font-size: 15px;
  font-weight: 400;
  font-family: var(--font-brush);
  color: var(--ink);
  letter-spacing: 2px;
}
.stock-bar.champ-bar .stock-label { color: var(--red); }
.stock-track {
  flex: 1;
  position: relative;
  height: 22px;
  background: rgba(107, 68, 35, 0.08);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}
.stock-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #F4D27A, var(--gold) 50%, var(--gold-deep));
  border-radius: 999px;
  transition: width .6s var(--ease);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 2px rgba(232, 184, 79, 0.3);
}
.stock-bar.champ-bar .stock-fill {
  background: linear-gradient(90deg, #E26447, var(--red) 50%, var(--red-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 4px rgba(200, 72, 47, 0.4);
}
.stock-count {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--ink);
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.stock-summary {
  text-align: right;
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(107, 68, 35, 0.15);
}

/* 状元榜 */
.champ-panel { max-height: 260px; overflow-y: auto; padding-right: 4px; }
.champ-panel::-webkit-scrollbar { width: 6px; }
.champ-panel::-webkit-scrollbar-thumb { background: rgba(107, 68, 35, 0.2); border-radius: 3px; }
.empty-tip {
  margin: 14px 0;
  color: var(--ink-mute);
  font-size: 14px;
  text-align: center;
  font-style: italic;
}
.champ-row {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 10px;
  padding: 10px 4px;
  font-size: 14px;
  border-bottom: 1px dashed rgba(107, 68, 35, 0.12);
  align-items: center;
  transition: background .2s var(--ease);
}
.champ-row:hover { background: rgba(232, 184, 79, 0.08); border-radius: 8px; }
.champ-row:last-child { border-bottom: none; }
.champ-i {
  color: var(--ink-mute);
  font-family: var(--font-brush);
  font-size: 16px;
}
.champ-row:first-child .champ-i {
  color: var(--red);
}
.champ-name { font-weight: 700; color: var(--ink); }
.champ-rank {
  color: var(--red);
  font-weight: 400;
  font-family: var(--font-brush);
  padding: 2px 10px;
  background: rgba(200, 72, 47, 0.08);
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 1px;
}
.champ-time { color: var(--ink-mute); font-size: 12px; }

/* 战利品 */
.trophy-panel { max-height: 300px; overflow-y: auto; padding-right: 4px; }
.trophy-panel::-webkit-scrollbar { width: 6px; }
.trophy-panel::-webkit-scrollbar-thumb { background: rgba(107, 68, 35, 0.2); border-radius: 3px; }
.trophy-row { margin-bottom: 8px; border-bottom: 1px dashed rgba(107, 68, 35, 0.12); }
.trophy-row summary {
  cursor: pointer;
  padding: 10px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-family: var(--font-brush);
  font-size: 16px;
  letter-spacing: 2px;
  list-style: none;
  border-radius: 8px;
  transition: background .2s var(--ease);
}
.trophy-row summary:hover { background: rgba(232, 184, 79, 0.1); }
.trophy-row summary::-webkit-details-marker { display: none; }
.trophy-row summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--ink-mute);
  transition: transform .25s var(--ease);
  font-size: 12px;
}
.trophy-row[open] summary::before { transform: rotate(90deg); }
.trophy-total {
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
  color: #FFF8EC;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(200, 144, 42, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.trophy-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px 8px 12px;
}
.trophy-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: var(--font-brush);
  background: rgba(255, 251, 240, 0.7);
  border-radius: 10px;
  border: 1px solid rgba(107, 68, 35, 0.06);
  transition: all .2s var(--ease);
  letter-spacing: 1px;
}
.trophy-item:hover {
  background: rgba(255, 251, 240, 0.95);
  border-color: rgba(232, 184, 79, 0.3);
  transform: translateY(-1px);
}
.trophy-item.zero { opacity: 0.35; }
.trophy-item-label { flex: 1; }
.trophy-item-count {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  background: rgba(232, 184, 79, 0.15);
  padding: 0 6px;
  border-radius: 999px;
}

/* 历史 */
.history-panel { max-height: 300px; overflow-y: auto; padding-right: 4px; }
.history-panel::-webkit-scrollbar { width: 6px; }
.history-panel::-webkit-scrollbar-thumb { background: rgba(107, 68, 35, 0.2); border-radius: 3px; }
.hist-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 10px;
  padding: 8px 4px;
  font-size: 13px;
  border-bottom: 1px dashed rgba(107, 68, 35, 0.1);
  align-items: center;
  transition: background .2s var(--ease);
}
.hist-row:hover { background: rgba(232, 184, 79, 0.06); border-radius: 6px; }
.hist-player { font-weight: 700; color: var(--ink); }
.hist-dice { font-family: 'Courier New', monospace; color: var(--ink-soft); letter-spacing: 2px; font-weight: 700; }
.hist-rank {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font-brush);
  border: 1px solid rgba(107, 68, 35, 0.1);
  letter-spacing: 1px;
}
.hist-rank.hist-champ {
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  color: #FFF8EC;
  border-color: transparent;
  box-shadow: 0 2px 4px rgba(200, 72, 47, 0.3);
}
.hist-time { color: var(--ink-mute); font-size: 11px; }

/* ===== 横幅 ===== */
.banner {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px) scale(0.9);
  background: linear-gradient(135deg, #E26447, var(--red) 50%, var(--red-deep));
  color: #FFF8EC;
  padding: 16px 32px;
  border-radius: 14px;
  box-shadow:
    0 12px 32px rgba(200, 72, 47, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  font-weight: 400;
  font-size: 22px;
  font-family: var(--font-brush);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: all .5s var(--ease-bounce);
  max-width: 90vw;
  text-align: center;
  letter-spacing: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 2px -2px 0 rgba(156, 51, 32, 0.3);
}
.banner::before {
  content: '🏮';
  margin-right: 8px;
}
.banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* ===== 弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(58, 36, 16, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(6px);
}
.modal.show { display: flex; animation: modalFade .3s var(--ease); }
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background:
    linear-gradient(180deg, rgba(255, 253, 245, 0.97), rgba(252, 247, 236, 0.97)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='1' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.27  0 0 0 0 0.14  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  border-radius: 20px;
  padding: 32px;
  max-width: 620px;
  width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  position: relative;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(232, 184, 79, 0.5);
  animation: modalIn .5s var(--ease-bounce);
}
.modal-content::before {
  content: '';
  position: absolute;
  top: 0; left: 32px; right: 32px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold-deep) 50%, var(--gold) 70%, transparent);
}
@keyframes modalIn {
  0% { transform: scale(0.85) translateY(20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-content h2 {
  color: var(--red);
  margin-top: 6px;
  font-family: var(--font-brush);
  font-weight: 400;
  font-size: 30px;
  letter-spacing: 6px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 2px -2px 0 rgba(156, 51, 32, 0.15);
}
.modal-content h3 {
  margin-top: 24px;
  color: var(--ink);
  border-left: 3px solid var(--gold);
  padding-left: 14px;
  font-family: var(--font-brush);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 4px;
}
.modal-content p, .modal-content li { line-height: 1.85; color: var(--ink-soft); font-size: 15px; }
.rank-list { padding-left: 22px; }
.rank-list li { margin-bottom: 8px; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: rgba(232, 184, 79, 0.15);
  border: none;
  font-size: 22px;
  color: var(--ink-soft);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  transition: all .2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--red);
  color: #FFF8EC;
  transform: rotate(90deg);
}

/* ===== 结算 ===== */
.finished-panel {
  text-align: center;
  border-top: 3px dashed rgba(232, 184, 79, 0.5);
}
.finished-panel h2 {
  justify-content: center;
}
.summary-panel {
  margin: 26px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sum-champion {
  font-size: 32px;
  font-weight: 400;
  font-family: var(--font-brush);
  color: var(--red);
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(232, 184, 79, 0.25), rgba(200, 72, 47, 0.15));
  border-radius: 16px;
  margin-bottom: 14px;
  border: 1px solid rgba(232, 184, 79, 0.4);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  letter-spacing: 5px;
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 2px -2px 0 rgba(156, 51, 32, 0.18);
}
.sum-champion::before {
  content: '👑';
  margin-right: 10px;
  filter: drop-shadow(0 2px 3px rgba(200, 72, 47, 0.3));
}
.sum-champion::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
  animation: shine 3s ease-in-out infinite;
  pointer-events: none;
}
.sum-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(255, 253, 245, 0.95), rgba(252, 247, 236, 0.85));
  border-radius: 14px;
  text-align: left;
  border: 1px solid rgba(107, 68, 35, 0.08);
  box-shadow: var(--shadow-sm), var(--shadow-inset);
  transition: transform .2s var(--ease);
}
.sum-row:hover { transform: translateY(-1px); box-shadow: var(--shadow), var(--shadow-inset); }
.sum-row.is-champion {
  background: linear-gradient(135deg, rgba(232, 184, 79, 0.18), rgba(200, 72, 47, 0.08));
  border-color: rgba(200, 72, 47, 0.3);
}
.sum-rank {
  font-size: 26px;
  font-weight: 400;
  font-family: var(--font-brush);
  color: var(--ink);
  letter-spacing: 2px;
}
.sum-name {
  font-weight: 400;
  font-family: var(--font-brush);
  font-size: 18px;
  color: var(--ink);
  letter-spacing: 2px;
}
.sum-total {
  color: var(--red);
  font-size: 17px;
  font-weight: 400;
  font-family: var(--font-brush);
  background: rgba(232, 184, 79, 0.18);
  padding: 4px 14px;
  border-radius: 999px;
  border: 1px solid rgba(232, 184, 79, 0.35);
  letter-spacing: 1px;
}
.sum-detail {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(107, 68, 35, 0.15);
}
.sum-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: linear-gradient(135deg, rgba(232, 184, 79, 0.18), rgba(200, 72, 47, 0.08));
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid rgba(232, 184, 79, 0.25);
  font-weight: 500;
}
.finished-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .app-header { padding: 14px 18px; }
  .title-block h1 { font-size: 22px; letter-spacing: 3px; }
  .title-block h1::before { margin-right: 6px; }
  .title-block .subtitle { font-size: 12px; }
  .header-actions { gap: 6px; }
  .icon-btn { padding: 6px 10px; font-size: 13px; min-height: 38px; }
  .state-grid { grid-template-columns: 1fr; }
  .trophy-list { grid-template-columns: repeat(2, 1fr); }
  .roll-result { font-size: 30px; letter-spacing: 4px; }
  .current-player-text { font-size: 18px; letter-spacing: 1px; }
  .current-player-block { padding: 14px 16px; }
  main { padding: 0 14px 30px; margin: 18px auto; }
  .panel { padding: 18px; border-radius: 16px; }
  .panel h2 { font-size: 20px; }
  .deco-rabbit, .deco-osmanthus { display: none; }
  .deco-moon { width: 240px; height: 240px; top: -60px; right: -60px; }
  .roll-btn { min-width: 140px; padding: 14px 24px; font-size: 16px; }
  .banner { font-size: 14px; padding: 12px 18px; top: 70px; }
}

@media (max-width: 480px) {
  .bowl { width: 92vw; height: 92vw; }
  .die-slot { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  .roll-result { font-size: 26px; letter-spacing: 3px; }
  .player-chip { padding: 6px 10px; font-size: 13px; }
}