/* ==========================================================================
   斗地主 · 薄片 —— 牌桌 UI（深绿绒面 / 暖金描边 / 纯 CSS 卡牌）
   纯手写，无外部依赖、无外部资源，离线可用。
   ========================================================================== */

:root {
  --felt-1: #1f8a4d;
  --felt-2: #14673c;
  --felt-3: #0a4027;
  --felt-4: #052b18;
  --panel: rgba(5, 30, 17, 0.86);
  --panel-2: rgba(4, 24, 13, 0.95);
  --text: #effaf2;
  --muted: #9cc7ad;
  --muted-dim: rgba(156, 199, 173, 0.55);
  --gold: #f6d87c;
  --gold-2: #ffe6a0;
  --gold-deep: #d9ab35;
  --red: #e5534b;
  --red-soft: #ffb0a9;
  --line: rgba(246, 216, 124, 0.2);
  --line-strong: rgba(246, 216, 124, 0.45);
  --card-w: 58px;
  --card-h: 82px;
  --mini-w: 46px;
  --mini-h: 65px;
  --radius: 16px;
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.48);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% -12%, rgba(48, 190, 110, 0.28), transparent 55%),
    radial-gradient(ellipse at 50% 118%, rgba(246, 216, 124, 0.08), transparent 62%),
    linear-gradient(180deg, #072f1a 0%, #04200f 58%, #02110a 100%);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ------------------------------------------------------------------ 顶栏 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(9, 48, 27, 0.97), rgba(4, 25, 14, 0.94));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.38);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--gold);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.brand-icon { font-size: 22px; color: var(--gold-2); }
.brand-name { font-size: 20px; font-weight: 900; letter-spacing: 2px; }
.brand-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  white-space: nowrap;
}

.stat b { color: var(--text); font-size: 14px; font-weight: 800; }
.stat.dim { opacity: 0.72; }
.stat-label { font-size: 11px; }
.landlord-stat { color: var(--gold); border-color: var(--line); }

.phase-pill {
  padding: 4px 13px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  background: rgba(246, 216, 124, 0.14);
  color: var(--gold);
  border: 1px solid rgba(246, 216, 124, 0.42);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.phase-pill.playing {
  background: rgba(74, 222, 128, 0.14);
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.42);
}

.phase-pill.finished {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.2);
}

.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(246, 216, 124, 0.26);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s, border-color 0.15s;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.icon-btn.muted { opacity: 0.55; border-color: rgba(255, 255, 255, 0.16); }

/* ------------------------------------------------------------------ 布局 */
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 304px;
  gap: 12px;
  align-items: start;
}

.left-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.right-rail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 100px);
}

/* ------------------------------------------------------------------ 牌桌 */
.table-felt {
  position: relative;
  min-height: 540px;
  border-radius: 28px;
  border: 2px solid rgba(246, 216, 124, 0.3);
  background:
    radial-gradient(ellipse at 50% 42%, var(--felt-1) 0%, var(--felt-2) 34%, var(--felt-3) 66%, var(--felt-4) 100%);
  box-shadow:
    inset 0 0 120px rgba(0, 0, 0, 0.58),
    inset 0 0 0 9px rgba(0, 0, 0, 0.14),
    0 22px 54px rgba(0, 0, 0, 0.46);
  overflow: hidden;
  transform-origin: center;
}

.table-felt::after {
  content: "";
  position: absolute;
  inset: 13px;
  border-radius: 20px;
  border: 1px dashed rgba(246, 216, 124, 0.15);
  pointer-events: none;
  z-index: 1;
}

.felt-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255, 255, 255, 0.07), transparent 55%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, 0.4), transparent 55%);
  z-index: 0;
}

.table-felt.shake { animation: tableShake 0.45s ease-in-out; }

@keyframes tableShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-7px, 3px) rotate(-0.35deg); }
  40% { transform: translate(6px, -4px) rotate(0.3deg); }
  60% { transform: translate(-4px, 2px) rotate(-0.2deg); }
  80% { transform: translate(3px, -1px) rotate(0.1deg); }
}

/* 座位 */
.seat-panel {
  position: absolute;
  width: 192px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(9, 46, 26, 0.94), rgba(4, 24, 13, 0.96));
  border: 1px solid rgba(246, 216, 124, 0.24);
  border-radius: 15px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.42);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  z-index: 4;
}

.seat-panel.active {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(246, 216, 124, 0.16),
    0 0 26px rgba(246, 216, 124, 0.24),
    0 14px 30px rgba(0, 0, 0, 0.5);
}

.seat-panel.active::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 19px;
  border: 1px solid rgba(246, 216, 124, 0.5);
  animation: turnRing 1.6s ease-out infinite;
  pointer-events: none;
}

@keyframes turnRing {
  0% { opacity: 0.85; transform: scale(1); }
  70% { opacity: 0; transform: scale(1.035); }
  100% { opacity: 0; transform: scale(1.035); }
}

/* 座位与出牌顺序一致：你(下) → AI-1(右，下家) → AI-2(左，上家) → 你 */
.seat-1 { right: 14px; top: 14px; }
.seat-2 { left: 14px; top: 14px; }
.seat-0 {
  left: 50%;
  bottom: 12px;
  width: 224px;
  transform: translateX(-50%);
}
.seat-0.active { transform: translateX(-50%) translateY(-2px); }

.seat-top { display: flex; align-items: center; gap: 9px; text-align: left; }
.seat-0 .seat-top { justify-content: center; }
.seat-0 .seat-meta { text-align: center; }

