/* ================= 基础 ================= */
:root {
  --bg: #07120f;
  --bg-2: #0d1d18;
  --panel: #10231d;
  --panel-2: #16302a;
  --line: #24443a;
  --text: #eaf2ee;
  --muted: #8fa79c;
  --gold: #e8c07a;
  --gold-2: #c69a4e;
  --green: #35c88a;
  --red: #e2564d;
  --blue: #57a8ff;
  --radius: 12px;
  --shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  --card-w: 46px;
  --card-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: radial-gradient(120% 90% at 50% 0%, #10261f 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }
.hidden { display: none !important; }

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.screen.is-active { display: flex; }

/* ================= 通用组件 ================= */
.btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  user-select: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #1d3b33; border-color: #33604f; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .3; cursor: not-allowed; filter: grayscale(.85); }
.btn-primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-2) 100%);
  border-color: #a9803a;
  color: #22190a;
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #f2cf8f 0%, #d0a659 100%); }
.btn-danger { background: #4a1f1c; border-color: #7a332d; color: #ffbdb7; }
.btn-danger:hover:not(:disabled) { background: #5c2622; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; padding: 13px; font-size: 16px; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

/* 所有文本类输入框统一深色样式。
   用 :where() 把这条规则的选择器优先级降到最低（等于只有 input），
   否则 width:100% 会把 .type-mult 这类「指定了宽度」的输入框也撑满，把旁边的文字挤没。
   之前只写了 input[type="text"]，密码框没被匹配到就露成白底黑字。 */
input:where(
  [type="text"],
  [type="password"],
  [type="number"],
  [type="search"],
  [type="tel"],
  [type="email"],
  [type="url"]
) {
  background: #0a1714;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  width: 100%;
  color: var(--text);
  transition: border-color .18s, box-shadow .18s;
}
input:where([type="text"], [type="password"], [type="number"], [type="search"], [type="tel"])::placeholder {
  color: #5f7a70;
}
input:where([type="text"], [type="password"], [type="number"], [type="search"], [type="tel"]):focus {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(232, 192, 122, .16);
}
/* 数字输入框去掉上下箭头，和整体风格统一 */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* 浏览器自动填充会强行刷成黄白底，这里盖回来 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #0a1714 inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}

.panel {
  background: linear-gradient(180deg, rgba(22, 48, 42, .75), rgba(10, 24, 20, .78));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--gold);
}
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(232, 192, 122, .14);
  border: 1px solid rgba(232, 192, 122, .3);
  color: var(--gold);
  font-size: 12px;
  white-space: nowrap;
}
/* 顶栏常驻的局数进度，比其它 pill 更亮一点 */
.pill-progress {
  background: rgba(232, 192, 122, .22);
  border-color: rgba(232, 192, 122, .55);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pill-progress:empty { display: none; }
.pill-phase { background: rgba(87, 168, 255, .14); border-color: rgba(87, 168, 255, .32); color: #9ecbff; }
.conn-badge { font-size: 12px; color: var(--muted); white-space: nowrap; }
.conn-badge.is-off { color: var(--red); }
.conn-badge.is-on { color: var(--green); }

/* 手机上顶栏东西太多，先统一瘦身：藏游戏名、按钮改短标签 */
@media (max-width: 560px) {
  #room-game { display: none; }
  .room-title b { max-width: 26vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 小屏顶栏放不下：复制链接侧栏里也有，直接收起来；喊话只留一个图标 */
  #btn-invite { display: none; }
  #btn-shout { font-size: 0; padding: 4px 7px; line-height: 1; }
  #btn-shout::before { content: '📢'; font-size: 15px; line-height: 1; }
}

/* 小屏（≤420px）：顶栏与操作区再压一压，避免换行把牌桌挤扁 */
@media (max-width: 420px) {
  .topbar { padding: 7px 8px; padding-top: calc(7px + env(safe-area-inset-top, 0px)); gap: 6px; }
  .topbar-left, .topbar-right { gap: 5px; }
  .topbar .btn-sm { padding: 5px 8px; font-size: 12px; }
  .room-title { gap: 5px; }
  .room-title b { font-size: 13px; max-width: 20vw; }
  .room-code { font-size: 11px; }
  .pill { padding: 2px 7px; font-size: 11px; }
  /* 连接状态只留一个圆点，省出横向空间 */
  .conn-badge { font-size: 0; }
  .conn-badge::before { content: '●'; font-size: 11px; }
  .controls { padding: 7px 6px calc(7px + var(--safe-b)); gap: 6px; min-height: 54px; }
  .controls .btn { padding: 8px 10px; font-size: 13px; border-radius: 9px; }
  .controls .btn-sm { padding: 5px 8px; font-size: 12px; }
  .ctrl-note { font-size: 12px; }
}

/* 短标签必须放在最后：否则会被上面的 .topbar .btn-sm 规则盖掉（特异性更高） */
@media (max-width: 560px) {
  .topbar #btn-invite { font-size: 0; padding: 5px 8px; }
  .topbar #btn-invite::after { content: '邀请'; font-size: 12px; }
  .topbar .side-toggle { font-size: 0; padding: 5px 8px; }
  .topbar .side-toggle::after { content: '记录'; font-size: 12px; }
  .room-code { font-size: 11px; }
  .pill { padding: 2px 7px; font-size: 11px; }
  .room-topbar { gap: 4px; }
  /* 房间名让位给号和局数，连接状态缩成一个圆点 */
  .room-title b { display: none; }
  .conn-badge { font-size: 0; }
  .conn-badge::before { content: '●'; font-size: 11px; }
  .topbar #btn-leave { padding: 5px 8px; font-size: 12px; }
}

.toasts {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: 92vw;
}
.toast {
  background: rgba(18, 40, 34, .96);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  padding: 9px 15px;
  border-radius: 9px;
  box-shadow: var(--shadow);
  animation: toastIn .18s ease;
  font-size: 14px;
}
.toast.is-error { border-left-color: var(--red); }
.toast.is-ok { border-left-color: var(--green); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ================= 登录 ================= */
#screen-login { align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(24, 52, 45, .9), rgba(9, 22, 18, .94));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.logo { font-size: 30px; letter-spacing: 6px; margin-bottom: 6px; }
.logo-suit.s0, .logo-suit.s2 { color: #dfe9e4; }
.logo-suit.s1, .logo-suit.s3 { color: var(--red); }
.login-card h1 { margin: 0; font-size: 30px; letter-spacing: .3em; font-weight: 800; }
.login-card .sub { color: var(--muted); margin: 8px 0 22px; font-size: 13px; }
.field { display: block; text-align: left; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12px; margin: 14px 0 0; line-height: 1.6; }
.status { color: var(--gold); font-size: 13px; min-height: 18px; margin: 8px 0 0; }

/* ================= 顶栏 ================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--line);
  background: rgba(8, 20, 17, .92);
  backdrop-filter: blur(8px);
  flex: 0 0 auto;
  z-index: 20;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand { font-weight: 800; letter-spacing: .1em; color: var(--gold); }
.me-badge.is-out { border-color: rgba(255, 123, 112, .55); color: #ff9a90; }
.me-badge { font-size: 13px; color: var(--muted); }
.room-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.room-title b { font-size: 15px; }
.room-code { color: var(--muted); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
@media (max-width: 560px) { .room-title b { max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }

/* ================= 大厅 ================= */
.lobby-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 360px) minmax(280px, 1fr);
  grid-template-areas: "create list" "rules rules";
  align-content: start;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
}
.create-panel { grid-area: create; }
.list-panel { grid-area: list; }
.rules-panel { grid-area: rules; }
@media (max-width: 820px) {
  .lobby-body { grid-template-columns: 1fr; grid-template-areas: "create" "list" "rules"; padding: 12px; }
}

.game-picker { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #17332c, #0d211c);
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.game-card:hover { border-color: var(--gold-2); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.game-emoji { font-size: 30px; line-height: 1; }
.game-name { font-weight: 700; }
.game-desc { font-size: 11px; color: var(--muted); text-align: center; }

#create-options { margin-top: 14px; }
#create-options summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 6px 0; }
.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 8px 0 4px; }
.config-grid label { font-size: 12px; color: var(--muted); display: block; }
.config-grid input, .config-grid select {
  width: 100%; margin-top: 3px; background: #0a1714; border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font-size: 13px;
}

.join-row { display: flex; gap: 8px; margin-top: 14px; }
.join-row input { flex: 1; }

/* 不再限高、也不做内部滚动：外层 .lobby-body 本来就能滚，
   限高只会让房间一多就「看不全」。改成自适应多列，房间多也铺得开。 */
.room-list {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.room-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; border-radius: 11px;
  background: rgba(9, 22, 18, .72); border: 1px solid var(--line);
  cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
  /* 整行是 <button>，把浏览器默认样式压掉 */
  width: 100%; text-align: left; font: inherit; color: inherit;
}
.room-item:hover { border-color: var(--gold-2); background: rgba(20, 44, 37, .8); }
.room-item:active { transform: scale(.99); }
.room-item .ri-code { font-size: 11px; font-variant-numeric: tabular-nums; }
.room-item .ri-main { flex: 1; min-width: 0; }
.room-item .ri-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-item .ri-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.room-item .ri-tag { font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 22px 0; font-size: 13px; }

.rules { color: #cddbd4; }
.rules h3 { color: var(--gold); font-size: 14px; margin: 14px 0 6px; }
.rules h3:first-child { margin-top: 0; }
.rules ul { margin: 0; padding-left: 20px; }
.rules li { margin: 5px 0; font-size: 13px; line-height: 1.65; }
.rules code { background: rgba(232, 192, 122, .12); color: var(--gold); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ================= 房间布局 ================= */
.room-body { flex: 1; display: flex; min-height: 0; }
.table-column { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.table-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.felt {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  transform: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background:
    radial-gradient(120% 86% at 50% 44%, rgba(38, 128, 96, .55) 0%, rgba(16, 64, 47, .6) 46%, rgba(6, 20, 15, .9) 100%),
    radial-gradient(60% 40% at 50% 50%, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0) 70%),
    linear-gradient(180deg, #071813 0%, #06120e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
/* 中央一枚淡淡的水印，背景不至于太空 */
.felt::after {
  content: '♠';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: min(46vh, 320px);
  color: rgba(255, 255, 255, .028);
  pointer-events: none;
  line-height: 1;
  z-index: 0;
}
.felt-inner { display: flex; align-items: center; justify-content: center; }

.seat-layer { position: absolute; inset: 0; pointer-events: none; }
.seat { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; }
/* 横排/两列时外侧边贴座位点，牌朝桌心伸出去。
   left:4px / right:4px 已经把外侧边贴住了，所以这里只做垂直居中。 */
.seat.anchor-l,
.seat.anchor-r { transform: translate(0, -50%); }
/* 两列布局里本人的座位：最底部居中 */
.seat.anchor-self { transform: translate(-50%, 0); }
.table-wrap.is-cols .seat.anchor-self .seat-main { flex-direction: row; }
.table-wrap.is-cols .seat.anchor-self .seat-tag { justify-content: center; }

/* 两列布局：桌子中间会被牌盖住，把中央信息收掉，阶段信息挪到底部提示里 */
.table-wrap.is-cols .center-layer { display: none; }
.table-wrap.is-cols .seat-tag { justify-content: flex-start; }
.table-wrap.is-cols .seat { padding: 2px 3px 3px; }

.center-layer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  z-index: 3;
}
.bull-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.center-hint-main {
  font-size: 30px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: .06em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
  line-height: 1.1;
}
.center-hint-main:empty { display: none; }
.center-hint-main.is-draw-title {
  font-size: 22px;
  animation: drawPulse .6s ease-in-out infinite;
}
@keyframes drawPulse { 50% { opacity: .4; } }

/* 搓牌：自己的 5 张牌从中间向两侧翻开 */
.seat-cards.is-rub .card { animation: rubIn .42s cubic-bezier(.2, .8, .3, 1) both; }
.seat-cards.is-rub .card:nth-child(2) { animation-delay: .06s; }
.seat-cards.is-rub .card:nth-child(3) { animation-delay: .12s; }
.seat-cards.is-rub .card:nth-child(4) { animation-delay: .18s; }
.seat-cards.is-rub .card:nth-child(5) { animation-delay: .24s; }
@keyframes rubIn {
  from { clip-path: inset(0 50% 0 50%); transform: scale(.96); }
  to { clip-path: inset(0 0 0 0); transform: scale(1); }
}

.pot-badge.is-hand { background: rgba(232, 192, 122, .18); }
.center-row { display: flex; gap: 6px; align-items: center; justify-content: center; min-height: calc(var(--card-h) + 4px); }
.pot-badge {
  background: rgba(6, 16, 13, .78);
  border: 1px solid var(--gold-2);
  color: var(--gold);
  border-radius: 999px;
  padding: 5px 16px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .03em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.center-hint { color: #b9d3c8; font-size: 12px; text-shadow: 0 1px 3px #000; }

/* ================= 卡牌 ================= */
.card {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 6px;
  background: linear-gradient(160deg, #ffffff 0%, #eef3f0 100%);
  color: #17211d;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: dealIn .22s ease;
  user-select: none;
  border: 1px solid rgba(0, 0, 0, .18);
}
.card.is-small { width: calc(var(--card-w) * .78); height: calc(var(--card-h) * .78); }
.card.is-red { color: #cf2f2f; }
.card-rank { font-weight: 800; font-size: calc(var(--card-w) * .46); line-height: 1; }
.card-suit { font-size: calc(var(--card-w) * .42); line-height: 1.1; }
.card.is-small .card-rank { font-size: calc(var(--card-w) * .38); }
.card.is-small .card-suit { font-size: calc(var(--card-w) * .34); }
.card.is-highlight { box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(232, 192, 122, .8); }
.card.is-dim { opacity: .45; filter: grayscale(.5); }

/* 牌很小时（9 人桌 / 窄屏）改成「突出点数」的迷你牌面，保证还看得清 */
.table-wrap.is-mini .card-back .back-pattern { font-size: calc(var(--card-w) * 0.42); }
.table-wrap.is-mini .joker-mark { font-size: calc(var(--card-w) * 0.4); }

.card-back {
  background: repeating-linear-gradient(45deg, #1c3f6e 0 5px, #16325a 5px 10px);
  border: 1px solid #4b7bbd;
  color: rgba(255, 255, 255, .3);
  align-items: center;
  justify-content: center;
}
.back-pattern { font-size: calc(var(--card-w) * .5); }
@keyframes dealIn { from { opacity: 0; transform: translateY(-14px) rotate(-6deg); } }

/* ================= 座位：名字+积分一个小框，下面放牌 ================= */
.seat {
  width: max-content;
  /* min-width 会盖过 max-width，所以这里必须放开，否则窄屏座位撑开会互相重叠 */
  min-width: 0;
  max-width: var(--seat-max-w, 140px);
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px 4px 4px;
  border-radius: 11px;
  background: rgba(4, 12, 10, .34);
  cursor: pointer;
}
/* 小框框：昵称在上、积分在下 —— 宽度取两者最大值，窄屏也能看清名字 */
.seat-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 100%;
  padding: 2px 8px 3px;
  border-radius: 12px;
  background: rgba(6, 18, 14, .92);
  border: 1.5px solid var(--line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
  transition: border-color .18s, box-shadow .18s;
}
.seat-role { display: flex; gap: 3px; flex: 0 0 auto; }
.seat-role:empty { display: none; }
.seat-tag .badge { font-size: 9px; padding: 0 4px; line-height: 13px; }
.seat-nick {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 76px;
  min-width: 0;
}
.seat-chips {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.seat.is-me .seat-bar { border-color: rgba(232, 192, 122, .65); }
/* 座位很挤时（13 人桌 / 小屏）字号与留白一起缩，保证名字和积分都还看得见 */
.table-wrap.is-tight-seat .seat { padding: 2px 2px 3px; gap: 2px; }
.table-wrap.is-tight-seat .seat-bar { padding: 1px 4px 2px; border-width: 1px; }
.table-wrap.is-tight-seat .seat-nick { font-size: 10px; max-width: 58px; }
.table-wrap.is-tight-seat .seat-chips { font-size: 10px; max-width: 58px; }
.table-wrap.is-tight-seat .seat-tag { font-size: 9px; min-height: 11px; gap: 2px; }
.table-wrap.is-tight-seat .seat-tag .badge { font-size: 7px; line-height: 10px; padding: 0 2px; }
.seat.is-turn .seat-bar {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(232, 192, 122, .4), 0 0 18px rgba(232, 192, 122, .55);
  animation: turnPulse 1.1s ease-in-out infinite;
}
@keyframes turnPulse { 50% { box-shadow: 0 0 0 3px rgba(232, 192, 122, .55), 0 0 24px rgba(232, 192, 122, .8); } }
.seat.is-draw .seat-bar {
  border-color: var(--gold);
  background: rgba(58, 46, 12, .96);
  box-shadow: 0 0 0 3px rgba(232, 192, 122, .7), 0 0 30px rgba(232, 192, 122, .95);
  animation: drawFlash .34s steps(2, end) infinite;
}
@keyframes drawFlash {
  50% { transform: scale(1.1); }
}
.seat.is-draw { z-index: 70 !important; }
.seat.is-folded { opacity: .4; }
.seat.is-offline { filter: grayscale(.6); }
.seat.is-banker .seat-bar { border-color: var(--red); box-shadow: 0 0 0 2px rgba(226, 86, 77, .3); }

/* 牌型大字：配色 + 描边，照参考图的做法，但放在牌下面那行以免挡住牌面 */
.handlabel {
  font-weight: 900;
  letter-spacing: .04em;
  transform: rotate(-4deg);
  color: #fff;
  -webkit-text-stroke: 2.5px rgba(0, 0, 0, .8);
  paint-order: stroke fill;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .7);
  font-size: 15px;
}
.handlabel.t-niu { color: #6fe3ff; }
.handlabel.t-nuclear { color: #ff7ae0; }
.handlabel.t-straightflush { color: #ff9d5c; }
.handlabel.t-fivesmall { color: #7ef0d0; }
.handlabel.t-bomb { color: #ffb14d; }
.handlabel.t-gourd { color: #ffe066; }
.handlabel.t-flush { color: #7fb6ff; }
.handlabel.t-straight { color: #9fd0ff; }
.handlabel.t-fiveflower { color: #ffd479; }
.handlabel.t-foursmall { color: #8fe6c0; }
.handlabel.t-fourflower { color: #a8e6a1; }
.handlabel.t-plain { color: #d8f3e8; }
.handlabel.t-none { color: #b9c7c0; }
.table-wrap.is-tight-seat .handlabel { font-size: 11px; -webkit-text-stroke-width: 1.5px; }

/* 座位里的牌：并排的窄牌，每张都完整可见（不做重叠） */
.seat-cards-wrap { position: relative; display: flex; justify-content: center; }
/* 还没发牌时不要留一个空框出来 */
.seat-cards:empty { min-height: 0; }
.seat-cards-wrap:has(.seat-cards:empty) { display: none; }
.seat-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  max-width: 100%;
}
/* 横排：名字框在外侧、牌朝桌心伸出去 —— 座位变扁，10 人桌也能给牌更大空间 */
.table-wrap.is-hseat .seat-main {
  flex-direction: row;
  align-items: center;
  gap: 5px;
}
.table-wrap.is-hseat .seat.is-flip .seat-main { flex-direction: row-reverse; }
.table-wrap.is-hseat .seat-tag { justify-content: flex-start; }
.seat-cards {
  display: flex;
  justify-content: center;
  gap: 2px;
  min-height: calc(var(--tile-h, 30px) + 1px);
  --card-w: var(--tile-w, 20px);
  --card-h: var(--tile-h, 30px);
}
.seat-cards .card,
.seat-cards .card.is-small {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 4px;
  margin-left: 0;
  animation: none;
}
/* 窄牌把点数放到最大，花色小一号：并排也不遮挡 */
.seat-cards .card-rank { font-size: calc(var(--card-w) * 0.80); line-height: 1; }
.seat-cards .card-suit { font-size: calc(var(--card-w) * 0.50); line-height: 1; margin-top: 1px; }
.seat-cards .joker-vertical { display: none; }
.seat-cards .joker-tag { display: none; }
/* 轮到自己开牌时，暗牌做成明显可点的样子 */
.seat-cards.can-flip .card-back {
  cursor: pointer;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(232, 192, 122, .55), 0 0 16px rgba(232, 192, 122, .75);
  animation: flipHint 1.2s ease-in-out infinite;
  touch-action: none; /* 搓牌要接管手指滑动 */
  user-select: none;
}
/* 搓牌：按住（或左右拖动）时，牌面从左边一点点露出来，松手盖回去 */
.card.is-peek { position: relative; overflow: hidden; }
.card.is-peek .peek-face {
  position: absolute; inset: 0; z-index: 3;
  background: linear-gradient(180deg, #fbf8f0, #e9e2d2);
  border-radius: inherit;
  clip-path: inset(0 calc((1 - var(--peel, 0)) * 100%) 0 0);
  pointer-events: none;
}
.card.is-peek.is-small .peek-face .card-rank { font-size: calc(var(--card-w) * 0.62); }
.card.is-peek .peek-face .card-rank { font-size: calc(var(--card-w) * 0.62); }
.card.is-peek .peek-face .card-suit { font-size: calc(var(--card-w) * 0.46); }
@keyframes flipHint {
  50% { transform: translateY(-2px); box-shadow: 0 0 0 3px rgba(232, 192, 122, .8), 0 0 22px rgba(232, 192, 122, .95); }
}

/* 开牌按钮比普通按钮更醒目 */
.btn-flip {
  min-width: 132px;
  font-size: 16px;
  letter-spacing: .12em;
}

/* ×N 倍数徽章 */
.seat-mult {
  position: absolute;
  top: -6px;
  left: -6px;
  z-index: 4;
  padding: 0 5px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  line-height: 15px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #f3d089, #cfa24d);
  color: #2a1c05;
  border: 1px solid rgba(0, 0, 0, .35);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  pointer-events: none;
}
.seat-mult:empty { display: none; }
.seat-mult.is-banker { background: linear-gradient(180deg, #ff8b7f, #d9473b); color: #2b0603; }
.seat-mult.is-hand { background: linear-gradient(180deg, #ffe08a, #f0a92e); color: #2a1c05; }
.seat-mult.is-allin { background: linear-gradient(180deg, #ffc79e, #e07a2b); color: #2b1403; }
.table-wrap.is-tight-seat .seat-mult { font-size: 9px; line-height: 13px; padding: 0 4px; top: -5px; left: -5px; }

/* 牌型 / 状态 / 输赢：一行小字（角色标记也放到这里，不占小框框的宽度） */
.seat-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  line-height: 1.2;
  color: #b9d3c8;
  max-width: 100%;
  min-height: 13px;
}
.seat-tagtext {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.seat-tag:has(.seat-tagtext:empty):has(.seat-role:empty) { display: none; }
.seat-tag.is-hand .seat-tagtext { color: #7fe0b4; font-weight: 600; }
.seat-tag.is-win .seat-tagtext { color: var(--green); font-weight: 700; }
.seat-tag.is-lose .seat-tagtext { color: var(--red); font-weight: 700; }
/* 牌型大字自带配色，优先级要压过上面的状态色 */
.seat-tag .seat-tagtext.handlabel { color: inherit; font-weight: 900; }
.seat-tag .seat-tagtext.handlabel.t-niu { color: #6fe3ff; }
.seat-tag .seat-tagtext.handlabel.t-nuclear { color: #ff7ae0; }
.seat-tag .seat-tagtext.handlabel.t-straightflush { color: #ff9d5c; }
.seat-tag .seat-tagtext.handlabel.t-fivesmall { color: #7ef0d0; }
.seat-tag .seat-tagtext.handlabel.t-bomb { color: #ffb14d; }
.seat-tag .seat-tagtext.handlabel.t-gourd { color: #ffe066; }
.seat-tag .seat-tagtext.handlabel.t-flush { color: #7fb6ff; }
.seat-tag .seat-tagtext.handlabel.t-straight { color: #9fd0ff; }
.seat-tag .seat-tagtext.handlabel.t-fiveflower { color: #ffd479; }
.seat-tag .seat-tagtext.handlabel.t-foursmall { color: #8fe6c0; }
.seat-tag .seat-tagtext.handlabel.t-fourflower { color: #a8e6a1; }
.seat-tag .seat-tagtext.handlabel.t-plain { color: #d8f3e8; }
.seat-tag .seat-tagtext.handlabel.t-none { color: #b9c7c0; }
/* 输赢数字单独一格，别和牌型挤在一起 */
.seat-delta { font-weight: 800; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.seat-delta.is-win { color: var(--green); }
.seat-delta.is-lose { color: var(--red); }
.seat-delta:empty { display: none; }
.seat-tag:has(.seat-delta:not(:empty)) { gap: 3px; }

.badge {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px;
  background: #2b4a3f; color: #cfe6dc; border: 1px solid #3d6a5a;
}
.badge.b-d { background: #4a3a12; color: var(--gold); border-color: #7d6420; }
.badge.b-sb { background: #1f3a52; color: #9ecbff; border-color: #2f5c80; }
.badge.b-bb { background: #3d2350; color: #d7b0ff; border-color: #5c3680; }
.badge.b-banker { background: #4a1f1c; color: #ffbdb7; border-color: #7a332d; }
.badge.b-allin { background: #5c2a12; color: #ffc79e; border-color: #8a4420; }
.badge.b-off { background: #333; color: #aaa; border-color: #555; }
/* 小框框里的角色标记更紧凑 */
.seat-bar .badge { font-size: 9px; padding: 0 4px; line-height: 14px; }

/* ================= 控制区 ================= */
.controls {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: rgba(8, 20, 17, .95);
  padding: 10px 12px calc(10px + var(--safe-b));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 62px;
}
.controls .ctrl-note { color: var(--muted); font-size: 13px; }
.controls-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.raise-row { display: flex; align-items: center; gap: 9px; width: 100%; max-width: 560px; }
.raise-row input[type="range"] { flex: 1; accent-color: var(--gold); }
.raise-amount {
  min-width: 74px; text-align: center; font-weight: 700; color: var(--gold);
  background: rgba(0, 0, 0, .45); border-radius: 8px; padding: 5px 8px; font-variant-numeric: tabular-nums;
}
.quick-bets { display: flex; gap: 6px; }
.quick-bets .btn { padding: 5px 9px; font-size: 12px; border-radius: 7px; }
.btn.is-picked { border-color: var(--gold); color: var(--gold); background: rgba(232, 192, 122, .16); }
.timer-bar {
  position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: rgba(255, 255, 255, .08); overflow: hidden;
}
.timer-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width .2s linear;
}

/* ================= 侧栏 ================= */
.side-panel {
  width: 290px; flex: 0 0 290px; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; background: rgba(7, 17, 14, .6);
}
.side-tabs { display: flex; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.side-tab {
  flex: 1; background: transparent; border: 0; padding: 11px; cursor: pointer;
  color: var(--muted); font-size: 13px; border-bottom: 2px solid transparent;
}
.side-tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }
.side-scroll { flex: 1; overflow-y: auto; padding: 11px; font-size: 13px; min-height: 0; }
.side-scroll .line { padding: 4px 0; border-bottom: 1px dashed rgba(255, 255, 255, .05); color: #c3d6cd; }
.side-scroll .line.mine { color: var(--gold); }
.side-scroll .line.sys { color: var(--muted); font-size: 12px; }
.side-scroll .line .who { color: #8fd0b4; font-weight: 600; }
.chat-form { display: flex; gap: 7px; padding: 9px; border-top: 1px solid var(--line); flex: 0 0 auto; }
.chat-form input { flex: 1; padding: 8px 11px; font-size: 13px; }

@media (max-width: 860px) {
  /* 手机端：侧栏变成抽屉，纵向空间全部还给牌桌 */
  .room-body { flex-direction: column; }
  .side-tab { padding: 12px; }
  .table-wrap { padding: 10px 4px; }
  .felt { border-width: 6px; }
  .seat { padding: 2px 3px 3px; border-radius: 9px; }
  .seat-bar { padding: 1px 6px; gap: 4px; }
  .seat-nick { font-size: 11px; max-width: 56px; }
  .seat-chips { font-size: 11px; }
  .seat-bar .badge { font-size: 8px; line-height: 12px; padding: 0 3px; }
  .seat-tag { font-size: 10px; min-height: 12px; }
  .seat-tag .badge { font-size: 8px; line-height: 11px; padding: 0 3px; }
}

/* ================= 金币收发特效 ================= */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 56;
  overflow: hidden;
}
.coin {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8 0%, #e8c07a 45%, #b8862f 100%);
  border: 1.5px solid #8a5f18;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5), inset 0 0 4px rgba(255, 255, 255, .55);
  will-change: transform, opacity;
}
.coin::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 1.5px solid rgba(140, 95, 24, .75);
}
.fx-float {
  position: fixed;
  font-size: 20px;
  font-weight: 800;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .85);
  will-change: transform, opacity;
}
.fx-float.is-win { color: #4fe0a0; }
.fx-float.is-lose { color: #ff7b70; }

/* 发公共牌时伸出来的那只手 */
.fx-hand {
  position: fixed;
  z-index: 72;
  font-size: 34px;
  line-height: 1;
  pointer-events: none;
  /* 绿呢底上要跳出来：加一圈亮边 */
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .75)) drop-shadow(0 0 5px rgba(255, 255, 255, .55))
    drop-shadow(0 0 12px rgba(232, 192, 122, .45));
  will-change: transform, opacity;
}

.fx-deck {
  position: fixed;
  width: 26px;
  height: 36px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 70;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, #1d4fbe, #12307a);
  border: 1px solid rgba(255, 255, 255, .5);
  box-shadow:
    2px 2px 0 rgba(255, 255, 255, .22),
    4px 4px 0 rgba(255, 255, 255, .12),
    0 6px 18px rgba(0, 0, 0, .5);
  will-change: transform, opacity;
}

/* ================= 点座位放大看牌 ================= */
.seat-pop {
  position: fixed;
  inset: 0;
  z-index: 58;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(3, 9, 7, .62);
  backdrop-filter: blur(2px);
}
.seat-pop-card {
  background: linear-gradient(180deg, rgba(24, 52, 45, .99), rgba(9, 22, 18, .99));
  border: 1px solid var(--gold-2);
  border-radius: 14px;
  padding: 14px 16px 12px;
  box-shadow: var(--shadow);
  max-width: min(560px, 100%);
  animation: popIn .16s ease;
  text-align: center;
  --card-w: 56px;
  --card-h: 80px;
}
.seat-pop-head {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}
.seat-pop-head b { font-size: 16px; }
.seat-pop-chips { color: var(--gold); font-variant-numeric: tabular-nums; }
.seat-pop-tags { color: #9ecbff; font-size: 12px; margin-bottom: 6px; }
.seat-pop-cards {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}
.seat-pop-empty { color: var(--muted); font-size: 13px; padding: 16px 0; }
.seat-pop-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* 座位弹层里的控场区（只有拿到后台授权的人看得到） */
.sup-panel {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed rgba(232, 192, 122, .35);
  display: flex; flex-direction: column; gap: 7px;
}
.sup-title { color: var(--gold); font-size: 12px; font-weight: 700; }
.sup-line { display: grid; grid-template-columns: 60px 1fr; gap: 8px; align-items: center; }
.sup-key { color: var(--muted); font-size: 12px; }
.sup-sel {
  width: 100%; background: #0a1714; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 8px; color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.sup-sel:focus { border-color: var(--gold-2); }
.sup-actions { display: flex; gap: 8px; margin-top: 2px; }
.sup-actions .btn { flex: 1; }
.sup-hint { color: var(--muted); font-size: 11px; line-height: 1.5; }
@media (max-width: 560px) {
  .seat-pop-card { --card-w: 46px; --card-h: 66px; padding: 12px; }
}

/* ================= 侧边栏抽屉 ================= */
.side-head { display: flex; align-items: center; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.side-close { display: none; padding: 0 12px; }
.side-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 45;
}
.side-toggle { display: none; }

@media (min-width: 861px) {
  .side-backdrop { display: none !important; }
}

@media (max-width: 860px) {
  .side-toggle { display: inline-flex; }
  .side-close { display: block; }
  .side-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 88vw);
    z-index: 50;
    transform: translateX(102%);
    transition: transform .22s ease;
    background: rgba(7, 18, 15, .99);
    border-left: 1px solid var(--line);
    box-shadow: -14px 0 34px rgba(0, 0, 0, .55);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    flex: none;
  }
  .side-panel.is-open { transform: translateX(0); }
}

/* ================= 等待遮罩 ================= */
/* 解散申请投票条：贴在顶栏下面，一行高，不挡座位 */
.dissolve-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 7px 12px;
  background: linear-gradient(180deg, rgba(74, 31, 28, .96), rgba(52, 20, 18, .96));
  border-bottom: 1px solid rgba(226, 86, 77, .45);
  z-index: 30;
}
.dissolve-bar .db-text { font-size: 13px; color: #ffd9d5; }
.dissolve-bar .db-text b { color: #ff9a90; }
.dissolve-bar .db-votes { font-size: 12px; color: #e9b7b2; font-variant-numeric: tabular-nums; }
.dissolve-bar .db-left {
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, .3);
  border-radius: 999px;
  padding: 1px 9px;
  font-variant-numeric: tabular-nums;
}
.dissolve-bar .btn-warn {
  background: linear-gradient(180deg, #e8564a, #b8342a);
  border-color: #8d2a22;
  color: #fff;
  font-weight: 700;
}

/* 等待/观战的操作条：放在底部操作区里，不遮牌桌 */
.wait-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.wait-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; }
.wait-actions .btn { min-width: 92px; }
.wait-actions .btn-primary { box-shadow: 0 3px 12px rgba(232, 192, 122, .32); }
.wait-note { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.5; }
.wait-note b { color: var(--gold); }

/* 自动准备勾选 */
.auto-ready {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 4px; cursor: pointer; user-select: none;
  color: var(--muted); font-size: 13px;
}
.auto-ready input { width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer; }
.auto-ready:hover { color: var(--text); }

/* 已准备的座位：淡淡的绿边，一眼看出还等谁 */
.seat.is-ready { box-shadow: 0 0 0 1px rgba(79, 224, 160, .5); }

/* 侧栏顶部的房间信息块 */
.side-room { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); }
.side-room:empty { display: none; }
.sr-head { display: flex; align-items: center; gap: 8px; }
.sr-head b { color: var(--gold); font-size: 14px; font-variant-numeric: tabular-nums; }
.sr-head .btn { margin-left: auto; }
.sr-meta { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sr-players { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 8px; }
.sr-p {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: #cfe0d8;
}
.sr-p.is-me { border-color: rgba(232, 192, 122, .6); color: var(--gold); background: rgba(232, 192, 122, .12); }
.sr-p.is-ready { border-color: rgba(79, 224, 160, .45); }
.sr-p .sr-chips { color: var(--muted); font-variant-numeric: tabular-nums; }
.sr-wait { margin-top: 6px; color: var(--muted); font-size: 11px; }

/* 空座位：虚线圆圈 + 加号，点一下就能坐下（参考同类产品的做法） */
.seat.is-empty {
  width: 42px;
  height: 42px;
  min-width: 0;
  max-width: none;
  padding: 0;
  gap: 0;
  border-radius: 50%;
  background: rgba(8, 22, 18, .55);
  border: 1.5px dashed rgba(232, 192, 122, .5);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .45);
  transition: border-color .18s, background .18s, color .18s;
}
.seat.is-empty:hover,
.seat.is-empty:focus-visible {
  border-color: var(--gold);
  background: rgba(232, 192, 122, .2);
  color: var(--gold);
  outline: none;
}
.empty-plus { display: block; font-size: 17px; line-height: 1; font-weight: 700; }
.empty-label { display: block; font-size: 8px; line-height: 1; opacity: .85; white-space: nowrap; color: inherit; }
.table-wrap.is-tight-seat .seat.is-empty { width: 34px; height: 34px; }
.table-wrap.is-tight-seat .empty-plus { font-size: 14px; }
.table-wrap.is-tight-seat .empty-label { font-size: 7px; }

/* 观战条 */
.spectate-bar { align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.spectate-tip { color: var(--gold); font-weight: 700; font-size: 14px; }
.spectate-seats { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.muted-sm { color: var(--muted); font-size: 12px; }
.waiting-actions { display: flex; gap: 9px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

@keyframes popIn { from { opacity: 0; transform: scale(.94); } }

/* ================= 癞子（大小王） ================= */
.card.card-joker {
  position: relative;
  background: linear-gradient(160deg, #ffffff 0%, #eef2ef 100%);
  color: #23241f;
  border-color: rgba(0, 0, 0, .28);
}
.card.card-joker.is-big-joker { color: #c62828; }
.joker-vertical {
  position: absolute;
  left: 8%;
  top: 7%;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-size: calc(var(--card-w) * 0.185);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  opacity: .9;
}
.joker-mark { font-size: calc(var(--card-w) * 0.5); line-height: 1; }
.joker-tag {
  position: absolute;
  right: 7%;
  bottom: 5%;
  font-size: calc(var(--card-w) * 0.22);
  font-weight: 800;
  opacity: .8;
}

/* ================= 设置弹窗 ================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 9, 7, .72); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.modal-card {
  background: linear-gradient(180deg, rgba(24, 52, 45, .99), rgba(9, 22, 18, .99));
  border: 1px solid var(--gold-2); border-radius: 16px;
  width: min(720px, 100%); max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow); animation: popIn .18s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.modal-head h3 { margin: 0; color: var(--gold); font-size: 16px; }
.modal-x {
  background: transparent; border: 0; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 2px 6px; line-height: 1;
}
.modal-x:hover { color: var(--text); }
.modal-foot {
  display: flex; justify-content: center; gap: 12px;
  padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); flex: 0 0 auto;
}
.modal-foot .btn { min-width: 130px; }

/* ================= 快捷喊话 ================= */
.shout-panel {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(3, 9, 7, .6);
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.shout-card {
  width: min(440px, 100%); max-height: 84vh; overflow: auto;
  background: linear-gradient(180deg, rgba(24, 52, 45, .99), rgba(9, 22, 18, .99));
  border: 1px solid var(--gold-2); border-radius: 16px;
  box-shadow: var(--shadow);
  animation: popIn .16s ease;
}
.shout-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.shout-head b { color: var(--gold); font-size: 15px; }
.shout-head .shout-ver { margin-left: auto; display: flex; gap: 6px; }
.shout-head .shout-ver .chip { padding: 3px 10px; font-size: 12px; }
.shout-head .auto-ready { margin-left: 0; }
.shout-list { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.shout-item {
  text-align: left; padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: rgba(6, 16, 13, .55); border: 1px solid var(--line);
  color: var(--text); font: inherit; font-size: 14px; line-height: 1.4;
  transition: border-color .15s, background .15s, transform .1s;
}
.shout-item:hover { border-color: var(--gold); background: rgba(232, 192, 122, .14); }
.shout-item:active { transform: scale(.985); }

/* 全场横幅 */
.shout-banner {
  position: fixed; left: 0; right: 0; bottom: 16%; z-index: 85;
  display: flex; justify-content: center; pointer-events: none; padding: 0 14px;
}
.shout-banner-card {
  max-width: min(560px, 100%);
  padding: 12px 20px; border-radius: 14px; text-align: center;
  background: linear-gradient(180deg, rgba(38, 22, 12, .96), rgba(20, 12, 6, .96));
  border: 1px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6), 0 0 24px rgba(232, 192, 122, .28);
}
.shout-banner.is-mine .shout-banner-card {
  border-color: var(--green);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6), 0 0 24px rgba(79, 224, 160, .3);
}
.shout-who { color: var(--gold); font-size: 12px; margin-bottom: 4px; }
.shout-banner.is-mine .shout-who { color: var(--green); }
.shout-text { color: #fff8e8; font-size: 20px; font-weight: 800; line-height: 1.4; letter-spacing: .5px; }
@media (max-width: 420px) {
  .shout-text { font-size: 17px; }
  .shout-item { font-size: 13px; padding: 9px 10px; }
}

/* 整场结算图 */
.session-card { width: min(780px, 100%); }
.session-body { overflow-y: auto; padding: 12px 16px; }
.session-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 720px;
  margin: 0 auto;
  border-radius: 16px;
}

.settings-body { overflow-y: auto; padding: 6px 16px 14px; }
.set-row {
  display: grid; grid-template-columns: 96px 1fr; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .05);
  align-items: start;
}
.set-row:last-of-type { border-bottom: 0; }
.set-label { color: var(--gold); font-size: 13px; font-weight: 600; padding-top: 5px; }
.set-ctrl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.set-hint { color: var(--muted); font-size: 12px; }
.set-note { color: var(--muted); font-size: 12px; margin: 12px 0 0; line-height: 1.7; }
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.set-field { display: flex; flex-direction: column; gap: 4px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip {
  border: 1px solid var(--line); background: #12271f; color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-size: 13px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: #3d6a5a; }
.chip.is-on {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-2) 100%);
  border-color: #a9803a; color: #22190a; font-weight: 700;
}
.chip.chip-step { padding: 6px 13px; font-size: 16px; line-height: 1; }

.stepper { display: flex; align-items: center; gap: 8px; }
.set-num {
  width: 92px; background: #0a1714; border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; font-size: 13px; color: inherit;
}
.set-num-lg { width: 78px; text-align: center; font-weight: 700; color: var(--gold); }
.set-select {
  background: #0a1714; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; font-size: 13px; color: inherit;
}
.set-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #cfe0d8; cursor: pointer; }

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 7px; width: 100%; }
.type-item {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  background: rgba(6, 16, 13, .5); border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; cursor: pointer;
}
.type-item.is-off { opacity: .45; }
.type-name { flex: 1; min-width: 0; white-space: nowrap; }
.type-mult {
  width: 48px; background: #0a1714; border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 5px; font-size: 12px; text-align: center; color: var(--gold);
}
.type-x { color: var(--muted); font-size: 12px; }
.time-row { display: flex; flex-wrap: wrap; gap: 12px; }
.time-item { display: flex; align-items: center; gap: 6px; }
.waiting-cfg { color: #cfe0d8; font-size: 12px; }
.waiting-ok { color: var(--green); font-size: 12px; }
.waiting-warn { color: var(--gold); font-size: 12px; }

@media (max-width: 560px) {
  .set-row { grid-template-columns: 1fr; gap: 4px; }
  .set-label { padding-top: 0; }
  .type-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .modal-foot .btn { min-width: 0; flex: 1; }
}
