/* =============================================================================
 * 变局 · Overthrow —— 全局样式（小丑牌 / Balatro 风：深色撞色 + 厚边贴纸感 + 像素字 + juice）
 *   - 混合字体：Silkscreen 像素字仅覆盖 Latin/数字（unicode-range），中文回落粗黑体。
 *   - 厚边圆角面板/按钮 + 实心偏移投影（贴纸感）；高饱和撞色；卡牌呼吸摆动 + 出炸屏幕晃。
 *   - 字体本地内置（assets/fonts），file:// 与离线均可用。
 * ========================================================================== */

/* ---------- 像素字（仅 Latin/数字/标点；中文自动回落） ---------- */
@font-face {
  font-family: 'Silkscreen'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../assets/fonts/silkscreen-400.woff2) format('woff2');
  unicode-range: U+0020-00FF, U+2000-206F, U+2190-21FF, U+2212, U+2215;
}
@font-face {
  font-family: 'Silkscreen'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(../assets/fonts/silkscreen-700.woff2) format('woff2');
  unicode-range: U+0020-00FF, U+2000-206F, U+2190-21FF, U+2212, U+2215;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 背景 */
  --bg-1: #20303f;
  --bg-2: #0c141d;
  /* 面板 */
  --panel: #2a3a4b;
  --panel-2: #20303f;
  --line: rgba(255,255,255,.14);
  --ink-shadow: rgba(0,0,0,.45);
  /* 撞色（小丑牌筹码色） */
  --red: #fe5f55;   --red-d: #c43c34;
  --blue: #20a6e8;  --blue-d: #1374a8;
  --gold: #f9c80e;  --gold-d: #c39a06;
  --green: #44c66e; --green-d: #2c9850;
  --purple: #9b5de5;
  /* 文字 */
  --tx: #f3f5ef;
  --tx2: #9fb3c4;
  /* 卡牌 */
  --card-face: linear-gradient(160deg, #ffffff 0%, #f3eee1 100%);
  --card-outline: #12181f;
  --ink: #1d232b;
  --card-red: #e23b34;
  /* 牌背 */
  --back-1: #e0484a; --back-2: #a52733;
  /* 尺寸（响应式） */
  --card-w: clamp(48px, 4.8vw, 66px);
  --card-h: calc(var(--card-w) * 1.46);
  --card-overlap: calc(var(--card-w) * -0.44);
  --radius: 14px;
  /* 字体栈：像素覆盖英文数字，中文落粗黑体 */
  --font-cn: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font: 'Silkscreen', var(--font-cn);
  --sh-pop: 0 18px 48px rgba(0,0,0,.55);
}

html, body { height: 100%; }
body {
  font-family: var(--font-cn);
  color: var(--tx);
  overflow: hidden;
  user-select: none;
  background: radial-gradient(130% 100% at 50% 28%, var(--bg-1) 0%, var(--bg-2) 70%);
}
/* 小丑牌招牌：缓慢流动的撞色暗背景 + 暗角 */
body::before {
  content: ""; position: fixed; inset: -20%; pointer-events: none; z-index: 0;
  background:
    radial-gradient(closest-side at 30% 35%, rgba(254,95,85,.10), transparent 60%),
    radial-gradient(closest-side at 72% 65%, rgba(32,166,232,.10), transparent 60%),
    conic-gradient(from 0deg at 50% 50%, rgba(249,200,14,.05), rgba(155,93,229,.05), rgba(254,95,85,.05), rgba(32,166,232,.05), rgba(249,200,14,.05));
  animation: bgspin 48s linear infinite;
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(120% 100% at 50% 50%, transparent 52%, rgba(0,0,0,.55) 100%);
}
@keyframes bgspin { to { transform: rotate(360deg); } }
#app { height: 100vh; position: relative; overflow: hidden; z-index: 1; }

/* ============================ 按钮（贴纸 + 按下手感） ============================ */
button {
  font-family: var(--font); font-size: 14px; font-weight: 700; letter-spacing: .6px;
  padding: 11px 22px; border: none; border-radius: 12px; color: #fff; cursor: pointer;
  background: var(--btn-bg, #41566b);
  box-shadow: 0 5px 0 var(--btn-edge, #283545), 0 8px 12px rgba(0,0,0,.32);
  transition: transform .06s ease, box-shadow .06s ease, filter .12s ease;
}
button:hover:not(:disabled) { filter: brightness(1.09); }
button:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 0 0 var(--btn-edge, #283545), 0 2px 4px rgba(0,0,0,.4); }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
button.primary { --btn-bg: var(--red); --btn-edge: var(--red-d); }
button.danger  { --btn-bg: var(--red); --btn-edge: var(--red-d); }
button.ghost   { --btn-bg: transparent; --btn-edge: transparent; box-shadow: inset 0 0 0 2px var(--line); }
button.big     { font-size: 16px; padding: 16px 24px; width: 100%; border-radius: 14px; }
button.small   { font-size: 12px; padding: 7px 14px; box-shadow: 0 4px 0 var(--btn-edge, #283545), 0 5px 8px rgba(0,0,0,.3); }
button.back    { font-size: 12px; padding: 7px 14px; --btn-bg: #34455a; --btn-edge: #212d3b; }
/* 点击回弹：JS 加 .btn-pop（动画结束移除），强化「按下去有回应」 */
button.btn-pop { animation: btn-pop .2s ease; }
@keyframes btn-pop { 0% { transform: scale(1); } 35% { transform: scale(.9) translateY(3px); } 100% { transform: scale(1); } }

/* ============================ 视图系统 ============================ */
.view { display: none; height: 100vh; width: 100%; position: relative; z-index: 1; }
.view.active { display: flex; animation: view-in .34s cubic-bezier(.2,.9,.3,1); }
@keyframes view-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
.view-center { flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
/* 让面板自己滚动（max-height 已留出 padding），视图本身不再产生第二条滚动条 */
.view-scroll { flex-direction: column; align-items: center; justify-content: flex-start; padding: 24px; overflow: hidden; }
/* 面板上下居中（内容超高时由面板内部滚动，不会顶部被裁） */
.view-scroll > .panel { margin: auto 0; }
.view-game { flex-direction: column; }

/* ---------- 主菜单 ---------- */
.menu-box { text-align: center; max-width: 460px; width: 100%; }
.menu-box .brand {
  font-family: var(--font); font-size: clamp(36px, 7.5vw, 58px); font-weight: 700;
  letter-spacing: 2px; line-height: 1.05; color: var(--gold);
  text-shadow: 0 3px 0 var(--gold-d), 0 6px 0 rgba(0,0,0,.35), 0 10px 22px rgba(0,0,0,.5);
  transform: rotate(-2deg); margin-bottom: 16px;
}
.menu-box .subtitle { color: var(--gold-d); margin: 4px 0 34px; font-size: 13px; letter-spacing: 6px; font-weight: 700; opacity: .9; }

/* 积分钱包卡片（跨局持久余额） */
.wallet-card {
  margin: 0 auto 30px; padding: 16px 24px; max-width: 320px;
  background: rgba(0,0,0,.32); border: 2px solid var(--gold-d); border-radius: 14px;
  box-shadow: inset 0 0 24px rgba(249,200,14,.1), 0 6px 16px rgba(0,0,0,.4);
}
.wallet-label { font-family: var(--font); font-size: 11px; color: var(--tx2); letter-spacing: 4px; }
.wallet-balance {
  font-family: var(--font); font-size: 44px; font-weight: 900; color: var(--gold);
  text-shadow: 0 2px 0 var(--gold-d), 0 0 20px rgba(249,200,14,.4); line-height: 1.1; margin: 2px 0;
}
.wallet-meta { font-size: 12px; color: var(--tx2); letter-spacing: 1px; }
.wallet-delta {
  display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 700;
  padding: 2px 12px; border-radius: 999px;
}
.wallet-delta.up { color: var(--green); background: rgba(68,198,110,.15); }
.wallet-delta.down { color: var(--red); background: rgba(254,95,85,.15); }
.wallet-delta.hidden { display: none; }

/* 结算面板的钱包结算条 */
.wallet-result {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 10px; padding: 10px 16px; border-radius: 10px;
}
.wallet-result.gain { background: rgba(68,198,110,.16); border: 2px solid var(--green); }
.wallet-result.loss { background: rgba(254,95,85,.16); border: 2px solid var(--red); }
.wallet-result .wr-delta { font-family: var(--font); font-size: 30px; font-weight: 900; }
.wallet-result.gain .wr-delta { color: var(--green); }
.wallet-result.loss .wr-delta { color: var(--red); }
.wallet-result .wr-balance { font-size: 14px; color: var(--tx); }
.wallet-result .wr-balance b { color: var(--gold); font-size: 20px; }
.wallet-result .wr-reset { font-size: 12px; color: var(--red); font-weight: 700; }

.menu-actions { display: flex; flex-direction: column; gap: 16px; }
.menu-actions button { font-family: var(--font); letter-spacing: 4px; font-weight: 700; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.hint-note {
  font-family: var(--font); font-size: 12px; color: var(--tx2); margin-top: 26px; letter-spacing: 1px;
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: rgba(0,0,0,.25); border: 2px solid var(--card-outline);
}

/* ---------- 通用面板 ---------- */
.panel {
  background: var(--panel); border: 2px solid var(--card-outline);
  border-radius: var(--radius); padding: 22px 24px; max-width: 600px; width: 100%;
  max-height: calc(100vh - 48px); overflow-y: auto; overflow-x: hidden; position: relative;
  box-shadow: 0 8px 0 rgba(0,0,0,.4), var(--sh-pop);
}
/* 滚动条统一成贴纸风：细、圆、嵌在面板内边距里，不再是突兀的系统长条 */
.panel, .dialog { scrollbar-width: thin; scrollbar-color: var(--gold-d) transparent; }
.panel::-webkit-scrollbar, .dialog::-webkit-scrollbar { width: 10px; }
.panel::-webkit-scrollbar-track, .dialog::-webkit-scrollbar-track { background: transparent; margin: 12px 0; }
.panel::-webkit-scrollbar-thumb, .dialog::-webkit-scrollbar-thumb {
  background: var(--gold-d); border-radius: 999px;
  border: 2px solid var(--panel); background-clip: padding-box;
}
.panel::-webkit-scrollbar-thumb:hover, .dialog::-webkit-scrollbar-thumb:hover { background: var(--gold); border-color: var(--panel); background-clip: padding-box; }
.panel::before {
  content: ""; position: absolute; top: 0; left: 14%; right: 14%; height: 5px; border-radius: 0 0 5px 5px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 2px solid var(--line); }
.panel-head h2 { color: var(--gold); font-size: 22px; letter-spacing: .5px; text-shadow: 0 2px 0 rgba(0,0,0,.4); margin-right: auto; }
.panel-foot { display: flex; gap: 10px; justify-content: space-between; margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--line); align-items: center; }
.empty-hint { color: var(--tx2); opacity: .8; font-size: 14px; text-align: center; padding: 44px 0; }
.section-label { font-family: var(--font); font-size: 12px; color: var(--gold); letter-spacing: 1px; margin: 18px 2px 8px; }

/* ---------- 历史对局 ---------- */
.history-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.history-card {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--panel-2); border: 2px solid var(--card-outline); border-left: 6px solid var(--gold);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.history-card.win { border-left-color: var(--green); }
.history-card.lose { border-left-color: var(--red); }
.history-card > input[type=checkbox] { margin-top: 3px; width: 18px; height: 18px; cursor: pointer; accent-color: var(--gold); }
.hc-main { flex: 1; min-width: 0; }
.hc-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; }
.hc-time { color: var(--tx2); font-size: 12px; font-family: var(--font); }
.hc-cond { color: var(--gold); font-weight: 700; font-size: 14px; }
.hc-role { color: var(--tx2); }
.hc-badge { padding: 2px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; font-family: var(--font); }
.hc-badge.win { background: var(--green); color: #0b2516; }
.hc-badge.lose { background: var(--red); color: #2a0c0a; }
.hc-score { color: var(--tx); font-size: 12px; font-family: var(--font); margin-left: auto; }
.hc-stats { font-size: 12px; color: var(--tx2); margin-top: 8px; padding: 7px 10px; background: rgba(0,0,0,.25); border-radius: 8px; }
.hc-actions { margin-top: 10px; display: flex; gap: 8px; }
.hc-detail { margin-top: 10px; border-top: 2px dashed var(--line); padding-top: 8px; }
.hc-rules { font-size: 12px; color: var(--tx2); margin-bottom: 6px; }
.hc-table { font-size: 12px; width: 100%; max-width: 420px; }
.hc-row { display: grid; grid-template-columns: 2em 3em 5em 3em 4em; gap: 6px; padding: 2px 0; }
.hc-row.hc-th { color: var(--tx2); border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.hc-nodetail { font-size: 12px; color: var(--tx2); }

/* ============================ 顶部信息栏 ============================ */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,.5), rgba(0,0,0,.28));
  border-bottom: 3px solid rgba(0,0,0,.5);
}
.topbar .title { font-family: var(--font); font-size: 18px; font-weight: 700; color: var(--gold); letter-spacing: 1px; text-shadow: 0 2px 0 var(--gold-d); }
.topbar .info { font-size: 13px; color: var(--tx2); font-family: var(--font); }
.topbar .rule-summary {
  font-size: 12px; padding: 6px 14px; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--panel); border: 2px solid var(--card-outline); border-radius: 999px;
  box-shadow: 0 3px 0 rgba(0,0,0,.4); color: var(--tx); font-weight: 700;
}
.topbar .rule-summary::before { content: "♦ "; color: var(--gold); }
.topbar-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.topbar-btn { font-size: 12px; padding: 7px 14px; --btn-bg: #34455a; --btn-edge: #212d3b; }

/* ============================ 牌桌 ============================ */
.table {
  flex: 1; position: relative; display: grid;
  grid-template-columns: 1fr 2fr 1fr; grid-template-rows: auto 1fr auto;
  padding: 14px 18px; gap: 10px;
}
.table::before {
  content: ""; position: absolute; inset: 12px; border-radius: 22px; pointer-events: none;
  border: 2px solid rgba(0,0,0,.35);
  box-shadow: inset 0 0 80px rgba(0,0,0,.4);
}

/* 对手区 */
.opponent { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 8px; z-index: 2; }
.opponent.left { grid-column: 1; grid-row: 1 / span 2; }
.opponent.right { grid-column: 3; grid-row: 1 / span 2; }
.opp-head {
  display: flex; align-items: center; gap: 8px; font-size: 14px;
  background: var(--panel); border: 2px solid var(--card-outline); border-radius: 999px;
  padding: 5px 12px 5px 5px; box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.opp-avatar {
  width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #2a0c0a; font-weight: 700;
  background: linear-gradient(180deg, #ffd76a, var(--gold-d));
  border: 2px solid var(--card-outline); box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.opp-name { font-weight: 700; }
.opp-role { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: var(--gold); color: #2a1f00; font-weight: 700; }
.opp-role.farmer { background: var(--blue); color: #04222e; }
.opp-count { font-size: 12px; color: var(--tx2); font-family: var(--font); }
.opp-count::before { content: "🂠 "; }
.opp-backs { display: flex; margin-top: 6px; min-height: 72px; }
.opp-backs .cardback { width: 32px; height: 48px; margin-left: -20px; }
.opp-backs .cardback:first-child { margin-left: 0; }
.opp-backs.revealed-hand {
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 4px;
  width: min(360px, 30vw);
  min-height: 108px;
  max-height: 156px;
  overflow: hidden;
  padding: 2px 0;
}
.opp-backs.revealed-hand .mini {
  width: 28px;
  height: 40px;
  margin-left: 0;
  background: var(--card-face);
  border-radius: 5px;
  border: 2px solid var(--card-outline);
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  font-size: 11px;
  line-height: 1.1;
}
.opp-backs.revealed-hand .mini.red { color: var(--card-red); }
.opp-backs.revealed-hand .mini .m-rank.wild { color: var(--gold); font-weight: 700; }
.opp-backs.revealed-hand .mini .m-suit { font-size: 12px; }
.cardback {
  border-radius: 7px; border: 2px solid var(--card-outline);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.14) 0 4px, transparent 4px 8px),
    linear-gradient(135deg, var(--back-1), var(--back-2));
  box-shadow: 0 2px 4px rgba(0,0,0,.4), inset 0 0 0 2px rgba(255,255,255,.18);
}
.cardback.cardback-lg { width: 50px; height: 74px; margin-left: 0; }

/* 中央 */
.center { grid-column: 2; grid-row: 1 / span 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 2; }
.bottom-cards { display: flex; gap: 6px; min-height: 92px; align-items: center; }
.bottom-cards .label { font-size: 13px; color: var(--tx2); margin-right: 8px; letter-spacing: 1px; font-weight: 700; }
/* 底牌容器（playing/finished 阶段显示翻面底牌） */
.bottom-cards .bottom-mini { display: flex; gap: 6px; align-items: center; }
/* 底牌专用牌：比出牌槽 mini 更大、更像一张牌 */
.bottom-cards .bcard {
  width: 46px; height: 64px; margin: 0;
  background: var(--card-face); border-radius: 6px; border: 2px solid var(--card-outline);
  box-shadow: 0 3px 0 rgba(0,0,0,.3), 0 5px 10px rgba(0,0,0,.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink); font-family: var(--font); font-weight: 700; line-height: 1.1;
  position: relative; overflow: hidden;
}
.bottom-cards .bcard .m-rank { font-size: 18px; }
.bottom-cards .bcard .m-suit { font-size: 20px; }
.bottom-cards .bcard .m-suit.jk { font-size: 9px; letter-spacing: .5px; } /* 王：JKR 文字缩小，避免溢出窄卡面 */
.bottom-cards .bcard.red { color: var(--red); }
.bottom-cards .bcard.wild { color: var(--gold); }
.bottom-cards .bcard.wild .m-rank.wild { font-size: 14px; }
/* 底牌翻面动画 */
.bottom-cards .bcard.flip-reveal {
  animation: flip-reveal .6s cubic-bezier(.2,1.1,.4,1) backwards;
  animation-delay: calc(var(--i, 0) * 0.15s);
}
@keyframes flip-reveal {
  0% { opacity: 0; transform: rotateY(90deg) scale(.7); }
  50% { opacity: 1; transform: rotateY(0deg) scale(1.08); }
  100% { transform: scale(1); }
}
.bid-log { font-size: 13px; min-height: 20px; color: var(--tx); text-align: center; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.bid-log .bid-line.sys { line-height: 1.5; width: 100%; color: var(--tx2); font-size: 12px; }
.bid-log .bid-line.sys.you { color: var(--gold); font-weight: 700; }
/* 叫分徽章（日志里每条叫分） */
.bid-log .bid-chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--font); font-weight: 700; font-size: 12px;
  padding: 3px 12px; border-radius: 999px; border: 2px solid var(--card-outline);
  box-shadow: 0 2px 0 rgba(0,0,0,.3); animation: pop-mini .3s cubic-bezier(.2,1.4,.4,1) backwards;
}
.bid-log .bid-chip .bc-name { color: var(--tx2); font-weight: 400; }
.bid-log .bid-chip.b0 { background: #4a5566; color: #cdd6e0; }
.bid-log .bid-chip.b1 { background: var(--blue-d); color: #d8e8ff; }
.bid-log .bid-chip.b2 { background: var(--green-d); color: #d8ffe8; }
.bid-log .bid-chip.b3 { background: var(--gold-d); color: #2a1d00; }
.bid-log .bid-chip.top { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(249,200,14,.4), 0 2px 0 rgba(0,0,0,.3); transform: scale(1.06); }
.bid-log .bid-chip.you .bc-name { color: var(--gold); }

/* 叫分气泡（叫地主阶段，显示在各座位出牌槽） */
.played-slot .bid-tag {
  font-family: var(--font); font-size: 15px; font-weight: 700; letter-spacing: 1px;
  padding: 7px 20px; border-radius: 999px; border: 2px solid var(--card-outline);
  box-shadow: 0 3px 0 rgba(0,0,0,.3), 0 5px 12px rgba(0,0,0,.4);
  animation: pop-mini .35s cubic-bezier(.2,1.5,.4,1) backwards;
}
.played-slot .bid-tag.b0 { background: #4a5566; color: #cdd6e0; }
.played-slot .bid-tag.b1 { background: var(--blue); color: #fff; }
.played-slot .bid-tag.b2 { background: var(--green); color: #fff; }
.played-slot .bid-tag.b3 { background: var(--gold); color: #2a1d00; }
.played-slot .bid-tag.top { box-shadow: 0 0 0 3px rgba(249,200,14,.5), 0 3px 0 rgba(0,0,0,.3), 0 6px 14px rgba(249,200,14,.3); }
.turn-indicator {
  font-size: 15px; color: var(--gold); min-height: 24px; letter-spacing: .5px; font-weight: 700;
  padding: 4px 16px; border-radius: 999px;
  background: rgba(249,200,14,.12); border: 1px solid rgba(249,200,14,.35);
}

/* 座位倒计时 */
.seat-timer { display: none; gap: 3px; margin: 4px 0; }
.seat-timer.active { display: flex; flex-direction: column; align-items: center; width: 100%; }
.seat-timer .st-txt { font-size: 12px; color: var(--gold); font-weight: 700; text-align: center; font-family: var(--font); }
.seat-timer .st-track { width: 96px; height: 9px; background: rgba(0,0,0,.5); border-radius: 999px; overflow: hidden; border: 2px solid var(--card-outline); }
.seat-timer .st-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue-d), var(--blue)); border-radius: 999px; transition: width .12s linear, background .2s; }
.seat-timer .st-fill.urgent { background: linear-gradient(90deg, var(--red-d), var(--red)); }
.seat-timer-player .st-track { width: 240px; height: 11px; }
.seat-timer-player .st-txt { font-size: 13px; }

/* 玩家手牌区 */
.player-area { grid-column: 1 / span 3; grid-row: 3;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 8px 10px; z-index: 3; }
.player-head {
  font-size: 14px; display: flex; gap: 10px; align-items: center;
  background: var(--panel); border: 2px solid var(--card-outline); border-radius: 999px;
  padding: 5px 14px; box-shadow: 0 4px 0 rgba(0,0,0,.35);
}
.player-head .role-you { color: var(--gold); font-weight: 700; }
.player-count { font-size: 12px; color: var(--tx2); font-family: var(--font); }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hand {
  display: flex; justify-content: center; align-items: flex-end; flex-wrap: nowrap;
  min-height: calc(var(--card-h) + 30px); padding: 30px 0 0; width: 100%;
}

/* ============================ 卡牌（核心质感） ============================ */
.card {
  position: relative; width: var(--card-w); height: var(--card-h);
  margin-left: var(--card-overlap);
  background: var(--card-face);
  border: 2px solid var(--card-outline);
  border-radius: 10px;
  box-shadow: 0 3px 0 rgba(0,0,0,.32), 0 6px 10px rgba(0,0,0,.4);
  cursor: pointer; overflow: hidden;
  color: var(--ink); font-family: var(--font); font-weight: 700;
  animation: sway 3.4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * -0.21s);
  transition: transform .12s ease, box-shadow .15s ease;
}
.card:first-child { margin-left: 0; }
.card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 9px;
  background: linear-gradient(150deg, rgba(255,255,255,.6) 0%, transparent 32%);
}
.card.red { color: var(--card-red); }
.card.joker-big { color: var(--card-red); background: linear-gradient(160deg, #fff 0%, #ffe0e0 100%); }
.card.wild      { color: var(--ink);   background: linear-gradient(160deg, #fffcf0 0%, #ffeec7 100%); } /* 癞子：金奶油色，区别普通牌 */
.card.joker-small { color: var(--ink); background: linear-gradient(160deg, #fff 0%, #e3ecff 100%); }
.c-corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; z-index: 2; }
.c-corner b { font-size: calc(var(--card-w) * 0.30); }
.c-corner i { font-size: calc(var(--card-w) * 0.24); font-style: normal; margin-top: 2px; }
.c-tl { top: 5px; left: 5px; }
.c-br { bottom: 5px; right: 5px; transform: rotate(180deg); }
.c-pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--card-w) * 0.56); z-index: 1; opacity: .92; }
.c-pip.c-joker { flex-direction: column; gap: 1px; }
.c-pip.c-joker .jk-star { font-size: calc(var(--card-w) * 0.46); line-height: 1; }
.c-pip.c-joker .jk-word { font-family: var(--font); font-size: calc(var(--card-w) * 0.15); letter-spacing: 1px; }
.c-pip.c-wild  { flex-direction: column; gap: 2px; }
.c-pip.c-wild .jk-star { font-size: calc(var(--card-w) * 0.5); line-height: 1; color: var(--gold); }
.c-pip.c-wild .jk-word { font-family: var(--font); font-size: calc(var(--card-w) * 0.16); letter-spacing: 1px; color: var(--gold); font-weight: 700; }
.played-slot .mini .m-suit.jk { font-size: 9px; letter-spacing: .5px; }

@keyframes sway {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-3px) rotate(1deg); }
}
/* 发牌入场：从屏幕上方中央（牌堆位置）逐张甩入手牌，带旋转弧线 */
.card.deal-in {
  animation: deal-in .5s cubic-bezier(.18, 1.1, .3, 1) backwards;
  animation-delay: calc(var(--i, 0) * 0.05s);
  z-index: 10;
}
@keyframes deal-in {
  0%   { opacity: 0; transform: translate(var(--deal-x, -120px), -260px) scale(.55) rotate(-25deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
}
/* 关键：选中/悬浮的牌【不要】设 z-index。牌按 DOM 顺序从左到右叠放，右邻牌天然压在上层，
   这正是每张牌左上角点数始终可读的原因。抬起只用 translateY（顶部探出表示选中），
   一旦给它 z-index 抬到右邻牌之上，就会盖住右邻牌的点数——这是之前重构引入的 bug。 */
.card:hover { animation: none; transform: translateY(-8px); box-shadow: 0 10px 18px rgba(0,0,0,.5); }
.card.selected { animation: none; transform: translateY(-22px);
  box-shadow: 0 0 0 3px #ffd700, 0 0 20px 8px rgba(255, 215, 0, 0.4), 0 12px 22px rgba(249,200,14,.5);
  border: 2px solid #ffd700; }
.card.disabled { cursor: default; animation: none; }
.card.disabled:hover { transform: none; box-shadow: 0 3px 0 rgba(0,0,0,.32), 0 6px 10px rgba(0,0,0,.4); }
.card.hint { box-shadow: 0 0 0 3px #90ee90, 0 0 16px 6px rgba(144, 238, 144, 0.3), 0 8px 14px rgba(0,0,0,.45); }
.played-row { display: flex; align-items: center; }
.played-row .card { margin-left: var(--card-overlap); cursor: default; animation: none; }
.played-row .card:hover { transform: none; }

/* ============================ 出牌槽位 / 迷你牌 ============================ */
.played-slot { min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; margin-top: 4px; }
.played-slot .played-row { display: flex; align-items: center; }
.played-slot .pass-tag {
  font-family: var(--font); font-size: 13px; color: #2a0c0a; padding: 5px 16px; border-radius: 999px;
  background: var(--gold); border: 2px solid var(--card-outline); box-shadow: 0 3px 0 rgba(0,0,0,.3);
}
.played-slot .kind-tag { font-family: var(--font); font-size: 11px; color: var(--tx2); letter-spacing: .5px; }
.played-slot .lp-label { font-size: 13px; color: var(--tx2); letter-spacing: .5px; }
.played-slot .mini {
  width: 32px; height: 46px; margin-left: -14px;
  background: var(--card-face); border-radius: 6px; border: 2px solid var(--card-outline);
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink); font-family: var(--font); font-weight: 700; font-size: 12px; line-height: 1.1;
  animation: pop-mini .3s cubic-bezier(.2,1.4,.4,1) backwards;
}
.played-slot .mini:nth-child(2) { animation-delay: .04s; }
.played-slot .mini:nth-child(3) { animation-delay: .08s; }
.played-slot .mini:nth-child(4) { animation-delay: .12s; }
.played-slot .mini:nth-child(n+5) { animation-delay: .16s; }
.played-slot .mini:first-child { margin-left: 0; }
.played-slot .mini.red { color: var(--card-red); }
.played-slot .mini .m-rank.wild { color: var(--gold); font-weight: 700; } /* 癞子代表点金标 */
.played-slot .mini .m-suit { font-size: 13px; }
.center .played-slot { min-height: 74px; }
.center .played-slot .mini { width: 42px; height: 60px; margin-left: -18px; font-size: 14px; box-shadow: 0 3px 0 rgba(0,0,0,.3), 0 5px 10px rgba(0,0,0,.4); }
.center .played-slot .mini:first-child { margin-left: 0; } /* 首张无负边距，使整行与上方牌型标签居中对齐 */
.center .played-slot .mini .m-suit { font-size: 16px; }
@keyframes pop-mini { from { opacity: 0; transform: translateY(-22px) scale(.6); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* ============================ 遮罩 / 对话框 ============================ */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.66); display: flex; align-items: center; justify-content: center; padding: 20px; }
.overlay.hidden { display: none; }
.hidden { display: none !important; }
.dialog {
  background: var(--panel); border: 2px solid var(--card-outline);
  border-radius: 18px; padding: 28px 34px; text-align: center;
  max-width: 480px; width: 100%; max-height: 90vh; overflow: auto;
  box-shadow: 0 10px 0 rgba(0,0,0,.45), var(--sh-pop); position: relative;
  animation: dialog-in .3s cubic-bezier(.2,1.3,.4,1);
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
.dialog::before { content: ""; position: absolute; top: 0; left: 18%; right: 18%; height: 5px; border-radius: 0 0 5px 5px; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.dialog h1 { font-family: var(--font); color: var(--gold); font-size: 30px; margin-bottom: 10px; letter-spacing: 1px; text-shadow: 0 3px 0 var(--gold-d), 0 5px 0 rgba(0,0,0,.35); }
.dialog h1.win { color: var(--green); text-shadow: 0 3px 0 var(--green-d), 0 5px 0 rgba(0,0,0,.35); }
.dialog h1.lose { color: var(--red); text-shadow: 0 3px 0 var(--red-d), 0 5px 0 rgba(0,0,0,.35); }
.dialog .subtitle { color: #cfe7da; margin-bottom: 14px; }
.dialog .desc { font-size: 14px; color: var(--tx2); line-height: 1.7; margin-bottom: 22px; }
.dialog p { font-size: 15px; line-height: 1.6; }
.dialog .pop-num { display: inline-block; font-family: var(--font); color: var(--gold); }
.dialog .pop-num.bump { animation: numbump .4s cubic-bezier(.2,1.6,.4,1); }
@keyframes numbump { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.dialog-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }

/* 行为数据 / A/B 对比 */
.metrics-box { text-align: left; margin: 14px 0 4px; }
.metrics-box .metrics-title { font-size: 13px; color: var(--gold); margin-bottom: 8px; letter-spacing: .5px; font-weight: 700; }
.metrics-box .metric { margin-bottom: 9px; }
.metrics-box .metric-name { font-size: 12px; color: var(--tx2); margin-bottom: 4px; }
.metrics-box .bar { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 12px; }
.metrics-box .bar-label { width: 92px; color: var(--tx2); text-align: right; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metrics-box .bar-track { flex: 1; height: 16px; background: rgba(0,0,0,.45); border-radius: 999px; overflow: hidden; border: 2px solid var(--card-outline); }
.metrics-box .bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--blue-d), var(--blue)); border-radius: 999px; transition: width .5s cubic-bezier(.2,.7,.3,1); }
.metrics-box .bar.b .bar-fill { background: linear-gradient(90deg, var(--gold-d), var(--gold)); }
.metrics-box .bar-val { width: 60px; flex-shrink: 0; font-family: var(--font); }
.metrics-box .metric-conclusion { font-size: 13px; color: #eafff0; background: var(--panel-2); border: 2px solid var(--card-outline); border-radius: 10px; padding: 10px 12px; margin-top: 10px; line-height: 1.6; }
.metrics-box .metric-note { font-size: 11px; color: var(--tx2); margin-top: 8px; }

/* ============================ 规则菜单 ============================ */
.rule-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 8px 0 4px; text-align: left; }
.rule-menu .field {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px;
  background: var(--panel-2); border: 2px solid var(--card-outline); border-radius: 10px;
  padding: 9px 12px; min-height: 46px; box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.rule-menu .field label { color: var(--tx); font-weight: 600; }
.rule-menu select { min-width: 104px; }
.rule-menu select {
  font-family: var(--font-cn); font-size: 13px; padding: 6px 10px; border-radius: 8px;
  background: var(--panel-2); color: #fff; border: 2px solid var(--card-outline);
}
.rule-menu select option { color: #1c1c1c; }
.rule-menu .toggle { position: relative; width: 46px; height: 24px; }
.rule-menu .toggle input { opacity: 0; width: 0; height: 0; }
.rule-menu .toggle .slider { position: absolute; inset: 0; border-radius: 999px; background: var(--panel-2); border: 2px solid var(--card-outline); cursor: pointer; transition: background .15s ease; }
.rule-menu .toggle .slider::before { content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s ease; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.rule-menu .toggle input:checked + .slider { background: var(--green); }
.rule-menu .toggle input:checked + .slider::before { transform: translateX(22px); }
.rule-issues { font-size: 12px; text-align: left; min-height: 16px; margin: 4px 0; }
.rule-issues .block { color: var(--red); font-weight: 700; }
.rule-issues .warn { color: var(--gold); }
.rule-panel { margin: 14px 0 4px; padding: 12px; background: var(--panel-2); border: 2px solid var(--card-outline); border-radius: 10px; }

/* ---------- 规则设置：以「一句话改规则」为核心 ---------- */
.rules-panel { max-width: 540px; padding-top: 32px; }
.rules-back { position: absolute; top: 14px; left: 14px; z-index: 2; }
.rules-hero { text-align: center; padding: 4px 2px 2px; }
.rules-title {
  font-family: var(--font); font-size: clamp(22px, 4.4vw, 30px); color: var(--gold); letter-spacing: 2px;
  text-shadow: 0 2px 0 var(--gold-d), 0 4px 0 rgba(0,0,0,.3);
}
.rules-sub { color: var(--tx2); font-size: 13px; margin: 9px 0 18px; letter-spacing: 1px; }

.nl-input { display: flex; gap: 8px; }
.nl-input input {
  flex: 1; font-family: var(--font-cn); font-size: 15px; padding: 14px 16px; border-radius: 12px;
  background: var(--panel-2); color: #fff; border: 2px solid var(--card-outline);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.3);
}
.nl-input input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(249,200,14,.35), inset 0 2px 6px rgba(0,0,0,.3); }
.nl-input input::placeholder { color: var(--tx2); }
.nl-input button.primary { padding: 14px 24px; font-size: 16px; }

.nl-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.chip {
  font-size: 12px; padding: 6px 13px; border-radius: 999px; font-weight: 600; letter-spacing: .3px;
  background: rgba(255,255,255,.05); border: 2px solid var(--card-outline); color: var(--tx);
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
}
.chip::before { content: "✎ "; color: var(--gold); }

.nl-result { margin-top: 14px; min-height: 16px; font-size: 13px; text-align: left; }
.nl-result .nl-msg { color: #eafff0; }
.nl-result .nl-warn { color: var(--gold); margin-top: 4px; }
.nl-result .nl-changes { margin-top: 6px; color: #bfe6d3; font-size: 12px; }
.nl-result .nl-changes div { line-height: 1.6; }
.nl-result .nl-thinking { color: var(--tx2); }
.nl-result .nl-ok { color: var(--green); margin-top: 4px; font-weight: 700; }
.nl-result button { margin-top: 10px; }

/* 折叠的手动菜单 */
.rules-toggle {
  width: 100%; margin-top: 20px; background: transparent; border: 2px dashed var(--line);
  color: var(--tx2); box-shadow: none; font-weight: 600; letter-spacing: 1px;
}
.rules-toggle:hover:not(:disabled) { color: var(--tx); border-color: var(--gold); filter: none; }
.rules-toggle .caret { display: inline-block; transition: transform .18s ease; }
.rules-toggle.open .caret { transform: rotate(180deg); }
.rules-advanced { margin-top: 12px; }

/* ============================ Toast ============================ */
.toast {
  position: fixed; top: 64px; left: 50%;
  background: var(--red); color: #fff; font-weight: 700;
  padding: 12px 28px; border-radius: 999px; font-size: 16px; z-index: 70;
  border: 2px solid var(--card-outline); box-shadow: 0 6px 0 var(--red-d), 0 10px 24px rgba(0,0,0,.5);
  letter-spacing: .5px; white-space: nowrap;
  animation: toast-in 1.8s ease forwards;
}
@keyframes toast-in {
  0%   { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(.7); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.08); }
  20%  { transform: translateX(-50%) translateY(0) scale(1); }
  82%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-12px) scale(.95); }
}
/* toast 类型配色（默认=info 蓝；不传 type 的旧调用走 info） */
.toast.info    { background: var(--blue);  box-shadow: 0 6px 0 var(--blue-d),  0 10px 24px rgba(0,0,0,.5); }
.toast.success { background: var(--green); box-shadow: 0 6px 0 var(--green-d), 0 10px 24px rgba(0,0,0,.5); }
.toast.warn    { background: var(--gold);  color: #1d232b; box-shadow: 0 6px 0 var(--gold-d), 0 10px 24px rgba(0,0,0,.5); }
.toast.error   { background: var(--red);   box-shadow: 0 6px 0 var(--red-d),   0 10px 24px rgba(0,0,0,.5); }

/* ============================ 牌型横幅播报（特殊牌型出场） ============================ */
.announce {
  position: fixed; top: 42%; left: 50%; z-index: 88; pointer-events: none;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: var(--font); font-weight: 900; letter-spacing: 6px; text-align: center;
  animation: announce 1.3s cubic-bezier(.2,1.4,.4,1) forwards;
}
.announce .an-emoji { font-size: 40px; line-height: 1; }
.announce .an-text {
  font-size: 56px; padding: 8px 32px; border-radius: 12px;
  text-shadow: 0 3px 0 rgba(0,0,0,.4), 0 0 24px currentColor;
  background: rgba(0,0,0,.45); border: 3px solid currentColor;
}
/* 各牌型配色 */
.announce.bomb   .an-text { color: #ff5a3c; }      /* 炸弹：火红 */
.announce.rocket .an-text { color: var(--gold); }  /* 火箭：金 */
.announce.plane  .an-text { color: #b06bff; }      /* 飞机：紫 */
.announce.straight .an-text { color: var(--blue); }/* 顺子：蓝 */
.announce.chain  .an-text { color: var(--green); } /* 连对：绿 */
.announce.four   .an-text { color: #ff9f43; }      /* 四带二：橙 */
@keyframes announce {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); }
  18%  { opacity: 1; transform: translate(-50%, -50%) scale(1.15) rotate(2deg); }
  30%  { transform: translate(-50%, -50%) scale(1) rotate(0); }
  78%  { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(1.1); }
}

/* ============================ 特效层（出炸：屏幕晃 + 闪光） ============================ */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; opacity: 0; }
#fx.flash { animation: flash .5s ease-out; background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.6), transparent 60%); }
#fx.flash.rocket { background: radial-gradient(circle at 50% 50%, rgba(249,200,14,.7), transparent 62%); }
@keyframes flash { 0% { opacity: 0; } 14% { opacity: 1; } 100% { opacity: 0; } }
#app.shake { animation: shake .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translate(-2px, 1px); }
  20%, 80% { transform: translate(4px, -2px); }
  30%, 50%, 70% { transform: translate(-6px, 2px); }
  40%, 60% { transform: translate(6px, -1px); }
}

/* ============================ 交互反馈：回合脉冲 / 彩纸 / 声音开关 ============================ */
/* 轮到你出牌：回合指示 + 玩家区脉冲一下 */
.turn-indicator.pulse { animation: turn-pulse .7s ease; }
@keyframes turn-pulse {
  0% { transform: scale(1); color: var(--tx); }
  30% { transform: scale(1.12); color: var(--gold); text-shadow: 0 0 14px rgba(249,200,14,.7); }
  100% { transform: scale(1); }
}
.player-area.your-turn { animation: seat-glow 1.1s ease; }
@keyframes seat-glow {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: inset 0 0 0 3px var(--gold), 0 0 26px rgba(249,200,14,.35); }
}
/* AI 出牌时座位闪光 */
.player-area.ai-played { animation: ai-seat-flash .5s ease; }
@keyframes ai-seat-flash {
  0% { box-shadow: 0 0 0 0 rgba(255, 200, 100, 0.7); }
  50% { box-shadow: 0 0 20px 8px rgba(255, 200, 100, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(255, 200, 100, 0); }
}
/* 紧迫座位：在既有 .urgent 红条上加整座脉冲 */
.seat-timer.active .st-fill.urgent { animation: urgent-pulse .5s ease-in-out infinite; }
@keyframes urgent-pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.5); } }

/* 回合开始时手牌微微上浮（视觉反馈） */
.player-area.your-turn .card {
  transform: translateY(-4px);
  transition: transform .2s ease;
}
.player-area.your-turn .card:hover {
  transform: translateY(-10px);
}

/* 底分数字跳动（确定地主时） */
@keyframes base-bump {
  0% { transform: scale(.5); opacity: 0; }
  60% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); }
}
.bottom-cards .base-score-bump {
  animation: base-bump .5s cubic-bezier(.2,1.6,.4,1);
  display: inline-block;
  font-weight: 700;
  color: var(--gold);
}

/* 胜利彩纸层（UI.confetti 临时挂到 body） */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 85; overflow: hidden; }
.confetti-pc { position: absolute; top: -16px; width: 10px; height: 14px; border-radius: 2px; will-change: transform, opacity; animation: confetti-fall linear forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(102vh) rotate(720deg); opacity: .9; }
}

/* 全局声音开关：固定左下角的圆形贴纸按钮 */
.sound-toggle {
  position: fixed; left: 14px; bottom: 14px; z-index: 90;
  width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 20px;
  --btn-bg: #34455a; --btn-edge: #212d3b;
  display: flex; align-items: center; justify-content: center;
}
.sound-toggle.muted { --btn-bg: #2a3543; opacity: .82; filter: grayscale(.4); }

/* ============================ 品牌开场动画（INTRO） ============================ */
/* 复用既有动画语言：deal-in 弧线 + flip-reveal 翻面 + 品牌金字阴影 + shake/flash（由 JS 在砸入时刻触发）。 */
#view-intro { cursor: pointer; flex-direction: column; }
.intro-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; }
.intro-cards { position: relative; height: 150px; width: 100%; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.intro-card {
  position: absolute;
  width: 88px; height: 128px; border-radius: 12px;
  background: var(--card-face); border: 3px solid var(--card-outline);
  box-shadow: 0 6px 0 rgba(0,0,0,.32), 0 12px 24px rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-family: var(--font); font-weight: 700;
  transform: translateX(var(--x)) rotate(var(--r));
  animation: intro-deal .7s cubic-bezier(.18,1.25,.3,1) backwards;
  animation-delay: calc(.3s + var(--i) * 0.12s);
}
.intro-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 10px;
  background: linear-gradient(150deg, rgba(255,255,255,.6) 0%, transparent 32%);
}
.intro-card .ic-pip { font-size: 52px; line-height: 1; }
.intro-card.s-red { color: var(--card-red); }
/* 大王：与游戏内 makeCardEl 一致——星 ✦ + JOKER 字样，红色奶油牌面 */
.intro-card.joker { flex-direction: column; gap: 2px; background: linear-gradient(160deg, #fff 0%, #ffe0e0 100%); }
.intro-card.joker .ic-star { font-size: 46px; line-height: 1; color: var(--card-red); }
.intro-card.joker .ic-word { font-family: var(--font); font-size: 13px; letter-spacing: 1px; font-weight: 700; color: var(--card-red); }
/* 牌从中央牌堆位置带翻面甩到扇形终点（终点位姿写在元素的 transform 上，配合 backwards） */
@keyframes intro-deal {
  0%   { opacity: 0; transform: translateX(0) translateY(-44px) rotateY(90deg) scale(.5); }
  55%  { opacity: 1; }
  72%  { transform: translateX(var(--x)) translateY(0) rotateY(0) rotate(var(--r)) scale(1.08); }
  100% { opacity: 1; transform: translateX(var(--x)) translateY(0) rotateY(0) rotate(var(--r)) scale(1); }
}
.intro-brand {
  font-family: var(--font); font-size: clamp(40px, 8vw, 68px); font-weight: 700;
  letter-spacing: 2px; line-height: 1.05; color: var(--gold); text-align: center;
  text-shadow: 0 3px 0 var(--gold-d), 0 6px 0 rgba(0,0,0,.35), 0 12px 26px rgba(0,0,0,.55);
  transform: rotate(-2deg);
  animation: intro-slam .6s cubic-bezier(.2,1.6,.35,1) 1.6s backwards,
             intro-glow 2.4s ease-in-out 2.4s infinite;
}
@keyframes intro-slam {
  0%   { opacity: 0; transform: rotate(-2deg) scale(1.6); }
  60%  { opacity: 1; transform: rotate(-2deg) scale(.92); }
  100% { opacity: 1; transform: rotate(-2deg) scale(1); }
}
@keyframes intro-glow {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(249,200,14,.4)); }
  50%      { filter: drop-shadow(0 0 18px rgba(249,200,14,.85)); }
}
.intro-sub {
  color: var(--gold-d); font-size: 14px; letter-spacing: 5px; font-weight: 700; text-align: center;
  animation: intro-fade .6s ease 2.2s backwards;
}
.intro-enter {
  margin-top: 22px; font-family: var(--font); font-size: 13px; letter-spacing: 2px; color: var(--tx2);
  animation: intro-fade .5s ease 2.7s backwards, intro-prompt 1.3s ease-in-out 3.2s infinite;
}
@keyframes intro-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes intro-prompt {
  0%, 100% { opacity: .5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); color: var(--gold); text-shadow: 0 0 12px rgba(249,200,14,.6); }
}
/* 主菜单大标题兼「重看开场」入口（点击标题即重放，课堂重复演示用） */
.menu-box .brand { cursor: pointer; }
.menu-box .brand:hover { filter: brightness(1.08); }

/* ============================ 响应式 ============================ */
@media (max-width: 1024px) {
  :root { --card-w: clamp(42px, 5.6vw, 56px); }
  .table { padding: 10px 12px; gap: 8px; }
  .opp-backs .cardback { width: 27px; height: 41px; }
  .opp-backs.revealed-hand { width: min(300px, 32vw); min-height: 96px; max-height: 132px; }
  .opp-backs.revealed-hand .mini { width: 24px; height: 35px; font-size: 10px; }
  .opp-avatar { width: 30px; height: 30px; font-size: 14px; }
}
@media (max-width: 720px) {
  :root { --card-w: clamp(34px, 9.5vw, 48px); }
  .table { display: flex; flex-direction: column; padding: 8px; gap: 6px; }
  .table::before { display: none; }
  .opponent.left, .opponent.right { grid-column: auto; grid-row: auto; }
  .center { grid-column: auto; grid-row: auto; gap: 8px; }
  .opponent { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 2px 0; }
  .opp-backs { min-height: 0; }
  .opp-backs .cardback { width: 16px; height: 24px; margin-left: -11px; }
  .opp-backs.revealed-hand { width: min(92vw, 360px); min-height: 40px; max-height: 88px; order: 3; }
  .opp-backs.revealed-hand .mini { width: 22px; height: 32px; font-size: 9px; }
  .opp-backs.revealed-hand .mini .m-suit { font-size: 10px; }
  .seat-timer .st-track { width: 70px; }
  .seat-timer-player .st-track { width: 80vw; max-width: 280px; }
  .center .played-slot .mini { width: 32px; height: 46px; margin-left: -14px; font-size: 12px; }
  .hand { padding-top: 20px; }
  .topbar { gap: 8px; padding: 8px 10px; }
  .topbar .title { font-size: 15px; }
  .topbar .info { display: none; }
  .bottom-cards .cardback.cardback-lg { width: 36px; height: 52px; }
  .rule-menu { grid-template-columns: 1fr; }
}

/* ============================ 动效降级（无障碍兜底） ============================ */
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  .card { animation: none; }
  .played-slot .mini { animation: none; }
  #app.shake { animation: none; }
  #fx.flash { animation: none; }
  .dialog { animation: none; }
  .view.active { animation: none; }
  button.btn-pop { animation: none; }
  .turn-indicator.pulse, .player-area.your-turn { animation: none; }
  .seat-timer.active .st-fill.urgent { animation: none; }
  .confetti-layer { display: none; }
  /* 开场：减弱动效时直接静态呈现（扇形位姿来自元素自身 transform），不卡演示 */
  .intro-card, .intro-brand, .intro-sub, .intro-enter { animation: none !important; opacity: 1 !important; }
  .intro-brand { filter: none; }
}
