/* ============================================================
 *  单机斗地主 —— 样式
 *  绿绒牌桌 · 金边 UI · 纯 CSS 扑克牌 · 竖屏/横屏自适应
 * ============================================================ */

:root {
  --felt-1: #1f7a4d;
  --felt-2: #0f5132;
  --felt-edge: #0a3d26;
  --gold: #f4d27a;
  --gold-deep: #c79a3a;
  --ink: #1c2530;
  --paper: #fdfdfb;
  --red: #d8392b;
  --black: #23272e;
  --shadow: rgba(0, 0, 0, 0.35);

  --card-w: clamp(46px, 11vw, 72px);
  --card-h: calc(var(--card-w) * 1.42);
  --card-radius: calc(var(--card-w) * 0.12);
  --hand-overlap: calc(var(--card-w) * -0.48);

  --ui-radius: 14px;
}

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

html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  overflow: hidden;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  /* 多层背景：顶部吊灯柔光 → 中央椭圆聚光台面 → 绿绒底色 → 四周渐暗 */
  background:
    radial-gradient(70% 42% at 50% 44%, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.03) 38%, transparent 70%),
    radial-gradient(130% 70% at 50% -8%, rgba(255,243,205,0.16) 0%, rgba(255,243,205,0.05) 42%, transparent 68%),
    radial-gradient(150% 120% at 50% 32%, #2c9160 0%, var(--felt-1) 28%, var(--felt-2) 64%, var(--felt-edge) 100%);
  overflow: hidden;
}
#app::before { /* 绒布织纹：经纬交织的细纹理，叠加增强质感 */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.055) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 3px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  opacity: .8;
}
#app::after { /* 暗角 + 金色内描边，强化台面纵深感 */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  box-shadow:
    inset 0 0 140px rgba(0,0,0,0.55),
    inset 0 0 38px rgba(0,0,0,0.40),
    inset 0 0 0 2px rgba(244,210,122,0.28),
    inset 0 0 0 5px rgba(0,0,0,0.28);
}

/* ---------------- 顶部栏 ---------------- */
/* 横屏下 .topbar-row 用 display:contents 外壳不生成盒子，chip 直接参与 #topbar 的 flex 横向并排
   竖屏下由 @media (orientation: portrait) 改为 display:flex 形成两行分组 */
.topbar-row { display: contents; }

#topbar {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 6px;
  background: linear-gradient(180deg, rgba(0,0,0,0.28), rgba(0,0,0,0));
}
.top-btn {
  flex: 0 0 auto; white-space: nowrap;
  font-family: inherit; font-size: 13px; font-weight: 800; letter-spacing: 1px;
  color: var(--gold);
  padding: 5px 12px; border: 1px solid var(--gold-deep);
  border-radius: 10px; background: rgba(0,0,0,.18);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  cursor: pointer; transition: transform .1s ease, background .15s ease;
}
.top-btn:active { transform: scale(.94); background: rgba(0,0,0,.32); }
/* 横屏下 .topbar-info 由 display:contents 不生成盒子，4 个 stat chip 由 #topbar 的 flex 横向并排 */
.stat {
  display: flex; flex-direction: column; align-items: center;
  min-width: 46px; padding: 2px 6px;
  background: rgba(0,0,0,.22); border-radius: 10px;
  border: 1px solid rgba(244,210,122,.35);
}
.stat-label { font-size: 10px; opacity: .8; }
.stat-val { font-size: 16px; font-weight: 800; color: var(--gold); }
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid rgba(244,210,122,.5);
  background: rgba(0,0,0,.25); color: var(--gold);
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.icon-btn:active { transform: scale(.92); }

