:root {
  --felt: #0f5132;
  --felt-dark: #07301e;
  --gold: #f0c674;
  --gold-dim: #c9a35a;
  --ink: #e8f1ec;
  --muted: #8fa89c;
  --panel: rgba(8, 22, 17, 0.92);
  --danger: #e05a5a;
  --ok: #4fc98a;
  --seat-w: clamp(58px, 17vw, 76px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #071410;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input { font-family: inherit; }

.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- 封面 / 大厅 ---------- */
.cover {
  --cv-1: #fff4f8;
  --cv-2: #ffe1ee;
  --cv-3: #ffc4de;
  --cv-4: #ff9ccb;
  --cv-5: #f271ae;
  --cv-blob-a: #ff9ad0;
  --cv-blob-b: #ffd0e4;
  --cv-blob-c: #d7a2ff;
  --cv-blob-d: #ffc9a8;
  --cv-text: #45112c;
  --cv-mute: #8d5a75;
  --cv-line: rgba(226, 74, 140, .18);
  --cv-accent: #e2478f;
  --cv-accent-2: #a81f63;
  --cv-glow: rgba(226, 71, 143, .38);

  align-items: center;
  justify-content: center;
  padding: calc(18px + env(safe-area-inset-top)) 20px calc(18px + env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 70% at 12% 0%, var(--cv-1) 0%, transparent 62%),
    linear-gradient(168deg, var(--cv-2) 0%, var(--cv-3) 38%, var(--cv-4) 72%, var(--cv-5) 100%);
  color: var(--cv-text);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  justify-content: flex-start;
}

.cover[data-theme="peach"] {
  --cv-1: #fff6f2;
  --cv-2: #ffe6dd;
  --cv-3: #ffced2;
  --cv-4: #ffa8b8;
  --cv-5: #f77b9b;
  --cv-blob-a: #ffae9c;
  --cv-blob-b: #ffd9b0;
  --cv-blob-c: #ff8fb4;
  --cv-blob-d: #ffc2e2;
  --cv-accent: #ef5f7e;
  --cv-accent-2: #c02f4f;
  --cv-glow: rgba(239, 95, 126, .36);
}

.cover[data-theme="neon"] {
  --cv-1: #ffeefc;
  --cv-2: #ffdcf4;
  --cv-3: #ffb3e8;
  --cv-4: #f579d4;
  --cv-5: #c46bff;
  --cv-blob-a: #ff7ad9;
  --cv-blob-b: #c9a5ff;
  --cv-blob-c: #ff9bf0;
  --cv-blob-d: #8f8bff;
  --cv-accent: #d63fc4;
  --cv-accent-2: #8a22b0;
  --cv-glow: rgba(214, 63, 196, .38);
}

.cover-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: .72;
  will-change: transform;
}
.blob-1 {
  width: 62vw; height: 62vw; max-width: 420px; max-height: 420px;
  left: -14vw; top: -10vh;
  background: radial-gradient(circle, var(--cv-blob-a), transparent 68%);
  animation: drift1 19s ease-in-out infinite alternate;
}
.blob-2 {
  width: 54vw; height: 54vw; max-width: 380px; max-height: 380px;
  right: -16vw; top: 8vh;
  background: radial-gradient(circle, var(--cv-blob-c), transparent 68%);
  animation: drift2 23s ease-in-out infinite alternate;
}
.blob-3 {
  width: 70vw; height: 70vw; max-width: 460px; max-height: 460px;
  left: 12vw; bottom: -18vh;
  background: radial-gradient(circle, var(--cv-blob-b), transparent 70%);
  animation: drift3 27s ease-in-out infinite alternate;
}
.blob-4 {
  width: 42vw; height: 42vw; max-width: 300px; max-height: 300px;
  right: 6vw; bottom: 6vh;
  background: radial-gradient(circle, var(--cv-blob-d), transparent 70%);
  animation: drift1 31s ease-in-out infinite alternate-reverse;
}
@keyframes drift1 { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(6vw,4vh,0) scale(1.16); } }
@keyframes drift2 { from { transform: translate3d(0,0,0) scale(1.08); } to { transform: translate3d(-7vw,6vh,0) scale(.94); } }
@keyframes drift3 { from { transform: translate3d(0,0,0) scale(.95); } to { transform: translate3d(5vw,-5vh,0) scale(1.12); } }