.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  color: var(--gold);
  background: radial-gradient(circle at 35% 30%, rgba(246, 216, 124, 0.34), rgba(246, 216, 124, 0.1));
  border: 1px solid rgba(246, 216, 124, 0.5);
  box-shadow: inset 0 1px 4px rgba(255, 255, 255, 0.18);
  position: relative;
}

.avatar.bot {
  color: #bfe3ff;
  background: radial-gradient(circle at 35% 30%, rgba(96, 165, 250, 0.34), rgba(96, 165, 250, 0.08));
  border-color: rgba(96, 165, 250, 0.5);
}

.avatar.agent {
  color: #d9c2ff;
  background: radial-gradient(circle at 35% 30%, rgba(167, 139, 250, 0.36), rgba(167, 139, 250, 0.08));
  border-color: rgba(167, 139, 250, 0.55);
}

.avatar .crown {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 15px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
}

.seat-meta { min-width: 0; }
.seat-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.seat-role { font-size: 11px; color: var(--muted); letter-spacing: 0.5px; }
.seat-role.landlord { color: var(--gold); font-weight: 900; }
.seat-role.farmer { color: #9fd8b4; }

.seat-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 7px; }

.seat-count {
  font-size: 11px;
  color: var(--muted);
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  white-space: nowrap;
}
.seat-count b { color: var(--text); font-size: 21px; font-weight: 900; line-height: 1; }