/* ---------------- 记牌器 ---------------- */
#counter-panel {
  position: relative; z-index: 4;
  margin: 0; padding: 6px 8px;
  background: rgba(0,0,0,.32); border: 1px solid rgba(244,210,122,.3);
  border-radius: 12px; display: flex; flex-wrap: wrap; gap: 4px;
  justify-content: center;
}
.counter-cell {
  display: flex; flex-direction: column; align-items: center;
  width: 30px; font-size: 12px; padding: 2px 0; border-radius: 8px;
  background: rgba(255,255,255,.06);
}
.counter-cell .cr { font-weight: 800; font-size: 13px; }
.counter-cell .cc { font-size: 10px; opacity: .85; }
.counter-cell.done { background: rgba(216,57,43,.3); }
.counter-cell.done .cc { color: #ffd; }
/* 癞子点数：癞子可被对手当作任意点数使用，剩余张数无意义，改显「癞」并描金边 */
.counter-cell.wild-rank { background: rgba(244,210,122,.22); box-shadow: inset 0 0 0 1px var(--gold); }
.counter-cell.wild-rank .cr { color: var(--gold); }
.counter-cell.wild-rank .cc { color: var(--gold); opacity: 1; font-weight: 700; }

/* ---------------- 牌桌 ---------------- */
#table-area { position: relative; flex: 1; min-height: 0; }
#table-area::before { /* 中央椭圆亮池：出牌台面 */
  content: ""; position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  width: min(86vw, 520px); height: min(62%, 360px);
  background: radial-gradient(ellipse at 50% 50%, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0.04) 45%, transparent 72%);
  border-radius: 50%;
  pointer-events: none;
}
.opponent {
  position: absolute; top: 22px; z-index: 3;
  width: 42px;                 /* 固定为头像直径，使牌列与头像共用同一中轴 */
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
#ai-left { left: clamp(10px, 3.5vw, 24px); }    /* 向屏幕中间靠一些 */
#ai-right { right: clamp(10px, 3.5vw, 24px); }
.opp-info {
  position: relative; width: 42px;
  display: flex; align-items: center; justify-content: center;
}
.opp-meta {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 1px; white-space: nowrap;
}
#ai-left .opp-meta { left: 100%; margin-left: 6px; text-align: left; }
#ai-right .opp-meta { right: 100%; margin-right: 6px; text-align: right; }
.opp-avatar {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3a4a5a, #16212c);
  border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center;
  font-size: 22px; box-shadow: 0 2px 6px var(--shadow);
}
.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.avatar-face { filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.crown {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: 16px; display: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6));
}
.crown.show { display: block; animation: pop .3s ease; }
.opp-name { font-size: 12px; font-weight: 700; color: var(--gold); text-shadow: 0 1px 2px #000; }
.opp-count { font-size: 11px; opacity: .9; }
.opp-hand { display: flex; flex-direction: column; align-items: center; margin-top: 2px; }
.opp-hand .card.back { --card-w: 24px; --card-h: calc(var(--card-w) * 1.42); margin-top: calc(var(--card-h) * -0.62); }
.opp-hand .card.back:first-child { margin-top: 0; }
/* 电脑出牌区：横向展示、每行最多 6 张，超出自动下一行。
   用 JS 在 render 时把每 6 张牌拆为独立的子行（.opp-last-row），避免 webview 中
   absolute 容器内 flex/inline-block 自动换列渲染异常的问题。 */
.opp-last {
  position: absolute; top: 44px;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 4px;
  min-height: 4px; z-index: 4;
}
#ai-left .opp-last { left: 100%; margin-left: 6px; }
#ai-right .opp-last { right: 100%; margin-right: 6px; }
.opp-last-row {
  display: block; height: calc(var(--card-h) + 4px); line-height: 0;
}
.opp-last .card {
  display: inline-block; vertical-align: top;
  margin-left: calc(var(--card-w) * -0.30);
  line-height: normal;
}
.opp-last .card:first-child,
.opp-last-row .card:first-child { margin-left: 0; }
.opp-last .pass-tag {
  margin-left: 0;
}
/* 玩家自己最近一手牌：放在手牌上方、靠近自己一侧。强制单行连续重叠（不换行），
   牌数过多时向左溢出扩展，保证间距一致不断行；与下方参考图一致。 */
.my-last {
  display: flex; flex-wrap: nowrap; justify-content: flex-start; align-items: flex-end;
  gap: 0; min-height: calc(var(--card-w) * 1.42); padding-bottom: 4px;
  overflow: visible;
}
.my-last .card { margin-left: calc(var(--card-w) * -0.30); }
.my-last .card:first-child { margin-left: 0; }
.seat-last .card { animation: popIn .25s ease both; }
/* 三个座位（你+左电脑+右电脑）的出牌区小牌与手牌保持同样大小，横竖屏均与 :root --card-w 一致 */
.my-last .card.mini, .opp-last .card.mini {
  --card-w: clamp(46px, 11vw, 72px);
  --card-h: calc(var(--card-w) * 1.42);
}
/* 过牌（不要）标记：在玩家本人一侧的出牌位置显示，文字横向排列 */
.pass-tag {
  display: inline-flex; flex-direction: row; align-items: center; justify-content: center;
  writing-mode: horizontal-tb; white-space: nowrap;
  height: calc(var(--card-w) * 0.62);
  width: auto; min-width: 0;
  padding: 0 6px;
  background: linear-gradient(180deg, #ffffff, #f2f2f2);
  border: 2px solid #d8392f; border-radius: 8px;
  color: #d8392f;
  font-size: calc(var(--card-w) * 0.32); font-weight: 800; letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .30);
  animation: popIn .25s ease both;
}
.opp-action {
  position: absolute; top: 22px;
  min-height: 18px; white-space: nowrap;
  font-size: 13px; font-weight: 800; color: #fff;
  background: rgba(0,0,0,.35); padding: 1px 8px; border-radius: 10px;
  opacity: 0; transition: opacity .2s; z-index: 4;
}
#ai-left .opp-action { left: 100%; margin-left: 6px; }
#ai-right .opp-action { right: 100%; margin-right: 6px; }
.opp-action.show { opacity: 1; animation: pop .25s ease; }

/* 当前出牌者高亮 */
.opponent.active .opp-avatar { box-shadow: 0 0 0 3px var(--gold), 0 2px 10px var(--gold); }
.opponent.active .opp-name { color: #fff; text-shadow: 0 0 8px var(--gold); }

/* 对手即将走完（剩 1~2 张）预警 */
.opponent.danger .opp-avatar { box-shadow: 0 0 0 3px #ff5a4d, 0 0 12px #ff5a4d; animation: dangerPulse 0.9s ease-in-out infinite; }
.opponent.danger .opp-name { color: #ff7a6e; text-shadow: 0 0 8px #ff5a4d; }
.opp-danger {
  position: absolute; top: -6px; right: -6px; z-index: 6;
  font-size: 11px; line-height: 1; padding: 3px 6px; border-radius: 10px;
  background: #ff5a4d; color: #fff; font-weight: 700; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.4); animation: dangerPulse 0.9s ease-in-out infinite;
}
@keyframes dangerPulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* 中央区域 */
#center {
  position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%);
  width: 92%; max-width: 460px; display: flex; flex-direction: column;
  align-items: center; gap: 6px; z-index: 2;
}
.bottom-cards { display: flex; gap: 3px; min-height: 4px; }
.bottom-cards .card { animation: revealCard .5s ease both; }
.trick-cards { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; min-height: 4px; }
.trick-cards .card { margin-left: calc(var(--card-w) * -0.3); }
.trick-cards .card:first-child { margin-left: 0; }
.trick-cards .card { animation: popIn .28s ease both; }
.banner {
  font-size: 26px; font-weight: 900; letter-spacing: 2px;
  color: #fff; text-shadow: 0 0 12px #ff4d3d, 0 2px 4px #000;
  opacity: 0; pointer-events: none; min-height: 30px;
}
.banner.show { animation: bannerPulse .9s ease; }

/* ---------------- 人类区 ---------------- */
#human-area {
  position: relative; z-index: 5;
  padding: 0 6px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.25));
}
.human-action {
  text-align: center; min-height: 16px; font-size: 13px; font-weight: 800;
  color: #ffe; opacity: 0; margin-bottom: 2px;
}
.human-action.show { opacity: 1; animation: pop .25s ease; }
/* 玩家头像：放在牌的左侧，与电脑人头像同款样式 */
.human-body { display: flex; align-items: center; gap: 8px; }
.human-avatar-wrap { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.human-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
#human-area.active .human-avatar { box-shadow: 0 0 0 3px var(--gold), 0 2px 10px var(--gold); }
.hand {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 5px;
  min-height: calc(var(--card-h) * 2 + 12px);
  padding: 6px 4px 0;
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.hand-row {
  display: flex; justify-content: center; align-items: flex-end;
}
.hand-row .card {
  margin-left: var(--hand-overlap);
  cursor: pointer; transition: transform .12s ease, filter .12s ease;
  transform-origin: bottom center;
}
.hand-row .card:first-child { margin-left: 0; }
.hand .card.selected { transform: translateY(-16px); filter: drop-shadow(0 6px 8px rgba(0,0,0,.5)); }
.hand.dealing .card { animation: dealIn .4s ease both; }
.hand .card.hint { box-shadow: 0 0 0 2px var(--gold), 0 0 10px var(--gold); }

.controls { display: flex; gap: 8px; justify-content: center; margin-top: 6px; }
.ctrl-btn {
  flex: 1; max-width: 110px; padding: 11px 4px; font-size: 16px; font-weight: 800;
  border-radius: 12px; border: none; cursor: pointer; color: #2a1d05;
  background: linear-gradient(180deg, #ffe9a8, var(--gold-deep));
  box-shadow: 0 3px 0 #8a6a1f, 0 4px 8px var(--shadow);
}
.ctrl-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6a1f; }
.ctrl-btn.ghost { background: rgba(255,255,255,.14); color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.3); border: 1px solid rgba(244,210,122,.4); }
.ctrl-btn.warn { background: linear-gradient(180deg, #ffb199, #e8654b); color: #fff; box-shadow: 0 3px 0 #9c3a26; }
.ctrl-btn.primary { background: linear-gradient(180deg, #ffe9a8, var(--gold-deep)); }
.ctrl-btn:disabled { opacity: .4; filter: grayscale(.5); pointer-events: none; }

/* ---------------- 扑克牌 ---------------- */
.card {
  position: relative;
  width: var(--card-w); height: var(--card-h);
  background: var(--paper);
  border-radius: var(--card-radius);
  border: 1px solid #d9d6cf;
  box-shadow: 0 2px 4px var(--shadow);
  flex: 0 0 auto;
  color: var(--black);
  overflow: hidden;
}
.card.red { color: var(--red); }
.card .corner {
  position: absolute; display: flex; flex-direction: column; align-items: center;
  line-height: 1; font-weight: 800;
}
.card .corner.tl { top: 1px; left: 1px; }
.card .corner.br { bottom: 1px; right: 1px; transform: rotate(180deg); }
.card .corner .r { font-size: calc(var(--card-w) * 0.51); letter-spacing: -0.08em; }
.card .corner .s { display: none; }
.card .pip {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--card-w) * 0.20); opacity: .9;
}
/* 迷你牌 */
.card.mini {
  --card-w: clamp(22px, 5.4vw, 34px);
  --card-h: calc(var(--card-w) * 1.42);
  box-shadow: 0 1px 2px var(--shadow);
}
.card.mini .corner.tl { top: 1px; left: 1px; }
.card.mini .corner.br { bottom: 1px; right: 1px; }
/* 王：整张图片牌面（彩色=大王 / 黑白=小王） */
.card.joker { background: linear-gradient(160deg, #fff, #fff7e6); color: #b01b1b; }
.card.joker .jk-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: inherit;
}
/* 牌背 */
.card.back {
  background:
    repeating-linear-gradient(45deg, #2b4ea0 0 5px, #22409a 5px 10px);
  border: 2px solid #cdd6f5;
}
.card.back .back-pattern {
  position: absolute; inset: 3px; border-radius: calc(var(--card-radius) * 0.7);
  border: 1px solid rgba(255,255,255,.5);
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,.25), transparent 60%);
}

/* ---------------- 弹层 ---------------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  padding: 16px;
}
.overlay.hidden, .hidden { display: none !important; }
.panel {
  width: 100%; max-width: 360px;
  background: linear-gradient(180deg, #15412c, #0e3322);
  border: 1px solid var(--gold-deep);
  border-radius: 18px; padding: 20px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6), inset 0 0 0 1px rgba(244,210,122,.2);
  text-align: center;
  animation: panelIn .3s ease both;
}
.game-title {
  margin: 0 0 4px; font-size: 30px; letter-spacing: 4px; color: var(--gold);
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.subtitle { margin: 0 0 16px; font-size: 13px; opacity: .85; }
.field { margin: 12px 0; text-align: left; }
.field-label { font-size: 13px; opacity: .85; margin-bottom: 6px; }
.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1; padding: 10px 0; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(244,210,122,.4); background: rgba(0,0,0,.25);
  color: #fff; font-weight: 700; font-size: 14px;
}
.seg-btn.active { background: linear-gradient(180deg, #ffe9a8, var(--gold-deep)); color: #2a1d05; }
.seg-btn:active { transform: scale(.96); }
/* 出牌语音：与开关同行的紧凑分段控件（横屏面板高度紧张，不额外占一行） */
#seg-voice { flex: 0 0 auto; width: 64%; max-width: 196px; }
.menu-score { margin: 14px 0; font-size: 14px; }
.menu-score b { color: var(--gold); font-size: 18px; }
.start-btns { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.row { display: flex; gap: 10px; }
.row .big-btn { flex: 1; }
.big-btn {
  padding: 13px 0; border-radius: 12px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 800;
  background: linear-gradient(180deg, #ffe9a8, var(--gold-deep)); color: #2a1d05;
  box-shadow: 0 3px 0 #8a6a1f;
}
.big-btn.ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(244,210,122,.4); box-shadow: 0 3px 0 rgba(0,0,0,.3); }
.big-btn.home { background: linear-gradient(180deg, #8fd0ff, #4aa3e8); color: #07243a; box-shadow: 0 3px 0 #1f5f93; }
.big-btn.home:active { transform: translateY(2px); box-shadow: 0 1px 0 #1f5f93; }
.big-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6a1f; }

.panel-title { margin: 0 0 14px; color: var(--gold); font-size: 20px; }

/* ---- 下注阶段：底分加倍 + 明牌（2026-10-08）---- */
#overlay-double { z-index: 24; }
.double-panel {
  width: 100%; max-width: 380px;
  background: linear-gradient(180deg, #15412c, #0e3322);
  border: 1px solid var(--gold-deep);
  border-radius: 18px; padding: 18px 16px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6), inset 0 0 0 1px rgba(244,210,122,.2);
  text-align: center;
  animation: panelIn .28s ease both;
}
.double-title { color: var(--gold); font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.double-hint { font-size: 12px; opacity: .72; margin: 6px 0 14px; }
.double-row { display: flex; gap: 8px; }
.double-row .big-btn { flex: 1; padding: 12px 0; font-size: 15px; border-radius: 11px; }
.big-btn.danger {
  background: linear-gradient(180deg, #ff9d8a, #c0392b); color: #2a0d05;
  box-shadow: 0 3px 0 #7d2418;
}
.big-btn.danger:active { transform: translateY(2px); box-shadow: 0 1px 0 #7d2418; }
/* 明牌行：整行可点，左侧开关用与设置面板同款 .toggle */
.double-reveal {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin-top: 12px; padding: 11px 12px; cursor: pointer;
  background: rgba(0,0,0,.24); border: 1px solid rgba(244,210,122,.32);
  border-radius: 12px; color: #fff; text-align: left; font-size: 14px; font-weight: 700;
}
.double-reveal .toggle { flex: 0 0 auto; transform: scale(.86); }
.double-reveal i { display: block; font-style: normal; font-size: 11px; font-weight: 400; opacity: .7; margin-top: 3px; }
.double-reveal:active { transform: translateY(1px); }
.double-reveal.on { border-color: var(--gold); background: rgba(244,210,122,.14); }

/* ==== 加倍弹层：强制居中 + 背景只模糊不变暗（2026-10-08 用户要求）====
 * ① 遮罩：.overlay 默认 background: rgba(0,0,0,.55) 会把整桌压暗。
 *    这里换成**几乎透明的黑 + 更强的 backdrop 模糊** —— 毛玻璃感，
 *    桌面的绿绒与牌面都还看得清，只是被"推到后面"，且不牺牲亮度。
 *    backdrop-filter 不生效的环境（老 WebView）靠 rgba 的 alpha 兜底也不会全黑。
 * ② 居中：竖屏靠 .overlay 自带的 align-items:center；
 *    横屏 @media 里 .overlay:not(#overlay-bidding) 被改成 align-items:flex-start，
 *    居中依赖 `> .panel { margin: auto; }` —— 而加倍面板的类名是
 *    **.double-panel 不是 .panel**，没吃到那条规则 → 横屏下贴顶（截图即此症状）。
 *    这里对 .double-panel 显式给 margin:auto，两种朝向都真正居中。
 */
#overlay-double {
  /* 背景不变暗：仅 0.16 的黑，主要靠模糊制造景深 */
  background: rgba(0, 0, 0, .16);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}
#overlay-double > .double-panel { margin: auto; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-bottom: 1px solid rgba(244,210,122,.15); font-size: 15px;
}

.toggle {
  width: 50px; height: 28px; border-radius: 14px; border: none; cursor: pointer;
  background: rgba(255,255,255,.2); position: relative; transition: background .2s;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: left .2s;
}
.toggle.on { background: var(--gold-deep); }
.toggle.on::after { left: 25px; }

/* 模式界面：癞子 / 不洗牌 开关 */
.mode-toggles { margin: 4px 0 6px; border-top: 1px solid rgba(244,210,122,.15); }
.mode-toggles .toggle-row { padding: 12px 2px; border-bottom: 1px solid rgba(244,210,122,.15); }
.mode-toggles .toggle-row span { display: flex; flex-direction: column; line-height: 1.3; gap: 2px; }
.mode-toggles .toggle-row small { font-size: 11px; opacity: .62; font-style: normal; }

/* 顶部状态栏：癞子指示 */
/* 默认态（未启用）：横排单一文字"常规" */
.stat-wild { font-size: 13px; padding: 3px 10px; border-radius: 12px;
  background: rgba(255,255,255,.12); color: var(--gold); border: 1px solid rgba(244,210,122,.35); }
/* 启用态：与底分/倍数/积分同结构——上下 column flex + 加粗金色边框，宽度与三项统一（46px） */
.stat-wild.show { display: flex; flex-direction: column; align-items: center;
  background: rgba(244,210,122,.12); color: var(--gold); font-weight: 700; border: 1.5px solid var(--gold);
  padding: 2px 6px; border-radius: 10px; min-width: 46px; }

/* 癞子（百搭）牌视觉标记 */
.card.wild { box-shadow: 0 0 0 2px var(--gold), 0 4px 10px rgba(0,0,0,.35); }
.card.wild .wild-badge {
  position: absolute;
  left: calc(var(--card-w) * 0.08);
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: calc(var(--card-w) * 0.34);
  height: calc(var(--card-w) * 0.34);
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--gold-deep);
  color: #1b1305;
  font-weight: 800;
  font-size: calc(var(--card-w) * 0.22);
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,.4), inset 0 0 0 1.5px rgba(27,19,5,.35);
}
.card.mini.wild .wild-badge {
  width: calc(var(--card-w) * 0.44);
  height: calc(var(--card-w) * 0.44);
  font-size: calc(var(--card-w) * 0.28);
  left: calc(var(--card-w) * 0.05);
}

/* 战绩面板 */
.stats-panel { max-width: 340px; width: 88%; text-align: center; }
.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 6px 0 16px;
}
.stat-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px; border-radius: 12px;
  background: rgba(244,210,122,.08); border: 1px solid rgba(244,210,122,.18);
}
.stat-cell span { font-size: 12px; opacity: .8; }
.stat-cell b { font-size: 20px; color: var(--gold); }

/* 滑块行（设置-背景音乐音量） */
.slider-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px 14px; border-bottom: 1px solid rgba(244,210,122,.15);
  font-size: 14px;
}
.slider-row .slider-label { flex: 0 0 auto; color: var(--gold); opacity: .9; }
.slider {
  flex: 1 1 auto; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; outline: none; cursor: pointer;
  background: linear-gradient(to right, var(--gold) 0%, var(--gold) var(--p,50%), rgba(255,255,255,.18) var(--p,50%), rgba(255,255,255,.18) 100%);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(180deg, #ffe9a8, var(--gold-deep));
  border: 1px solid #8a6a1e; box-shadow: 0 1px 3px rgba(0,0,0,.4);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(180deg, #ffe9a8, var(--gold-deep));
  border: 1px solid #8a6a1e; box-shadow: 0 1px 3px rgba(0,0,0,.4);
  cursor: pointer; border: none;
}
.slider-val {
  flex: 0 0 auto; min-width: 38px; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--gold); font-size: 13px;
}

.help-panel .help-body { text-align: left; font-size: 13px; line-height: 1.6; max-height: 60vh; overflow-y: auto; }
.help-body p { margin: 8px 0; }
.help-body b { color: var(--gold); }

/* 关于作者面板 */
.about-panel { max-width: 340px; }
.about-body { text-align: left; font-size: 13px; line-height: 1.7; max-height: 55vh; overflow-y: auto; }
.about-body p { margin: 10px 0; text-align: justify; }
.about-body b { color: var(--gold); }

/* 抢地主：仅显示两枚按钮，无卡片背景；按钮浮在牌桌上方（中央桌面区附近），不遮挡手牌 */
#overlay-bidding {
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
  /* 把按钮推到牌桌上方：底部留出"手牌+行动按钮"合计的高度，让按钮位于中央桌面正下方 */
  align-items: flex-end;
  padding-bottom: clamp(150px, 30vh, 230px);
}
#overlay-bidding .bid-btns {
  pointer-events: auto;
  display: flex;
  gap: 10px;
}
#overlay-bidding .big-btn {
  min-width: 66px;
  flex: 1 1 auto;
  padding: 7px 12px;
  font-size: 17px;   /* 文字大小不变 */
}