.grain {
  position: absolute; inset: -20%;
  opacity: .05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/></filter><rect width='160' height='160' filter='url(%23n)' opacity='.55'/></svg>");
  mix-blend-mode: multiply;
}

.glyph {
  position: absolute;
  font-size: clamp(40px, 13vw, 92px);
  color: rgba(255, 255, 255, .5);
  text-shadow: 0 8px 24px rgba(168, 31, 99, .18);
  animation: floatGlyph 9s ease-in-out infinite alternate;
  user-select: none;
}
.g1 { left: 6%; top: 16%; transform: rotate(-16deg); animation-delay: .2s; }
.g2 { right: 8%; top: 10%; transform: rotate(14deg); animation-delay: 1.4s; font-size: clamp(30px, 9vw, 64px); }
.g3 { left: 12%; bottom: 12%; transform: rotate(10deg); animation-delay: 2.2s; font-size: clamp(28px, 8vw, 58px); }
.g4 { right: 10%; bottom: 18%; transform: rotate(-12deg); animation-delay: 3s; }
@keyframes floatGlyph {
  from { translate: 0 0; opacity: .34; }
  to { translate: 0 -16px; opacity: .62; }
}

.theme-btn {
  position: absolute;
  right: 14px;
  top: calc(12px + env(safe-area-inset-top));
  z-index: 4;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: .5px;
  color: var(--cv-accent-2);
  background: rgba(255, 255, 255, .58);
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(168, 31, 99, .12);
  backdrop-filter: blur(8px);
}
.theme-btn:active { transform: scale(.95); }