.seat-backs { display: flex; align-items: center; padding-left: 8px; }
.mini-back {
  width: 19px;
  height: 26px;
  margin-left: -13px;
  border-radius: 3px;
  border: 1px solid rgba(246, 216, 124, 0.32);
  background:
    repeating-linear-gradient(45deg, rgba(246, 216, 124, 0.2) 0 2px, transparent 2px 5px),
    linear-gradient(160deg, #123e63, #0a2742);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.mini-back:first-child { margin-left: 0; }

/* 气泡 */
.bubble {
  position: absolute;
  z-index: 8;
  max-width: 210px;
  padding: 7px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #1d1300;
  background: linear-gradient(180deg, #ffe9a8, #efc55a);
  border: 1px solid #fff0bd;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  animation: bubbleIn 0.28s cubic-bezier(0.2, 1.4, 0.4, 1);
  pointer-events: none;
  white-space: nowrap;
}

.bubble::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 7px solid transparent;
}

.bubble.pos-1 { right: 208px; top: 34px; }
.bubble.pos-1::after { right: -13px; top: 12px; border-left-color: #f3cf66; }
.bubble.pos-2 { left: 208px; top: 34px; }
.bubble.pos-2::after { left: -13px; top: 12px; border-right-color: #f3cf66; }
.bubble.pos-0 { left: 50%; bottom: 118px; transform: translateX(-50%); }
.bubble.pos-0::after { left: 50%; bottom: -13px; transform: translateX(-50%); border-top-color: #f3cf66; }

.bubble.soft {
  color: #dbeeff;
  background: linear-gradient(180deg, rgba(37, 78, 118, 0.96), rgba(20, 47, 74, 0.96));
  border-color: rgba(147, 197, 253, 0.5);
}
.bubble.soft.pos-1::after { border-left-color: #254e76; }
.bubble.soft.pos-2::after { border-right-color: #254e76; }
.bubble.soft.pos-0::after { border-top-color: #254e76; }

.bubble.thinking {
  color: var(--muted);
  font-weight: 600;
  background: rgba(4, 22, 13, 0.94);
  border-color: rgba(255, 255, 255, 0.16);
  letter-spacing: 0.5px;
}
.bubble.thinking::after { border: none; }
.bubble.thinking .dots::after { content: ""; animation: dots 1s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* AI 牌友骚话：与动作气泡分开，暗色小气泡 */
.chat-bubble {
  position: absolute;
  z-index: 9;
  max-width: 232px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #ffe9b0;
  background: rgba(4, 22, 13, 0.93);
  border: 1px solid rgba(246, 216, 124, 0.42);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  animation: chatIn 0.26s cubic-bezier(0.2, 1.2, 0.4, 1);
  pointer-events: none;
  word-break: break-word;
}
.chat-bubble.pos-1 { right: 26px; top: 112px; }
.chat-bubble.pos-2 { left: 26px; top: 112px; }
.chat-bubble.pos-0 {
  left: 50%;
  bottom: 128px;
  transform: translateX(-50%);
}
@keyframes chatIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-bubble.pos-0 { animation-name: chatInCenter; }
@keyframes chatInCenter {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px) scale(0.9); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.seat-order {
  margin-left: 5px;
  font-size: 10px;
  color: var(--muted-dim);
  letter-spacing: 0;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px) scale(0.82); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.bubble.pos-0 { animation-name: bubbleInCenter; }
@keyframes bubbleInCenter {
  from { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.84); }
  to { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* 出牌区 */
.trick-zone {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 70px;
  min-height: var(--mini-h);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.trick-1 { left: 77%; top: 43%; }
.trick-2 { left: 23%; top: 43%; }
.trick-0 { left: 50%; top: 68%; }

.trick-zone .card.mini { margin-left: -13px; animation: trickCardIn 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1) both; }
.trick-zone .card.mini:first-child { margin-left: 0; }

@keyframes trickCardIn {
  from { opacity: 0; transform: translateY(18px) scale(0.7) rotate(-6deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

.trick-label {
  position: absolute;
  left: 50%;
  top: -17px;
  transform: translateX(-50%);
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #052b18;
  background: var(--gold);
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
}

.pass-tag {
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--muted);
  background: rgba(2, 18, 10, 0.7);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  animation: trickCardIn 0.25s ease-out both;
}

/* 中央控制区 */
.center-console {
  position: absolute;
  left: 50%;
  top: 41%;
  transform: translate(-50%, -50%);
  width: min(60%, 470px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  z-index: 2;
  pointer-events: none;
}

.bottom-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(246, 216, 124, 0.16);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.3);
}

.bottom-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--gold);
  writing-mode: vertical-rl;
  padding: 2px 0;
}

.bottom-cards { display: flex; gap: 5px; }
.bottom-cards .card.mini { animation: bottomFlip 0.5s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
.bottom-cards .card.mini:nth-child(2) { animation-delay: 0.1s; }
.bottom-cards .card.mini:nth-child(3) { animation-delay: 0.2s; }

@keyframes bottomFlip {
  from { opacity: 0; transform: rotateY(90deg) scale(0.8); }
  to { opacity: 1; transform: rotateY(0deg) scale(1); }
}

.center-banner {
  min-height: 30px;
  padding: 2px 18px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 3px;
  color: var(--gold-2);
  text-shadow: 0 0 18px rgba(246, 216, 124, 0.45), 0 2px 6px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
}
.center-banner.show { opacity: 1; transform: scale(1); }
.center-banner.gold { color: var(--gold-2); }
.center-banner.danger { color: #ffb3ae; text-shadow: 0 0 20px rgba(229, 83, 75, 0.6); }

.turn-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 22px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.turn-hint.you { color: var(--gold); font-weight: 800; font-size: 15px; text-shadow: 0 0 16px rgba(246, 216, 124, 0.4); }
.turn-hint.waiting { color: #a7d8ff; }
.turn-hint.finished { color: var(--muted); }
.turn-hint.urgent { animation: hintPulse 1.2s ease-in-out infinite; }
@keyframes hintPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.3s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(167, 216, 255, 0.5); opacity: 1; }
  100% { box-shadow: 0 0 0 9px rgba(167, 216, 255, 0); opacity: 0.55; }
}

/* 牌堆 */
.deck {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--mini-w);
  height: var(--mini-h);
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1;
  pointer-events: none;
}
.deck.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.deck-card {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  border: 1px solid rgba(246, 216, 124, 0.4);
  background:
    repeating-linear-gradient(45deg, rgba(246, 216, 124, 0.22) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #16466f, #0a2742);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}
.deck-card-1 { transform: translate(-5px, -4px) rotate(-5deg); }
.deck-card-2 { transform: translate(4px, 3px) rotate(4deg); }
.deck-glow {
  position: absolute;
  inset: -18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 216, 124, 0.22), transparent 65%);
  animation: deckGlow 1.8s ease-in-out infinite;
}
@keyframes deckGlow { 0%, 100% { opacity: 0.4; } 50% { opacity: 0.9; } }

.fly-layer { position: absolute; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.fly-card {
  position: absolute;
  width: var(--mini-w);
  height: var(--mini-h);
  will-change: transform;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}
.fly-card .card { width: 100%; height: 100%; }

.fx-layer { position: absolute; inset: 0; z-index: 34; pointer-events: none; overflow: hidden; }

.deal-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 36;
  padding: 9px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--gold-2);
  background: rgba(2, 16, 9, 0.86);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  animation: hintPulse 1.1s ease-in-out infinite;
  pointer-events: none;
}

/* 炸弹闪光 */
.bomb-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 55%, rgba(255, 236, 170, 0.95), rgba(255, 138, 60, 0.55) 34%, transparent 68%);
  animation: bombFlash 0.7s ease-out forwards;
}
@keyframes bombFlash {
  0% { opacity: 0; }
  12% { opacity: 1; }
  100% { opacity: 0; }
}

/* ------------------------------------------------------------------ 卡牌 */
.card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.32);
  background: linear-gradient(158deg, #ffffff 0%, #f5f8fa 58%, #e6ebef 100%);
  color: #172029;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  user-select: none;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, margin 0.14s ease;
  transform: translateY(0);
}

.card.red { color: #cf2f26; }

.c-corner {
  position: absolute;
  left: 4px;
  top: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.95;
  font-family: "Segoe UI", "Arial Narrow", system-ui, sans-serif;
}
.c-corner b { font-size: 19px; font-weight: 900; letter-spacing: -0.5px; }
.c-corner i { font-size: 12px; font-style: normal; }
.c-corner.bottom { left: auto; right: 4px; top: auto; bottom: 3px; transform: rotate(180deg); }

.c-pip {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  line-height: 1;
  opacity: 0.9;
}

.card.joker {
  background:
    radial-gradient(circle at 50% 28%, #fffdf4 0%, #faf0d2 54%, #eeddb2 100%);
  border-color: rgba(201, 154, 43, 0.55);
  overflow: hidden;
}
.card.joker::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), transparent 42%),
    repeating-linear-gradient(45deg, rgba(201, 154, 43, 0.07) 0 3px, transparent 3px 8px);
  pointer-events: none;
}
.card.joker .c-corner { z-index: 2; }
.card.joker .c-corner b {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
  writing-mode: horizontal-tb;
}
.card.joker.red .c-corner { color: #c62828; }
.card.joker .c-corner i { display: none; }

.joker-crown {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  width: 30px;
  height: 16px;
  background: linear-gradient(180deg, #ffe9a3 0%, #e2b23f 62%, #b8860b 100%);
  clip-path: polygon(0 100%, 0 30%, 22% 64%, 50% 0, 78% 64%, 100% 30%, 100% 100%);
  filter: drop-shadow(0 1px 1px rgba(120, 80, 0, 0.35));
  z-index: 2;
}
.joker-char {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  font-family: "STKaiti", "KaiTi", "Songti SC", "Microsoft YaHei", serif;
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(180deg, #8d5b00 0%, #d8a52f 56%, #7a4b00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  z-index: 2;
}
.card.joker.red .joker-char {
  background: linear-gradient(180deg, #9d1010 0%, #ef5b4b 56%, #8c0c0c 100%);
  -webkit-background-clip: text;
  background-clip: text;
}
.card.joker.big {
  box-shadow:
    0 0 0 1px rgba(229, 83, 75, 0.28),
    0 2px 4px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.joker-sub {
  position: absolute;
  left: 50%;
  bottom: 9px;
  transform: translateX(-50%);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 2.5px;
  color: #a97f2a;
  z-index: 2;
}

.card.back {
  cursor: default;
  background:
    repeating-linear-gradient(45deg, rgba(246, 216, 124, 0.2) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, #16466f 0%, #0c2d4a 60%, #0a2742 100%);
  border-color: rgba(246, 216, 124, 0.35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.42);
}
.card.back::after {
  content: "♠";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(246, 216, 124, 0.4);
  font-size: 20px;
}

.card.mini {
  width: var(--mini-w);
  height: var(--mini-h);
  border-radius: 6px;
  cursor: default;
}
.card.mini .c-corner { left: 3px; top: 2px; }
.card.mini .c-corner b { font-size: 15px; }
.card.mini .c-corner i { font-size: 9px; }
.card.mini .c-corner.bottom { right: 3px; bottom: 2px; }
.card.mini .c-pip { font-size: 18px; right: 5px; }
.card.mini.joker .c-corner b { font-size: 12px; }
.card.mini.joker .joker-crown { width: 20px; height: 11px; top: 8px; }
.card.mini.joker .joker-char { font-size: 23px; }
.card.mini.joker .joker-sub { font-size: 5px; bottom: 4px; letter-spacing: 1px; }

/* ------------------------------------------------------------------ 手牌区 */
.hand-area {
  position: relative;
  padding: 10px 16px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 46, 25, 0.88), rgba(4, 24, 13, 0.94));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

.hand-head { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 3px; }

.role-chip {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
  border: 1px solid var(--line);
  background: rgba(246, 216, 124, 0.08);
}
.role-chip.landlord { color: #2a1c00; background: linear-gradient(180deg, #ffe6a0, #e8bc4b); border-color: #ffe6a0; }
.role-chip.farmer { color: #a7e9c1; border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.08); }

.hand-title { font-weight: 700; }
.selected-hint { margin-left: auto; color: var(--gold); font-weight: 800; }

.hand {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  min-height: 108px;
  padding: 16px 6px 4px;
  overflow: visible;
  touch-action: none;
}

.hand.dragging .card { cursor: grabbing; }

.hand .card { margin-left: 4px; }
.hand .card:first-child { margin-left: 0; }
.hand .card:hover { transform: translateY(-11px); z-index: 60; }
.hand .card.selected {
  transform: translateY(-22px);
  box-shadow:
    0 0 0 2px var(--gold-2),
    0 14px 22px rgba(0, 0, 0, 0.5),
    0 0 22px rgba(246, 216, 124, 0.32);
  z-index: 70;
}
.hand .card.deselect { animation: cardWiggle 0.2s ease; }
@keyframes cardWiggle { 0%, 100% { transform: translateY(var(--lift, 0)); } 50% { transform: translateY(calc(var(--lift, 0px) + 3px)); } }
.hand .card.deal-in { animation: handDealIn 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.06) both; animation-delay: calc(var(--i, 0) * 24ms); }
@keyframes handDealIn {
  from { opacity: 0; transform: translate(0, 34px) rotate(-8deg) scale(0.7); }
  to { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
}

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 9px; min-height: 46px; }
.controls-group { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.controls-note { font-size: 12px; color: var(--muted); }

.bid-label { font-size: 15px; font-weight: 900; letter-spacing: 1px; color: var(--gold); margin-right: 3px; }
#bid-controls.grab .bid-label { color: #ffb3ae; animation: hintPulse 1.1s ease-in-out infinite; }
#bid-controls.grab #btn-bid-take { animation: grabPulse 1.15s ease-in-out infinite; }
@keyframes grabPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(246, 216, 124, 0.28); }
  50% { box-shadow: 0 0 22px rgba(255, 220, 120, 0.72); }
}

/* ------------------------------------------------------------------ 按钮 */
.btn {
  appearance: none;
  padding: 9px 18px;
  border-radius: 11px;
  border: 1px solid rgba(246, 216, 124, 0.34);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, #ffe28b 0%, #f1c64e 55%, #d9a92e 100%);
  border-color: #ffe9a6;
  color: #2a1c00;
  box-shadow: 0 4px 14px rgba(246, 216, 124, 0.26);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffeaa5 0%, #f7d05f 55%, #e2b436 100%); }
.btn.danger { background: rgba(229, 83, 75, 0.14); border-color: rgba(229, 83, 75, 0.5); color: var(--red-soft); }
.btn.danger:hover:not(:disabled) { background: rgba(229, 83, 75, 0.26); }
.btn.ghost { background: transparent; }
.btn.big { padding: 11px 26px; font-size: 16px; }
.btn.small { padding: 7px 13px; font-size: 13px; }

/* ------------------------------------------------------------------ 右侧栏 */
.thought-panel,
.log-panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 46, 25, 0.9), rgba(4, 22, 12, 0.95));
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.panel-head,
.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.16);
  border-bottom: 1px solid rgba(246, 216, 124, 0.12);
}

.thought-seat { font-size: 11px; color: var(--muted); letter-spacing: 0; }
.thought-body {
  padding: 10px 13px 13px;
  min-height: 74px;
  max-height: 132px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 216, 124, 0.35) transparent;
}
.thought-body.live { color: var(--text); }
.thought-body .thought-who { color: var(--gold); font-weight: 800; margin-right: 4px; }

.log-toggle {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(246, 216, 124, 0.22);
  background: rgba(255, 255, 255, 0.05);
  color: var(--gold);
  font-size: 11px;
  cursor: pointer;
}
.log-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px 12px;
  overflow-y: auto;
  min-height: 120px;
  max-height: 452px;
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 216, 124, 0.35) transparent;
}
.log-panel.collapsed .log-body { display: none; }
.log-empty { padding: 10px 4px; font-size: 13px; color: var(--muted-dim); }

.log-item {
  padding: 6px 9px;
  border-left: 2px solid rgba(246, 216, 124, 0.38);
  border-radius: 0 7px 7px 0;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12.5px;
}
.log-item.fresh { animation: logIn 0.2s ease-out; }
@keyframes logIn { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: translateX(0); } }
.log-item.system { border-left-color: rgba(255, 255, 255, 0.12); background: transparent; color: var(--muted); }
.log-item.human { border-left-color: rgba(246, 216, 124, 0.8); }
.log-item.bot { border-left-color: rgba(96, 165, 250, 0.6); }
.log-meta { font-size: 10px; color: var(--muted-dim); margin-bottom: 1px; letter-spacing: 0.5px; }
.log-text { color: var(--text); word-break: break-word; }
.log-reason { margin-top: 2px; font-size: 11.5px; font-style: italic; color: var(--muted); }
.log-banter {
  margin-top: 3px;
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 11.5px;
  color: #ffe1a1;
  background: rgba(246, 216, 124, 0.09);
  border-left: 2px solid rgba(246, 216, 124, 0.5);
}
.review-banter {
  margin-top: 3px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 12px;
  color: #ffe1a1;
  background: rgba(246, 216, 124, 0.08);
}

/* ------------------------------------------------------------------ 提示 / 浮层 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 90;
  max-width: min(92vw, 580px);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  color: #ffe9b0;
  background: rgba(16, 14, 6, 0.95);
  border: 1px solid rgba(246, 216, 124, 0.5);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6);
  animation: bubbleIn 0.2s ease-out;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(3px);
}

.settlement {
  width: min(92vw, 430px);
  padding: 28px 34px 24px;
  text-align: center;
  border-radius: 24px;
  border: 1px solid rgba(246, 216, 124, 0.5);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(46, 200, 120, 0.24), transparent 62%),
    linear-gradient(180deg, #0f4c2a 0%, #062815 100%);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.68);
  animation: pop 0.28s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.settlement.lose {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(120, 60, 60, 0.22), transparent 62%),
    linear-gradient(180deg, #3a1a18 0%, #1c0b0a 100%);
}

.settlement-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--gold);
  background: rgba(246, 216, 124, 0.14);
  border: 1px solid rgba(246, 216, 124, 0.42);
}
.settlement-badge.farmer { color: #86efac; background: rgba(74, 222, 128, 0.12); border-color: rgba(74, 222, 128, 0.42); }
.settlement h2 { margin: 10px 0 18px; font-size: 27px; font-weight: 900; letter-spacing: 2px; color: var(--gold); text-shadow: 0 2px 20px rgba(246, 216, 124, 0.35); }
.settlement.lose h2 { color: #ffb3ae; }

.settlement-grid { display: grid; grid-template-columns: auto auto; gap: 8px 26px; justify-content: center; text-align: left; margin-bottom: 20px; }
.settle-key { font-size: 13px; color: var(--muted); }
.settle-val { font-size: 13px; font-weight: 800; color: var(--text); }
.settlement-actions { display: flex; justify-content: center; gap: 10px; }

.review-modal {
  width: min(94vw, 760px);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(246, 216, 124, 0.42);
  background: linear-gradient(180deg, #0c3a22 0%, #051d0f 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: pop 0.24s ease-out;
}
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid rgba(246, 216, 124, 0.16); }
.review-head h3 { margin: 0; font-size: 17px; color: var(--gold); letter-spacing: 1px; }
.review-tools { display: flex; align-items: center; gap: 12px; }
.review-filter { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.review-filter input { accent-color: #e8bc4b; }
.review-body { overflow-y: auto; padding: 12px 16px 20px; display: flex; flex-direction: column; gap: 7px; scrollbar-width: thin; scrollbar-color: rgba(246, 216, 124, 0.35) transparent; }
.review-row { padding: 8px 11px; border-radius: 10px; background: rgba(255, 255, 255, 0.035); border-left: 3px solid rgba(255, 255, 255, 0.14); }
.review-row.human { border-left-color: var(--gold); }
.review-row.bot { border-left-color: rgba(96, 165, 250, 0.65); }
.review-row.system { border-left-color: rgba(255, 255, 255, 0.2); color: var(--muted); background: transparent; }
.review-meta { font-size: 10.5px; color: var(--muted-dim); letter-spacing: 0.5px; }
.review-text { font-size: 13px; color: var(--text); }
.review-reason { margin-top: 3px; font-size: 12px; color: #bfe0cc; background: rgba(0, 0, 0, 0.22); border-radius: 7px; padding: 5px 8px; }
.review-reason::before { content: "思路："; color: var(--gold); font-weight: 800; }
.review-summary { padding: 8px 11px; margin-bottom: 4px; border-radius: 10px; background: rgba(246, 216, 124, 0.08); border: 1px solid rgba(246, 216, 124, 0.2); font-size: 12.5px; color: var(--muted); }

.help-modal {
  width: min(92vw, 430px);
  padding: 24px 26px;
  border-radius: 22px;
  border: 1px solid rgba(246, 216, 124, 0.42);
  background: linear-gradient(180deg, #0c3a22 0%, #051d0f 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: pop 0.24s ease-out;
}
.help-modal h3 { margin: 0 0 14px; color: var(--gold); font-size: 18px; letter-spacing: 1px; }
.help-list { margin: 0 0 18px; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 2; }
.help-list b { color: var(--text); }
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 5px;
  border: 1px solid rgba(246, 216, 124, 0.35);
  background: rgba(255, 255, 255, 0.07);
  color: var(--gold);
  font-family: inherit;
  font-size: 11px;
  text-align: center;
}

/* ------------------------------------------------------------------ 观战模式 */
.spectate-btn.active {
  background: linear-gradient(180deg, #ffe28b 0%, #f1c64e 55%, #d9a92e 100%);
  border-color: #ffe9a6;
  color: #2a1c00;
}

.spectate-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 46, 25, 0.88), rgba(4, 24, 13, 0.94));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

.spectate-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.spectate-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
}
.spectate-note { font-size: 11.5px; color: var(--muted); }

