﻿/* ---------- 顶部：标题 + 操作提示 ---------- */
header {
  position: relative;   /* 顶栏 #pkBar 锚定在这里，避免溢出屏幕 */
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 8px;
}
.brand { display: flex; align-items: baseline; gap: 7px; }

.ver { font-size: 11.5px; color: var(--dim); letter-spacing: 0; }
/* 竖屏时版本号挂在「十三水」标题下方（绝对定位，不挤压布局） */
.brand { position: relative; }
.ver-under { font-size: 10px; line-height: 12px; color: var(--dim); letter-spacing: 0; margin-left: -9px; }   /* 竖屏：内联在标题右侧，基线对齐 = 底部齐平 */

header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 3px;
  color: var(--text);
  flex: none;
}

/* 十三水 · 网页版样式 */
:root {
  --felt: #124a32;
  --panel: rgba(0, 0, 0, .18);
  --panel-border: rgba(212, 175, 96, .35);
  --gold: #d4af60;
  --text: #f0f4f0;
  --dim: #a8baae;
  --win: #eb5a50;
  --lose: #5acd82;

  /* 我摆好的牌：按屏宽自动放大，(屏宽-134px)/5，最宽 64px */
  --cw: min(64px, calc((100vw - 134px) / 5));
  --ch: calc(var(--cw) * 1.38);
  /* 三家：牌贴到面板内边框（1px），牌间 1px，三道行距 2px，牌宽按面板宽度反算 */
  --opp-gap: 5px;      /* 三个面板之间 */
  --opp-pad: 1px;      /* 牌 ↔ 面板边框（上/右/下） */
  --opp-pad-l: 2px;    /* 左边框 ↔ 第一张牌 */
  --card-gap: 1px;     /* 牌 ↔ 牌 */
  --row-gap: 2px;      /* 三道之间（名字行同值） */
  --score-w: 44px;     /* 头道右侧「本局/累计」列宽（估算值） */
  --panel-inner: calc((min(100vw, 760px) - 20px - 2 * var(--opp-gap)) / 3 - 2px - var(--opp-pad) - var(--opp-pad-l));
  --sw: min(
    calc((var(--panel-inner) - 4 * var(--card-gap)) / 5),   /* 中/尾道 5 张不溢出 */
    calc((var(--panel-inner) - 2 * var(--card-gap) - 2px - var(--score-w)) / 3),  /* 头道 3 张 + 分数列 */
    34px                                                     /* 桌面封顶 */
  );
  --sh: calc(var(--sw) * 1.38);
  --gap: 5px;
  --typew: 46px;   /* 牌型文字列宽（三道对齐用） */
}

* { box-sizing: border-box; }