.cover-content {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 400px;
  margin-block: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

@media (max-width: 480px) {
  .blob { filter: blur(38px); }
  .cover { padding-left: 16px; padding-right: 16px; }
}

.cover-hero { text-align: center; }
.card-fan {
  position: relative;
  height: 74px;
  margin-bottom: 6px;
}
.fan-card {
  position: absolute;
  left: 50%;
  top: 0;
  width: 50px;
  height: 68px;
  margin-left: -25px;
  border-radius: 8px;
  background: linear-gradient(165deg, #ffffff, #fff2f7);
  box-shadow: 0 10px 22px rgba(168, 31, 99, .22), inset 0 0 0 1px rgba(226, 71, 143, .16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  animation: fanBob 5.2s ease-in-out infinite alternate;
}
.fan-card i { font-style: normal; font-size: 17px; line-height: 1; color: var(--cv-accent-2); }
.fan-card em { font-style: normal; font-size: 15px; line-height: 1.1; color: var(--cv-accent); }
.fc1 { transform: translateX(-40px) rotate(-13deg); animation-delay: .1s; }
.fc2 { transform: translateY(-8px) rotate(0deg); z-index: 2; animation-delay: .5s; }
.fc3 { transform: translateX(40px) rotate(13deg); animation-delay: .9s; }
@keyframes fanBob { from { translate: 0 0; } to { translate: 0 -7px; } }

.cover-title {
  margin: 4px 0 0;
  font-size: clamp(30px, 9vw, 40px);
  letter-spacing: 8px;
  text-indent: 8px;
  background: linear-gradient(100deg, var(--cv-accent-2) 0%, var(--cv-accent) 46%, #7b3ff2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 14px rgba(168, 31, 99, .18));
}
.cover-sub {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--cv-mute);
}

.lobby-card {
  width: 100%;
  padding: 22px 20px 18px;
  border-radius: 26px;
  background: linear-gradient(165deg, rgba(255, 255, 255, .82) 0%, rgba(255, 255, 255, .55) 100%);
  border: 1.5px solid rgba(255, 255, 255, .92);
  box-shadow: 0 22px 52px rgba(168, 31, 99, .22), inset 0 1px 0 rgba(255, 255, 255, .95);
  backdrop-filter: blur(18px) saturate(1.12);
}

.cover .field span { color: var(--cv-mute); }
.cover .field input {
  color: var(--cv-text);
  background: rgba(255, 255, 255, .88);
  border: 1.5px solid var(--cv-line);
  border-radius: 14px;
}
.cover .field input::placeholder { color: #c8a0b4; }
.cover .field input:focus {
  border-color: var(--cv-accent);
  box-shadow: 0 0 0 3px rgba(226, 71, 143, .14);
}
.cover .btn.primary {
  background: linear-gradient(135deg, #ff7ab5 0%, var(--cv-accent) 46%, var(--cv-accent-2) 100%);
  color: #fff;
  box-shadow: 0 10px 26px var(--cv-glow);
  border-radius: 14px;
}
.cover .btn.ghost {
  background: rgba(255, 255, 255, .52);
  color: var(--cv-accent-2);
  border: 1.5px solid rgba(226, 71, 143, .34);
  border-radius: 14px;
}
.cover .divider { color: var(--cv-mute); }
.cover .divider::before { background: rgba(226, 71, 143, .18); }
.cover .divider span { background: transparent; }
.cover .hint { color: #a4718a; }
.cover .hint b { color: var(--cv-accent-2); }
.update-bar {
  position: fixed;
  left: 50%;
  top: calc(10px + env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(10, 26, 20, .94);
  border: 1px solid rgba(240, 198, 116, .45);
  color: #f5e3bb;
  font-size: 12px;
  z-index: 60;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .45);
  animation: pop .2s ease-out;
}
.update-bar button {
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(160deg, #f7d99b, #d9a94e);
  color: #22180a;
  font-size: 11px;
  font-weight: 700;
}
body[data-mode="day"] .update-bar {
  background: rgba(255, 255, 255, .98);
  color: #16232b;
  border-color: rgba(200, 140, 30, .5);
  box-shadow: 0 10px 26px rgba(20, 40, 60, .18);
}

.install-btn {
  margin-top: 12px;
  border-radius: 14px !important;
  background: rgba(255, 255, 255, .55) !important;
  color: var(--cv-accent-2, #a81f63) !important;
  border: 1.5px dashed rgba(226, 71, 143, .45) !important;
  box-shadow: none !important;
}
.install-hint {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: #a4718a;
  text-align: center;
}
.install-hint b { color: var(--cv-accent-2, #a81f63); }


@media (prefers-reduced-motion: reduce) {
  .blob, .glyph, .fan-card { animation: none !important; }
}

@media (max-height: 680px) {
  .cover { gap: 10px; }
  .cover-content { gap: 12px; }
  .card-fan { height: 58px; }
  .fan-card { width: 42px; height: 58px; margin-left: -21px; }
  .cover-title { font-size: 28px; letter-spacing: 6px; }
  .lobby-card { padding: 16px 16px 12px; }
}

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; letter-spacing: 1px; }
.field input {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  outline: none;
  transition: border-color .2s;
}
.field input:focus { border-color: var(--gold-dim); }
#room-code { letter-spacing: 8px; text-transform: uppercase; font-size: 20px; text-align: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  transition: transform .12s, opacity .2s, background .2s;
}
.btn:active { transform: scale(0.97); }
.btn.big { width: 100%; padding: 14px; margin-top: 4px; font-size: 16px; }
.btn.small { padding: 9px 16px; font-size: 14px; border-radius: 10px; }
.btn.primary { background: linear-gradient(160deg, #f7d99b, #d9a94e); color: #22180a; }
.btn.ghost { background: rgba(255, 255, 255, 0.07); color: var(--ink); border: 1px solid rgba(255, 255, 255, 0.1); }
.btn.call { background: linear-gradient(160deg, #68d6a4, #2f9c6e); color: #042114; }
.btn.raise { background: linear-gradient(160deg, #ffcf7a, #e0952f); color: #241505; }
.btn:disabled { opacity: 0.38; }

.divider { position: relative; text-align: center; margin: 18px 0 14px; color: var(--muted); font-size: 12px; }
.divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(255, 255, 255, 0.08); }
.divider span { position: relative; padding: 0 12px; background: rgba(9, 26, 20, 1); }
.hint { margin: 18px 0 0; font-size: 11px; line-height: 1.6; color: #6f8a7e; text-align: center; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  gap: 10px;
  background: linear-gradient(180deg, rgba(0,0,0,.45), transparent);
  z-index: 5;
}
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--muted);
  border-radius: 10px;
  background: rgba(255,255,255,.05);
}
.icon-btn.small { width: 28px; height: 28px; font-size: 16px; }
.room-badge { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.room-badge strong { font-size: 17px; letter-spacing: 3px; color: var(--gold); }
.copy-btn {
  padding: 5px 10px; font-size: 11px; color: #0a2419;
  background: rgba(240, 198, 116, .9); border-radius: 8px; font-weight: 600;
}

/* ---------- 牌桌 ---------- */
.table-wrap { flex: 1; padding: 6px 12px 0; display: flex; min-height: 0; }
.felt {
  --f1: #3ee08a; --f2: #16a34a; --f3: #0c7a38; --f4: #075226;
  --f-ink: #ffffff;
  --f-ink-2: rgba(255, 255, 255, .66);
  --f-gold: #ffe6a8;
  --f-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  position: relative;
  flex: 1;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 200px / 190px;
  border: 6px solid var(--table-border, #0a0a0a);
  background:
    radial-gradient(ellipse at 50% 45%, var(--f1) 0%, var(--f2) 42%, var(--f3) 78%, var(--f4) 100%);
  box-shadow:
    inset 0 0 70px rgba(0, 0, 0, .28),
    inset 0 0 0 6px rgba(0, 0, 0, .1),
    0 18px 44px rgba(0, 0, 0, .28);
  transition: border-color .25s ease;
}

/* 牌桌内的文字跟随配色明暗自动换墨色 */
.felt .seat-name { color: var(--f-ink); text-shadow: var(--f-shadow); }
.felt .seat-chips { color: var(--f-gold); text-shadow: var(--f-shadow); }
.felt .seat-action { color: var(--f-ink-2); }
.felt .pot strong { color: var(--f-gold); text-shadow: var(--f-shadow); }
.felt .pot-label, .felt .stage-label { color: var(--f-ink-2); }
.felt::after {
  content: "";
  position: absolute; inset: 10px;
  border-radius: 200px / 190px;
  border: 1px solid rgba(240, 198, 116, .16);
  pointer-events: none;
}
.felt-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18%;
}

.pot { text-align: center; }
.pot-label { display: block; font-size: 10px; letter-spacing: 2px; color: rgba(255,255,255,.4); }
.pot strong { font-size: 20px; color: var(--gold); font-variant-numeric: tabular-nums; }

.stage-label { font-size: 10px; letter-spacing: 3px; color: rgba(255,255,255,.35); height: 14px; }

.board { display: flex; gap: clamp(3px, 1vw, 6px); min-height: 54px; align-items: center; }

.card {
  position: relative;
  width: clamp(32px, 8.6vw, 46px);
  height: clamp(46px, 12.4vw, 66px);
  border-radius: 6px;
  background: linear-gradient(160deg, #ffffff, #e8e8ef);
  color: #14161c;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: clamp(14px, 4vw, 19px);
  line-height: 1;
  box-shadow: 0 3px 8px rgba(0,0,0,.4);
}
.card.red { color: #d3324a; }
.card .suit { font-size: .78em; margin-top: 2px; }
.card.back {
  background:
    repeating-linear-gradient(45deg, #1e5f8a 0 4px, #17496b 4px 8px);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.06), 0 3px 8px rgba(0,0,0,.4);
}
.card.empty {
  background: rgba(0, 0, 0, .1);
  border: 1px dashed var(--f-ink-2, rgba(255,255,255,.3));
  box-shadow: none;
}
@keyframes dealIn { from { transform: translateY(-8px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.result-banner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 18px;
  background: rgba(4, 16, 11, .94);
  border: 1px solid rgba(240, 198, 116, .35);
  border-radius: 14px;
  font-size: 13px;
  text-align: center;
  line-height: 1.7;
  box-shadow: 0 16px 40px rgba(0,0,0,.6);
  z-index: 6;
  max-width: 78%;
  pointer-events: none;
}
.result-banner b { color: var(--gold); }

/* ---------- 座位 ---------- */
.seats { position: absolute; inset: 0; pointer-events: none; }

.seat {
  position: absolute;
  width: var(--seat-w);
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: opacity .2s;
  pointer-events: auto;
}
.seat.empty .avatar { opacity: .18; border-style: dashed; }
.seat.folded { opacity: .42; }
.seat.winner .avatar { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(240,198,116,.7); }

.avatar {
  width: clamp(38px, 11vw, 50px);
  height: clamp(38px, 11vw, 50px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(15px, 4.4vw, 19px);
  font-weight: 700;
  color: #06170f;
  background: linear-gradient(150deg, #9fd4b8, #4e9c76);
  border: 1.5px solid rgba(255, 255, 255, .55);
  box-shadow: 0 6px 16px rgba(0,0,0,.28);
  position: relative;
}
.seat.actor .avatar {
  background: linear-gradient(150deg, #ffe1a6, #e5a93f);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,198,116,.55), 0 6px 16px rgba(0,0,0,.45); }
  50% { box-shadow: 0 0 0 7px rgba(240,198,116,0), 0 6px 16px rgba(0,0,0,.45); }
}

.seat-name {
  font-size: clamp(9px, 2.6vw, 11px);
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.seat-chips {
  font-size: clamp(10px, 2.8vw, 12px);
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0,0,0,.8);
}
.seat-cards {
  position: absolute;
  top: calc(-1 * clamp(26px, 7.4vw, 34px));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  z-index: 2;
  pointer-events: none;
}
.seat-cards .card {
  width: clamp(20px, 5.6vw, 27px);
  height: clamp(28px, 7.8vw, 38px);
  font-size: clamp(9px, 2.6vw, 12px);
  border-radius: 4px;
}
.seat-cards .card .suit { font-size: .85em; }

.badges { position: absolute; top: -6px; right: -16px; display: flex; gap: 3px; }
.badge {
  font-size: 9px; font-weight: 700;
  padding: 2px 4px; border-radius: 5px;
  background: #123a29; color: #9fe0bd; border: 1px solid rgba(255,255,255,.14);
}
.badge.allin { background: #7a1f2b; color: #ffd9dd; }

.seat-bet {
  position: absolute;
  font-size: 10px;
  color: #ffe2ab;
  background: rgba(0,0,0,.45);
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
}
.seat-action {
  font-size: 9px;
  color: #b9d3c6;
  min-height: 11px;
  white-space: nowrap;
}
.mine .seat-name { color: var(--gold); }

/* ---------- 底部操作区 ---------- */
.dock {
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, #05120d 30%, rgba(5,18,13,.85) 70%, transparent);
  z-index: 4;
}
.status-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; min-height: 20px; position: relative; }
.my-status { font-size: 11px; color: var(--muted); text-align: center; min-height: 14px; }
.sitout-btn {
  padding: 3px 9px; font-size: 11px; border-radius: 8px;
  background: rgba(255,255,255,.08); color: #cfe3d8;
  border: 1px solid rgba(255,255,255,.12);
}
.sitout-btn.on { background: rgba(240,198,116,.18); color: #f5d79b; border-color: rgba(240,198,116,.45); }
.seat.away { opacity: .5; }
.badge.away { background: #4a3a12; color: #e8c987; }
.my-status strong { color: var(--gold); }

.waiting { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.waiting .btn { width: 100%; max-width: 320px; padding: 13px; }
.waiting-hint { font-size: 11px; color: var(--muted); }

.actions { display: flex; flex-direction: column; gap: 8px; }
.action-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.action-row .btn { padding: 13px 4px; font-size: 14px; white-space: nowrap; }
.actions.locked .action-row .btn { opacity: .45; pointer-events: none; }

.raise-panel {
  background: rgba(4, 16, 11, .92);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  padding: 10px 12px 12px;
}
.raise-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.raise-value { font-size: 20px; font-weight: 700; color: var(--gold); font-variant-numeric: tabular-nums; }
.quick { display: flex; gap: 6px; }
.quick button {
  padding: 5px 9px; font-size: 11px; border-radius: 8px;
  background: rgba(255,255,255,.08); color: #cfe3d8;
}
.raise-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.raise-actions .btn { flex: 1; }

input[type="range"] {
  width: 100%;
  height: 26px;
  -webkit-appearance: none;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #d9a94e 0%, #d9a94e var(--fill, 0%), rgba(255,255,255,.12) var(--fill, 0%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; margin-top: -8px;
  border-radius: 50%;
  background: #f5d79b;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
}

/* ---------- 记录 ---------- */
.log-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: min(78vw, 300px);
  background: rgba(5, 18, 13, .97);
  border-left: 1px solid rgba(255,255,255,.08);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 14px;
  animation: slideIn .2s ease-out;
}
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.log-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
#log-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; font-size: 12px; line-height: 1.9; color: #b9cfc4; }
#log-list li { border-bottom: 1px dashed rgba(255,255,255,.06); padding: 3px 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  padding: 10px 16px;
  background: rgba(20, 20, 24, .95);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  font-size: 13px;
  z-index: 50;
  animation: pop .18s ease-out;
  max-width: 80vw;
  text-align: center;
}
@keyframes pop { from { transform: translate(-50%, 8px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.mini { font-size: 10px; color: var(--muted); }

/* ---------- 顶栏动作 ---------- */
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn.on { background: rgba(79, 201, 138, .22); color: #8ff0bd; }
.chat-badge {
  position: absolute; top: -2px; right: -2px;
  min-width: 16px; height: 16px; line-height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e05a5a; color: #fff;
  font-size: 10px; font-weight: 700; text-align: center;
}
#btn-chat { position: relative; }

/* ---------- 语音条 ---------- */
.voice-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 12px 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(79, 201, 138, .12);
  border: 1px solid rgba(79, 201, 138, .3);
  font-size: 12px; color: #a8e6c6;
}
.voice-bar .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #4fc98a;
  animation: blink 1.6s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.voice-off {
  margin-left: auto;
  padding: 4px 10px; font-size: 11px;
  border-radius: 8px;
  background: rgba(224, 90, 90, .2); color: #ff9a9a;
}
.avatar.speaking { box-shadow: 0 0 0 3px #4fc98a, 0 0 16px rgba(79,201,138,.7) !important; }
.badge.voice { background: #10402c; color: #7fe3ad; }

/* ---------- 聊天抽屉 ---------- */
.chat-panel {
  position: fixed;
  right: 0; left: 0; bottom: 0;
  height: min(62vh, 460px);
  background: rgba(6, 20, 15, .98);
  border-top: 1px solid rgba(240, 198, 116, .18);
  border-radius: 18px 18px 0 0;
  z-index: 30;
  display: flex; flex-direction: column;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  animation: sheetUp .2s ease-out;
  box-shadow: 0 -12px 40px rgba(0,0,0,.6);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.chat-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); padding: 2px 4px 8px; }
.chat-list {
  list-style: none; margin: 0; padding: 0 2px;
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px;
}
.chat-list li { line-height: 1.5; word-break: break-word; }
.chat-list .who { color: #9fd4b8; font-size: 11px; margin-right: 5px; }
.chat-list li.emoji-only { font-size: 26px; }
.chat-list .sys { color: #6f8a7e; font-size: 11px; }
.chat-input-row { display: flex; gap: 8px; align-items: center; padding-top: 8px; }
.chat-input-row input {
  flex: 1; padding: 10px 12px; font-size: 14px;
  color: var(--ink); background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1); border-radius: 10px; outline: none;
}
.chat-input-row input:focus { border-color: var(--gold-dim); }
.emoji-btn, .send-btn {
  height: 38px; padding: 0 12px; border-radius: 10px;
  font-size: 13px; background: rgba(255,255,255,.08); color: #cfe3d8;
}
.send-btn { background: linear-gradient(160deg, #f7d99b, #d9a94e); color: #22180a; font-weight: 600; }
.emoji-panel {
  display: grid; grid-template-columns: repeat(8, 1fr);
  gap: 2px; padding: 6px 0 2px;
  max-height: 120px; overflow-y: auto;
}
.emoji-panel button { font-size: 20px; padding: 4px 0; border-radius: 8px; }
.emoji-panel button:active { background: rgba(255,255,255,.12); }

/* ---------- 飘表情 ---------- */
.float-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 8; }
.fu {
  position: absolute;
  font-size: 30px;
  transform: translate(-50%, -50%);
  animation: floatUp 2.2s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes floatUp {
  0% { transform: translate(-50%, -50%) scale(.6); opacity: 0; }
  15% { transform: translate(-50%, -90%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -260%) scale(1); opacity: 0; }
}


/* ---------- 回合计时条 ---------- */
.turn-bar {
  height: 3px;
  margin: 0 12px;
  border-radius: 2px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
  flex: 0 0 auto;
}
.turn-bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #68d6a4, #f0c674);
  transition: width .18s linear, background .3s;
}
.turn-bar.low i { background: linear-gradient(90deg, #ffb020, #e05a5a); }

.seat .timer {
  position: absolute;
  right: -4px; bottom: -4px;
  min-width: 18px; height: 18px; line-height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #f0c674; color: #22180a;
  font-size: 10px; font-weight: 700; text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
}
.seat .timer.low { background: #e05a5a; color: #fff; }

/* ---------- 准备 ---------- */
.waiting-actions { display: flex; gap: 8px; width: 100%; max-width: 320px; }
.waiting-actions .btn { flex: 1; padding: 13px 8px; }
#btn-ready.on {
  background: linear-gradient(160deg, #68d6a4, #2f9c6e);
  color: #042114;
  border-color: transparent;
}
.badge.ready { background: #123a29; color: #8ff0bd; }
.seat.ready .avatar { box-shadow: 0 0 0 2px #4fc98a, 0 6px 16px rgba(0,0,0,.45); }


/* ---------- 牌桌配色（14 套） ---------- */
/* 每组：四段渐变 + 文字墨色 + 筹码金色，亮色系 */
[data-felt="green"]    { --f1: #3ee08a; --f2: #16a34a; --f3: #0c7a38; --f4: #075226; }
[data-felt="forest"]   { --f1: #4fe3b0; --f2: #0f9e78; --f3: #0a7055; --f4: #054536; }
[data-felt="ocean"]    { --f1: #4db8ff; --f2: #1285d8; --f3: #0a5c9e; --f4: #063a66; }
[data-felt="midnight"] { --f1: #6f8bff; --f2: #3355e6; --f3: #2238a8; --f4: #131f60; }
[data-felt="wine"]     { --f1: #ff7fa0; --f2: #e0235c; --f3: #a3123f; --f4: #5e0a24; }
[data-felt="plum"]     { --f1: #c79bff; --f2: #8b5cf6; --f3: #6a34d6; --f4: #3d1785; }
[data-felt="teal"]     { --f1: #6fe9e0; --f2: #0fb5a6; --f3: #0a857c; --f4: #055049;
                         --f-ink: #05322c; --f-ink-2: rgba(5, 50, 44, .62); --f-gold: #0a6b5e; --f-shadow: 0 1px 1px rgba(255,255,255,.45); }
[data-felt="charcoal"] { --f1: #cfe3f5; --f2: #7fa8cc; --f3: #4a7099; --f4: #2b4660;
                         --f-ink: #0f2030; --f-ink-2: rgba(15, 32, 48, .6); --f-gold: #1f4a6b; --f-shadow: 0 1px 1px rgba(255,255,255,.4); }
[data-felt="crimson"]  { --f1: #ff9a8b; --f2: #ef4444; --f3: #b91c1c; --f4: #6f0f0f; }
[data-felt="sunset"]   { --f1: #ffc06b; --f2: #f97316; --f3: #c2410c; --f4: #7c2d12; }
[data-felt="rose"]     { --f1: #ffb3d1; --f2: #f0559b; --f3: #c93179; --f4: #8f1c52; }
[data-felt="sand"]     { --f1: #ffe08a; --f2: #f5b400; --f3: #d18a00; --f4: #9c6400;
                         --f-ink: #3a2600; --f-ink-2: rgba(58, 38, 0, .6); --f-gold: #7a4f00; --f-shadow: 0 1px 1px rgba(255,255,255,.45); }
[data-felt="steel"]    { --f1: #bfe4ff; --f2: #6db3e8; --f3: #3d86c4; --f4: #22567f;
                         --f-ink: #0b2438; --f-ink-2: rgba(11, 36, 56, .6); --f-gold: #14527f; --f-shadow: 0 1px 1px rgba(255,255,255,.4); }
[data-felt="lime"]     { --f1: #dcf98a; --f2: #a3d92a; --f3: #7ab00f; --f4: #4f7a06;
                         --f-ink: #25360a; --f-ink-2: rgba(37, 54, 10, .6); --f-gold: #3f5c05; --f-shadow: 0 1px 1px rgba(255,255,255,.4); }

.felt-btn { }
.felt-panel {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-height: 62vh;
  overflow-y: auto;
  background: rgba(6, 20, 15, .98);
  border-top: 1px solid rgba(240, 198, 116, .22);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -14px 44px rgba(0, 0, 0, .62);
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
  z-index: 31;
  animation: sheetUp .2s ease-out;
}
.felt-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 6px 2px 2px;
}
.felt-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.felt-swatch i {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 38%, var(--f1) 0%, var(--f2) 58%, var(--f3) 100%);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), 0 4px 10px rgba(0, 0, 0, .35);
  transition: transform .12s, border-color .15s;
}
.felt-swatch:active i { transform: scale(.94); }
.felt-swatch.on i {
  border-color: #f0c674;
  box-shadow: 0 0 0 3px rgba(240, 198, 116, .22), inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.felt-swatch span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.felt-swatch.on span { color: var(--gold); }

/* ---------- 白天 / 黑夜 ---------- */
body { --table-border: #0a0a0a; }
body[data-mode="day"] {
  --table-border: #ffffff;
  background: #e6eef5;
  color: #16232b;
}
body[data-mode="day"] .topbar { background: linear-gradient(180deg, rgba(255, 255, 255, .92), transparent); }
body[data-mode="day"] .icon-btn {
  background: rgba(255, 255, 255, .92);
  color: #35505f;
  box-shadow: 0 2px 8px rgba(20, 40, 60, .12);
}
body[data-mode="day"] .room-badge { color: #5f7480; }
body[data-mode="day"] .room-badge strong { color: #a86a12; }
body[data-mode="day"] .copy-btn { background: #f0b95c; color: #3a2600; }
body[data-mode="day"] .dock {
  background: linear-gradient(0deg, #e6eef5 32%, rgba(230, 238, 245, .88) 72%, transparent);
}
body[data-mode="day"] .my-status { color: #5f7480; }
body[data-mode="day"] .my-status strong { color: #a86a12; }
body[data-mode="day"] .sitout-btn {
  background: rgba(255, 255, 255, .95);
  color: #2f4a5a;
  border-color: rgba(20, 40, 60, .14);
}
body[data-mode="day"] .sitout-btn.on { background: rgba(240, 185, 92, .32); color: #7a4c00; border-color: rgba(200, 140, 30, .5); }
body[data-mode="day"] #room .btn.ghost {
  background: rgba(255, 255, 255, .95);
  color: #2a4352;
  border-color: rgba(20, 40, 60, .14);
}
body[data-mode="day"] .action-row .btn.ghost { color: #2a4352; }
body[data-mode="day"] .raise-panel {
  background: rgba(255, 255, 255, .97);
  border-color: rgba(20, 40, 60, .12);
  box-shadow: 0 -10px 30px rgba(20, 40, 60, .12);
}
body[data-mode="day"] .raise-panel .quick button { background: rgba(20, 40, 60, .07); color: #35505f; }
body[data-mode="day"] .raise-value { color: #a86a12; }
body[data-mode="day"] .turn-bar { background: rgba(20, 40, 60, .14); }
body[data-mode="day"] .chat-panel,
body[data-mode="day"] .felt-panel,
body[data-mode="day"] .log-panel {
  background: #ffffff;
  border-color: rgba(20, 40, 60, .12);
  box-shadow: 0 -14px 40px rgba(20, 40, 60, .16);
}
body[data-mode="day"] .chat-head,
body[data-mode="day"] .log-head { color: #5f7480; }
body[data-mode="day"] .chat-list { color: #22333d; }
body[data-mode="day"] .chat-list .who { color: #2c8a63; }
body[data-mode="day"] .chat-input-row input {
  background: #f2f6f9;
  color: #16232b;
  border-color: rgba(20, 40, 60, .14);
}
body[data-mode="day"] .emoji-panel button:active { background: rgba(20, 40, 60, .08); }
body[data-mode="day"] #log-list { color: #37505e; }
body[data-mode="day"] #log-list li { border-bottom-color: rgba(20, 40, 60, .08); }
body[data-mode="day"] .waiting-hint { color: #5f7480; }
body[data-mode="day"] .felt-swatch span { color: #5f7480; }
body[data-mode="day"] .felt-swatch.on span { color: #a86a12; }
body[data-mode="day"] .toast {
  background: rgba(255, 255, 255, .98);
  color: #16232b;
  border-color: rgba(20, 40, 60, .12);
}
body[data-mode="day"] .voice-bar {
  background: rgba(79, 201, 138, .16);
  color: #1d6b47;
}
body[data-mode="day"] .result-banner {
  background: rgba(255, 255, 255, .96);
  color: #16232b;
  border-color: rgba(200, 140, 30, .45);
}
body[data-mode="day"] .icon-btn.on { background: rgba(79, 201, 138, .3); color: #14663f; }

@media (max-height: 700px) {
  .chat-panel { height: min(70vh, 420px); }
}

@media (max-height: 640px) {
  .felt-inner { gap: 6px; }
  .stage-label { display: none; }
}