.spectate-rows { display: flex; flex-direction: column; gap: 6px; }

.sp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.sp-row.active {
  border-color: var(--gold);
  background: rgba(246, 216, 124, 0.1);
  box-shadow: 0 0 14px rgba(246, 216, 124, 0.2);
}
.sp-row.landlord .sp-role { color: var(--gold); font-weight: 800; }

.sp-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 164px;
  flex: 0 0 auto;
}
.sp-name { font-size: 13px; font-weight: 800; white-space: nowrap; }
.sp-role { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sp-count { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }

.sp-cards {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  padding: 2px 0 2px 4px;
}
.sp-cards .card.mini { margin-left: -9px; }
.sp-cards .card.mini:first-child { margin-left: 0; }

@media (max-width: 720px) {
  .sp-meta { width: 108px; gap: 5px; }
  .sp-name { font-size: 12px; }
  .sp-cards .card.mini { margin-left: -14px; }
}

/* AI 深度思考计时条 */
.thinking-strip {
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  color: #bfe3ff;
  background: rgba(10, 38, 62, 0.92);
  border: 1px solid rgba(147, 197, 253, 0.42);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  animation: hintPulse 1.4s ease-in-out infinite;
}

.llm-badge {
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #d9c2ff;
  border: 1px solid rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.16);
}