/* 结算面板：整体缩小一档（2026-09-06） */
.result-panel { max-width: 280px; padding: 14px 14px 16px; }
.result-panel .result-emoji { font-size: 40px; animation: pop .4s ease; }
.result-title { margin: 4px 0; font-size: 21px; color: var(--gold); }
.result-detail { font-size: 12.5px; line-height: 1.65; margin: 6px 0 12px; opacity: .95; }
.result-detail b { color: var(--gold); }
.result-btns { display: flex; gap: 10px; }
.result-btns .big-btn { flex: 1; padding: 10px 0; font-size: 15px; }
/* 看牌模式：对手亮牌横排（重叠排布）——覆盖容器默认的竖排 flex */
.opp-hand.revealed {
  display: block; flex-direction: row; flex-wrap: nowrap;
  line-height: 0; font-size: 0; white-space: nowrap;
}
.opp-hand.revealed .card {
  --card-w: clamp(22px, 6vw, 34px);
  --card-h: calc(var(--card-w) * 1.42);
  margin-top: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
/* 地主明牌加倍：常驻身份标记（区别于"剩N张"预警角标） */
.opp-open {
  position: absolute; top: -6px; left: -6px; z-index: 6;
  font-size: 10px; line-height: 1; padding: 3px 6px; border-radius: 10px;
  background: linear-gradient(135deg, #ffb43d, #ff7a18);
  color: #fff; font-weight: 700; white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
/* 看牌模式悬浮返回按钮 */
#btn-reveal-menu {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 24px; z-index: 15; min-width: 150px; padding: 11px 0;
}

/* ---------------- 提示气泡 / Toast ---------------- */
.toast {
  position: absolute; left: 50%; bottom: 28%; transform: translateX(-50%);
  z-index: 30; background: rgba(0,0,0,.8); color: #fff;
  padding: 10px 18px; border-radius: 20px; font-size: 14px; font-weight: 700;
  border: 1px solid rgba(244,210,122,.4);
  animation: toastIn .2s ease;
}

/* ---------------- 特效 ---------------- */
#flash {
  position: absolute; inset: 0; z-index: 15; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.7), transparent 60%);
  opacity: 0;
}
#flash.on { animation: flash .35s ease; }
#app.shake { animation: shake .45s ease; }