html, body { overflow-x: hidden; }   /* 防止任何元素把页面撑宽（手机上顶栏被切、界面显示不全） */
body {
  margin: 0;
  background: var(--felt);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 760px;
  /* 安全区：刘海屏顶部 / 底部 Home 条 / 横屏左右；Android 上 env() 为 0，无副作用 */
  padding: calc(26px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
  min-height: 100vh;
  min-height: 100dvh;        /* iOS 地址栏收起/展开时高度更可靠 */
}

html.in-app #app { padding-top: 6px; }   /* APK 里不要那 20px */
html { scrollbar-gutter: stable; }   /* 滚动条出现/消失不改变布局宽度 */

/* 空位（没有真人的座位）：占位显示，等下一局有人补进来 */
.opp.empty { opacity: .5; }
.card.ghost { background: transparent !important; border: 1px dashed rgba(255, 255, 255, .16) !important; box-shadow: none !important; }
.card.ghost .rank, .card.ghost .suit { display: none; }
.opp.empty .oname .seat-empty { color: var(--dim); font-size: 13px; }

/* ---------- 三家（一行） ---------- */
.opponents {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 5px;
}

.opp {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: var(--opp-pad) var(--opp-pad) var(--opp-pad) var(--opp-pad-l);
  min-width: 0;
  overflow: hidden;          /* 牌贴到 1px 后，用圆角把牌角裁齐 */
}

.opp .oname { display: flex; align-items: baseline; gap: 4px; font-size: 12.5px; padding: 0 2px; margin-bottom: var(--row-gap); white-space: nowrap; overflow: hidden; min-height: 15px; }
.opp .oname .ospec { display: inline-flex; gap: 3px; flex: 1 1 auto; min-width: 0; justify-content: center; overflow: hidden; font-size: 15px; }
.opp .oname .badge { font-size: inherit; font-weight: 400; background: #000; padding: 0 4px; border-radius: 3px; }
.opp .oname .badge.gold { color: var(--gold); }
.opp .oname .badge.bad { color: var(--win); }

.opp .oline {
  min-height: var(--sh);
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: var(--row-gap);
}
.opp .oline:last-child { margin-bottom: 0; }

.opp .ocards { display: flex; gap: var(--card-gap); flex: none; }
.opp .ocards .card {
  width: var(--sw);
  height: var(--sh);
  flex: none;
  cursor: default;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.opp .ocards .card .rank { font-size: calc(var(--sw) * .54); left: 6%; top: 2%; }
.opp .ocards .card .suit { font-size: calc(var(--sw) * .56); top: 64%; transform: translateY(-50%); }

/* 三家的分数：本局在上、累计在下 */
.opp .oscore {
  margin-left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  font-size: 8.5px;
  color: var(--dim);
  white-space: nowrap;
  flex: none;
  min-width: 0;
}
.opp .oscore .l { display: flex; align-items: baseline; justify-content: flex-start; gap: 3px; }
.opp .oscore i { font-style: normal; flex: none; }
.opp .oscore b { font-size: 11.5px; font-weight: 400; color: var(--text); min-width: 1.9em; text-align: left; }
.opp .oscore b.zero { text-align: center; }
.opp .oscore b.win { color: var(--win); }
.opp .oscore b.lose { color: var(--lose); }

/* ---------- 我的三道 ---------- */
.table {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 9px 11px;
  margin-bottom: 5px;
  touch-action: pan-y;
}

.row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  min-height: var(--ch);
}
.row:first-child { margin-top: 0; }
.row:last-child { margin-bottom: 0; }

.row .label { width: 32px; font-size: 13px; color: var(--gold); flex: none; }
.row .slots { display: flex; gap: var(--gap); flex: none; }

.row .rowscore {
  margin-right: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;                 /* 行距统一交给三行的 line-height: 18px */
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;      /* 徽标行要越过右侧牌型列，铺到面板右边框 */
  padding-left: 4px;
}
.row .rowscore .l { display: flex; align-items: baseline; justify-content: flex-start; gap: 4px; line-height: 18px; }
/* 我的名字：放在本局分数上方（字号与三家的名字一致，三行行距统一 18px） */
.row .rowscore .me {
  font-size: 15px;
  color: var(--gold);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 18px;
}

/* 名字 + 特殊牌型徽标同一行：徽标从名字右侧铺到面板右边框（宽度 + 牌型列 + 间距） */
.row .rowscore .meLine {
  display: flex;
  align-items: baseline;
  gap: 3px;                                       /* 名字右边 → 徽标区 3px */
  width: calc(100% + var(--typew) + 6px + 8px);   /* 右端贴到面板边框内 3px（11 - 3 = 8） */
  line-height: 18px;
}
.row .rowscore .meLine .me { flex: 0 1 auto; min-width: 0; }
.row .rowscore .meLine .spec {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;                     /* 徽标在区域内居中 */
  align-items: baseline;
  line-height: 18px;
}
.row .rowscore .spec { display: flex; flex-wrap: nowrap; gap: 4px; line-height: 1.2; font-size: 15px; justify-content: center; max-width: 100%; overflow: hidden; }
.badge { font-size: inherit; font-weight: 400; background: #000; padding: 0 4px; border-radius: 3px; }
.badge.gold { color: var(--gold); }
.badge.bad { color: var(--win); }
.row .rowscore .l i { font-style: normal; font-size: 13px; width: 2.2em; text-align: right; flex: none; }
.row .rowscore .l b { font-size: 13px; font-weight: 400; color: var(--text); min-width: 2.3em; text-align: left; }
.row .rowscore .l b.zero { text-align: center; }
.row .rowscore .l b.win { color: var(--win); }
.row .rowscore .l b.lose { color: var(--lose); }

.row .type {
  margin-left: auto;
  width: var(--typew);
  flex: none;
  font-size: 13px;
  color: var(--gold);
  text-align: right;
}

.slot {
  width: var(--cw);
  height: var(--ch);
  border: 1px dashed rgba(255, 255, 255, .14);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* ---------- 新开局：待选区「发牌中」闪现（13 个牌位各闪 2 轮，约 400ms） ----------
   只在 #hand.dealing 期间生效；收到手牌时 net.js 会立刻移除该类，不等动画播完 */
@keyframes dealFlash {
  0%, 100% { background: transparent; border-color: rgba(255, 255, 255, .14); }
  40%      { background: rgba(212, 175, 96, .20); border-color: rgba(212, 175, 96, .70); }
}
#hand.dealing .handrow > .slot:not(.filler) { animation: dealFlash 200ms ease-in-out 2 both; }
/* 13 个牌位依次延迟 18ms（第一行 6 张，第二行 7 张） */
#hand.dealing .handrow:nth-child(1) > .slot:nth-child(1) { animation-delay: 0ms; }
#hand.dealing .handrow:nth-child(1) > .slot:nth-child(2) { animation-delay: 18ms; }
#hand.dealing .handrow:nth-child(1) > .slot:nth-child(3) { animation-delay: 36ms; }
#hand.dealing .handrow:nth-child(1) > .slot:nth-child(4) { animation-delay: 54ms; }
#hand.dealing .handrow:nth-child(1) > .slot:nth-child(5) { animation-delay: 72ms; }
#hand.dealing .handrow:nth-child(1) > .slot:nth-child(6) { animation-delay: 90ms; }
#hand.dealing .handrow:nth-child(2) > .slot:nth-child(1) { animation-delay: 108ms; }
#hand.dealing .handrow:nth-child(2) > .slot:nth-child(2) { animation-delay: 126ms; }
#hand.dealing .handrow:nth-child(2) > .slot:nth-child(3) { animation-delay: 144ms; }
#hand.dealing .handrow:nth-child(2) > .slot:nth-child(4) { animation-delay: 162ms; }
#hand.dealing .handrow:nth-child(2) > .slot:nth-child(5) { animation-delay: 180ms; }
#hand.dealing .handrow:nth-child(2) > .slot:nth-child(6) { animation-delay: 198ms; }
#hand.dealing .handrow:nth-child(2) > .slot:nth-child(7) { animation-delay: 216ms; }

/* ---------- 待选牌 ---------- */
.hand {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 5px;             /* 四边统一 5px：牌更大、总高 −5 */
  overflow: hidden;         /* 兜底：小数像素取整导致手牌溢出面框 */
  margin-bottom: 5px;
  touch-action: pan-y;
}
.handrow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin: 3px 0; }
.handrow .slot { width: 100%; height: auto; aspect-ratio: 5 / 7; min-width: 0; }
.handrow .filler { visibility: hidden; }
.handrow .slot .card { min-width: 0; }   /* 牌不设最小宽度，避免把列撑宽 */

/* ---------- 牌面 ---------- */
.card {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #fdfcf8, #f1ece0);
  border: 1px solid #cdc5b1;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  color: #1d1f23;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: transform .06s ease;
}
.card .rank {
  position: absolute;
  left: 8%;
  top: 2%;
  font-size: calc(var(--cw) * .38);
  line-height: 1;
  font-weight: 700;
}
.card .suit {
  position: absolute;
  left: 0; right: 0;
  top: 60%;
  transform: translateY(-50%);
  text-align: center;
  font-size: calc(var(--cw) * .62);
  line-height: 1;
}
.card.red { color: #be282d; }

.card.sel { transform: translateY(-5px); box-shadow: 0 0 0 2px var(--gold), 0 6px 12px rgba(0,0,0,.45); }

/* 待选区的牌：更大 */
.handrow .card .rank { font-size: clamp(15px, 4.2vw, 24px); }
.handrow .card .suit { font-size: clamp(20px, 5.8vw, 33px); top: 62%; }

.card.back {
  /* 深蓝灰宽斜条：蓝:灰 = 2:1，用百分比让条纹随牌大小等比缩放 */
  background-color: #18202a;
  background-image: repeating-linear-gradient(
    45deg,
    #283545 0,
    #283545 13.33%,
    #18202a 13.33%,
    #18202a 20%
  );
  border: 1.5px solid #a88a54;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}

/* ---------- 按钮 ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
button {
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 96, .35);
  background: rgba(20, 62, 43, .95);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}
button.primary {
  background: linear-gradient(180deg, #d8b366, #c19a45);
  color: #241a05;
  border-color: #e6c77c;
  font-weight: 700;
}
button:disabled { opacity: .4; cursor: not-allowed; }



/* ---------- 窄屏 ---------- */
@media (max-width: 420px) {
  :root {
    --gap: 4px;
    --typew: 40px;
  }
  #app {
    padding: calc(24px + env(safe-area-inset-top)) calc(8px + env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
    min-height: 100vh;
    min-height: 100dvh;
  }
  html.in-app #app { padding-top: 4px; }
  /* 注意：这里不要再覆盖 .opp 的 padding，否则三家牌宽会算错（v3.36 踩过） */
  .row .label { width: 28px; font-size: 12px; }
  .row .type { font-size: 11px; }
  button { padding: 11px 6px; font-size: 14px; }
}


/* ==========================================================================

/* ==========================================================================

/* ==========================================================================

/* ==========================================================================
   桌面 / 平板：四家完全统一（参考电脑版亮牌界面）
   顺序：小西 | 小北 | 我（第 3 位）| 小东
   四块等宽：每块都是「名字行 + 三道（3/5/5）+ 叠牌」，牌宽、字号、行距完全一致
   待选区：占第 2~4 列（左框对齐第 2 家），13 张一行；按钮在其下方、同宽
   断点：宽 ≥768 且高 ≥560 —— 平板与电脑命中，手机横屏（高 390）仍走竖屏
   ========================================================================== */
/* 横屏布局：由 html.land 控制（JS 按屏幕尺寸自动判断，也响应「横屏/竖屏」按钮） */
/* 横屏布局：显式选择器（不用 CSS 嵌套，兼容旧版 Safari / iPadOS） */
/* 横屏：顶部四个按钮统一 14px（竖屏是 13px + 3px 边距） */
html.land #pkBar button, html.land #pkBar a.pkLink { font-size: 14px; padding: 0 12px; }
html.land #pkBar b { color: #d4af60; font-size: 14px; letter-spacing: 0; }
html.land #app {
    --appw: min(100vw, 1280px);
    --avail: calc(var(--appw) - 48px);                  /* 减左右内边距 24 + 3 个列间距 24 */
    --block: calc((var(--avail) - 24px) / 4);           /* 四家等宽 */
    --inner: calc(var(--block) - 18px);   /* 2×8px 内边距 + 2×1px 边框 */
    --handW: calc(3 * var(--block) + 16px);             /* 第 2~4 家面板宽度之和 */
    /* 四家牌宽：由「块内宽 / 屏高」决定 → 5 张正好摆满块宽（封顶 74 = 电脑版） */
    --c: min(
      calc(var(--inner) / 4.12),
      calc((100vh - 225px) / 5.5),
      74px
    );
    /* 待选区牌宽：受「13 张一行」约束，最多和四家一样大 */
    --hc: min(calc((var(--handW) - 66px) / 13), var(--c));
    --ch: calc(var(--c) * 1.366);
    --cw: var(--c);
    --gap: 4px;
    --typew: 0px;
    /* 三道块宽 = 尾道宽（5 张牌组宽 4.12c），块在面板内居中 */
    --bw: calc(var(--c) * 4.12);

    max-width: 1280px;
    padding: 10px 12px 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "hdr  hdr  hdr  hdr"
      "left top  table right"
      ".    .    .    ."
      "msg  msg  msg  msg"
      "ctl  ctl  ctl  ctl";
    column-gap: 8px;
    row-gap: 6px;
    align-content: start;           /* 高屏时整体靠上 */
  }
html.land header { grid-area: hdr; }
html.land .opponents { display: contents; }
/* 三家拆成独立格子，DOM 不动 */
html.land .opponents > .opp:nth-child(1) { grid-area: left; }
html.land .opponents > .opp:nth-child(2) { grid-area: top; }
html.land .opponents > .opp:nth-child(3) { grid-area: right; }
html.land .opponents > .opp { min-width: 0; }
html.land .table { grid-area: table; margin-bottom: 0; min-width: 0; }
/* 提示区：只占我的面板那一列并居中 */
html.land #pkMsg { grid-area: 4 / 3 / 5 / 4; margin: 0; text-align: center; }
html.land .controls { grid-area: ctl; }
/* ---- 四家统一的字号 ---- */
html.land .opp .oname, html.land .row .rowscore .me { font-size: 15px; }
/* 名字行固定 18px 高：中英文行高一致，四家头道起点才会齐；名字下方留 5px */
html.land .opp .oname { height: 18px; line-height: 18px; align-items: center; margin-bottom: 5px; }
/* 三家分数：头道第三张牌右边 +15px */
html.land .opp .oline .oscore {
    position: absolute;
    left: calc(50% - min(var(--bw), 100%) * .5 + var(--c) * 2.56 + 15px);
    top: 50%; transform: translateY(-50%);
    margin: 0; font-size: 14px; white-space: nowrap; pointer-events: none;
  }
html.land .opp .oscore .l { gap: 6px; }
html.land .opp .oscore b { font-size: 14px; min-width: 1.8em; }
/* ---- 面板四边与牌统一 8px；有富余时牌居中 ---- */
html.land .opponents > .opp { padding: 5px 8px 8px; }   /* 上 5px：名字行起点固定 */
html.land .opp .oline { position: relative; min-height: 0; gap: 2px; margin-bottom: 2px; justify-content: flex-start; }
/* 三道作为一个整体：块宽 = 尾道宽，块在面板中居中，块内三道统一左对齐 */
html.land .opp .ocards {
    display: flex; gap: 0; flex: none; min-width: 0;
    width: min(var(--bw), 100%);
    margin-inline: auto;
    justify-content: flex-start;
  }
html.land .opp .ocards .card {
    width: var(--c);
    height: var(--ch);
    flex: none;
    margin-left: calc(var(--c) * -0.22);
  }
html.land .opp .ocards .card:first-child { margin-left: 0; }
/* 花色/点数字号与我一致（原来用的是旧变量 --sw，只有 15px）；花色调小一号、点数不加粗 */
html.land .opp .ocards .card .rank, html.land .row .slots .card .rank { font-size: calc(var(--c) * .38); font-weight: 400; left: 8%; top: 2%; }
html.land .opp .ocards .card .suit, html.land .row .slots .card .suit { font-size: calc(var(--c) * .54); top: 60%; }
html.land .handrow .card .rank { font-size: calc(var(--hc) * .38); font-weight: 400; }
html.land .handrow .card .suit { font-size: calc(var(--hc) * .54); top: 60%; }
/* ---- 我的块：与 .opp 完全相同的「边框 + 内边距 + 名字行 + 三道」 ---- */
html.land .table { position: relative; padding: 28px 8px 8px; }   /* 5 + 18(名字) + 5 = 28 */
/* 上 8 + 名字行 17，其余 8 */
html.land .row { margin: 2px 0; gap: 2px; }
html.land .row:first-child { margin-top: 0; }
html.land .row .label { display: none; }
html.land .row .type { display: none; }
html.land .row .slots {
    gap: 0; flex: none; min-width: 0;
    width: min(var(--bw), 100%);
    margin-inline: auto;
    justify-content: flex-start;
  }
html.land .row .slots .slot { margin-left: calc(var(--c) * -0.22); }
html.land .row .slots .slot:first-child { margin-left: 0; }
/* 名字 + 徽标在块顶左侧（绝对定位，和三家一样）；本局/累计仍留在头道行右侧 —— 与三家的 .oscore 完全同构 */
/* 本局/累计：两个 .l 绝对定位（相对 .table），名字 .meLine 保持原基准 */
html.land .row:first-child .rowscore {
    position: static;
    display: block;
    flex: 0 0 0;          /* 关键：不再 flex-grow，否则会挤掉 .slots 的居中边距 */
    width: 0;
    margin: 0; padding: 0;
    font-size: 14px;
    overflow: visible;
  }
html.land .row:first-child { column-gap: 0; }
/* 去掉这行多出来的 2px 间隙，保证与中道/尾道同一起点 */
html.land .row:first-child .rowscore .meLine {
    position: absolute;
    left: 8px;
    right: 3px;      /* 右端距面板边框 3px */
    top: 5px;
    height: 18px;
    line-height: 18px;
    width: auto;
    gap: 3px;
  }
html.land .row:first-child .rowscore .me { flex: 0 1 auto; min-width: 0; font-size: 15px; line-height: 17px; }
html.land .row:first-child .rowscore .l {
    position: absolute;
    left: calc(50% - min(var(--bw), 100%) * .5 + var(--c) * 2.56 + 15px);
    gap: 6px; line-height: 18px; white-space: nowrap;
    pointer-events: auto;
  }
html.land .row:first-child .rowscore .l:nth-of-type(1) { top: calc(28px + (var(--ch) - 36px) / 2); }
html.land .row:first-child .rowscore .l:nth-of-type(2) { top: calc(28px + (var(--ch) - 36px) / 2 + 18px); }
html.land .row:first-child .rowscore .l i { font-size: 14px; width: auto; }
html.land .row:first-child .rowscore .l b { font-size: 14px; min-width: 1.8em; }
/* ---- 待选区：第 2~4 列宽度（左框对齐第 2 家），13 张一行 ---- */
html.land .hand {
    grid-area: 3 / 2 / 4 / 5;
    width: 100%;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(13, minmax(0, 1fr));
    gap: 4px;
  }
html.land .handrow { display: contents; }
html.land .handrow .filler { display: none; }
html.land .handrow .slot {
    width: 100%;
    max-width: var(--hc);
    justify-self: center;
    height: auto;
    aspect-ratio: 5 / 7;
  }
/* ---- 按钮：在手牌下方，宽度对齐手牌面板 ---- */
/* 按钮组左右边框对齐我的面板（第 3 列） */
html.land .controls { grid-area: 5 / 3 / 6 / 4; gap: 6px; }
html.land button { padding: 10px 2px; font-size: 14px; white-space: nowrap; }
/* ---- 亮牌阶段：空的待选区收起来，只留「新开一局 / 上局回顾」 ---- */
/* 亮牌阶段保留待选区占位：只隐藏内容，不改整页高度，避免切阶段时整页跳动 */
html.land #app.reveal .hand { visibility: hidden; }
html.land #app.reveal .controls { grid-template-columns: minmax(0, 260px); justify-content: center; }
html.land #app.reveal #btnClear, html.land #app.reveal #btnAuto, html.land #app.reveal #btnSubmit { display: none; }

/* 横屏：禁用AI 在顶栏里（单机版左侧），用顶栏按钮样式 */
#pkBar #aiToggle { position: static; right: auto; top: auto; height: 26px; padding: 0 6px; font-size: 13px; line-height: 24px; background: rgba(20,62,43,.95); border: 1px solid rgba(212,175,96,.35); border-radius: 6px; color: #d4af60; }