/* ------------------------------------------------------------------ AI 决策对话（transcript） */
/* 布局（定位 / 开合 / 移动端）在 table-pov.css，这里只放组件内部样式 */
.transcript-drawer {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--radius);
  border: 1px solid rgba(246, 216, 124, 0.34);
  background: linear-gradient(180deg, rgba(6, 32, 18, 0.97), rgba(2, 16, 9, 0.98));
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  overflow: hidden;
}

.transcript-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 8px 12px;
  border-bottom: 1px solid rgba(246, 216, 124, 0.16);
  background: rgba(0, 0, 0, 0.18);
}

.transcript-ident {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.transcript-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  color: #bfe3ff;
  background: radial-gradient(circle at 35% 30%, rgba(96, 165, 250, 0.34), rgba(96, 165, 250, 0.08));
  border: 1px solid rgba(96, 165, 250, 0.5);
}

.transcript-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.transcript-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.transcript-sub {
  font-size: 10.5px;
  color: var(--muted-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 210px;
}

.transcript-tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
}

.transcript-tab {
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
}

.transcript-tab.active {
  color: var(--gold);
  border-color: rgba(246, 216, 124, 0.5);
  background: rgba(246, 216, 124, 0.14);
}

.transcript-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(246, 216, 124, 0.32);
  background: rgba(0, 0, 0, 0.4);
  color: var(--gold);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.transcript-close:hover {
  background: rgba(246, 216, 124, 0.18);
  transform: rotate(90deg);
}