@keyframes dealIn {
  from { transform: translateY(-40px) scale(.8); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes popIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes revealCard { from { transform: rotateY(90deg); opacity: 0; } to { transform: rotateY(0); opacity: 1; } }
@keyframes pop { from { transform: scale(.5); } to { transform: scale(1); } }
@keyframes panelIn { from { transform: translateY(20px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastIn { from { transform: translateX(-50%) translateY(10px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
@keyframes bannerPulse {
  0% { opacity: 0; transform: scale(.4); }
  40% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes flash { 0% { opacity: 0; } 30% { opacity: .9; } 100% { opacity: 0; } }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  15% { transform: translateX(-10px); } 30% { transform: translateX(9px); }
  45% { transform: translateX(-7px); } 60% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}

/* ---------------- 横屏自适应 ---------------- */
@media (orientation: landscape) {
  :root { --card-w: clamp(28px, 5vw, 46px); }
  #topbar { padding-top: calc(env(safe-area-inset-top, 0px) + 4px); }
  .brand { font-size: 15px; }
  .topbar-info .stat, .topbar-info .stat-wild.show { min-width: 40px; }
  /* 横屏：display:contents 下子元素直接参与 #topbar 横向并排；用 order 把"图标按钮"压到最右，保持原横屏视觉顺序 [重启] [参数] [记牌] [图标] */
  .top-actions { order: 4; }
  /* 横屏：锚定在牌桌顶部偏下（记牌器之下），避免头像/名称/张数被上方记牌器遮挡；
     牌列仍用 align-items:center 与头像共用同一水平中轴 */
  .opponent { top: 10px; transform: none; width: 42px; align-items: center; }
  #ai-left { left: clamp(10px, 3.5vw, 24px); }
  #ai-right { right: clamp(10px, 3.5vw, 24px); }
  .opp-hand .card.back { --card-w: 18px; --card-h: calc(var(--card-w) * 1.42); margin-top: calc(var(--card-h) * -0.74); }
  .opp-last { max-width: none; }
  #center { top: 50%; width: 60%; }
  /* 横屏：亮底牌时底牌脱离 #center 垂直居中栈，固定锚定在顶栏（记牌器）正下方，
     避免中央栈上溢被记牌器遮挡；竖屏保持原布局不动 */
  #bottom-cards {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 58px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
  }
  .hand { padding-top: 4px; min-height: calc(var(--card-h) + 8px); }
  /* 横屏：出牌区 mini 牌与横屏手牌尺寸同步 */
  .my-last .card.mini, .opp-last .card.mini { --card-w: clamp(28px, 5vw, 46px); }
  /* 横屏：玩家头像移到牌桌最左下角，脱离手牌行，避免遮挡手牌 */
  .human-avatar-wrap {
    position: absolute;
    left: 8px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
    z-index: 6;
  }
  .controls { margin-top: 4px; }
  /* 横屏：出牌按钮稍宽，便于点；文字横排 */
  .ctrl-btn { max-width: 120px; padding: 8px 4px; }
  /* 横屏：抢地主按钮再往上移、彻底避开手牌。
     让按钮绝对定位在桌面中央（即屏幕 vertical center），不再受 padding-bottom 限制。
     注意：父级 .overlay 是 fixed inset:0、align-items:flex-end；这里改用绝对定位覆盖。 */
  #overlay-bidding { padding-bottom: 0; }
  #overlay-bidding .bid-btns {
    position: absolute;
    left: 50%;
    top: 38%;
    transform: translate(-50%, -50%);
  }
  #overlay-bidding .big-btn { padding: 6px 11px; font-size: 16px; min-width: 58px; }
  /* 横屏顶栏：统计框挨着"重新开始"，记牌器内容内嵌顶栏中部、压缩显示，按钮组靠右不被挤出 */
  #topbar { flex-wrap: nowrap; gap: 4px; padding: 6px 8px; }
  /* 横屏下 .topbar-info = display:contents，下面的 chip 直接参与 #topbar 横向并排；以下规则只针对 chip 自身 */
  .topbar-info .stat, .topbar-info .stat-wild.show { min-width: 36px; padding: 3px 4px; font-size: 11px; }
  .topbar-info .stat .stat-label { font-size: 10px; }
  .top-btn { padding: 5px 8px; font-size: 13px; letter-spacing: 0; }
  #counter-panel {
    flex: 0 1 auto; min-width: 0; order: 0; align-self: center;
    margin: 0 4px; padding: 3px 5px;
    flex-wrap: nowrap; gap: 1px; overflow: hidden;  /* 一行 + 内容超出可缩 */
  }
  .counter-cell { width: 20px; font-size: 9px; padding: 0; flex: 0 0 auto; }
  .counter-cell .cr { font-size: 10px; }
  .counter-cell .cc { font-size: 7px; }
  .top-actions { gap: 6px; margin-left: auto; flex: 0 0 auto; }  /* 靠右、不挤出 */
  .icon-btn { width: 32px; height: 32px; font-size: 14px; }
  @media (max-width: 880px) {
    .counter-cell { width: 17px; font-size: 8px; }
    .counter-cell .cr { font-size: 9px; }
    .counter-cell .cc { font-size: 6px; }
    #counter-panel { gap: 1px; padding: 3px 3px; margin: 0 3px; }
    .top-btn { padding: 5px 6px; font-size: 12px; }
    .topbar-info .stat, .topbar-info .stat-wild.show { min-width: 32px; padding: 2px 3px; font-size: 10px; }
    .topbar-info .stat .stat-label { font-size: 9px; }
    .icon-btn { width: 30px; height: 30px; font-size: 13px; }
  }
  @media (max-width: 680px) {
    .counter-cell { width: 15px; font-size: 7px; }
    .counter-cell .cr { font-size: 8px; }
    .counter-cell .cc { font-size: 5px; }
    #counter-panel { gap: 1px; padding: 3px 2px; margin: 0 2px; }
  }
  /* 横屏：设置/帮助/开始菜单面板内容缩到约一半，避免高视口太低时内容溢出 */
  #overlay-settings .panel,
  #overlay-help .panel,
  #overlay-start .panel {
    max-width: 280px;
    padding: 10px 12px 12px;
    border-radius: 12px;
  }
  #overlay-settings .panel-title,
  #overlay-help .panel-title,
  #overlay-start .game-title {
    font-size: 14px;
    margin: 0 0 8px;
    letter-spacing: 2px;
  }
  #overlay-start .game-title { margin-top: 4px; }
  #overlay-start .subtitle { font-size: 11px; margin: 0 0 8px; }
  #overlay-start .menu-score { font-size: 12px; margin: 8px 0; }
  #overlay-settings .toggle-row,
  #overlay-settings .slider-row {
    padding: 6px 2px;
    font-size: 11px;
  }
  #overlay-settings .slider-row { padding-bottom: 8px; }
  #overlay-settings .seg { gap: 4px; }
  #overlay-settings .seg-btn { padding: 5px 0; font-size: 11px; border-radius: 8px; }
  #overlay-settings .toggle { width: 34px; height: 20px; border-radius: 10px; }
  #overlay-settings .toggle::after { width: 16px; height: 16px; top: 2px; left: 2px; }
  #overlay-settings .toggle.on::after { left: 16px; }
  #overlay-settings .slider { height: 3px; }
  #overlay-settings .slider::-webkit-slider-thumb,
  #overlay-settings .slider::-moz-range-thumb { width: 13px; height: 13px; }
  #overlay-settings .slider-val { min-width: 30px; font-size: 11px; }
  #overlay-settings .big-btn { padding: 6px 24px; font-size: 13px; margin-top: 6px; }
  #overlay-settings .row { gap: 6px; }
  #overlay-help .help-body { font-size: 11px; line-height: 1.45; max-height: 50vh; }
  #overlay-help .help-body p { margin: 4px 0; }
  #overlay-start .start-btns { gap: 6px; }
  #overlay-start .row { gap: 6px; }
  #overlay-start .big-btn { padding: 7px 0; font-size: 13px; }
  #overlay-start .field-label { font-size: 11px; margin-bottom: 4px; }
}

/* 小屏微调 */
@media (max-height: 560px) {
  :root { --card-w: clamp(26px, 7vw, 44px); }
  .opp-hand .card.back { --card-w: 18px; --card-h: calc(var(--card-w) * 1.42); margin-top: calc(var(--card-h) * -0.74); }
}

/* 竖屏：顶栏单行（重启 ↻ 图标 + 4 chip + 3 图标）整体横排；记牌器面板单独换到第 2 行 */
@media (orientation: portrait) {
  #topbar {
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: calc(env(safe-area-inset-top, 0px) + 4px) 8px 4px;
    flex-wrap: wrap;  /* 记牌器面板能换到第 2 行 */
  }
  .topbar-row { display: contents; }  /* 子元素直接参与 #topbar 横向并排 */
  /* 4 chip 居中并排：保留 .topbar-info 为真实 box，靠 flex:1 + justify-content:center 在 [重启] 与 [3 图标] 之间居中 */
  .topbar-info { display: flex; gap: 4px; flex: 1; justify-content: center; order: 3; }
  .topbar-info .stat { min-width: 38px; padding: 2px 4px; }
  .topbar-info .stat-val { font-size: 15px; }
  /* 重启 ↻ 图标靠左；3 图标靠右；用 order 排定 */
  #btn-restart { order: 1; }
  .top-actions { order: 5; }
  /* 重启按钮：文字"重新开始"已改为 ↻ 图标；与 .icon-btn 一致的圆形样式 */
  .top-btn { width: 30px; height: 30px; border-radius: 50%; padding: 0; letter-spacing: 0; font-size: 14px; line-height: 1; }
  .icon-btn { width: 30px; height: 30px; font-size: 14px; }
  /* 记牌器面板：换到第 2 行（flex-basis:100% 触发换行） */
  #counter-panel { flex-basis: 100%; order: 10; margin: 2px 0 4px; }
  /* 竖屏：电脑玩家背牌保持原柱状上下堆叠（每张重叠显示），便于一眼看清张数 */
  .opp-hand {
    flex-direction: column;
    flex-wrap: nowrap;
    max-width: none;
    margin-top: 2px;
  }
  .opp-hand .card.back {
    margin-top: calc(var(--card-h) * -0.62);
    margin-left: 0;
  }
  .opp-hand .card.back:first-child {
    margin-left: 0;
    margin-top: 0;
  }
  /* 竖屏：玩家手牌放大 25%（30→38 / 8vw→10vw / 50→63）；--card-h、--hand-overlap 等均跟随 --card-w 自动放大。
     仅竖屏生效，横屏保持原尺寸。 */
  :root { --card-w: clamp(38px, 10vw, 63px); }
  /* 竖屏：玩家已出牌的 mini 牌与手牌保持同尺寸（之前约定出牌区小牌=手牌大小） */
  .my-last .card.mini, .opp-last .card.mini { --card-w: clamp(38px, 10vw, 63px); }
  /* 竖屏：玩家头像垂直中轴对齐「第2行牌」(从底往上数第2行) 的中轴（横屏不动）。
     让 #my-last 脱离文档流浮到手牌上方，使 .human-body(align-items:center) 把头像对手牌居中；
     由之前对齐第1行(0.20)上移整整一行(-0.80)，使头像中轴落在第2行牌的垂直中轴。 */
  .human-main { position: relative; }
  #my-last { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 2px; }
  .human-avatar-wrap { transform: translateY(calc(var(--card-h) * -0.80)); }
  /* 竖屏：玩家出牌区在 .human-main 中横向居中（横屏保持 flex-start 不动）。
     #my-last 已 left:0 right:0 占满 .human-main 宽度；将 .my-last 改为 justify-content:center
     即可把其子节点 .my-last-row（已出牌）居中于 .human-main，而 .human-main 本身又因
     左侧 42px 头像与右侧 42px::after 占位而居于屏幕中线。 */
  .my-last { justify-content: center; }
  /* 竖屏：在右侧加一个与头像等宽（42px）的占位，平衡左侧头像所占空间，
     使 .human-main（玩家手牌+控制按钮）横向居中于屏幕中线；纵向位置保持不变 */
  .human-body::after { content: ""; flex: 0 0 auto; width: 42px; }
  /* 竖屏：非当前出牌（lastPlay.seat）的电脑玩家牌面变暗，便于一眼分辨最新一手 */
  .opp-last-dim { opacity: 0.42; }
  /* 竖屏：玩家控制按钮横向单行紧凑排布（最小/最大/提示/重选/不要/出牌 共 6 个），
     不再沿用基线 max-width:110px / font-size:16px，否则会被挤压成"按钮竖排 + 文字竖排"。 */
  .controls {
    flex-wrap: nowrap;         /* 强制单行，挤不下时按钮尺寸自动收缩（white-space:nowrap） */
    gap: 4px;
    margin-top: 4px;
    width: 100%;
    justify-content: center;   /* 6 按钮整体居中显示，不再 space-between 撑满导致"出牌"溢出 */
    padding: 0 2px;            /* 两端各留 2px，避免边缘贴死 */
  }
  .ctrl-btn {
    flex: 1 1 0;               /* 6 按钮完全等宽 */
    min-width: 0;
    padding: 9px 4px;          /* 缩小内边距，让"最小/最大"等 2 字能横排 */
    font-size: 12px;           /* 缩小字号，避免"出牌"溢出 */
    line-height: 1.1;
    white-space: nowrap;       /* 强制单行横排，CJK 不再被自动竖排 */
    border-radius: 10px;
    box-shadow: 0 2px 0 rgba(0,0,0,.3);  /* 阴影也缩小 */
  }
  /* "出牌"主按钮：等宽（不再撑满剩余），仅靠 .primary 金色填充保持主次区分 */
  #btn-play { font-size: 13px; padding: 9px 4px; }
}

/* ============================================================
 *  模式选择 & 局域网联机界面
 * ============================================================ */
.mode-panel { max-width: 360px; width: 86%; text-align: center; }
.mode-list { display: flex; flex-direction: column; gap: 12px; margin: 18px 0 6px; }
.mode-btn {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: none; border-radius: var(--ui-radius);
  background: linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border: 1px solid rgba(244, 210, 122, 0.35);
  color: #fff; cursor: pointer; text-align: left;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.mode-btn:active { transform: scale(0.98); }
.mode-btn .mode-ico { font-size: 30px; width: 38px; text-align: center; }
.mode-btn .mode-text { display: flex; flex-direction: column; line-height: 1.25; }
.mode-btn .mode-text b { font-size: 17px; color: var(--gold); }
.mode-btn .mode-text i { font-style: normal; font-size: 12px; opacity: 0.8; }
.mode-btn.bomb { border-color: rgba(255, 120, 90, 0.5); }
.mode-btn.bomb .mode-text b { color: #ff9a6b; }
.mode-btn.lan { border-color: rgba(110, 200, 255, 0.5); }
.mode-btn.lan .mode-text b { color: #8fd4ff; }

/* 局域网 */
.lan-panel { max-width: 360px; width: 88%; }
.lan-view { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.lan-tip { font-size: 13px; line-height: 1.6; opacity: 0.85; text-align: left; }
.lan-tip code, .lan-room-ip code { background: rgba(0,0,0,0.35); padding: 2px 6px; border-radius: 6px; color: var(--gold); }
.lan-input {
  width: 100%; padding: 12px 12px; border-radius: 10px; border: 1px solid rgba(244,210,122,0.4);
  background: rgba(0,0,0,0.30); color: #fff; font-size: 15px; letter-spacing: 0.5px;
}
.lan-input::placeholder { color: rgba(255,255,255,0.45); }
.lan-msg { min-height: 18px; font-size: 13px; color: #ff9a6b; text-align: left; }
.lan-msg.ok { color: #7fe0a0; }
.room-list-title { font-size: 14px; opacity: 0.9; text-align: left; margin: 2px 0 0; }
.room-list { display: flex; flex-direction: column; gap: 8px; max-height: 38vh; overflow-y: auto; }
.room-empty { font-size: 13px; opacity: 0.7; text-align: left; padding: 8px 2px; }
.room-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(244,210,122,0.25);
}
.room-info { text-align: left; min-width: 0; }
.room-name { font-size: 15px; font-weight: 600; color: #fff; }
.room-addr { font-size: 12px; opacity: 0.7; margin-top: 2px; word-break: break-all; }
.room-join-btn {
  flex: 0 0 auto; padding: 8px 16px; border: none; border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, #f7d27a, #e0ab2e); color: #3a2a05; font-size: 14px; font-weight: 700;
  box-shadow: 0 3px 0 #8a6a1f;
}
.room-join-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a6a1f; }
.room-divider { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: 0.6; margin: 2px 0; }
.room-divider::before, .room-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.2); }
.lan-room-role {
  align-self: center; font-size: 14px; padding: 4px 14px; border-radius: 999px;
  background: rgba(110,200,255,0.18); border: 1px solid rgba(110,200,255,0.5); color: #8fd4ff;
}
.lan-room-ip { font-size: 13px; text-align: center; }
.lan-players { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; }
.lan-player {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px;
  background: rgba(0,0,0,0.28); font-size: 14px;
}
.lan-player .dot { width: 8px; height: 8px; border-radius: 50%; background: #7fe0a0; }
.lan-player .seat-tag { margin-left: auto; font-size: 12px; opacity: 0.7; }
.lan-player.ai .dot { background: #c9a24a; }
.lan-player.waiting .dot { background: #888; }

/* ============================================================
 *  横屏弹层适配（追加在文件末尾，用于覆盖前面的同名规则）
 *  背景：横屏视口高度通常只有 300~330px（实测设备 715×320 CSS px），
 *        可用高度仅 ~288px。而模式选择面板沿用了竖屏的「竖排大卡片」，
 *        实测高 542px，上下各被裁掉一大截（顶部标题、底部按钮都看不到）。
 *  做法：① 模式选择改成横向三段式（标题行 / 三张模式卡一行 / 开关+按钮一行）
 *        ② 弹层加纵向滚动兜底，内容再高也不会「裁掉且滚不到」
 *        ③ 关于作者面板同步缩一档
 *  竖屏（portrait）完全不受影响。
 * ============================================================ */
@media (orientation: landscape) {

  /* ---------- ① 弹层滚动兜底 ---------- */
  /* 抢地主层是浮在牌桌上的纯按钮层，不参与滚动，单独排除 */
  .overlay:not(#overlay-bidding) {
    align-items: flex-start;      /* 配合子元素 margin:auto 实现「可滚动的居中」 */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 16px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .overlay:not(#overlay-bidding)::-webkit-scrollbar { width: 0; height: 0; }
  /* 关键：用 margin:auto 居中而不是 align-items:center。
     后者在内容超高时会向两侧溢出，顶部那半截滚不到（本次 bug 的成因之一）。 */
  .overlay:not(#overlay-bidding) > .panel { margin: auto; }

  /* ---------- ② 模式选择：竖排 → 横排三段式 ---------- */
  #overlay-mode .mode-panel {
    max-width: 660px;
    width: 100%;
    padding: 15px 18px 17px;
    border-radius: 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "title   sub"
      "modes   modes"
      "toggles actions";
    align-items: center;
    column-gap: 14px;
    row-gap: 13px;
  }
  #overlay-mode .game-title {
    grid-area: title;
    font-size: 23px; letter-spacing: 4px; margin: 0;
    text-align: left;            /* 横屏标题靠左，与右侧副标题组成一条页眉 */
  }
  #overlay-mode .subtitle {
    grid-area: sub;
    margin: 0; font-size: 12px; opacity: .72; text-align: right;
  }

  /* 三张模式卡并排 */
  #overlay-mode .mode-list {
    grid-area: modes;
    flex-direction: row;
    gap: 10px;
    margin: 0;
  }
  #overlay-mode .mode-btn {
    flex: 1 1 0; min-width: 0;
    flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px;
    padding: 11px 8px;
    text-align: center;
    border-radius: 12px;
  }
  #overlay-mode .mode-btn .mode-ico { font-size: 24px; width: auto; line-height: 1.15; }
  #overlay-mode .mode-btn .mode-text { align-items: center; }
  #overlay-mode .mode-btn .mode-text b { font-size: 16px; }
  #overlay-mode .mode-btn .mode-text i { font-size: 11.5px; }
  #overlay-mode .mode-btn:active { transform: scale(.97); }

  /* 两个开关并排（横屏下改成带底色的胶囊卡片，与按钮同一行） */
  #overlay-mode .mode-toggles {
    grid-area: toggles;
    display: flex; gap: 8px;
    margin: 0;
    border-top: none;
  }
  #overlay-mode .mode-toggles .toggle-row {
    flex: 1 1 0; min-width: 0;
    padding: 8px 10px;
    border: 1px solid rgba(244, 210, 122, .16);
    border-radius: 10px;
    background: rgba(0, 0, 0, .16);
  }
  #overlay-mode .mode-toggles .toggle-row span { font-size: 13px; }
  #overlay-mode .mode-toggles .toggle-row small { font-size: 10.5px; }
  #overlay-mode .mode-toggles .toggle { width: 42px; height: 24px; border-radius: 12px; }
  #overlay-mode .mode-toggles .toggle::after { width: 18px; height: 18px; top: 3px; left: 3px; }
  #overlay-mode .mode-toggles .toggle.on::after { left: 21px; }

  /* 关于作者 / 退出游戏：不撑满，跟在开关右边同一行 */
  #overlay-mode .row { grid-area: actions; gap: 8px; margin: 0; }
  #overlay-mode .row .big-btn {
    flex: 0 0 auto;
    padding: 9px 14px;
    font-size: 13px;
    border-radius: 10px;
    white-space: nowrap;
  }

  /* ---------- ③ 关于作者面板：横屏缩一档 ---------- */
  #overlay-about .panel { max-width: 430px; padding: 14px 16px 15px; }
  #overlay-about .panel-title { font-size: 15px; margin: 0 0 8px; }
  #overlay-about .about-body { font-size: 11.5px; line-height: 1.55; max-height: none; }
  #overlay-about .about-body p { margin: 6px 0; }
  #overlay-about .big-btn { padding: 8px 0; font-size: 13px; }
}

/* 横屏极矮屏（某些横屏窗口/分屏）：模式卡再压一档，避免出现滚动 */
@media (orientation: landscape) and (max-height: 300px) {
  #overlay-mode .mode-panel { padding: 11px 14px 12px; row-gap: 9px; }
  #overlay-mode .game-title { font-size: 19px; letter-spacing: 2px; }
  #overlay-mode .mode-btn { padding: 8px 6px; gap: 3px; }
  #overlay-mode .mode-btn .mode-ico { font-size: 20px; }
  #overlay-mode .mode-btn .mode-text b { font-size: 14px; }
  #overlay-mode .mode-btn .mode-text i { font-size: 10.5px; }
  #overlay-mode .mode-toggles .toggle-row { padding: 6px 8px; }
  #overlay-mode .mode-toggles .toggle-row span { font-size: 12px; }
  #overlay-mode .mode-toggles .toggle-row small { font-size: 9.5px; }
  #overlay-mode .mode-toggles .toggle { width: 36px; height: 21px; border-radius: 11px; }
  #overlay-mode .mode-toggles .toggle::after { width: 15px; height: 15px; top: 3px; left: 3px; }
  #overlay-mode .mode-toggles .toggle.on::after { left: 18px; }
  #overlay-mode .row .big-btn { padding: 7px 11px; font-size: 12px; }
}


/* ==== UI 精修：主菜单与顶栏（2026-10-11 用户要求「高级美观」）====
 * 全部为层叠覆盖：写在原规则之后靠源顺序胜出，不改写任何既有规则。
 * 手感关键词：玻璃拟态（渐变底 + 顶部内高光 + 细描边）、图标容器化、
 * 金色数字排版、hover 光泽扫过 + 按压微反馈。
 */

/* ---- 1. 模式卡：玻璃质感 + 高光线 + 光泽扫过 ---- */
.mode-btn {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, rgba(255,255,255,.13), rgba(255,255,255,.045) 55%, rgba(0,0,0,.10));
  border: 1px solid rgba(244,210,122,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 6px 16px rgba(0,0,0,.28);
  transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease;
}
.mode-btn::before {           /* 卡片顶部的 1px 金色高光线 */
  content: ''; position: absolute; top: 0; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,235,180,.55), transparent);
  pointer-events: none;
}
.mode-btn::after {            /* 悬停/按压时扫过的高光 */
  content: ''; position: absolute; top: -10%; bottom: -10%; left: -70%; width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,.14), transparent);
  transform: skewX(-18deg); transition: left .5s ease; pointer-events: none;
}
.mode-btn:hover::after { left: 135%; }
.mode-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(244,210,122,.78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 10px 24px rgba(0,0,0,.36);
}
.mode-btn:active { transform: scale(.975); }

