:root {
  --bg: #0f3d2e;
  --felt: #145a40;
  --panel: rgba(0, 0, 0, 0.25);
  --text: #f4f1e8;
  --muted: #b9c9bf;
  --accent: #f2c14e;
  --danger: #e05a4f;
  --ok: #4fbf7a;
  --card: #fffdf7;
  --red: #c8312b;
  --black: #1d1d1f;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  background: radial-gradient(circle at 50% 0%, var(--felt), var(--bg) 70%) fixed;
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
h1 { font-size: 28px; margin: 8px 0 4px; }
h2 { font-size: 18px; margin: 0 0 8px; }
p.sub { color: var(--muted); margin: 0 0 20px; }
.panel { background: var(--panel); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
label { display: block; color: var(--muted); font-size: 14px; margin-bottom: 6px; }
input {
  width: 100%; font-size: 18px; padding: 12px; border-radius: 10px; border: 0;
  background: rgba(255,255,255,0.92); color: #111;
}
button {
  font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 16px;
  background: rgba(255,255,255,0.14); color: var(--text); cursor: pointer;
}
button:disabled { opacity: 0.4; }
button.primary { background: var(--accent); color: #2a2100; }
button.danger { background: var(--danger); color: #fff; }
button.ok { background: var(--ok); color: #fff; }
button.big { width: 100%; font-size: 18px; padding: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }
.seg { display: flex; background: rgba(0,0,0,0.25); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 8px; background: transparent; font-weight: 500; }
.seg button.on { background: var(--accent); color: #2a2100; font-weight: 700; }
.game-card { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); font-size: 14px; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 8px; }
.code { font-size: 22px; font-weight: 800; letter-spacing: 4px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 8px; margin-left: 4px; font-weight: 700; vertical-align: 2px; }
.badge.banker { background: var(--accent); color: #2a2100; }
.badge.host { background: rgba(255,255,255,0.2); }
.badge.off { background: var(--danger); }

.seat { padding: 10px 12px; border-radius: 12px; margin-bottom: 8px; background: rgba(0,0,0,0.18); border: 2px solid transparent; }
.seat.turn { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242,193,78,0.25); }
.seat.me { background: rgba(255,255,255,0.08); }
.seat .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.seat .name { font-weight: 700; }
.seat .score { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; white-space: nowrap; }
.seat .status { font-size: 14px; color: var(--muted); margin-top: 4px; min-height: 1em; }
.seat.pickable { cursor: pointer; }

.cards { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.pc {
  width: 46px; height: 64px; border-radius: 7px; background: var(--card); color: var(--black);
  display: flex; flex-direction: column; justify-content: space-between; padding: 4px 5px;
  font-weight: 800; box-shadow: 0 2px 4px rgba(0,0,0,0.35); font-size: 16px; line-height: 1;
}
.pc.red { color: var(--red); }
.pc .s { align-self: flex-end; font-size: 18px; }
.pc.back { background: repeating-linear-gradient(45deg, #8b2b2b 0 6px, #a63a3a 6px 12px); border: 3px solid var(--card); }
.pc.mine-hidden { outline: 2px dashed var(--accent); outline-offset: 2px; }

.actions { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }
.bets { display: flex; gap: 8px; }
.bets button { flex: 1; font-size: 20px; }
.timer { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal .box { background: #1c4a38; border-radius: 16px; padding: 20px; width: 100%; max-width: 420px; text-align: center; }
.modal .box h2 { font-size: 20px; }

.result { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.win { color: var(--ok); font-weight: 700; }
.lose { color: var(--danger); font-weight: 700; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(0,0,0,0.85); padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; text-align: center;
}
.share-tip { position: fixed; top: 8px; right: 12px; z-index: 30; text-align: right; font-size: 18px; font-weight: 700; }

/* ---------- scoreboard ---------- */
.board { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board td { padding: 7px 4px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.board td.rank { width: 28px; font-weight: 800; color: var(--accent); }
.board td.num { text-align: right; white-space: nowrap; }
.board tr.me td { background: rgba(255,255,255,0.06); }
.seat.busted { border-color: var(--danger); }
.bust-tag { display: inline-block; background: var(--danger); color: #fff; font-weight: 800; padding: 0 8px; border-radius: 6px; transform: rotate(-6deg); margin-left: 6px; }

/* ---------- full-screen effects ---------- */
.fx { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 16px; animation: fx-in .2s ease-out; }
.fx-out { opacity: 0; transition: opacity .25s; }
.fx-light { background: rgba(0,0,0,0.45); }
.fx-flash-red { background: rgba(120,0,0,0.75); animation: fx-in .2s ease-out, fx-flash .5s 2; }
.fx-flash-amber { background: rgba(110,60,0,0.82); animation: fx-in .2s ease-out, fx-flash .6s 3; }
.fx-card { position: relative; z-index: 2; text-align: center; }
.fx-huge { font-size: 76px; font-weight: 900; line-height: 1.1; color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 0 30px rgba(255,200,60,0.6); }
.fx-big { font-size: 64px; font-weight: 900; line-height: 1.1; text-shadow: 0 4px 0 rgba(0,0,0,0.35); }
.fx-mid { font-size: 36px; font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,0.35); }
.fx-label { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.fx-sub { font-size: 16px; color: rgba(255,255,255,0.8); margin-top: 10px; }
.fx-mugs { font-size: 44px; margin-top: 8px; }
.fx-red { color: #ff5a4f; }
.fx-green { color: #6ee59a; }
.fx-shake { animation: fx-zoom .35s cubic-bezier(.2,1.6,.4,1), fx-shake .5s .35s 2; }
.fx-pop { animation: fx-zoom .35s cubic-bezier(.2,1.6,.4,1); }
.fx-drop { position: absolute; top: -60px; z-index: 1; animation: fx-fall 2.2s linear forwards; pointer-events: none; }
@keyframes fx-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fx-flash { 50% { filter: brightness(1.8); } }
@keyframes fx-zoom { from { transform: scale(0.2) rotate(-12deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes fx-shake { 0%,100% { transform: translateX(0) rotate(0); } 20% { transform: translateX(-14px) rotate(-4deg); } 40% { transform: translateX(12px) rotate(3deg); } 60% { transform: translateX(-8px) rotate(-2deg); } 80% { transform: translateX(6px) rotate(1deg); } }
@keyframes fx-fall { to { transform: translateY(115vh) rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .fx, .fx * { animation: none !important; } }