.transcript-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 216, 124, 0.35) transparent;
}

.transcript-empty {
  padding: 22px 10px;
  text-align: center;
  color: var(--muted-dim);
  font-size: 12.5px;
}

.transcript-msg {
  padding: 7px 9px;
  border-radius: 10px;
  border-left: 3px solid rgba(96, 165, 250, 0.55);
  background: rgba(255, 255, 255, 0.035);
}

.transcript-msg.fallback {
  border-left-color: #e5a34b;
}

.transcript-msg.error {
  border-left-color: #e5534b;
}

.transcript-msg.thinking {
  border-left-color: rgba(147, 197, 253, 0.8);
  color: #bfe3ff;
  font-size: 12px;
}

.transcript-msg-meta {
  font-size: 10px;
  color: var(--muted-dim);
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.transcript-block {
  margin: 3px 0;
}

.transcript-block > summary {
  cursor: pointer;
  list-style: none;
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  font-size: 11.5px;
}

.transcript-block > summary::-webkit-details-marker {
  display: none;
}

.transcript-block[open] > summary {
  color: var(--gold-2);
}

.transcript-pre {
  margin: 4px 0 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.34);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}

.transcript-out {
  margin-top: 5px;
}

.transcript-label {
  font-size: 10.5px;
  color: var(--gold);
  margin-bottom: 2px;
}

.transcript-action {
  margin-top: 5px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(246, 216, 124, 0.1);
  color: var(--gold-2);
  font-size: 12px;
  font-weight: 800;
}

.transcript-reason {
  margin-top: 4px;
  font-size: 11.5px;
  font-style: italic;
  color: #bfe0cc;
}