/* 图标容器化：emoji 不再裸放，坐进带渐变与内高光的圆角座里 */
.mode-btn .mode-ico {
  width: 46px; height: 46px; border-radius: 14px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, rgba(255,255,255,.16), rgba(255,255,255,.03));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 4px 10px rgba(0,0,0,.30);
  font-size: 25px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
}
.mode-btn .mode-text b { letter-spacing: 1px; }
.mode-btn .mode-text i { opacity: .72; letter-spacing: .3px; }

/* 炸弹/联机卡的专属氛围（暖橙 / 冷蓝的光晕底） */
.mode-btn.bomb {
  border-color: rgba(255,140,100,.48);
  background: linear-gradient(150deg, rgba(255,120,80,.17), rgba(255,255,255,.03) 55%, rgba(0,0,0,.10));
}
.mode-btn.bomb .mode-text b { text-shadow: 0 1px 6px rgba(255,120,80,.35); }
.mode-btn.lan {
  border-color: rgba(110,200,255,.48);
  background: linear-gradient(150deg, rgba(80,170,255,.17), rgba(255,255,255,.03) 55%, rgba(0,0,0,.10));
}
.mode-btn.lan .mode-text b { text-shadow: 0 1px 6px rgba(80,170,255,.35); }

/* ---- 2. 开关行：从分隔线列表改成独立玻璃胶囊 ---- */
#overlay-mode .mode-toggles {
  border-top: none; gap: 8px;
  display: flex; flex-direction: column;
  margin: 12px 0 10px;
}
#overlay-mode .mode-toggles .toggle-row {
  border: none; border-radius: 12px; padding: 11px 14px;
  background: linear-gradient(150deg, rgba(255,255,255,.09), rgba(255,255,255,.02) 60%, rgba(0,0,0,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
#overlay-mode .mode-toggles .toggle-row small { opacity: .58; letter-spacing: .3px; }

/* ---- 3. 底部 ghost 按钮（关于作者 / 退出游戏）：玻璃渐变 + 实体按压 ---- */
.big-btn.ghost {
  background: linear-gradient(150deg, rgba(255,255,255,.15), rgba(255,255,255,.05) 55%, rgba(0,0,0,.12));
  border: 1px solid rgba(244,210,122,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 3px 0 rgba(0,0,0,.28);
}
.big-btn.ghost:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 1px 0 rgba(0,0,0,.28);
}

/* 主菜单标题：微金色环境光 */
#overlay-mode .game-title {
  text-shadow: 0 2px 0 rgba(0,0,0,.35), 0 5px 16px rgba(244,210,122,.28);
}

/* ---- 4. 顶栏：数字芯片 + 圆钮的质感统一 ---- */
.stat {
  min-width: 48px; padding: 3px 8px; border-radius: 11px;
  background: linear-gradient(160deg, rgba(0,0,0,.38), rgba(0,0,0,.16));
  border: 1px solid rgba(244,210,122,.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.10), 0 3px 8px rgba(0,0,0,.22);
}
.stat-label { font-size: 9.5px; letter-spacing: 2px; padding-left: 2px; opacity: .66; }
.stat-val {
  font-variant-numeric: tabular-nums; letter-spacing: .5px;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.stat-wild {
  background: linear-gradient(160deg, rgba(244,210,122,.20), rgba(244,210,122,.06));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14);
}
.icon-btn {
  background: radial-gradient(120% 120% at 30% 25%, rgba(255,255,255,.14), rgba(0,0,0,.30) 70%);
  border: 1px solid rgba(244,210,122,.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 3px 8px rgba(0,0,0,.26);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  transition: transform .1s ease, border-color .15s ease, box-shadow .15s ease;
}
.icon-btn:hover {
  border-color: rgba(244,210,122,.85);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 4px 12px rgba(0,0,0,.34);
}
.top-btn {
  background: linear-gradient(160deg, rgba(0,0,0,.34), rgba(0,0,0,.14));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 3px 8px rgba(0,0,0,.22);
}

/* ---- 5. 横屏适配的重置与微调（与上方 @media 的网格布局对齐）----
 * 竖屏把开关行改成了 column 卡片，横屏网格里要恢复并排；
 * 图标容器在横屏窄卡里缩到 42px 并去掉外发光，避免拥挤。 */
@media (orientation: landscape) {
  #overlay-mode .mode-toggles { flex-direction: row; margin: 0; }
  #overlay-mode .mode-toggles .toggle-row { flex: 1 1 0; min-width: 0; padding: 8px 12px; }
  #overlay-mode .mode-btn .mode-ico { width: 42px; height: 42px; font-size: 22px; border-radius: 12px; }
  #overlay-mode .mode-btn:hover { transform: none; }
  #overlay-mode .mode-btn:active { transform: scale(.97); }
}

/* ==== UI 精修结束 ==== */

/* ==== 金币与商店：金币图标 / 菜单 / 金币商店（2026-10-11） ==== */
.coin-ico {
  width: 1em; height: 1em; vertical-align: -0.12em;
  margin-right: 2px; object-fit: contain;
}
.coin-ico.big { width: 34px; height: 34px; }
.stat-label .coin-ico { width: 11px; height: 11px; vertical-align: -1px; margin-right: 1px; }
.stat-coin .stat-val { font-size: clamp(12px, 3.6vw, 16px); }
.menu-panel { display: flex; flex-direction: column; gap: 10px; }
.menu-panel .menu-btn { width: 100%; }
.shop-balance {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 14px; opacity: .95; margin-bottom: 12px;
}
.shop-balance .coin-ico { width: 18px; height: 18px; }
.shop-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.shop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(0,0,0,.22); border: 1px solid rgba(244,210,122,.3);
}
.shop-item .coin-ico.big { flex: 0 0 auto; }
.shop-item-info { flex: 1 1 auto; text-align: left; min-width: 0; }
.shop-item-name { font-weight: 800; color: var(--gold); font-size: 15px; }
.shop-item-desc { font-size: 11px; opacity: .65; margin-top: 2px; }
.shop-buy { flex: 0 0 auto; padding: 8px 14px; font-size: 14px; }
/* ==== 金币与商店结束 ==== */

/* ==== 桌面背景：设置可选（经典/湖景/红桌），横竖屏自动切图（2026-10-11） ==== */
#app.bg-1 {
  background:
    linear-gradient(rgba(8,22,38,.34), rgba(8,22,38,.34)),
    url('../img/bg1_h.jpg') center/cover no-repeat;
}
#app.bg-2 {
  background:
    linear-gradient(rgba(22,10,10,.30), rgba(22,10,10,.30)),
    url('../img/bg2_h.jpg') center/cover no-repeat;
}
@media (orientation: portrait) {
  #app.bg-1 { background-image: linear-gradient(rgba(8,22,38,.34), rgba(8,22,38,.34)), url('../img/bg1_v.jpg'); }
  #app.bg-2 { background-image: linear-gradient(rgba(22,10,10,.30), rgba(22,10,10,.30)), url('../img/bg2_v.jpg'); }
}
/* 暗夜鎏金：深紫黑 + 紫金 */
#app.bg-3 {
  background:
    radial-gradient(70% 42% at 50% 44%, rgba(255,220,150,0.10) 0%, transparent 70%),
    radial-gradient(130% 70% at 50% -8%, rgba(120,80,200,0.25) 0%, transparent 60%),
    radial-gradient(150% 120% at 50% 32%, #2a1a4a 0%, #1a1030 40%, #0a0618 100%);
}
/* 翡翠琉璃：祖母绿 + 青碧 */
#app.bg-4 {
  background:
    radial-gradient(70% 42% at 50% 44%, rgba(200,255,230,0.12) 0%, transparent 70%),
    radial-gradient(130% 70% at 50% -8%, rgba(120,255,210,0.18) 0%, transparent 60%),
    radial-gradient(150% 120% at 50% 32%, #1a8a6a 0%, #0d5a48 40%, #063a2e 100%);
}
/* ==== 桌面背景结束 ==== */

