/* ================= 任丘麻将 · 样式 ================= */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --felt-hi: #246b4f;
  --felt-mid: #143f2e;
  --felt-lo: #081d14;
  --wood: #4a3524;
  --wood-lo: #2a1d12;
  --cream: #fbf7ea;
  --gold: #d9b45a;
  --ink: #22302a;

  /* 牌尺寸 */
  --tw: 50px;              /* 自己手牌 */
  --th: 70px;
  --tw-s: 28px;            /* 河牌 */
  --th-s: 39px;
  --tw-x: 32px;            /* 对手手牌（牌背） */
  --th-x: 22px;
  --tw-m: 24px;            /* 对家副露（横排） */
  --th-m: 33px;
  --tw-mv: 20px;           /* 左右两家副露（竖排） */
  --th-mv: 28px;
  --tw-m0: 28px;           /* 自己副露 */
  --th-m0: 40px;

  /* 操作栏（紧贴自己手牌上方） */
  --act-h: 56px;
  /* 手牌容器上下内边距合计 */
  --hand-pad: 6px;
  /* 中央方形方位台边长 */
  --hub: 148px;
  /* 中央两侧留给左右两家的宽度 */
  --side-gap: 92px;
  /* 方位标注（东南西北 + 三角）向外伸出的高度，河边牌需为其让位 */
  --mark-band: 20px;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: #050f0b;
  color: #e8efe9;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.app {
  height: 100dvh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------------- HUD ---------------- */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}

.hud-group { display: flex; align-items: center; gap: 8px; }

/* 品牌位：麻将「發」牌做 logo */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 4px;
}
.brand-logo {
  width: 26px;
  height: 34px;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
}
.brand-name {
  font-family: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .16em;
  color: #f3e9c9;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .5);
  white-space: nowrap;
}
@media (max-width: 620px) {
  .brand-name { display: none; }
  .brand-logo { width: 22px; height: 29px; }
}

.chip {
  font-size: 12px;
  letter-spacing: .04em;
  color: #a9c4b5;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  padding: 5px 11px;
  white-space: nowrap;
}
.chip b { color: #f2f7f3; font-weight: 600; }
.chip-dealer { color: #e8cf8f; border-color: rgba(217, 180, 90, .35); background: rgba(217, 180, 90, .08); }
.chip-dealer b { color: var(--gold); }

.btn-ghost {
  font-family: inherit;
  font-size: 12px;
  color: #b6cbbf;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  padding: 5px 13px;
  cursor: pointer;
  transition: all .15s;
}
.btn-ghost:hover { color: #fff; border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .06); }
.btn-ghost:active { transform: scale(.96); }

/* ---------------- 桌面 ---------------- */
.table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 牌桌用流式布局：上（对家） / 中（中央区） / 下（自己）三段自适应，
   中央区自动拿到剩余空间。不用手工算 inset，副露高度变化也不会互相遮挡。 */
.table {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 26px;
  isolation: isolate;
}

.table::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 26px;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, var(--felt-hi) 0%, var(--felt-mid) 46%, var(--felt-lo) 100%);
  box-shadow:
    inset 0 0 0 9px var(--wood),
    inset 0 0 0 10px #1a1208,
    inset 0 0 90px rgba(0, 0, 0, .75),
    0 18px 40px rgba(0, 0, 0, .65);
  z-index: -1;
}

/* 桌面丝绒质感 */
.table::after {
  content: '';
  position: absolute;
  inset: 11px;
  border-radius: 18px;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.012) 0 2px, transparent 2px 4px);
  z-index: -1;
}

/* ---------------- 座位通用 ---------------- */
.seat { z-index: 3; }
/* 左右两家固定在两侧（绝对定位） */
.seat-left, .seat-right { position: absolute; }