.transcript-banter {
  margin-top: 4px;
  font-size: 11.5px;
  color: #ffe1a1;
}

.transcript-msg-error {
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 7px;
  background: rgba(229, 83, 75, 0.14);
  border: 1px solid rgba(229, 83, 75, 0.38);
  color: #ffb3ae;
  font-size: 11.5px;
  word-break: break-word;
}

.transcript-chip {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  border: 1px solid rgba(167, 139, 250, 0.55);
  background: rgba(167, 139, 250, 0.16);
  color: #d9c2ff;
}

.transcript-dots::after {
  content: "";
  animation: transcriptDots 1s steps(4, end) infinite;
}

@keyframes transcriptDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

.transcript-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 8px;
  border-top: 1px solid rgba(246, 216, 124, 0.14);
  font-size: 10.5px;
  color: var(--muted-dim);
}

.transcript-count {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transcript-earlier,
.transcript-jump {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(246, 216, 124, 0.34);
  background: rgba(246, 216, 124, 0.1);
  color: var(--gold-2);
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .transcript-head {
    flex-wrap: wrap;
  }

  .transcript-tabs {
    order: 3;
    width: 100%;
    margin-left: 0;
    padding: 0 2px 2px;
    overflow-x: auto;
  }

  .transcript-sub {
    max-width: 150px;
  }
}

.settings-divider {
  margin: 10px 0 4px;
  padding-top: 10px;
  border-top: 1px solid rgba(246, 216, 124, 0.16);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
}

.setting-row.setting-col {
  flex-wrap: wrap;
  align-items: flex-start;
}
.setting-row.setting-col span { margin-top: 4px; }
.setting-row input[type="text"],
.setting-row input[type="password"] {
  flex: 1;
  min-width: 200px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid rgba(246, 216, 124, 0.32);
  background: #082817;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}
.setting-row input[type="text"]:focus,
.setting-row input[type="password"]:focus {
  outline: none;
  border-color: rgba(246, 216, 124, 0.7);
  box-shadow: 0 0 0 2px rgba(246, 216, 124, 0.12);
}

.llm-status {
  flex: 1;
  font-size: 11.5px;
  color: var(--muted);
  align-self: center;
}
.llm-status.ready { color: #86efac; }

.setting-note code {
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gold);
  font-size: 11px;
}

/* ------------------------------------------------------------------ 设置 / 积分 */
.score-stat b { color: var(--gold); }
.score-stat.neg b { color: var(--red-soft); }

.settings-modal {
  width: min(94vw, 520px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(246, 216, 124, 0.42);
  background: linear-gradient(180deg, #0c3a22 0%, #051d0f 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: pop 0.24s ease-out;
  overflow: hidden;
}

.settings-body {
  padding: 12px 18px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 216, 124, 0.35) transparent;
}

.settings-active {
  padding: 8px 11px;
  margin-bottom: 2px;
  border-radius: 10px;
  border: 1px solid rgba(246, 216, 124, 0.2);
  background: rgba(246, 216, 124, 0.08);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
  color: var(--text);
}

.setting-row span b { color: var(--gold); font-weight: 800; }
.setting-row select {
  min-width: 118px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid rgba(246, 216, 124, 0.32);
  background: #082817;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
}
.setting-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #e8bc4b;
  cursor: pointer;
}

.setting-note {
  margin: 4px 2px 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted-dim);
}
.setting-note strong { color: var(--gold); }

.settings-preview {
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.24);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.settings-preview b { color: var(--gold-2); }

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}


/* ------------------------------------------------------------------ 彩带 */
.confetti {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(560px) rotate(620deg); opacity: 0; }
}

/* ------------------------------------------------------------------ 响应式 */
@media (max-width: 1080px) {
  .main-grid { grid-template-columns: minmax(0, 1fr) 274px; }
  .seat-panel { width: 176px; }
  .seat-name { max-width: 96px; }
}

@media (max-width: 980px) {
  .main-grid { grid-template-columns: minmax(0, 1fr); }
  .right-rail { position: static; max-height: none; flex-direction: row; }
  .thought-panel, .log-panel { flex: 1; }
  .log-body { max-height: 280px; }
}

@media (max-width: 720px) {
  :root { --card-w: 46px; --card-h: 65px; --mini-w: 36px; --mini-h: 51px; }
  .app { padding: 10px 10px 28px; }
  .table-felt { min-height: 480px; }
  .seat-panel { width: 138px; padding: 7px 9px; }
  .seat-1 { right: 7px; top: 7px; }
  .seat-2 { left: 7px; top: 7px; }
  .seat-0 { width: 170px; }
  .seat-name { font-size: 12px; max-width: 72px; }
  .seat-count b { font-size: 16px; }
  .avatar { width: 32px; height: 32px; font-size: 12px; }
  .bubble.pos-1 { right: 148px; top: 22px; }
  .bubble.pos-2 { left: 148px; top: 22px; }
  .center-console { width: 88%; top: 40%; }
  .trick-1 { left: 73%; top: 42%; }
  .trick-2 { left: 27%; top: 42%; }
  .trick-0 { top: 66%; }
  .brand-name { font-size: 17px; }
  .stats { gap: 6px; }
  .stat { padding: 3px 7px; }
  .right-rail { flex-direction: column; }
  .card .c-pip { font-size: 20px; }
  .c-corner b { font-size: 16px; }
}