/* ==== 弹层白底主题：设置/菜单/主页等面板底色改白（2026-10-12 用户要求） ====
 * 范围：仅 .panel / .double-panel 弹层内部，牌桌与顶栏不受影响。
 * 深金色 #9a7418 = var(--gold) 的白底可读版；正文深灰、控件浅灰。 */
.panel, .double-panel {
  background:
    linear-gradient(180deg, rgba(201,162,39,.20) 0px, rgba(201,162,39,.20) 6px, rgba(154,116,24,.45) 6px, rgba(154,116,24,.45) 7px, rgba(0,0,0,0) 7px) no-repeat,
    url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='96'%20height='96'%3E%3Cg%20opacity='.055'%3E%3Cpath%20fill='%23b0392b'%20d='M24%206%20L38%2024%20L24%2042%20L10%2024%20Z'/%3E%3Cg%20fill='%232f3540'%3E%3Ccircle%20cx='72'%20cy='14'%20r='7'/%3E%3Ccircle%20cx='64'%20cy='26'%20r='7'/%3E%3Ccircle%20cx='80'%20cy='26'%20r='7'/%3E%3Crect%20x='70'%20y='24'%20width='4'%20height='12'%20rx='2'/%3E%3C/g%3E%3Cpath%20fill='%23b0392b'%20d='M24%2090%20C%2010%2078,%208%2066,%2016%2061%20C%2021%2058,%2024%2062,%2024%2065%20C%2024%2062,%2027%2058,%2032%2061%20C%2040%2066,%2038%2078,%2024%2090%20Z'/%3E%3Cg%20fill='%232f3540'%3E%3Cpath%20d='M72%2054%20C%2086%2066,%2088%2078,%2080%2083%20C%2075%2086,%2072%2082,%2072%2079%20C%2072%2082,%2069%2086,%2064%2083%20C%2056%2078,%2058%2066,%2072%2054%20Z'/%3E%3Crect%20x='70'%20y='80'%20width='4'%20height='10'%20rx='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") 0 0 / 96px 96px repeat,
    linear-gradient(180deg, #fdfaf3, #f2ead6) no-repeat;
  border-color: #e0d6bc;
  color: #2a2f36;
  box-shadow: 0 12px 40px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.8);
}
.panel-title, .double-title, .game-title { color: #9a7418; }
.subtitle, .double-hint { color: #5a6068; opacity: 1; }
.menu-score { color: #2a2f36; }
.menu-score b { color: #9a7418; }
.field-label { color: #5a6068; opacity: 1; }
.toggle-row { color: #2a2f36; border-bottom-color: #e3e8ee; }
.mode-toggles { border-top-color: #e3e8ee; }
.seg-btn {
  background: #f3eee0; color: #2a2f36;
  border-color: #ddd2b6;
}
.seg-btn.active { background: linear-gradient(180deg, #ffe9a8, var(--gold-deep)); color: #2a1d05; }
.toggle { background: #e3dac2; }
.toggle.on { background: var(--gold-deep); }
.slider {
  background: linear-gradient(to right, var(--gold) 0%, var(--gold) var(--p,50%), #e3dac2 var(--p,50%), #e3dac2 100%);
}
.slider::-webkit-slider-thumb,
.slider::-moz-range-thumb { border: 2px solid #c9a227; }
.slider-val { color: #9a7418; }
.big-btn.ghost { background: #fffdf6; color: #2a2f36; border: 1px solid #ddd2b6; box-shadow: 0 3px 0 rgba(0,0,0,.12); }
.result-detail { color: #2a2f36; opacity: 1; }
.result-detail b { color: #9a7418; }
.help-body b, .about-body b { color: #9a7418; }
.shop-balance { color: #2a2f36; }
.shop-item { background: #f6f1e3; border-color: #e0d6bc; }
.shop-item-name { color: #9a7418; }
.shop-item-desc { color: #5a6068; opacity: 1; }
.double-reveal {
  background: #f6f1e3; border-color: #e0d6bc;
  color: #2a2f36;
}
.double-reveal.on { border-color: #c9a227; background: #fdf3d7; }
/* ==== 弹层白底主题结束 ==== */

/* ==== 竖屏顶栏单行：紧凑版，不改原布局顺序（2026-10-12 用户钦定） ====
 * 顺序恢复为原竖屏版：[↻ 最左] [4 信息 chip 居中] [牌/菜/⚙ 最右]，记牌器仍独占第 2 行。
 * 但不依赖 display:contents（部分老 WebView 不支持，会退化成按钮纵向堆两行）：
 * .topbar-actions 改为绝对定位铺满第 1 行、两端对齐 —— ↻ 落最左、牌/菜/⚙ 落最右；
 * .topbar-info 为真实盒子 margin:auto 居中，视觉顺序与原版一致，仅尺寸收紧。
 * 容器 pointer-events:none，避免透明绝对定位层挡住 chip 点击。 */
@media (orientation: portrait) {
  #topbar { position: relative; flex-wrap: wrap; gap: 3px 2px; padding-left: 6px; padding-right: 6px; }
  .topbar-row.topbar-actions {
    position: absolute; left: 6px; right: 6px;
    top: calc(env(safe-area-inset-top, 0px) + 4px);
    display: flex; flex-direction: row; align-items: center;
    justify-content: space-between; gap: 5px; order: 1; pointer-events: none;
  }
  .topbar-row.topbar-actions .top-btn,
  .topbar-row.topbar-actions .icon-btn { pointer-events: auto; }
  .topbar-info {
    display: flex; gap: 3px; flex: 0 1 auto; min-width: 0; align-items: center;
    justify-content: flex-start; order: 3; min-height: 27px;
    max-width: calc(100% - 146px);
    margin-left: 40px; margin-right: auto;  /* 紧挨重启钮（左 padding6+27px），左对齐不居中，远离右侧图标 */
  }
  .topbar-info .stat { min-width: 0; flex: 0 1 auto; padding: 2px 3px; white-space: nowrap; }
  .topbar-info .stat-val { font-size: 13px; }
  .topbar-info .stat .stat-label { font-size: 9px; }
  #btn-restart { order: 0; }   /* 覆盖旧竖屏块的 order:1，重启钮保持组内最左 */
  .top-actions { order: 1; gap: 4px; }
  .top-btn, .icon-btn { width: 27px; height: 27px; font-size: 13px; }
  #counter-panel { flex-basis: 100%; order: 10; margin: 2px 0 4px; }
}
/* ==== 竖屏顶栏单行结束 ==== */

/* ==== 横屏出牌区单行：左右电脑玩家出的牌不论张数都排同一行（2026-10-12 用户要求） ====
 * 竖屏保持 JS 每 6 张拆一行（.opp-last-row）不变；横屏把 .opp-last 改横向 flex、
 * .opp-last-row 改横排且去掉「组内首张 margin 复位」，跨组也连续重叠成一条线，
 * 仅整体第一张不留负边距。牌多时向屏幕内侧延伸（left/right 锚定不动）。 */
@media (orientation: landscape) {
  .opp-last { flex-direction: row; align-items: flex-end; gap: 0; }
  .opp-last-row { display: flex; flex-wrap: nowrap; height: auto; line-height: normal; }
  .opp-last-row .card { margin-left: calc(var(--card-w) * -0.30); }
  .opp-last-row:first-child .card:first-child { margin-left: 0; }
  .opp-last .pass-tag { margin-left: 0; }
}
/* ==== 横屏出牌区单行结束 ==== */

/* 九州音娱：牌桌水印 */
#table-area::after {
  content: "九州娱乐";
  position: absolute; left: 50%; top: 46%; transform: translate(-50%,-50%);
  font-size: 56px; font-weight: 800; letter-spacing: 14px;
  color: rgba(244,210,122,0.12); pointer-events: none; z-index: 0;
  white-space: nowrap;
}

/* 金箔余额 + 兑换码 */
.shop-foil { text-align:center; font-size:14px; color:var(--gold); margin:6px 0; }
.shop-foil b { color:#ffe9a8; }
.redeem-box { display:flex; gap:8px; margin:10px 0; }
.redeem-box input {
  flex:1; padding:10px 12px; border-radius:10px; border:1px solid var(--gold-deep);
  background:rgba(0,0,0,.3); color:#fff; font-size:14px; outline:none;
}
.redeem-box input::placeholder { color:rgba(255,255,255,.4); }
.redeem-box .big-btn { padding:8px 16px; font-size:13px; }