.opp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #9db8aa;
  letter-spacing: .05em;
}
.pname { color: #cfe0d5; font-weight: 600; }
.score {
  font-variant-numeric: tabular-nums;
  color: #8fa79a;
  background: rgba(0, 0, 0, .25);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10px;
}
.score.pos { color: #ff9c8a; }
.score.neg { color: #7fd8a8; }

.tag-you {
  font-size: 9px;
  color: #0b2318;
  background: var(--gold);
  border-radius: 3px;
  padding: 1px 4px;
  font-weight: 700;
  display: none;
}
.tag-you.on { display: inline-block; }

/* ---------------- 对家（上） ---------------- */
.seat-top {
  order: 1;
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.opp-hand {
  display: flex;
  gap: 2px;
}
.opp-hand .tile {
  width: var(--tw-x);
  height: var(--th-x);
  border-radius: 4px;
}
/* 对手副露：对家横排 */
.opp-melds .tile {
  width: var(--tw-m);
  height: var(--th-m);
  border-radius: 4px;
}
/* 左右两家副露：竖排，牌更小，避免横向溢出撞进中央区 */
.opp-melds.vert .tile {
  width: var(--tw-mv);
  height: var(--th-mv);
  border-radius: 4px;
}
/* 自己副露：稍大一点，便于辨认 */
.my-melds {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: center;
}
.my-melds .tile {
  width: var(--tw-m0);
  height: var(--th-m0);
  border-radius: 4px;
}

/* ---------------- 左右两家 ---------------- */
.seat-left, .seat-right {
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.seat-left { left: 16px; }
.seat-right { right: 16px; }

.opp-hand.vert {
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
/* 左右两家的副露：组与组横向并排，每组内的牌竖着叠。
   max-width 把整条副露限制在中央区之外，组多了会自动换行，
   无论几个副露都不会横向撞进中央。 */
.opp-melds.vert {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  align-items: flex-end;
  max-width: calc(var(--side-gap) - 26px);
}
.opp-melds.vert .meld-group {
  flex-direction: column;
  align-items: center;
}
.opp-melds.vert .meld-tag {
  align-self: center;
  margin-left: 0;
  margin-top: 2px;
}

/* ---------------- 中央 ---------------- */
.center {
  position: relative;
  order: 2;
  flex: 1 1 auto;
  min-height: 0;
  margin: 6px var(--side-gap);
  display: grid;
  /* 显式三行：上（对家弃牌河）/ 中（左右河 + 方位台）/ 下（自己弃牌河）。
     用行号而非命名区域，避免 grid-area 命名在多行间误解析导致跨行重叠。 */
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  z-index: 2;
}

.river-row {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 3px;
  min-height: 0;
}
/* 上下两行河边牌贴着中央方位台排，为东南西北标注让出 --mark-band */
.river-top {
  grid-row: 1;
  grid-column: 1 / -1;
  align-content: flex-end;
  justify-content: center;
  padding-bottom: var(--mark-band);
}
.river-bottom {
  grid-row: 3;
  grid-column: 1 / -1;
  align-content: flex-start;
  justify-content: center;
  padding-top: var(--mark-band);
}

.river-mid {
  grid-row: 2;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 0;
}

.river-col {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-content: center;
  justify-content: center;
}
.river-left { grid-column: 1; }
.river-right { grid-column: 3; }

.river-row .tile,
.river-col .tile {
  width: var(--tw-s);
  height: var(--th-s);
  border-radius: 4px;
  opacity: .96;
}

.tile.last {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  box-shadow: 0 0 12px rgba(217, 180, 90, .7);
  z-index: 2;
}

/* 中央信息 */
.info-card {
  grid-column: 2;
  justify-self: center;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(4, 18, 12, .45);
  border: 1px solid rgba(255, 255, 255, .07);
  backdrop-filter: blur(3px);
  min-width: 118px;
}

/* ---------------- 中央方形方位台 ---------------- */
.hub {
  position: relative;
  justify-self: center;
  align-self: center;
  width: var(--hub);
  height: var(--hub);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, .045), rgba(0, 0, 0, .16) 72%);
  border: 1px solid rgba(255, 255, 255, .06);
}

.hub .info-card {
  grid-column: auto;
  justify-self: auto;
  align-self: auto;
  min-width: 0;
  background: transparent;
  border: none;
  backdrop-filter: none;
  padding: 0;
}

/* 四方方位标注 + 外侧三角 */
.hub-mark {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  letter-spacing: .2em;
  color: #b9d0c2;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .85);
  opacity: .6;
  transition: opacity .2s, color .2s;
  pointer-events: none;
}
.hub-mark-s { bottom: -14px; left: 50%; transform: translateX(-50%); flex-direction: column; gap: 1px; }
.hub-mark-n { top: -14px; left: 50%; transform: translateX(-50%); flex-direction: column-reverse; gap: 1px; }
/* 右侧：标注在内、三角朝外；左侧：三角在外、标注在内 */
.hub-mark-e { right: -12px; top: 50%; transform: translateY(-50%); flex-direction: row; }
.hub-mark-w { left: -12px; top: 50%; transform: translateY(-50%); flex-direction: row-reverse; }

.hub-tri {
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  opacity: .55;
  transition: opacity .2s;
}
.hub-mark-s .hub-tri { border-width: 8px 7px 0 7px; border-color: var(--gold) transparent transparent transparent; }
.hub-mark-n .hub-tri { border-width: 0 7px 8px 7px; border-color: transparent transparent var(--gold) transparent; }
.hub-mark-e .hub-tri { border-width: 7px 0 7px 8px; border-color: transparent transparent transparent var(--gold); }
.hub-mark-w .hub-tri { border-width: 7px 8px 7px 0; border-color: transparent var(--gold) transparent transparent; }

/* 当前回合 */
.hub-mark.active { opacity: 1; color: #f0e2b8; }
.hub-mark.active .hub-tri { opacity: 1; }

/* 出牌高亮闪动 */
.hub-mark.flash { opacity: 1; color: #fff; }
.hub-mark.flash .hub-tri {
  opacity: 1;
  animation: triFlash .85s ease-in-out infinite;
}
@keyframes triFlash {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(217, 180, 90, .5)); }
  50% { filter: drop-shadow(0 0 11px rgba(255, 226, 140, 1)); }
}

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: .14em;
  color: #8fae9d;
}
.info-row.small { font-size: 10px; letter-spacing: .06em; color: #7f9b8c; }
.info-row b { color: #dff0e5; font-size: 12px; font-variant-numeric: tabular-nums; }

/* 混皮 / 混牌 左右排列 */
.hun-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
}
.hun-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.hun-item .info-label {
  font-size: 9px;
  letter-spacing: .18em;
  color: #8fae9d;
}

.hun-wrap { display: flex; align-items: center; }
.hun-wrap .tile {
  width: 30px;
  height: 42px;
  border-radius: 4px;
  box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(217, 180, 90, .45);
}

/* 混牌高亮闪动（万能牌，要一眼看到） */
.hun-wrap .tile.hun-live { animation: hunFlash 1.7s ease-in-out infinite; }
@keyframes hunFlash {
  0%, 100% {
    box-shadow: 0 0 0 1px var(--gold), 0 0 8px rgba(217, 180, 90, .35);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 2px #ffe9a8, 0 0 24px rgba(255, 226, 140, .95);
    transform: scale(1.06);
  }
}

.turn-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3c5a4a;
  transition: background .2s, box-shadow .2s;
}
.turn-dot.active { background: var(--gold); box-shadow: 0 0 10px var(--gold); }

/* ---------------- 自己 ---------------- */
.seat-bottom {
  order: 3;
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.self-top {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 24px;
}

.opp-melds {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.meld-group {
  display: flex;
  gap: 1px;
  padding: 2px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .18);
  align-items: flex-end;
}

/* 明杠 / 暗杠 标注 */
.meld-tag {
  align-self: flex-end;
  font-size: 9px;
  line-height: 1;
  letter-spacing: .04em;
  padding: 2px 3px 1px;
  border-radius: 3px;
  margin-left: 2px;
  white-space: nowrap;
}
.meld-tag.sm { font-size: 8px; padding: 1px 2px 0; }
.meld-tag-ming {
  color: #f0d9a0;
  background: rgba(217, 180, 90, .22);
  border: 1px solid rgba(217, 180, 90, .45);
}
.meld-tag-an {
  color: #cfe0d5;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .22);
}

.hand {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 4px 8px 2px;
  max-width: 100%;
}

.hand .tile {
  width: var(--tw);
  height: var(--th);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s;
}

.hand .tile.playable:hover {
  transform: translateY(-10px);
  box-shadow: 0 1px 0 #c9bfa4, 0 12px 16px rgba(0, 0, 0, .45);
  filter: brightness(1.04);
}

.hand .tile.drawn { margin-left: 10px; }
.hand .tile.dim { opacity: .35; filter: grayscale(.6); }

/* 混牌（万能牌）描边 + 红色标记 */
.tile.is-hun {
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(217, 180, 90, .55), 0 3px 6px rgba(0, 0, 0, .38);
}
.tile.is-hun::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(217, 180, 90, .16), transparent 40%);
  pointer-events: none;
}
/* 牌角红色标记：一眼认出这是混牌，避免误打 */
.tile.is-hun::after {
  content: '';
  position: absolute;
  top: 4%;
  left: 4%;
  width: 19%;
  height: 14%;
  min-width: 5px;
  min-height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 32%, #ffb0a0, #d63d2c 68%);
  box-shadow: 0 0 7px rgba(230, 70, 55, 1), 0 0 0 1px rgba(255, 235, 230, .65);
  pointer-events: none;
  z-index: 3;
}

/* ---------------- 牌面 ---------------- */
.tile {
  position: relative;
  flex: 0 0 auto;
  /* 默认尺寸（各容器规则会覆盖）。
     container-type: size 让牌面内的字号用 cqh（牌自身高度的 1%）计算，
     这样任何尺寸的牌都能完整显示，不会被 overflow:hidden 裁掉。 */
  width: var(--tw);
  height: var(--th);
  container-type: size;
  background: linear-gradient(168deg, #ffffff 0%, #faf5e6 52%, #ece2c9 100%);
  border: 1px solid rgba(0, 0, 0, .13);
  border-radius: 6px;
  box-shadow: 0 1.5px 0 #c6bb9d, 0 3px 6px rgba(0, 0, 0, .38);
  overflow: hidden;
  user-select: none;
}

/* 牌背 */
.tile.back {
  background: linear-gradient(165deg, #2f7d5c 0%, #226148 45%, #17452f 100%);
  border-color: #0f3323;
  box-shadow: 0 1.5px 0 #0b2618, 0 3px 6px rgba(0, 0, 0, .4);
}
.tile.back::after {
  content: '';
  position: absolute;
  inset: 14%;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, .13);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 2px, transparent 2px 5px);
}

/* 牌面容器。
   牌面是内联 SVG（viewBox 0 0 100 140），按比例缩放到牌内，
   缩到 22px 的副露牌也不会糊、不会被裁。 */
.face {
  position: absolute;
  inset: 5% 6%;
  --fh: 1cqh;
}
.face > svg.tf {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ---------------- 操作栏（紧贴自己手牌上方） ---------------- */
.action-bar {
  flex: 0 0 auto;
  height: var(--act-h);
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(14, 42, 28, .94), rgba(6, 24, 16, .96));
  border: 1px solid rgba(217, 180, 90, .38);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .55), 0 0 18px rgba(217, 180, 90, .12);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
  position: relative;
}
.action-bar.on {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* 指向自己手牌的小箭头 */
.action-bar::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(7, 26, 17, .96);
  border-right: 1px solid rgba(217, 180, 90, .38);
  border-bottom: 1px solid rgba(217, 180, 90, .38);
}

/* 听牌提示条：没有按钮时只显示听牌信息（高度不变，不挤动手牌） */
.action-bar.quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.action-bar.quiet::after { display: none; }
.action-bar.quiet .action-tip {
  color: #cfe3d6;
  letter-spacing: .06em;
}

.action-tip {
  font-size: 11px;
  color: #e2c98d;
  letter-spacing: .1em;
  white-space: nowrap;
  /* 文字过长时收缩省略，绝不把按钮挤出屏幕 */
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; flex: 0 0 auto; }

.act {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .1em;
  color: #0d2419;
  background: linear-gradient(180deg, #f6e7b8, #d9b45a);
  border: none;
  border-radius: 10px;
  padding: 10px 20px;
  cursor: pointer;
  box-shadow: 0 3px 0 #9a7c31, 0 6px 14px rgba(0, 0, 0, .35);
  transition: transform .1s, box-shadow .1s;
}
.act:hover { filter: brightness(1.06); }
.act:active { transform: translateY(2px); box-shadow: 0 1px 0 #9a7c31, 0 3px 8px rgba(0, 0, 0, .35); }

.act-ghost {
  color: #c7d8cd;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: none;
  font-weight: 500;
}
.act-ghost:hover { background: rgba(255, 255, 255, .12); }
.act-ghost:active { transform: scale(.97); box-shadow: none; }

.act-hu {
  background: linear-gradient(180deg, #ff8a7a, #d63d2c);
  color: #fff;
  box-shadow: 0 3px 0 #8e2418, 0 6px 16px rgba(214, 61, 44, .45);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.act small {
  display: block;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: .04em;
  opacity: .7;
  margin-top: 1px;
  white-space: nowrap;   /* 副标注不换行，避免按钮被撑成两行 */
}

/* ---------------- 弹层 ---------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 10, 7, .78);
  backdrop-filter: blur(4px);
}
.overlay.on { display: flex; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  width: min(560px, 100%);
  max-height: 86dvh;
  overflow: auto;
  background: linear-gradient(170deg, #14271e, #0b1811);
  border: 1px solid rgba(217, 180, 90, .28);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .7);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.2);
}
@keyframes pop { from { transform: scale(.94) translateY(10px); opacity: 0; } }

.dialog h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .08em;
  color: #f2ead5;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dialog h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(217, 180, 90, .4), transparent);
}

.dlg-body { font-size: 13px; line-height: 1.75; color: #b9cabd; }
.dlg-body b { color: #e8d9ae; font-weight: 600; }
.dlg-body p { margin-bottom: 9px; }
.dlg-body ul { padding-left: 18px; margin-bottom: 10px; }
.dlg-body li { margin-bottom: 4px; }
.dlg-body h3 {
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--gold);
  margin: 16px 0 8px;
  font-weight: 600;
}
.dlg-body h3:first-child { margin-top: 0; }

.dlg-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* 结算 */
.result-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 14px;
  font-size: 13px;
  margin: 12px 0;
}
.result-grid .k { color: #8ba595; }
.result-grid .v { color: #ecdfb9; text-align: right; font-variant-numeric: tabular-nums; }

.fan-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.fan-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(217, 180, 90, .12);
  border: 1px solid rgba(217, 180, 90, .35);
  color: #e2c98d;
}

.pay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}
.pay-table th, .pay-table td {
  padding: 7px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.pay-table th { color: #7d9a89; font-weight: 500; font-size: 11px; letter-spacing: .08em; }
.pay-table td { color: #cdddcf; font-variant-numeric: tabular-nums; }
.pay-table td.plus { color: #ff9c8a; font-weight: 600; }
.pay-table td.minus { color: #7fd8a8; font-weight: 600; }

.dream-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 8px 0 10px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .25);
  min-height: 42px;
  align-items: center;
}
.dream-row .tile { width: 22px; height: 30px; border-radius: 3px; }
.dream-row .tile.hit { box-shadow: 0 0 0 2px #e2574f, 0 0 10px rgba(226, 87, 79, .6); }

/* 混掉胡「全副明牌」展示 */
.reveal-row { display: flex; flex-wrap: wrap; gap: 3px; }
.reveal-row .tile {
  width: 24px;
  height: 33px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

/* 胡牌者牌面：副露一行 + 手牌一行 */
.win-reveal { }
.reveal-melds {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 5px;
  padding: 5px 6px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .2);
}
.reveal-melds .meld-group { gap: 1px; padding: 2px; }
.reveal-melds .tile {
  width: 24px;
  height: 33px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

/* 副露区里单独亮出的混牌 */
.meld-lone .tile.is-hun {
  box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(217, 180, 90, .6);
}

/* 胡牌者亮出来的牌稍微放大一点，方便看清牌面 */
.opp-hand .tile.shown {
  width: calc(var(--tw-x) * 1.15);
  height: calc(var(--th-x) * 1.15);
}

/* 番型标签里的「混掉 ×2」 */
.fan-mult {
  background: rgba(217, 180, 90, .22);
  color: #ffe9a8;
  border-color: rgba(217, 180, 90, .5);
}

/* ---------------- 响应式 ---------------- */

/* 平板 / 小笔记本 */
@media (max-width: 900px) {
  :root {
    --tw: 42px; --th: 59px;
    --tw-s: 24px; --th-s: 33px;
    --tw-x: 26px; --th-x: 18px;
    --tw-m: 22px; --th-m: 30px;
    --tw-mv: 18px; --th-mv: 25px;
    --tw-m0: 24px; --th-m0: 34px;
    --hub: 128px;
    --side-gap: 70px;
    --mark-band: 18px;
  }
  .hub-mark { font-size: 11px; }
  .hub-mark-s { bottom: -12px; }
  .hub-mark-n { top: -12px; }
  .hub-mark-e { right: -10px; }
  .hub-mark-w { left: -10px; }
}

/* 手机竖屏 */
@media (max-width: 620px) {
  :root {
    --tw: min(38px, calc((100vw - 58px) / 14.6));
    --th: calc(var(--tw) * 1.42);
    --tw-s: 22px; --th-s: 31px;
    --tw-x: 20px; --th-x: 14px;
    --tw-m: 21px; --th-m: 29px;
    --tw-mv: 19px; --th-mv: 26px;
    --tw-m0: 22px; --th-m0: 30px;
    --hub: 112px;
    --side-gap: 52px;
    --mark-band: 18px;
    --act-h: 74px;
  }
  .app { padding: 6px 6px 4px; gap: 4px; }
  .seat-left { left: 4px; }
  .seat-right { right: 4px; }
  .info-card { padding: 6px 10px; min-width: 92px; gap: 4px; border-radius: 10px; }
  .hun-wrap .tile { width: 22px; height: 31px; }
  .act { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
  .chip { padding: 4px 8px; font-size: 11px; }
  .action-bar { padding: 0 10px; gap: 8px; }
  .action-tip { font-size: 10px; }
  /* 窄屏：提示文字独占一行、按钮组另起一行，固定两行高度避免手牌跳动 */
  .action-bar { flex-wrap: wrap; align-content: center; padding: 6px 10px; row-gap: 4px; }
  .action-tip { flex: 0 0 100%; text-align: center; }
  .action-btns { flex: 0 0 100%; }
  /* 收紧按钮，保证「3 个吃 + 过」也能排进一行 */
  .act { padding: 6px 9px; font-size: 13px; }
  .act small { font-size: 8px; letter-spacing: 0; }
  .action-btns { gap: 6px; }
}

@media (max-width: 420px) {
  :root {
    --side-gap: 44px;
    --hub: 104px;
    --mark-band: 16px;
    --tw-s: 20px; --th-s: 28px;
    --tw-mv: 18px; --th-mv: 25px;
    --tw-m0: 21px; --th-m0: 29px;
  }
  .hand { gap: 1px; padding: 2px 3px 0; }
  .hand .tile.drawn { margin-left: 5px; }
  .hud .chip:nth-child(2) { display: none; }
  .self-top { gap: 6px; }
  :root { --hand-pad: 2px; }
}

@media (max-height: 620px) {
  .app { padding-top: 4px; gap: 4px; }
  :root { --act-h: 44px; }
}

/* 手机横屏：纵向空间紧张，信息卡改横向紧凑排布，避免压到自家区 */
@media (orientation: landscape) and (max-height: 460px) {
  :root {
    --tw: 36px; --th: 48px;
    --tw-s: 18px; --th-s: 25px;
    --tw-x: 20px; --th-x: 13px;
    --tw-m: 18px; --th-m: 25px;
    --tw-mv: 16px; --th-mv: 22px;
    --tw-m0: 19px; --th-m0: 26px;
    --act-h: 38px;
    --hub: 80px;
    --side-gap: 58px;
    --mark-band: 12px;
    --hand-pad: 4px;
  }
  .app { padding: 4px 8px 4px; gap: 4px; }
  .seat-top { top: 6px; }
  .seat-left { left: 8px; }
  .seat-right { right: 8px; }

  /* 信息卡横排 + 自动换行：混皮/混牌并排，「剩余」换到下一行 */
  .info-card {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    align-content: center;
    gap: 4px 8px;
    padding: 4px 8px;
    min-width: 0;
    border-radius: 10px;
  }
  .info-row {
    flex-direction: column;
    align-items: center;
    gap: 1px;
    font-size: 8px;
    letter-spacing: .04em;
  }
  .info-row.small { flex-direction: column; font-size: 8px; }
  .info-row b { font-size: 10px; }
  /* 混皮/混牌标签压到最小，避免信息卡变高压到下方弃牌河 */
  .hun-item { gap: 1px; }
  .hun-item .info-label { font-size: 8px; letter-spacing: .04em; }
  .hun-wrap .tile { width: 15px; height: 21px; border-radius: 3px; }
  .turn-dot { width: 5px; height: 5px; }

  .hub { border-radius: 16px; align-items: flex-start; padding-top: 3px; }
  .hub-mark { font-size: 9px; letter-spacing: .08em; }
  .hub-mark-s { bottom: -8px; }
  .hub-mark-n { top: -8px; }
  .hub-mark-e { right: -6px; }
  .hub-mark-w { left: -6px; }
  .hub-tri { border-width: 5px 4px 0 4px; }
  .hub-mark-n .hub-tri { border-width: 0 4px 5px 4px; }
  .hub-mark-e .hub-tri { border-width: 4px 0 4px 5px; }
  .hub-mark-w .hub-tri { border-width: 4px 5px 4px 0; }
}

/* ---------------- 移动端竖屏提示 ---------------- */
.rotate-hint {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 14, 10, .82);
  backdrop-filter: blur(6px);
  animation: fadeIn .22s ease;
}
.rotate-hint[hidden] { display: none; }

.rotate-box {
  max-width: 320px;
  text-align: center;
  color: #e8efe9;
  background: linear-gradient(180deg, rgba(20, 58, 40, .96), rgba(8, 28, 18, .98));
  border: 1px solid rgba(217, 180, 90, .3);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .6);
}

.rotate-icon { color: var(--gold); margin-bottom: 12px; }
.rotate-box h3 { font-size: 17px; letter-spacing: .1em; margin-bottom: 8px; color: #f2e6c6; }
.rotate-box p { font-size: 13px; line-height: 1.7; color: #a8c0b1; margin-bottom: 18px; }
.rotate-box .btn-ghost { width: 100%; padding: 9px 14px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