/* 设置里跳转「语音自定义 / 试听」 */
.setting-link {
  display: block;
  margin: -2px 0 12px;
  color: var(--gold-2);
  font-size: 13px;
  text-decoration: none;
}
.setting-link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ 角色人设 / 赛后发言 */
.seat-persona {
  margin-top: 1px;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: var(--gold-2);
  opacity: 0.82;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 结算浮层里的「赛后发言」 */
.settlement-victory {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(246, 216, 124, 0.24);
  background: rgba(0, 0, 0, 0.26);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settle-victory-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
}

.settle-victory-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid rgba(255, 255, 255, 0.16);
}

.settle-victory-row.win {
  border-left-color: var(--gold);
  background: rgba(246, 216, 124, 0.09);
}

.settle-victory-row.lose {
  border-left-color: rgba(147, 197, 253, 0.55);
}

.settle-victory-who {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-2);
  white-space: nowrap;
}

.settle-victory-row.lose .settle-victory-who { color: #bfe3ff; }

.settle-victory-text {
  font-size: 12px;
  color: var(--text);
  word-break: break-word;
}

/* 局末：胜利/惜败气泡（复用 .chat-bubble 的位置，加一点情绪色） */
.chat-bubble.settle-win {
  border-color: rgba(246, 216, 124, 0.72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(246, 216, 124, 0.28);
  animation: settlePop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.chat-bubble.settle-lose {
  color: #cfe6ff;
  border-color: rgba(147, 197, 253, 0.5);
  background: rgba(8, 26, 40, 0.94);
  animation: settlePop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes settlePop {
  from { opacity: 0; transform: translateY(10px) scale(0.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 帮助浮层：两位牌友的人设卡 */
.persona-cards {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0 0 16px;
}

.persona-card {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(246, 216, 124, 0.22);
  background: rgba(0, 0, 0, 0.24);
}

.persona-avatar {
  width: 58px;
  height: 74px;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  border: 1px solid rgba(246, 216, 124, 0.28);
  background: rgba(255, 255, 255, 0.04);
}

.persona-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.persona-name {
  font-size: 14px;
  font-weight: 900;
  color: var(--gold-2);
}

.persona-title {
  margin-left: 7px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid rgba(246, 216, 124, 0.35);
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  vertical-align: 1px;
}

.persona-tagline {
  font-size: 11.5px;
  color: var(--muted);
}

.persona-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.persona-trait {
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
  color: var(--muted);
}

.persona-line {
  margin-top: 3px;
  font-size: 11px;
  color: #ffe1a1;
  font-style: italic;
}

/* ------------------------------------------------------------------ 公网：邀请码登录 / 托管额度 */

/* 顶栏额度徽章（仅公网模式 + 启用 LLM 时由 app.js 显示） */
.llm-budget-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  color: #b9f3cd;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  cursor: default;
}
.llm-budget-badge.low {
  color: #ffdda1;
  background: rgba(246, 216, 124, 0.12);
  border-color: rgba(246, 216, 124, 0.42);
}
.llm-budget-badge.empty {
  color: var(--red-soft);
  background: rgba(229, 83, 75, 0.14);
  border-color: rgba(229, 83, 75, 0.42);
}

/* 设置里的可编辑 LLM 配置块（公网模式整块隐藏） */
.llm-config-edit {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

/* 设置里的 LLM 只读卡片（公网模式下替代上面整块配置） */
.llm-locked-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(246, 216, 124, 0.26);
  background: rgba(246, 216, 124, 0.06);
}
.llm-locked-head {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
}
.llm-locked-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.llm-locked-row b {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-weight: 800;
  color: var(--text);
  word-break: break-all;
}

/* 邀请码登录浮层：全屏、深色牌桌风格；打开时 Esc / 点空白都不关闭（必须登录） */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(31, 138, 77, 0.34), transparent 62%),
    linear-gradient(180deg, rgba(3, 24, 13, 0.96), rgba(1, 9, 5, 0.98));
  backdrop-filter: blur(6px);
}

.login-card {
  width: min(92vw, 372px);
  padding: 26px 26px 20px;
  text-align: center;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #0c3a22 0%, #051d0f 100%);
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.72);
  animation: pop 0.26s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.login-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  color: var(--gold);
}
.login-brand-icon { font-size: 20px; color: var(--gold-2); }
.login-brand-name { font-size: 18px; font-weight: 900; letter-spacing: 2px; }
.login-brand-sub {
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--muted);
}

.login-title {
  margin: 14px 0 6px;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 1px;
  color: var(--gold);
}
.login-sub {
  margin: 0 0 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login-field-label { font-size: 12px; letter-spacing: 1px; color: var(--muted); }

.login-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(246, 216, 124, 0.32);
  background: #082817;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  letter-spacing: 2px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input::placeholder { color: var(--muted-dim); font-size: 14px; letter-spacing: 0; }
.login-input:focus {
  outline: none;
  border-color: rgba(246, 216, 124, 0.75);
  box-shadow: 0 0 0 3px rgba(246, 216, 124, 0.12);
}
.login-input:disabled { opacity: 0.6; }

.login-error {
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid rgba(229, 83, 75, 0.45);
  background: rgba(229, 83, 75, 0.12);
  color: var(--red-soft);
  font-size: 12.5px;
  text-align: left;
}

.login-submit { width: 100%; margin-top: 2px; }
.login-foot {
  margin: 14px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted-dim);
}

@media (max-width: 420px) {
  .login-overlay { padding: 14px; }
  .login-card { padding: 22px 18px 16px; }
  .login-input { font-size: 16px; }
}

/* 小屏：顶栏按钮允许换行，额度徽章收窄，避免把「重开」挤出屏幕 */
@media (max-width: 720px) {
  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    row-gap: 6px;
  }
  .llm-budget-badge {
    padding: 3px 9px;
    font-size: 11px;
  }
}
