:root {
  color-scheme: dark;
  --ink: #fffaf1;
  --muted: rgba(255, 250, 241, 0.72);
  --glass: rgba(16, 29, 25, 0.48);
  --glass-strong: rgba(13, 24, 21, 0.78);
  --line: rgba(255, 255, 255, 0.2);
  --gold: #ffd777;
  --red: #e6362d;
  --green: #75d7a3;
  --card-w: clamp(76px, 10.5vw, 108px);
  --card-h: calc(var(--card-w) * 1.33);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #244f38;
}

body {
  color: var(--ink);
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  background-position: center;
  background-size: cover;
  transform: scale(1.015);
  transition: background-image 500ms ease, filter 500ms ease;
}

body[data-theme="classic"]::before { background-image: url("/doudizhu/assets/themes/theme-classic.jpg"); }
body[data-theme="green"]::before { background-image: radial-gradient(ellipse at 50% 35%, #2f8a5a 0%, #1d5a3b 55%, #123826 100%); }

body::after {
  z-index: 0;
  background:
    radial-gradient(circle at 50% 44%, transparent 0 38%, rgba(2, 13, 10, 0.06) 76%, rgba(2, 8, 7, 0.2) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.025), transparent 38%, rgba(0, 0, 0, 0.1));
}

#game {
  position: relative;
  z-index: 1;
  width: 100%;
  height: calc(100% - var(--site-bar-h));
  margin-top: var(--site-bar-h);
}

/* 站点顶栏：牌桌整体下移一条栏高，不压住牌桌元素 */
:root { --site-bar-h: calc(30px + env(safe-area-inset-top, 0px)); }
.site-bar {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  right: 0;
  height: var(--site-bar-h);
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  background: rgba(6, 16, 13, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
}
.site-home {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}
.site-name { max-width: 50vw; overflow: hidden; color: var(--gold); text-overflow: ellipsis; white-space: nowrap; }

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.glass {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), inset 0 1px rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(18px) saturate(1.12);
  -webkit-backdrop-filter: blur(18px) saturate(1.12);
}

.topbar {
  position: absolute;
  z-index: 20;
  top: max(10px, env(safe-area-inset-top, 0px));
  right: max(10px, env(safe-area-inset-right, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 999px;
  transform: none;
  white-space: nowrap;
  font-size: 12px;
}

.topbar strong { color: var(--gold); font-size: 13px; }
.topbar .dot { width: 7px; height: 7px; border-radius: 50%; background: #f59a8f; box-shadow: 0 0 10px #f59a8f; }
.topbar .dot.online { background: #80e2aa; box-shadow: 0 0 10px #80e2aa; }

.table-back-button {
  position: absolute;
  z-index: 32;
  top: max(9px, env(safe-area-inset-top, 0px));
  left: max(10px, env(safe-area-inset-left, 0px));
  min-width: 58px;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.settings-button,
.chat-button,
.interaction-button {
  position: absolute;
  z-index: 30;
  bottom: calc(12px + var(--safe-bottom));
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(13, 24, 21, 0.68);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.settings-button { left: 12px; font-size: 20px; }
.chat-button,
.interaction-button { position: relative; bottom: auto; font-size: 19px; }
.chat-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.table-tools {
  position: absolute;
  z-index: 30;
  right: 12px;
  bottom: calc(var(--card-h) + 22px + var(--safe-bottom));
  display: flex;
  gap: 8px;
}
.settings-button:active,
.chat-button:active,
.interaction-button:active { transform: scale(0.92); }

.player-seat {
  position: absolute;
  z-index: 12;
  display: grid;
  justify-items: center;
  width: 112px;
  pointer-events: none;
  transition: transform 260ms ease, opacity 260ms ease;
}

.player-seat[data-seat="1"] { left: 2.5%; top: 20%; }
.player-seat[data-seat="2"] { right: 2.5%; top: 20%; }
.player-seat[data-seat="0"] { z-index: 26; left: 52px; bottom: 3px; transform: none; }

.seat-score {
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--gold);
  background: rgba(7, 17, 14, 0.68);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.avatar-wrap {
  position: relative;
  width: clamp(56px, 6.4vw, 76px);
  height: clamp(56px, 6.4vw, 76px);
  border: 3px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
}

.player-seat.is-turn .avatar-wrap {
  border-color: var(--gold);
  box-shadow: 0 0 0 5px rgba(255, 215, 119, 0.2), 0 0 28px rgba(255, 215, 119, 0.56);
  animation: turn-pulse 1.5s ease-in-out infinite;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}

.role-badge {
  position: absolute;
  right: -5px;
  bottom: -2px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  color: #492407;
  background: var(--gold);
  border: 2px solid white;
  font-size: 11px;
  font-weight: 900;
}

.seat-name {
  max-width: 110px;
  margin-top: 5px;
  padding: 3px 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(7, 17, 14, 0.7);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 5px #000;
}

.hand-count {
  position: absolute;
  top: 32px;
  padding: 3px 6px;
  border-radius: 7px;
  background: rgba(7, 17, 14, 0.75);
  font-size: 11px;
  font-weight: 900;
}

.player-seat[data-seat="1"] .hand-count { right: -1px; }
.player-seat[data-seat="2"] .hand-count { left: -1px; }
.player-seat[data-seat="0"] .hand-count { right: 5px; }

.timer-ring {
  --progress: 1;
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(var(--gold) calc(var(--progress) * 1turn), rgba(255, 255, 255, 0.13) 0);
  z-index: -1;
}

.timer-ring::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  background: rgba(16, 29, 25, 0.8);
}

.center-table {
  position: absolute;
  z-index: 8;
  top: 48%;
  left: 50%;
  width: min(58vw, 600px);
  min-height: 170px;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  text-align: center;
}

.landlord-cards {
  display: flex;
  align-items: flex-end;
}

.landlord-cards--revealed {
  position: absolute;
  z-index: 18;
  top: 7px;
  left: 50%;
  gap: 3px;
  align-items: center;
  transform: translateX(-50%);
}

.landlord-cards-caption {
  margin-right: 4px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.landlord-mini-card {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  min-width: 38px;
  height: 34px;
  padding: 2px 5px 3px;
  border: 1px solid rgba(32, 30, 28, 0.32);
  border-radius: 4px;
  color: #171717;
  background: linear-gradient(#fff, #f2f0ed);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.24);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
}

.landlord-mini-card strong { font-size: 23px; font-weight: 700; }
.landlord-mini-card span { font-size: 18px; }
.landlord-mini-card.is-red { color: #ba2525; }
.landlord-mini-card.is-joker { gap: 0; min-width: 43px; font-family: inherit; }
.landlord-mini-card.is-joker strong,
.landlord-mini-card.is-joker span { font-size: 15px; font-weight: 900; }

.landlord-deal-stage {
  display: grid;
  place-items: center;
  gap: 9px;
}

.landlord-cards--waiting {
  gap: clamp(7px, 1.2vw, 14px);
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.24));
}

.landlord-cards--waiting .playing-card {
  cursor: default;
  animation: none;
}

.last-move {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 112px;
}

.last-move-label {
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(7, 17, 14, 0.54);
  font-size: 11px;
}

.table-cards {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 90px;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.22));
}

.table-cards .playing-card { --card-w: clamp(72px, 9vw, 92px); animation: none; }
.table-cards .playing-card + .playing-card { margin-left: calc(var(--card-w) * -0.48); }

.playing-card {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  height: var(--card-h);
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: calc(var(--card-w) * 0.04);
  background: transparent;
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: filter 120ms ease, box-shadow 120ms ease;
}

.playing-card > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  -webkit-user-drag: none;
}

.hand-zone {
  position: absolute;
  z-index: 18;
  left: 55%;
  bottom: calc(5px + var(--safe-bottom));
  width: min(90vw, 1120px);
  transform: translateX(-50%);
}

.hand {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: calc(var(--card-h) + 24px);
  padding: 22px 24px 0;
  overflow: visible;
  touch-action: none;
}

.hand .playing-card {
  margin-left: calc(var(--card-w) * var(--hand-overlap, -0.58));
  animation: none;
  top: 0;
  transition: filter 120ms ease, box-shadow 120ms ease;
}

.hand .playing-card:first-child { margin-left: 0; }
.hand .playing-card.selected {
  top: -10px;
  filter: brightness(1.06) drop-shadow(0 0 8px rgba(255, 215, 119, 0.95));
  box-shadow: inset 0 0 0 4px var(--gold), 0 13px 18px rgba(0, 0, 0, 0.34);
}
.hand .playing-card:active { filter: brightness(0.96); }

.turn-actions {
  position: absolute;
  left: 50%;
  bottom: calc(var(--card-h) + 18px + var(--safe-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateX(-50%);
}

.action-button {
  min-width: 72px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(40, 80, 57, 0.96), rgba(19, 52, 36, 0.96));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25), inset 0 1px rgba(255, 255, 255, 0.18);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.action-button.primary { color: #513012; background: linear-gradient(#ffe69d, #f2bb50); border-color: #fff0c4; }
.action-button.danger { background: linear-gradient(#dc5c51, #a92d29); }
.action-button:disabled { opacity: 0.42; cursor: default; }
.action-button:not(:disabled):active { transform: translateY(1px) scale(0.97); }

.speech-bubble {
  position: absolute;
  z-index: 40;
  top: -38px;
  left: 50%;
  max-width: 126px;
  padding: 7px 10px;
  border-radius: 13px 13px 13px 3px;
  color: #18211d;
  background: #fffdf7;
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 800;
  animation: bubble-in 260ms ease both;
}

.feed-line {
  position: absolute;
  z-index: 15;
  left: 50%;
  bottom: calc(var(--card-h) + 70px + var(--safe-bottom));
  max-width: min(70vw, 680px);
  overflow: hidden;
  padding: 5px 12px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(5, 15, 12, 0.46);
  transform: translateX(-50%);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  pointer-events: none;
}

.lobby {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 24px;
  overflow-y: auto;
}

.lobby-card {
  width: min(820px, 94vw);
  padding: clamp(18px, 3vw, 34px);
  border-radius: 30px;
  text-align: center;
}

.lobby-kicker { color: var(--gold); font-size: 12px; font-weight: 900; letter-spacing: 0.16em; text-transform: uppercase; }
.lobby .lobby-title { margin: 8px 0 4px; font-size: clamp(30px, 5vw, 58px); line-height: 1; text-shadow: 0 6px 20px rgba(0,0,0,.26); }
.lobby p { margin: 8px auto 18px; color: var(--muted); font-size: 13px; }

.lobby-players {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.lobby-player {
  color: inherit;
  border: 1px solid transparent;
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  padding: 13px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.09);
  cursor: pointer;
}

.lobby-player.selected { border-color: var(--gold); background: rgba(255, 215, 119, 0.15); box-shadow: inset 0 0 0 2px rgba(255, 215, 119, 0.12); }
.lobby-player.fixed { cursor: default; opacity: 1; }
.lobby-player.selectable:not(.selected) { opacity: 0.66; }

.lobby-player img { width: 64px; height: 64px; object-fit: cover; border: 2px solid white; border-radius: 50%; }
.lobby-player strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.lobby-player span { color: var(--gold); font-size: 11px; }

.round-picker { display: flex; justify-content: center; gap: 8px; margin: 16px 0; }
.round-option { min-width: 74px; padding: 10px 15px; border: 1px solid var(--line); border-radius: 999px; background: rgba(0,0,0,.2); font-weight: 900; cursor: pointer; }
.round-option.active { color: #4d3010; background: var(--gold); border-color: #fff0c4; }
.start-button { min-width: 180px; padding: 13px 28px; border: 0; border-radius: 999px; color: #4a2805; background: linear-gradient(#ffe8a5, #f2b945); box-shadow: 0 13px 30px rgba(85, 45, 7, .32); font-size: 17px; font-weight: 1000; cursor: pointer; }

.leaderboard { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 14px; margin-top: 16px; color: var(--muted); font-size: 11px; }
.leaderboard strong { color: var(--ink); }

.modal-backdrop,
.drawer-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(4, 10, 8, 0.58);
  backdrop-filter: blur(10px);
  animation: fade-in 180ms ease both;
}

.modal-backdrop[hidden],
.drawer-backdrop[hidden] { display: none; }

.settings-panel,
.result-panel {
  width: min(720px, 96vw);
  max-height: min(90vh, 760px);
  overflow: auto;
  padding: 20px;
  border-radius: 26px;
  background: rgba(18, 28, 25, 0.94);
  box-shadow: 0 30px 90px rgba(0,0,0,.45);
}

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 22px; }
.close-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.08); cursor: pointer; }
.settings-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.settings-section h3 { margin: 0 0 10px; color: var(--gold); font-size: 13px; }

.profile-editor-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.profile-editor { display: grid; gap: 7px; justify-items: center; padding: 12px 8px; border-radius: 18px; background: rgba(255,255,255,.06); }
.profile-editor img { width: 56px; height: 56px; border: 2px solid white; border-radius: 50%; object-fit: cover; }
.profile-editor input[type="text"] { width: 100%; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; color: white; background: rgba(0,0,0,.22); text-align: center; }
.profile-editor button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.08); font-size: 11px; cursor: pointer; }

.theme-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.theme-option { position: relative; aspect-ratio: 1.55; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 13px; background-size: cover; background-position: center; cursor: pointer; }
.theme-option.active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255,215,119,.25); }
.theme-option span { position: absolute; inset: auto 0 0; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.8)); font-size: 10px; font-weight: 900; }

.volume-row { display: grid; grid-template-columns: 62px 1fr 34px; align-items: center; gap: 10px; margin: 10px 0; font-size: 12px; }
.volume-row input { accent-color: var(--gold); width: 100%; }
.dissolve-button { width: 100%; padding: 11px; border: 1px solid rgba(255,120,110,.45); border-radius: 14px; color: #ffd8d5; background: rgba(185,54,48,.3); font-weight: 900; cursor: pointer; }
.dissolve-button:disabled { opacity: .4; }

.interaction-drawer {
  position: absolute;
  right: 12px;
  bottom: calc(62px + var(--safe-bottom));
  width: min(360px, calc(100vw - 24px));
  padding: 14px;
  border-radius: 22px;
  background: rgba(15, 27, 23, .94);
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

.chat-drawer {
  position: absolute;
  right: 12px;
  bottom: calc(66px + var(--safe-bottom));
  width: min(560px, calc(100% - 24px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 27, 23, .96);
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

.chat-backdrop { background: rgba(4, 10, 8, .2); backdrop-filter: blur(2px); }
.chat-row { display: flex; gap: 6px; }
.chat-row input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; color: white; background: rgba(0,0,0,.22); }
.chat-row button { padding: 7px 12px; border: 0; border-radius: 12px; color: #4d2d09; background: var(--gold); font-weight: 900; cursor: pointer; }
.emote-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 11px; }
.emote-button { aspect-ratio: 1; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background-color: rgba(255,255,255,.08); background-image: url("/doudizhu/assets/emotes/emotes-13.jpg"); background-size: 300% 500%; background-position: var(--emoji-x) var(--emoji-y); cursor: pointer; }
.target-row,
.prop-row { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.target-row span { color: var(--muted); font-size: 11px; }
.target-chip,
.prop-button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.07); font-size: 11px; font-weight: 800; cursor: pointer; }
.target-chip.active { color: #4d2d09; background: var(--gold); }
.prop-button { flex: 1; }

.result-backdrop { cursor: pointer; }
.result-panel { position: relative; cursor: default; text-align: center; }
.result-panel-head { display: grid; grid-template-columns: 36px minmax(0, 1fr) 36px; align-items: center; gap: 8px; }
.result-panel-head > div { min-width: 0; }
.result-close-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: rgba(255,255,255,.08); font-size: 22px; line-height: 1; cursor: pointer; }
.result-panel h2 { margin: 2px 0 8px; font-size: 30px; }
.result-panel .result-kicker { color: var(--gold); font-size: 12px; font-weight: 900; }
.result-summary > p { margin: 8px 0; }
.result-score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.result-score { padding: 12px 6px; border-radius: 16px; background: rgba(255,255,255,.07); }
.result-score strong { display: block; font-size: 22px; }
.result-score span { color: var(--muted); font-size: 11px; }
.match-transcript { display: flex; flex-direction: column; overflow: hidden; min-height: 0; margin: 14px 0; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: rgba(0,0,0,.2); text-align: left; }
.match-transcript > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.match-transcript > header strong { color: var(--gold); font-size: 14px; }
.match-transcript > header span { color: var(--muted); font-size: 11px; }
.match-transcript-list { max-height: 160px; overflow: auto; padding: 4px 14px 10px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; user-select: text; -webkit-user-select: text; }
.match-transcript-round h3 { position: sticky; top: 0; z-index: 1; margin: 0 -2px 4px; padding: 10px 2px 5px; color: #d8eadf; background: rgba(17, 27, 24, .96); font-size: 11px; }
.match-transcript-row { display: grid; grid-template-columns: 42px minmax(58px, auto) 1fr; align-items: baseline; gap: 7px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.055); font-size: 12px; }
.match-transcript-row time { color: var(--muted); font-variant-numeric: tabular-nums; }
.match-transcript-row strong { overflow: hidden; max-width: 120px; color: #fff2c5; text-overflow: ellipsis; white-space: nowrap; }
.match-transcript-row span { overflow-wrap: anywhere; color: var(--ink); }
.match-transcript-empty { margin: 0; padding: 24px 0 12px; color: var(--muted); text-align: center; }
.transcript-toggle { width: 100%; min-height: 36px; padding: 8px 14px; border: 0; border-top: 1px solid rgba(255,255,255,.1); color: #ffe8a5; background: rgba(255,215,119,.08); font-size: 12px; font-weight: 900; cursor: pointer; }
.result-panel.transcript-expanded { display: flex; flex-direction: column; width: min(940px, 96vw); height: min(90vh, 760px); max-height: none; overflow: hidden; }
.result-panel.transcript-expanded .result-summary { display: none; }
.result-panel.transcript-expanded .match-transcript { flex: 1; }
.result-panel.transcript-expanded .match-transcript-list { flex: 1; max-height: none; }
.result-actions { position: sticky; z-index: 3; bottom: -2px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 10px 0 2px; background: linear-gradient(180deg, transparent, rgba(18,28,25,.98) 25%); }
.result-actions .start-button { min-width: 132px; padding: 11px 18px; font-size: 14px; }
.result-copy-button,
.result-exit-button { min-width: 132px; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 900; cursor: pointer; }
.result-copy-button { border: 1px solid rgba(255,215,119,.5); color: #ffe8a5; background: rgba(255,215,119,.09); }
.result-exit-button { border: 1px solid rgba(255,150,140,.42); color: #ffd8d5; background: rgba(185,54,48,.22); }
.result-reopen-button { position: absolute; z-index: 55; top: 62px; left: 50%; padding: 9px 16px; border-radius: 999px; color: #4d3010; background: var(--gold); transform: translateX(-50%); font-size: 12px; font-weight: 1000; cursor: pointer; }

.dissolve-banner {
  position: absolute;
  z-index: 50;
  top: 64px;
  left: 50%;
  width: min(470px, 90vw);
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(27, 25, 21, .9);
  transform: translateX(-50%);
  text-align: center;
  box-shadow: 0 15px 45px rgba(0,0,0,.32);
}
.vote-list { display: flex; justify-content: center; gap: 8px; margin-top: 7px; }
.vote-chip { padding: 4px 8px; border-radius: 999px; background: rgba(255,255,255,.08); font-size: 11px; }
.vote-chip.yes { color: #baffd1; }
.vote-chip.no { color: #ffaaa4; }

.error-toast {
  position: fixed;
  z-index: 300;
  top: 18px;
  left: 50%;
  max-width: 88vw;
  padding: 9px 14px;
  border-radius: 999px;
  color: white;
  background: rgba(172, 43, 38, .94);
  box-shadow: 0 10px 30px rgba(0,0,0,.3);
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 900;
  animation: toast-in 2.8s ease both;
}
.error-toast.success { background: rgba(34, 122, 78, .96); }

#effects,
#particleCanvas {
  position: fixed;
  z-index: 200;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.bomb-flash,
.rocket-flash {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(70px, 15vw, 180px);
  font-weight: 1000;
  text-shadow: 0 0 20px white, 0 0 60px #ff5b2f, 0 0 120px #ff2500;
  animation: blast 780ms ease-out both;
}
.rocket-flash { color: #d6f5ff; text-shadow: 0 0 20px white, 0 0 55px #80caff, 0 0 120px #b24aff; }

.prop-flight {
  position: fixed;
  z-index: 230;
  width: clamp(70px, 10vw, 122px);
  height: clamp(70px, 10vw, 122px);
  object-fit: contain;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.28));
  will-change: transform, filter;
}
.prop-flight--egg { width: clamp(58px, 8.6vw, 102px); height: clamp(58px, 8.6vw, 102px); }
.prop-flight--cheers { width: clamp(96px, 13vw, 160px); height: clamp(96px, 13vw, 160px); }
.prop-impact {
  position: fixed;
  z-index: 232;
  left: 0;
  top: 0;
  width: clamp(170px, 19vw, 245px);
  height: clamp(170px, 19vw, 245px);
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.prop-impact-image {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0,0,0,.32));
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg));
}
.prop-impact--tomato .prop-impact-image { animation: tomato-smash 1.05s cubic-bezier(.13,.88,.2,1) both; }
.prop-impact--egg .prop-impact-image { width: 88%; height: 88%; animation: egg-crack 1.02s cubic-bezier(.12,.82,.24,1) both; }
.prop-impact--cheers .prop-impact-image { width: 110%; height: 110%; animation: cheers-clink 1.18s cubic-bezier(.16,.75,.2,1) both; }
.prop-drop {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--size);
  height: var(--size);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: prop-scatter 900ms cubic-bezier(.14,.72,.22,1) var(--delay, 0ms) both;
}
.tomato-drop {
  border-radius: 62% 38% 55% 45%;
  background: radial-gradient(circle at 32% 30%, #ffd08d 0 13%, #ff4a29 20%, #b91414 100%);
  box-shadow: inset 0 -2px 2px rgba(97, 0, 0, .2);
}
.egg-shard {
  border-radius: 42% 58% 38% 62%;
  background: linear-gradient(135deg, #fff9e5 0 45%, #e69d3b 48% 100%);
  clip-path: polygon(8% 5%, 100% 24%, 78% 100%, 24% 72%);
}
.beer-bubble {
  border-radius: 50%;
  background: radial-gradient(circle at 30% 26%, #fff 0 20%, #fff1b3 22% 58%, #ffba35 100%);
  box-shadow: 0 0 8px rgba(255, 227, 130, .55);
}
.beer-spark {
  width: 3px;
  height: var(--size);
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, #ffffff, #ffd36a, transparent);
  transform-origin: center bottom;
}
.emote-popup { position: fixed; z-index: 231; width: 62px; height: 62px; border-radius: 50%; background-image: url("/doudizhu/assets/emotes/emotes-13.jpg"); background-size: 300% 500%; background-position: var(--emoji-x) var(--emoji-y); box-shadow: 0 9px 20px rgba(0,0,0,.26); transform: translate(-50%, -50%); animation: emote-pop 1.8s ease both; }

.game-shell.shake { animation: table-shake 520ms ease both; }

@keyframes turn-pulse { 50% { transform: scale(1.035); } }
@keyframes deal-card { from { opacity: 0; transform: translate(0, -140px) scale(.72) rotate(-4deg); } }
@keyframes card-land { from { opacity: 0; transform: translateY(35px) scale(.78); } }
@keyframes bubble-in { from { opacity: 0; transform: translate(-50%, 8px) scale(.88); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes toast-in { 0% { opacity: 0; transform: translate(-50%, -12px); } 10%, 82% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
@keyframes blast { 0% { opacity: 0; transform: scale(.1) rotate(-8deg); } 24% { opacity: 1; transform: scale(1.15) rotate(3deg); } 100% { opacity: 0; transform: scale(1.8); } }
@keyframes table-shake { 15% { transform: translate(-10px, 5px); } 30% { transform: translate(8px, -6px); } 46% { transform: translate(-6px, 4px); } 62% { transform: translate(5px, -3px); } 80% { transform: translate(-2px, 1px); } }
@keyframes tomato-smash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.18,.58) rotate(calc(var(--tilt, 0deg) - 22deg)); filter: blur(1px) drop-shadow(0 7px 12px rgba(0,0,0,.28)); }
  16% { opacity: 1; transform: translate(-50%, -50%) scale(1.2,.74) rotate(calc(var(--tilt, 0deg) + 5deg)); }
  62% { opacity: 1; transform: translate(-50%, -50%) scale(1.02) rotate(var(--tilt, 0deg)); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.92) rotate(var(--tilt, 0deg)); }
}
@keyframes egg-crack {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.28) rotate(calc(var(--tilt, 0deg) - 16deg)); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.16) rotate(calc(var(--tilt, 0deg) + 4deg)); }
  36% { transform: translate(-50%, -50%) scale(.97) rotate(calc(var(--tilt, 0deg) - 2deg)); }
  76% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(var(--tilt, 0deg)); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.88) rotate(var(--tilt, 0deg)); }
}
@keyframes cheers-clink {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.42) rotate(calc(var(--tilt, 0deg) - 10deg)); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.18) rotate(calc(var(--tilt, 0deg) + 4deg)); }
  27% { transform: translate(-50%, -50%) scale(.96) rotate(calc(var(--tilt, 0deg) - 2deg)); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1.02) rotate(var(--tilt, 0deg)); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.94) rotate(var(--tilt, 0deg)); }
}
@keyframes prop-scatter {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0deg); }
  12% { opacity: 1; }
  72% { opacity: .95; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.84) rotate(var(--rot)); }
}
@keyframes emote-pop { 0% { opacity: 0; transform: translate(-50%, 0) scale(.3); } 20%, 72% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -110%) scale(.8); } }

@media (max-height: 560px) and (orientation: landscape) {
  :root { --card-w: clamp(76px, 10.5vw, 108px); }
  .player-seat[data-seat="1"],
  .player-seat[data-seat="2"] { top: 20%; }
  .player-seat[data-seat="0"] { left: 52px; bottom: 3px; transform: none; }
  .center-table { top: 47%; transform: translate(-50%, -50%); }
  .turn-actions { bottom: calc(var(--card-h) + 8px); }
  .feed-line { bottom: calc(var(--card-h) + 51px); }
  .hand-zone { left: 55%; width: min(90vw, 1120px); }
  .hand { justify-content: center; padding: 13px 24px 0; min-height: calc(var(--card-h) + 14px); overflow: visible; }
  .settings-button,
  .chat-button,
  .interaction-button { width: 38px; height: 38px; }
  .settings-button { bottom: 7px; }
  .table-tools { right: 8px; bottom: calc(var(--card-h) + 18px); }
}

/* --- yinliu v1: classic art, doubling, AI advice --- */
:root { --card-h: calc(var(--card-w) * 1.374); }
.playing-card { border-radius: calc(var(--card-w) * 0.07); background: transparent; }
.hand .playing-card.suggested { box-shadow: inset 0 0 0 3px #4fd6ff, 0 0 12px 3px rgba(79, 214, 255, 0.85); }
.hand .playing-card.suggested.selected { box-shadow: inset 0 0 0 4px var(--gold), 0 0 12px 3px rgba(79, 214, 255, 0.85); }

.action-button { border: 0; border-radius: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); background: url("/doudizhu/assets/ui/btn-blue.png") center / 100% 100% no-repeat; font-weight: 900; }
.action-button.primary { color: #6a3300; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); background: url("/doudizhu/assets/ui/btn-yellow.png") center / 100% 100% no-repeat; }
.action-button:disabled { opacity: 1; color: #eee; background-image: url("/doudizhu/assets/ui/btn-gray.png"); }
span.action-button { background: rgba(10, 30, 70, 0.55); border-radius: 999px; }
.start-button { color: #6a3300; background: url("/doudizhu/assets/ui/btn-yellow.png") center / 100% 100% no-repeat; border-radius: 14px; }

.role-badge.is-landlord { display: inline-flex; align-items: center; gap: 2px; width: auto; padding: 0 6px 0 2px; color: #fff3c4; background: #c8361f; }
.role-badge.is-landlord img { width: 18px; height: auto; }
.double-badge { position: absolute; left: -8px; top: -8px; z-index: 3; padding: 1px 6px; border-radius: 999px; color: #fff; background: rgba(40, 50, 80, 0.86); font-size: 11px; font-weight: 900; white-space: nowrap; }
.double-badge.is-double { color: #5a2a00; background: linear-gradient(#ffe36b, #f5a524); }

.advice-panel { position: absolute; z-index: 24; right: 2.5%; top: 46%; width: clamp(170px, 19vw, 230px); padding: 10px 12px; border-radius: 14px; text-align: left; font-size: 13px; }
.advice-panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.advice-panel header strong { color: #9fe6ff; font-size: 14px; }
.advice-panel.is-collapsed { width: auto; padding: 6px 10px; }
.advice-toggle { padding: 2px 10px; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; background: rgba(255, 255, 255, 0.08); font-size: 12px; cursor: pointer; }
.advice-move { margin: 8px 0 6px; }
.advice-move strong { color: var(--gold); font-size: 16px; }
.advice-cards { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.advice-card { min-width: 28px; padding: 2px 5px; border-radius: 6px; color: #1b1b1b; background: #fff; font-weight: 900; text-align: center; }
.advice-apply { width: 100%; padding: 6px; border: 0; border-radius: 10px; color: #6a3300; background: url("/doudizhu/assets/ui/btn-yellow.png") center / 100% 100% no-repeat; font-weight: 900; cursor: pointer; }
.advice-note, .advice-empty { margin: 6px 0 0; color: var(--muted); font-size: 11px; }

.last-move { align-content: start; }
@media (max-height: 560px) and (orientation: landscape) {
  .advice-panel { top: 27%; right: 14%; width: 158px; padding: 6px 9px; font-size: 11px; }
  .advice-panel header strong { font-size: 12px; }
  .advice-move { margin: 4px 0; }
  .advice-move strong { font-size: 13px; }
  .advice-cards { margin-bottom: 5px; }
  .advice-apply { padding: 4px; font-size: 12px; }
  .advice-note { display: none; }
  /* 矮屏横屏把底牌和说明一起上移，给叫分按钮留空间。 */
  .landlord-deal-stage { transform: translateY(-14px); }
  .landlord-cards--waiting { --card-w: 46px; --card-h: 61px; }
}
.result-banner { display: block; max-width: min(360px, 70%); margin: 0 auto 6px; }

.emote-button { display: grid; place-items: center; background-image: none; font-size: 22px; }
.emote-popup { display: grid; place-items: center; background-image: none; background-color: rgba(255, 255, 255, 0.9); font-size: 40px; }
.prop-flight, .prop-impact-image { display: grid; place-items: center; font-size: clamp(44px, 6vw, 80px); line-height: 1; }
.theme-option[data-theme-preview="classic"] { background-image: url("/doudizhu/assets/themes/theme-classic.jpg"); }
.theme-option[data-theme-preview="green"] { background-image: radial-gradient(ellipse at 50% 35%, #2f8a5a 0%, #1d5a3b 55%, #123826 100%); }
.theme-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* --- 整站接入：结算面板广告入口、回首页链接 --- */
.result-adc { margin: 10px 0 4px; }
.advice-toggle { min-height: 24px; }
a.result-exit-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
@media (max-height: 560px) and (orientation: landscape) {
  :root { --site-bar-h: calc(26px + env(safe-area-inset-top, 0px)); }
  .site-bar { font-size: 12px; }
  .site-home { min-height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* 手机竖屏：不旋转牌桌，按竖屏重新排。
   从上到下：对局信息条 → 两家电脑 + 底牌 → 出牌区 → AI 建议 → 操作按钮 → 我的座位与工具 → 两行手牌。 */
@media (orientation: portrait) {
  :root {
    --card-w: min(60px, calc((100vw - 16px) / 5.2));
    --hand-h: calc(var(--card-h) * 1.55 + 16px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
  }
  .topbar {
    top: 4px;
    left: 50%;
    right: auto;
    min-height: 28px;
    max-width: calc(100% - 16px);
    gap: 8px;
    padding: 3px 10px;
    overflow: hidden;
    transform: translateX(-50%);
    font-size: 11px;
  }
  .topbar strong { font-size: 12px; }

  .player-seat { width: 84px; }
  .player-seat[data-seat="1"] { left: 6px; top: 38px; }
  .player-seat[data-seat="2"] { right: 6px; top: 38px; }
  .player-seat .avatar-wrap { width: 48px; height: 48px; border-width: 2px; }
  .player-seat .seat-score { margin-bottom: 9px; padding: 1px 6px; font-size: 11px; }
  .player-seat .seat-name { max-width: 84px; margin-top: 3px; padding: 2px 7px; font-size: 11px; }
  /* 张数放到名字下面，不和头像上的身份/加倍标记抢位置 */
  .player-seat .hand-count { position: static; order: 9; margin-top: 3px; padding: 1px 6px; font-size: 11px; }
  .player-seat .double-badge { top: -11px; }
  .player-seat .speech-bubble { top: auto; bottom: -30px; max-width: 110px; font-size: 11px; }

  /* 我的座位：手牌上方左侧的一条小名片 */
  .player-seat[data-seat="0"] {
    left: 8px;
    bottom: calc(var(--hand-h) + 6px + var(--safe-bottom));
    width: auto;
    max-width: calc(100% - 150px);
    grid-template-columns: 36px auto;
    grid-template-areas: "avatar name" "avatar score";
    column-gap: 14px;
    row-gap: 1px;
    align-items: center;
    justify-items: start;
  }
  .player-seat[data-seat="0"] .avatar-wrap { grid-area: avatar; width: 36px; height: 36px; }
  .player-seat[data-seat="0"] .seat-name { grid-area: name; margin: 0; max-width: 100%; }
  .player-seat[data-seat="0"] .seat-score { grid-area: score; margin: 0; }
  .player-seat[data-seat="0"] .hand-count { display: none; }
  .player-seat[data-seat="0"] .role-badge { right: auto; left: 50%; bottom: -8px; transform: translateX(-50%); white-space: nowrap; }
  .player-seat[data-seat="0"] .double-badge { top: -10px; left: 50%; transform: translateX(-50%); }
  .player-seat[data-seat="0"] .speech-bubble { top: -34px; bottom: auto; left: 18px; transform: none; }
  .player-seat .role-badge { min-width: 22px; height: 20px; font-size: 10px; }
  .player-seat .role-badge.is-landlord img { width: 14px; }
  .player-seat .double-badge { left: -6px; top: -6px; font-size: 10px; }

  .landlord-cards--revealed { top: 40px; gap: 2px; }
  .landlord-mini-card { min-width: 28px; height: 28px; padding: 2px 3px; }
  .landlord-mini-card strong { font-size: 17px; }
  .landlord-mini-card span { font-size: 13px; }
  .landlord-mini-card.is-joker { min-width: 30px; }
  .landlord-mini-card.is-joker strong,
  .landlord-mini-card.is-joker span { font-size: 11px; }

  .center-table {
    top: 156px;
    bottom: calc(var(--hand-h) + 170px + var(--safe-bottom));
    left: 8px;
    width: auto;
    right: 8px;
    min-height: 0;
    transform: none;
    place-items: center;
  }
  .center-table .playing-card { --card-w: 40px; --card-h: 55px; }
  .last-move { min-height: 0; gap: 6px; width: 100%; }
  .table-cards { min-height: 0; width: 100%; max-width: 100%; }
  .table-cards .playing-card { --card-w: 42px; --card-h: 58px; }
  .table-cards .playing-card + .playing-card { margin-left: min(calc(var(--card-w) * -0.48), calc((100% - var(--card-w) * var(--count, 2)) / (var(--count, 2) - 1))); }
  .landlord-deal-stage { gap: 6px; }

  /* 两行手牌：每行按张数自动压叠，露出宽度在 320 宽下仍 ≥ 24px */
  .hand-zone {
    left: 8px;
    right: 8px;
    bottom: calc(4px + var(--safe-bottom));
    width: auto;
    transform: none;
  }
  .hand.hand--rows {
    display: block;
    min-height: 0;
    padding: 10px 0 0;
  }
  .hand-row {
    display: flex;
    justify-content: center;
    width: 100%;
  }
  .hand-row + .hand-row { margin-top: calc(var(--card-h) * -0.45); }
  .hand-row .playing-card { margin-left: min(4px, calc((100% - var(--card-w) * var(--row-count, 2)) / (var(--row-count, 2) - 1))); }
  .hand-row .playing-card:first-child { margin-left: 0; }
  .hand .playing-card.selected { top: -9px; }

  .turn-actions {
    bottom: calc(var(--hand-h) + 50px + var(--safe-bottom));
    width: calc(100% - 16px);
    flex-wrap: nowrap;
    gap: 6px;
  }
  .action-button { min-width: 60px; min-height: 36px; padding: 7px 10px; font-size: 13px; }
  span.action-button { min-width: 0; white-space: nowrap; }

  .feed-line { display: none; }

  .settings-button,
  .chat-button,
  .interaction-button { width: 36px; height: 36px; font-size: 17px; }
  .chat-button svg { width: 19px; height: 19px; }
  .table-tools { right: 8px; bottom: calc(var(--hand-h) + 6px + var(--safe-bottom)); gap: 6px; }
  .game-shell > .settings-button { left: auto; right: 92px; bottom: calc(var(--hand-h) + 6px + var(--safe-bottom)); }
  .lobby ~ .settings-button { right: 12px; bottom: calc(12px + var(--safe-bottom)); }

  .advice-panel {
    top: auto;
    right: 8px;
    left: 8px;
    bottom: calc(var(--hand-h) + 94px + var(--safe-bottom));
    width: auto;
    padding: 5px 8px 6px 10px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "title move toggle" "cards cards apply";
    align-items: center;
    gap: 4px 8px;
    font-size: 12px;
  }
  .advice-panel header { display: contents; }
  .advice-panel header strong { grid-area: title; font-size: 13px; white-space: nowrap; }
  .advice-toggle { grid-area: toggle; min-width: 48px; min-height: 26px; }
  .advice-panel.is-collapsed { left: auto; width: auto; grid-template-areas: "title toggle"; grid-template-columns: auto auto; padding: 4px 6px 4px 10px; }
  .advice-move { grid-area: move; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .advice-move strong { font-size: 14px; }
  .advice-cards { grid-area: cards; margin: 0; gap: 3px; min-width: 0; }
  .advice-card { min-width: 24px; padding: 2px 4px; font-size: 12px; }
  .advice-apply { grid-area: apply; width: auto; min-height: 30px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
  .advice-note { display: none; }
  .advice-panel .advice-empty { grid-area: move; margin: 0; }

  .result-reopen-button { top: 104px; }
  .dissolve-banner { top: 150px; }

  .lobby { padding: 14px; }
  .lobby-card { width: min(420px, 94vw); padding: 22px 16px; border-radius: 22px; }
  .lobby .lobby-title { font-size: 36px; }

  .modal-backdrop,
  .drawer-backdrop { padding: 8px; }
  .settings-panel,
  .result-panel { width: min(460px, 96vw); max-height: calc(100% - 16px); padding: 12px 12px 10px; border-radius: 20px; }
  .result-panel h2 { margin-bottom: 4px; font-size: 22px; }
  .result-banner { max-width: 72%; margin-bottom: 4px; }
  .result-summary > p { margin: 4px 0; font-size: 12px; }
  .result-score-grid { gap: 6px; margin: 8px 0; }
  .result-score { padding: 7px 4px; border-radius: 12px; }
  .result-score strong { font-size: 18px; }
  .match-transcript { margin: 8px 0; }
  .match-transcript-list { max-height: 96px; }
  .result-actions { gap: 6px; }
  .result-actions .start-button,
  .result-copy-button,
  .result-exit-button { min-width: 0; flex: 1 1 88px; padding: 9px 10px; font-size: 13px; }
  .profile-editor-list { grid-template-columns: 1fr; }
  .profile-editor { grid-template-columns: 40px minmax(0, 1fr); justify-items: stretch; align-items: center; }
  .profile-editor img { width: 40px; height: 40px; grid-row: span 3; }
  .profile-editor button { min-height: 28px; }
  .interaction-drawer,
  .chat-drawer { right: 8px; left: 8px; width: auto; bottom: calc(var(--hand-h) + 48px + var(--safe-bottom)); }
  .target-chip,
  .prop-button { min-height: 30px; }
}

@media (orientation: portrait) and (max-height: 700px) {
  .result-banner { max-width: 56%; }
  .match-transcript-list { max-height: 64px; }
}

/* 矮屏竖屏（如 320×568）：牌和头像再小一档，给中间出牌区留够高度 */
@media (orientation: portrait) and (max-height: 660px) {
  :root { --card-w: min(52px, calc((100vw - 16px) / 5.2)); }
  .player-seat .avatar-wrap { width: 40px; height: 40px; }
  .player-seat[data-seat="0"] .avatar-wrap { width: 34px; height: 34px; }
  .center-table { top: 146px; }
  .center-table .playing-card { --card-w: 36px; --card-h: 49px; }
  .table-cards .playing-card { --card-w: 38px; --card-h: 52px; }
  .landlord-cards--revealed { top: 38px; }
  .result-banner { max-width: 48%; }
}


/* ===== 10-29 按国内斗地主常见做法调布局 =====
   手牌压底 → 出牌提示条贴在手牌上沿 → 「不出 · 闹钟 · 出牌」一排 → 各家出的牌摆在各自座位前面；
   面板去毛玻璃，改成牌桌美术的深蓝底 + 金边。 */
:root {
  --w-navy: #0f2f6b;
  --w-navy-deep: #0a1f4a;
  --w-gold: #ffcf4d;
  --w-gold-rim: rgba(255, 207, 77, 0.62);
}
.glass {
  border: 1.5px solid var(--w-gold-rim);
  background: rgba(10, 31, 74, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32), inset 0 1px rgba(255, 255, 255, 0.12);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.site-bar { background: var(--w-navy-deep); border-bottom: 2px solid #f0b630; }
.site-home { background: rgba(255, 255, 255, 0.12); }
.topbar { border-radius: 10px; }
.drawer-backdrop, .modal-backdrop { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(3, 10, 28, 0.62); }
.settings-panel, .interaction-drawer, .chat-drawer { background: var(--w-navy-deep); border: 1.5px solid var(--w-gold-rim); }
.settings-button, .chat-button, .interaction-button { background: rgba(10, 31, 74, 0.86); border: 1.5px solid var(--w-gold-rim); backdrop-filter: none; }

/* 座位：张数挂在名字下面（带牌背小图），不再压在头像上 */
.player-seat .hand-count,
.player-seat[data-seat] .hand-count {
  position: static;
  order: 9;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  padding: 1px 7px 1px 3px;
  border-radius: 6px;
  color: #fff;
  background: rgba(6, 18, 46, 0.82);
  font-size: 12px;
}
.hand-count img { width: 13px; height: auto; }
.pass-mark { position: absolute; z-index: 30; top: 46%; width: 62px; height: auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); animation: bubble-in 220ms ease both; }
.player-seat[data-seat="1"] .pass-mark { left: calc(100% + 4px); }
.player-seat[data-seat="2"] .pass-mark { right: calc(100% + 4px); }
.player-seat[data-seat="0"] .pass-mark { left: 100%; top: -6px; }

/* 出的牌摆在出牌人面前（上家左、下家右、自己在手牌上方居中） */
.center-table[data-from-seat="1"] { left: 30%; }
.center-table[data-from-seat="2"] { left: 70%; }
.center-table[data-from-seat="1"],
.center-table[data-from-seat="2"] { top: 40%; width: min(40vw, 420px); }
.center-table[data-from-seat="0"] { top: 50%; }
.last-move-label { color: #fff; background: rgba(6, 18, 46, 0.72); }

/* 操作排：不出 · 闹钟 · 出牌（叫分、加倍同样带闹钟） */
.turn-actions { bottom: calc(var(--card-h) + 74px + var(--safe-bottom)); gap: 10px; }
.turn-clock {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 52px;
  padding-top: 5px;
  color: #6b2f00;
  background: url("/doudizhu/assets/ui/w-clock.png") center / contain no-repeat;
  font-size: 17px;
  font-weight: 1000;
  font-variant-numeric: tabular-nums;
}
.turn-clock:empty::after { content: ""; }

/* AI 出牌提示：一条贴在手牌上沿的提示带，像游戏自带的「提示」，不再浮在牌桌中间 */
.advice-panel {
  position: absolute;
  z-index: 24;
  top: auto;
  right: auto;
  left: 50%;
  bottom: calc(var(--card-h) + 26px + var(--safe-bottom));
  width: max-content;
  max-width: min(94vw, 760px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 8px;
  border: 2px solid var(--w-gold);
  border-bottom-width: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #17407f, #0c2759);
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.28);
  transform: translateX(-50%);
  text-align: left;
  font-size: 13px;
}
.advice-panel header { display: contents; }
.advice-panel header strong { order: 0; display: inline-flex; align-items: center; gap: 5px; color: #fff; font-size: 13px; white-space: nowrap; }
.advice-badge { padding: 0 5px; border-radius: 5px; color: #5a2a00; background: var(--w-gold); font-size: 11px; line-height: 18px; }
.advice-move { order: 1; margin: 0; white-space: nowrap; }
.advice-move strong { color: var(--w-gold); font-size: 15px; }
.advice-cards { order: 2; display: flex; flex-wrap: nowrap; gap: 3px; margin: 0; min-width: 0; overflow: hidden; }
.advice-card { min-width: 26px; padding: 1px 4px; border-radius: 4px; color: #1b1b1b; background: #fffdf6; box-shadow: 0 1px 0 #b9b3a4; font-family: Georgia, "Noto Serif CJK SC", serif; font-weight: 900; text-align: center; }
.advice-apply { order: 3; width: auto; min-height: 32px; padding: 4px 14px; color: #6a3300; background: url("/doudizhu/assets/ui/w-btn-yellow.png") center / 100% 100% no-repeat; font-size: 13px; white-space: nowrap; }
.advice-toggle { order: 4; min-height: 28px; padding: 2px 10px; border: 0; border-radius: 8px; color: #fff; background: rgba(255, 255, 255, 0.14); font-size: 12px; white-space: nowrap; }
.advice-note { order: 5; margin: 0; color: rgba(255, 255, 255, 0.62); font-size: 11px; white-space: nowrap; }
.advice-empty { order: 1; margin: 0; color: #fff; }
.advice-panel.is-collapsed { left: auto; right: 12px; transform: none; width: auto; padding: 4px 6px 4px 8px; }
.advice-panel.is-collapsed .advice-toggle { color: #6a3300; background: var(--w-gold); }
.hand .playing-card.suggested { box-shadow: inset 0 0 0 3px var(--w-gold), 0 0 12px 3px rgba(255, 207, 77, 0.75); }
.hand .playing-card.suggested.selected { box-shadow: inset 0 0 0 4px #fff, 0 0 14px 4px rgba(255, 207, 77, 0.9); }

/* 结算：地主 / 农民立绘 + 胜负字，金边深蓝底 */
.result-panel { border: 2px solid var(--w-gold); background: linear-gradient(180deg, #143a78 0, #0b2152 46%, #0a1c45 100%); }
.result-panel.is-win { box-shadow: 0 0 0 4px rgba(255, 207, 77, 0.18), 0 30px 90px rgba(0, 0, 0, 0.45); }
.result-hero { position: absolute; z-index: 0; left: 10px; top: 8px; width: 92px; height: auto; pointer-events: none; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4)); }
.result-panel.is-lose .result-hero { filter: grayscale(0.25) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.4)); }
.result-panel-head, .result-banner, .result-summary { position: relative; z-index: 1; }
.result-panel h2 { color: var(--w-gold); text-shadow: 0 2px 0 #6b3a00; }
.result-score { background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); }
.result-actions { background: linear-gradient(180deg, transparent, #0a1c45 25%); }
.match-transcript-round h3 { background: #0b2152; }

/* 特效层 */
.fx-scene { position: absolute; inset: 0; overflow: hidden; }
.fx-sprite,
.fx-still { position: absolute; transform: translate(-50%, -50%); }
.fx-sprite {
  background-repeat: no-repeat;
  background-position: 0 0;
  animation: fx-frames var(--dur) steps(var(--steps), jump-none) var(--delay) var(--iter) both;
}
.fx-still img { display: block; width: 100%; height: auto; }
.fx-still { animation: fx-show var(--dur) ease var(--delay) both; }
.fx-still.fx-pop { animation: fx-pop var(--dur) cubic-bezier(.2, 1.4, .4, 1) var(--delay) both; }
.fx-still.fx-rise { animation: fx-rise var(--dur) cubic-bezier(.5, 0, .9, .5) var(--delay) both; }
.fx-still.fx-fly { animation: fx-fly var(--dur) linear var(--delay) both; }
.fx-still.fx-glow { animation: fx-glow var(--dur) ease var(--delay) both; }
.fx-sprite.fx-drop { animation: fx-frames var(--dur) steps(var(--steps), jump-none) var(--delay) 1 both, fx-drop var(--dur) cubic-bezier(.5, 0, .9, .4) var(--delay) both; }
.fx-sprite.fx-rise-soft { animation: fx-frames var(--dur) steps(var(--steps), jump-none) var(--delay) 1 both, fx-rise var(--dur) cubic-bezier(.5, 0, .9, .5) var(--delay) both; }
.fx-sprite.fx-fall { animation: fx-frames var(--dur) steps(var(--steps), jump-none) var(--delay) infinite both, fx-fall 2.4s linear var(--delay) both; }
@keyframes fx-frames { from { background-position: 0 0; } to { background-position: 100% 0; } }
@keyframes fx-show { 0% { opacity: 0; } 10%, 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fx-pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 24%, 86% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.04); } }
@keyframes fx-drop { from { transform: translate(-50%, -260%); } to { transform: translate(-50%, -50%); } }
@keyframes fx-rise { 0% { opacity: 1; transform: translate(-50%, 120%); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -260%); } }
@keyframes fx-fly { from { transform: translate(-50%, -50%) translateX(-75vw); } to { transform: translate(-50%, -50%) translateX(75vw); } }
@keyframes fx-glow { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 20%, 80% { opacity: .95; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }
@keyframes fx-fall { from { transform: translate(-50%, -50%); } to { transform: translate(-50%, 380%); } }

/* 横屏矮屏 */
@media (max-height: 560px) and (orientation: landscape) {
  :root { --card-w: clamp(64px, 8.4vw, 96px); }
  .advice-panel { top: auto; right: auto; width: max-content; bottom: calc(var(--card-h) + 12px); padding: 3px 5px 3px 7px; gap: 7px; font-size: 12px; }
  .advice-panel.is-collapsed { right: 10px; }
  .advice-move strong { font-size: 13px; }
  .advice-apply { min-height: 26px; padding: 2px 10px; font-size: 12px; }
  .advice-toggle { min-height: 24px; }
  .advice-note { display: none; }
  .turn-actions { bottom: calc(var(--card-h) + 46px); }
  .turn-clock { width: 38px; height: 43px; font-size: 14px; }
  .action-button { min-height: 34px; padding: 6px 14px; }
  .player-seat[data-seat="1"], .player-seat[data-seat="2"] { top: 14%; }
  .center-table { top: 36%; }
  .center-table[data-from-seat="1"], .center-table[data-from-seat="2"] { top: 34%; }
  .center-table[data-from-seat="0"] { top: 40%; }
  .table-tools { bottom: calc(var(--card-h) + 46px); }
  .pass-mark { width: 50px; top: 30%; }
  .result-hero { width: 70px; }
}

/* 手机竖屏：从下往上 手牌 → 提示带 → 我的名片/工具 → 操作排 → 出牌区 → 对家 */
@media (orientation: portrait) {
  :root { --card-w: min(70px, calc((100vw - 16px) / 5.2)); }
  .player-seat[data-seat="1"], .player-seat[data-seat="2"] { top: 148px; }
  .player-seat .avatar-wrap { width: 58px; height: 58px; }
  .player-seat .hand-count { position: static; font-size: 11px; }
  .player-seat[data-seat="0"] .hand-count { display: none; }
  .landlord-cards--revealed { top: 44px; }
  .advice-panel {
    left: 6px;
    right: 6px;
    bottom: calc(var(--hand-h) - 2px + var(--safe-bottom));
    width: auto;
    max-width: none;
    transform: none;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "title move toggle" "cards cards apply";
    gap: 4px 8px;
    padding: 5px 6px 6px 8px;
  }
  .advice-panel header strong { grid-area: title; }
  .advice-move { grid-area: move; overflow: hidden; text-overflow: ellipsis; }
  .advice-toggle { grid-area: toggle; }
  .advice-cards { grid-area: cards; flex-wrap: wrap; }
  .advice-apply { grid-area: apply; }
  .advice-panel .advice-empty { grid-area: move; }
  .advice-panel.is-collapsed { left: auto; right: 6px; grid-template-areas: "title toggle"; grid-template-columns: auto auto; }
  .player-seat[data-seat="0"],
  .table-tools,
  .game-shell > .settings-button { bottom: calc(var(--hand-h) + 76px + var(--safe-bottom)); }
  .turn-actions { bottom: calc(var(--hand-h) + 134px + var(--safe-bottom)); gap: 8px; }
  .turn-clock { width: 40px; height: 45px; font-size: 15px; }
  .center-table { top: 300px; bottom: calc(var(--hand-h) + 180px + var(--safe-bottom)); }
  .center-table[data-from-seat="1"] { left: 96px; right: 22%; top: 168px; bottom: auto; width: auto; place-items: start; }
  .center-table[data-from-seat="2"] { left: 22%; right: 96px; top: 168px; bottom: auto; width: auto; place-items: end; }
  .landlord-deal-stage { margin-top: -40px; }
  .center-table[data-from-seat="1"] .last-move, .center-table[data-from-seat="2"] .last-move { justify-items: inherit; }
  .center-table .playing-card, .table-cards .playing-card { --card-w: 52px; --card-h: 71px; }
  .pass-mark { width: 52px; top: auto; bottom: -26px; }
  .player-seat[data-seat="1"] .pass-mark { left: 50%; transform: translateX(-50%); }
  .player-seat[data-seat="2"] .pass-mark { right: 50%; transform: translateX(50%); }
  .result-hero { width: 66px; left: 6px; top: 6px; }
}
@media (orientation: portrait) and (max-height: 660px) {
  :root { --card-w: min(52px, calc((100vw - 16px) / 5.2)); }
  .player-seat[data-seat="1"], .player-seat[data-seat="2"] { top: 64px; }
  .center-table { top: 186px; }
  .center-table .playing-card, .table-cards .playing-card { --card-w: 40px; --card-h: 55px; }
}
/* 最新一条动态挪到操作排上方，不压按钮和闹钟 */
.feed-line { bottom: calc(var(--card-h) + 128px + var(--safe-bottom)); }
@media (max-height: 560px) and (orientation: landscape) {
  .feed-line { bottom: calc(var(--card-h) + 92px); }
}

/* ===== 10-29 风格方案：墨绿牌桌（换桌布、站名标识、配色；布局不动） ===== */
:root { --w-navy: #18412f; --w-navy-deep: #0d2a1e; --w-gold: #e9c870; --w-gold-rim: rgba(212, 175, 95, 0.62); --gold: #e9c870; --ink: #f7efdf; }
html, body { background: #173f2c; }
body[data-theme="classic"]::before { background-image: url("/doudizhu/assets/themes/table-style.jpg"); }
.theme-option[data-theme-preview="classic"] { background-image: url("/doudizhu/assets/themes/table-style.jpg"); }
body::after { background: radial-gradient(circle at 50% 44%, transparent 0 42%, rgba(4, 18, 12, 0.30) 100%); }
/* 牌桌中间：站名标识 + 一圈桌面嵌线，做淡 */
#game::before {
  content: "斗地主AI";
  position: absolute; left: 50%; top: 53%; z-index: 0;
  transform: translate(-50%, -50%);
  color: rgba(247, 239, 223, 0.10);
  font-size: clamp(40px, min(6.4vw, 8vh), 92px); font-weight: 900; letter-spacing: 0.12em; text-indent: 0.12em; white-space: nowrap;
  pointer-events: none;
}
#game::after {
  content: "";
  position: absolute; left: 50%; top: 52%; z-index: 0;
  width: min(62vw, 640px); height: min(30vw, 300px);
  border: 2px solid rgba(233, 200, 112, 0.16); border-radius: 50%;
  box-shadow: 0 0 0 8px transparent, 0 0 0 10px rgba(233, 200, 112, 0.16);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
@media (orientation: portrait) {
  #game::before { top: 39%; font-size: 44px; letter-spacing: 0.24em; text-indent: 0.24em; }
  #game::after { top: 39%; width: 76vw; height: 30vw; }
}
.glass { border-color: rgba(212, 175, 95, 0.62); background: rgba(12, 36, 26, 0.92); }
.site-bar { background: #0b2118; border-bottom-color: #d4af5f; }
.settings-panel, .interaction-drawer, .chat-drawer { background: #0d2a1e; border-color: rgba(212, 175, 95, 0.62); }
.settings-button, .chat-button, .interaction-button { background: rgba(12, 36, 26, 0.92); border-color: rgba(212, 175, 95, 0.62); }
.avatar-wrap { border-color: #d4af5f; background: #18412f; box-shadow: 0 0 0 2px #0d2a1e, 0 8px 20px rgba(0, 0, 0, 0.32); }
.player-seat .hand-count, .player-seat[data-seat] .hand-count, .last-move-label { background: rgba(8, 26, 18, 0.82); }
.action-button {
  border: 1.5px solid #d4af5f;
  border-radius: 12px;
  color: #f7efdf;
  background: linear-gradient(180deg, #2f6f4d 0%, #1c4a33 100%);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.22), 0 4px 0 #0c2a1b, 0 7px 12px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.action-button.primary, .start-button, .advice-apply {
  border: 0;
  border-radius: 12px;
  color: #3b2606;
  background: linear-gradient(180deg, #f6dc93 0%, #d6a640 100%);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.45), inset 0 -2px rgba(0, 0, 0, 0.12), 0 4px 0 #8c6420, 0 7px 12px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.action-button:disabled {
  border: 0;
  color: rgba(255, 255, 255, 0.78);
  background: linear-gradient(180deg, #9a948a, #6f6a62);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.25), 0 4px 0 #4b4741, 0 7px 12px rgba(0, 0, 0, 0.25);
  text-shadow: none;
}
.advice-panel { border-color: #d4af5f; background: linear-gradient(180deg, #18412f, #0d2a1e); }
.advice-badge { background: #e9c870; color: #2e1d05; }
.advice-panel.is-collapsed .advice-toggle { background: #e9c870; color: #2e1d05; }
.result-panel { border-color: #d4af5f; background: linear-gradient(180deg, #18412f 0, #0d2a1e 100%); }
.result-actions { background: linear-gradient(180deg, transparent, #0d2a1e 25%); }
.match-transcript-round h3 { background: #0d2a1e; }

/* ===== 10-29 A 风格补强：呢绒桌布带顶灯；按钮跟墨绿金走，不再出现灰按钮 ===== */
body::after { background: radial-gradient(ellipse 70% 62% at 50% 38%, rgba(255, 214, 140, 0.07), transparent 70%), radial-gradient(circle at 50% 42%, transparent 0 46%, rgba(4, 18, 12, 0.34) 100%); }
/* 按不了的「出牌」「不出」保持金 / 墨绿本色，只压暗，玩家仍认得哪个是哪个 */
.action-button:disabled, .action-button.primary:disabled {
  cursor: not-allowed;
  opacity: 0.72;
  filter: saturate(0.7);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.18), 0 3px 0 rgba(0, 0, 0, 0.35);
}
.action-button:disabled { border: 1.5px solid rgba(212, 175, 95, 0.6); color: #f7efdf; background: linear-gradient(180deg, #2f6f4d 0%, #1c4a33 100%); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.action-button.primary:disabled { border: 0; color: #3b2606; background: linear-gradient(180deg, #f6dc93 0%, #d6a640 100%); text-shadow: none; }
/* 结算：「复制记录」「回首页」用墨绿次按钮，「再来一局」金色主按钮 */
.result-copy-button, .result-exit-button {
  border: 1.5px solid #d4af5f;
  color: #f7efdf;
  background: linear-gradient(180deg, #2f6f4d 0%, #1c4a33 100%);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.22), 0 4px 0 #0c2a1b, 0 7px 12px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ===== 10-29 返修：话框不压头像 / 张数 / 身份标签；站名标识矮屏让位 ===== */
@media (orientation: portrait) {
  /* 对手：张数在名字下面，话框改挂到座位上方（本场分之上） */
  .player-seat[data-seat="1"] .speech-bubble, .player-seat[data-seat="2"] .speech-bubble { top: auto; bottom: calc(100% + 4px); }
  /* 我：话框挪到名字那一列上方，让开头像顶上的加倍标 */
  .player-seat[data-seat="0"] .speech-bubble { left: 50px; }
}
/* 手机横屏等矮屏：中间放不下站名标识（会压到操作排），隐藏 */
@media (max-height: 560px) and (orientation: landscape) {
  #game::before { display: none; }
}

/* 提示条左侧换成吉祥物「地主大叔」圆头像（金边） */
.advice-avatar { order: -1; flex: none; width: 36px; height: 36px; border: 2px solid #e9c870; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff8e6, #f0e2c0); object-fit: cover; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.advice-panel.is-collapsed .advice-avatar { width: 30px; height: 30px; }
/* 收起后原来贴右（right: 12px），电脑和横屏会钻到右下工具按钮底下点不到「展开」；改成和展开时一样居中 */
.advice-panel.is-collapsed { left: 50%; right: auto; transform: translateX(-50%); }
@media (max-height: 560px) and (orientation: landscape) {
  .advice-avatar { width: 30px; height: 30px; border-width: 1.5px; }
}
@media (orientation: portrait) {
  .advice-panel { grid-template-columns: auto auto minmax(0, 1fr) auto; grid-template-areas: "av title move toggle" "av cards cards apply"; }
  .advice-panel.is-collapsed { left: auto; right: 6px; transform: none; grid-template-areas: "av title toggle"; grid-template-columns: auto auto auto; }
  .advice-avatar { grid-area: av; align-self: center; width: 40px; height: 40px; }
  .advice-panel.is-collapsed .advice-avatar { width: 28px; height: 28px; }
}

/* 本局回顾（结算面板里点开）：每一手你出了什么、AI 建议什么 */
.result-review-button { min-width: 132px; padding: 10px 16px; border: 1px solid rgba(255,215,119,.7); border-radius: 999px; color: #4d3010; background: var(--gold); font-size: 13px; font-weight: 900; cursor: pointer; }
.round-review { display: flex; flex: 1; flex-direction: column; min-height: 0; margin: 10px 0 6px; text-align: left; }
.review-summary { margin: 0 0 10px; padding: 10px 14px; border-radius: 14px; color: #ffe8a5; background: rgba(255,215,119,.1); font-size: 15px; font-weight: 900; text-align: center; overflow-wrap: anywhere; }
.review-list { flex: 1; min-height: 0; margin: 0; padding: 0 4px 0 0; overflow: auto; list-style: none; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.review-row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; align-items: start; padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px; }
.review-row.is-mine { border-radius: 10px; background: rgba(255,255,255,.06); }
.review-row.is-diff { box-shadow: inset 3px 0 0 #ff8a7a; background: rgba(185,54,48,.16); }
.review-seq { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.review-main { min-width: 0; }
.review-main p { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.review-main strong { margin-right: 6px; color: #fff2c5; }
.review-main small { margin-right: 6px; padding: 1px 6px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.08); font-size: 11px; }
.review-advice-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 3px !important; }
.review-advice { color: #bfe3cf; font-size: 12px; }
.review-advice.is-missing { color: var(--muted); }
.review-flag { padding: 1px 7px; border-radius: 999px; color: #fff; background: #c2453b; font-size: 11px; font-style: normal; font-weight: 900; }
.review-flag.is-same { color: #10301f; background: #8fd6a8; }
.review-empty { padding: 20px 0; color: var(--muted); text-align: center; }

/* --- 体验修复（ddz-uxfix-1106） --- */
/* 结算面板：内容（比分 → 亮牌 → 聊天记录 → 广告）在上面滚动，按钮行固定在面板底部，两者不重叠 */
.result-panel { display: flex; flex-direction: column; overflow: hidden; }
.result-scroll { position: relative; flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.result-panel .result-actions { position: static; flex: none; margin-top: 8px; padding: 10px 0 2px; border-top: 1px solid rgba(255,255,255,.12); background: none; }
.result-panel.transcript-expanded .result-scroll { display: flex; flex-direction: column; overflow: hidden; }
.result-panel.review-open .result-scroll { display: flex; flex-direction: column; overflow: hidden; }
.result-panel h2 { margin-bottom: 0; }
.result-sub { margin: 0 0 6px; color: var(--gold); font-size: 14px; font-weight: 900; }
.result-summary .result-formula { color: #fff2c5; font-size: 15px; font-weight: 900; }
.result-summary .result-factors { color: var(--muted); font-size: 12px; }
.result-adc { margin: 12px 0 2px; }

/* 结算亮牌 */
.reveal-hands { margin: 4px 0 10px; padding: 8px 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(0,0,0,.18); text-align: left; }
.reveal-hands h3 { margin: 0 0 6px; color: var(--gold); font-size: 13px; }
.reveal-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 8px; padding: 3px 0; }
.reveal-name { display: flex; flex-direction: column; color: #fff2c5; font-size: 13px; font-weight: 900; }
.reveal-name small { color: var(--muted); font-size: 11px; font-weight: 700; }
.reveal-cards { display: flex; flex-wrap: wrap; gap: 3px; }
.reveal-cards .landlord-mini-card { width: 26px; height: 36px; }
.round-review .reveal-hands { flex: none; }

/* 代打提示框；游客结算面板「再来一局」旁的剩余局数一句 */
.notice-backdrop { z-index: 120; }
.notice-panel { width: min(400px, 92vw); padding: 20px 18px 14px; border-radius: 22px; background: rgba(18, 28, 25, 0.97); box-shadow: 0 30px 90px rgba(0,0,0,.5); text-align: center; }
.notice-panel p { margin: 6px 0; color: var(--ink); font-size: 14px; line-height: 1.6; }
.guest-again-note { margin: 8px 12px 0; color: var(--muted); font-size: 13px; line-height: 1.5; text-align: center; }
.notice-panel strong { display: block; margin-bottom: 4px; color: #ffe8a5; font-size: 19px; }
.notice-panel .start-button { margin-top: 12px; min-width: 140px; padding: 10px 18px; font-size: 14px; }

/* 掉线盖层：盖住整张牌桌，按钮点不到 */
.net-overlay { position: absolute; z-index: 90; inset: 0; display: grid; place-items: center; background: rgba(4, 10, 8, .55); backdrop-filter: blur(1.5px); }
.net-card { display: grid; justify-items: center; gap: 8px; width: min(360px, 88vw); padding: 18px 16px; border-radius: 20px; background: rgba(18, 28, 25, .95); text-align: center; }
.net-card strong { color: #ffd8d5; font-size: 18px; }
.net-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.net-spinner { width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--gold); border-radius: 50%; animation: net-spin 900ms linear infinite; }
@keyframes net-spin { to { transform: rotate(360deg); } }

/* 托管中 */
.autoplay-bar { position: absolute; z-index: 60; left: 50%; top: 50%; display: grid; justify-items: center; gap: 6px; width: min(340px, 90vw); padding: 14px 16px; border: 2px solid rgba(255,215,119,.7); border-radius: 20px; background: rgba(40, 24, 8, .9); transform: translate(-50%, -50%); text-align: center; }
.autoplay-bar strong { color: var(--gold); font-size: 22px; letter-spacing: 2px; }
.autoplay-bar span { color: #fff2c5; font-size: 13px; }
.autoplay-cancel { min-width: 200px; margin-top: 4px; padding: 12px 22px; font-size: 17px; }
.autoplay-badge { position: absolute; z-index: 4; left: 50%; bottom: -24px; padding: 1px 8px; border-radius: 999px; color: #4d3010; background: var(--gold); transform: translateX(-50%); font-size: 11px; font-weight: 1000; white-space: nowrap; }

/* 叫分小牌（样子同加倍徽标） */
.bid-badge { z-index: 4; }

/* 报单 / 报双：醒目的红色角标，出现时闪几下 */
/* 挂在头像朝牌桌中间的那一侧，不压「本场」分数和名字 */
.warn-badge { position: absolute; z-index: 6; top: 52px; right: -50px; padding: 2px 9px; border: 2px solid #fff3c4; border-radius: 999px; color: #fff; background: linear-gradient(#ff5a4a, #c8221a); box-shadow: 0 0 14px rgba(255, 60, 40, .8); font-size: 14px; font-weight: 1000; white-space: nowrap; animation: warn-flash 420ms ease-in-out 4 alternate; }
.player-seat[data-seat="2"] .warn-badge { right: auto; left: -50px; }
@keyframes warn-flash { from { transform: scale(1); opacity: 1; } to { transform: scale(1.18); opacity: .55; } }

/* 错误提示：放到手牌上方、出牌按钮附近 */
.error-toast.near-hand { top: auto; bottom: calc(var(--card-h) + 70px + var(--safe-bottom)); font-size: 14px; padding: 10px 18px; }
@keyframes card-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }
.hand .playing-card.shake-card { animation: card-shake 380ms ease both; }

/* 竖屏手机 */
@media (orientation: portrait) {
  .error-toast.near-hand { bottom: calc(var(--hand-h) + 188px + var(--safe-bottom)); max-width: calc(100vw - 24px); }
  /* 自己的座位：头像不贴屏幕左边，徽标挪到头像上方两侧、不盖住头像 */
  .player-seat[data-seat="0"] { left: 14px; }
  .player-seat[data-seat="0"] .avatar-wrap { overflow: visible; }
  /* 身份徽标挪到名字右边、加倍徽标挪到头像正上方，都不再盖住头像 */
  .player-seat[data-seat="0"] .role-badge { left: calc(100% + 44px); right: auto; top: -5px; bottom: auto; transform: none; }
  .player-seat[data-seat="0"] .double-badge { top: -23px; left: 50%; transform: translateX(-50%); }
  .result-banner { display: none; }
  /* 「阿福 思考中…」胶囊：放到出牌区上方的窄条，不挡刚出的牌 */
  .turn-actions.is-waiting { bottom: auto; top: calc(var(--site-bar-h, 44px) + 92px); width: auto; }
  .turn-actions.is-waiting .action-button { min-height: 26px; padding: 3px 12px; font-size: 12px; opacity: .92; }
  .warn-badge { top: 44px; right: -40px; font-size: 12px; padding: 1px 7px; }
  .player-seat[data-seat="2"] .warn-badge { right: auto; left: -40px; }
  .autoplay-badge { bottom: -20px; font-size: 10px; }

  /* 结算：手机上广告缩成一条（不删）：去掉插画和长说明 */
  .result-adc .adc-scene,
  .result-adc .adc-body,
  .result-adc .adc-cells { display: none; }
  .result-adc .adc-content { gap: 4px; padding: 24px 12px 10px; }
  .result-adc .adc-card { --adc-pop: 0px; }
  .result-adc .adc-title { font-size: 17px; }
  .result-adc .adc-subtitle { font-size: 13px; }
  .result-sub { font-size: 13px; margin-bottom: 2px; }
  .result-summary .result-formula { font-size: 14px; }
  .result-summary .result-factors { font-size: 11px; }
  .reveal-row { grid-template-columns: 58px minmax(0, 1fr); gap: 6px; }
  .reveal-cards .landlord-mini-card { width: 22px; height: 31px; }
}
/* 矮屏（1366×768 这类）：广告去掉插画，按钮行固定在底部 */
@media (min-width: 761px) and (max-height: 820px) {
  .result-adc .adc-scene { display: none; }
  .result-banner { max-width: min(300px, 60%); }
}

/* 各家「不出」写在自己的出牌位；「思考中 + 倒计时」挂在正在想的那家座位旁；电脑座位名字旁小「AI」标 */
.seat-pass { padding: 2px 14px; border-radius: 10px; color: #ffe27a; background: rgba(8, 26, 18, 0.72); font-size: 22px; font-weight: 900; letter-spacing: 2px; text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6); animation: bubble-in 220ms ease both; }
.ai-badge { display: inline-block; margin-left: 4px; padding: 0 4px; border-radius: 4px; color: #0b2a1c; background: #9fe6ff; font-size: 10px; font-style: normal; font-weight: 900; line-height: 15px; vertical-align: 1px; }
.seat-thinking { position: absolute; z-index: 30; top: 46%; padding: 3px 10px; border-radius: 999px; color: #fff; background: rgba(8, 26, 18, 0.82); font-size: 12px; white-space: nowrap; }
.seat-thinking b { color: #ffe27a; font-variant-numeric: tabular-nums; }
.player-seat[data-seat="1"] .seat-thinking { left: calc(100% + 6px); }
.player-seat[data-seat="2"] .seat-thinking { right: calc(100% + 6px); }
@media (orientation: portrait) {
  .seat-pass { font-size: 17px; padding: 1px 10px; }
  .player-seat[data-seat="1"] .seat-thinking, .player-seat[data-seat="2"] .seat-thinking { top: auto; bottom: -26px; font-size: 11px; padding: 2px 8px; }
  .player-seat[data-seat="1"] .seat-thinking { left: 50%; transform: translateX(-50%); }
  .player-seat[data-seat="2"] .seat-thinking { right: 50%; transform: translateX(50%); }
  /* 建议「不出」时理由放进第二行（原来单独再起一行，面板长高压住自己的座位） */
  .advice-panel .advice-reason { grid-area: cards; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
}

/* 状态与底牌 / 桌面 / 玩家操作依次排布。建议增高时，桌面会随之让出空间。 */
[data-table-part]:not(.player-tools) { display: contents; }

.active-table {
  --table-edge: clamp(12px, 3vw, 36px);
  display: grid;
  grid-template-rows: auto minmax(min-content, 1fr) auto;
  align-items: stretch;
  padding-inline: max(var(--table-edge), env(safe-area-inset-left, 0px)) max(var(--table-edge), env(safe-area-inset-right, 0px));
  overflow-y: auto;
}

.table-info {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 16px;
  padding: 10px 0;
}

.active-table .topbar,
.active-table .landlord-cards--revealed {
  position: static;
  transform: none;
}

.active-table .topbar { min-height: 34px; }
.active-table .landlord-cards--revealed {
  gap: 3px;
  padding: 3px 6px 3px 9px;
  border: 1px solid rgba(212, 175, 95, .38);
  border-radius: 10px;
  background: rgba(9, 35, 24, .55);
}
.active-table .landlord-mini-card { min-width: 29px; height: 26px; padding: 1px 3px; }
.active-table .landlord-mini-card strong { font-size: 18px; }
.active-table .landlord-mini-card span { font-size: 13px; }
.active-table .landlord-mini-card.is-joker { min-width: 30px; }
.active-table .landlord-mini-card.is-joker strong,
.active-table .landlord-mini-card.is-joker span { font-size: 11px; }

.table-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "left center right";
  place-items: center;
  gap: 12px;
  width: min(100%, 1160px);
  min-width: 0;
  justify-self: center;
  padding: 6px 0 16px;
}
.table-opponents { display: contents; }
.table-opponents .player-seat[data-seat="1"] { grid-area: left; }
.table-opponents .player-seat[data-seat="2"] { grid-area: right; }

.active-table .player-seat[data-seat] {
  position: relative;
  inset: auto;
  transform: none;
  width: auto;
  max-width: 100%;
  display: grid;
  align-items: center;
  grid-template-columns: repeat(2, max-content);
  grid-template-areas: "avatar avatar" "name name" "role role" "score cards" "status status";
  gap: 3px 4px;
  justify-content: center;
  justify-items: center;
}

.active-table .avatar-wrap { grid-area: avatar; }
.active-table .seat-role {
  grid-area: role;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.active-table .player-seat[data-seat] .seat-role > * {
  position: static;
  inset: auto;
  transform: none;
  width: auto;
  min-width: 0;
  height: auto;
  border: 1px solid rgba(255, 240, 205, .72);
  padding: 1px 5px;
  font-size: 10px;
  white-space: nowrap;
}
.active-table .seat-name { grid-area: name; max-width: 116px; margin: 0; }
.active-table .seat-score { grid-area: score; margin: 0; white-space: nowrap; }
.active-table .player-seat[data-seat] .hand-count { display: inline-flex; grid-area: cards; margin: 0; white-space: nowrap; }
.active-table :is(.seat-thinking, .seat-pass-slot, .warn-badge, .autoplay-badge) {
  position: static;
  transform: none;
  inset: auto;
  grid-area: status;
}
.active-table .seat-pass-slot { display: flex; }
.active-table .seat-pass { padding: 2px 8px; font-size: 12px; letter-spacing: 0; animation-name: fade-in; }
.active-table .seat-thinking { padding: 2px 8px; font-size: 11px; }
.player-seat .seat-role > .warn-badge,
.active-table .player-seat[data-seat] .seat-role > .warn-badge { position: static; inset: auto; padding: 0 6px; border: 1px solid #fff3c4; font-size: 11px; line-height: 1.45; }
.active-table .autoplay-badge { font-size: 10px; }

.active-table .center-table {
  grid-area: center;
  position: static;
  transform: none;
  width: 100%;
  min-height: 0;
}
.active-table .last-move { width: 100%; min-height: 0; gap: 9px; }
.active-table .last-move-label {
  max-width: 100%;
  padding: 4px 11px;
  border: 1px solid rgba(212, 175, 95, .32);
  color: var(--ink);
  font-size: clamp(11px, 1.5vw, 13px);
  font-weight: 800;
}
.last-move-count { color: var(--gold); white-space: nowrap; }
.active-table .landlord-deal-stage { margin: 0; }
.active-table .landlord-cards--waiting .playing-card {
  --card-w: clamp(38px, 7vw, 72px);
  --card-h: calc(var(--card-w) * 1.374);
}
.active-table .table-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(100%, 720px);
  min-height: 0;
  gap: 0;
  filter: none;
}
.table-card-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  min-width: 0;
}
.table-card-row + .table-card-row { margin-top: calc(clamp(40px, 7.4vw, 78px) * -.4); }
.active-table .table-card-row .playing-card {
  --card-w: clamp(40px, 7.4vw, 78px);
  --card-h: calc(var(--card-w) * 1.374);
  cursor: default;
}
.active-table .table-card-row .playing-card + .playing-card {
  margin-left: min(calc(var(--card-w) * -.36), calc((100% - var(--card-w) * var(--row-count)) / (var(--row-count) - 1)));
}

.table-controls {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  grid-template-areas: "advice advice advice" "actions actions actions" "player hand settings";
  align-items: center;
  justify-items: center;
  gap: 5px 10px;
  justify-self: center;
  width: min(100%, 1240px);
  min-width: 0;
  padding: 6px 0 calc(8px + var(--safe-bottom));
}
.player-tools, .turn-tools { display: contents; }
.table-controls .player-seat[data-seat="0"] { grid-area: player; }
.table-controls .settings-button { grid-area: settings; position: relative; inset: auto; }
.table-controls .advice-panel { grid-area: advice; }
.table-controls .turn-actions { grid-area: actions; }
.table-controls .hand-zone { grid-area: hand; }
.table-controls :is(.advice-panel, .turn-actions, .hand-zone),
.table-controls .advice-panel.is-collapsed {
  position: relative;
  inset: auto;
  transform: none;
}
.table-controls .advice-panel {
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  border: 1px solid var(--w-gold-rim);
  border-radius: 12px;
  box-shadow: 0 3px 12px rgba(0,0,0,.22);
}
.table-controls .advice-cards { flex-wrap: wrap; }
.table-controls .advice-move { flex: none; }
.table-controls .advice-reason { margin: 0; color: var(--ink); }
.table-controls .advice-apply { border-radius: 8px; box-shadow: inset 0 1px rgba(255,255,255,.4), 0 2px 0 #8c6420; }
.table-controls .hand-zone { width: min(100%, 1040px); }
.table-controls .hand { padding: 10px 0 0; min-height: 0; }
.table-controls .action-button { min-width: 76px; }
.table-controls .error-toast.near-hand {
  position: absolute;
  top: auto;
  bottom: calc(100% + 6px);
  width: max-content;
  max-width: 100%;
  pointer-events: none;
}
.active-table .result-reopen-button { top: 64px; }
.lobby .lobby-card { max-width: min(100%, 560px); }

@media (orientation: landscape) {
  .table-controls .hand .playing-card + .playing-card {
    margin-left: min(calc(var(--card-w) * var(--hand-overlap)), calc((100% - var(--card-w) * var(--hand-count)) / (var(--hand-count) - 1)));
  }
}

@media (orientation: portrait) {
  .active-table { --table-edge: clamp(9px, 3vw, 20px); }
  .table-info { padding-block: 8px 4px; gap: 5px 9px; }
  .active-table .topbar { min-height: 28px; max-width: 100%; }
  .table-field {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto minmax(min-content, 1fr);
    grid-template-areas: "left right" "center center";
    align-items: start;
    align-self: stretch;
    gap: 5px 8px;
    padding: 6px 0 10px;
  }
  .table-opponents .player-seat[data-seat] {
    grid-template-columns: auto auto auto;
    grid-template-areas: "avatar name name" "avatar role role" "avatar score cards" "status status status";
    justify-items: start;
    column-gap: 4px;
  }
  .table-opponents .player-seat[data-seat="1"] { justify-self: start; }
  .table-opponents .player-seat[data-seat="2"] {
    grid-template-areas: "name name avatar" "role role avatar" "score cards avatar" "status status status";
    justify-items: end;
    justify-self: end;
  }
  .table-opponents .avatar-wrap { width: clamp(34px, 11vw, 50px); height: clamp(34px, 11vw, 50px); margin-inline: 3px; }
  .table-opponents .seat-name { max-width: clamp(70px, 26vw, 110px); }
  .table-opponents .seat-score { padding-inline: 4px; font-size: 10px; }
  .table-opponents .player-seat .hand-count { padding-inline: 3px; font-size: 10px; }
  .table-opponents .hand-count img { width: 10px; }
  .active-table .center-table { align-self: center; }
  .active-table .last-move { gap: 7px; }
  .active-table .table-card-row .playing-card { --card-w: clamp(40px, 13.4vw, 63px); }
  .table-card-row + .table-card-row { margin-top: calc(clamp(40px, 13.4vw, 63px) * -.44); }
  .table-controls {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "player-tools" "advice" "actions" "hand";
    gap: 5px;
    border-top: 1px solid rgba(212, 175, 95, .28);
    background: linear-gradient(rgba(10, 39, 26, .6), rgba(10, 39, 26, 0));
  }
  .player-tools {
    grid-area: player-tools;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  .table-controls .player-seat[data-seat="0"] {
    grid-template-columns: auto auto auto auto;
    grid-template-areas: "avatar name role role" "avatar score cards status";
    gap: 2px 5px;
    justify-items: start;
  }
  .table-controls .player-seat[data-seat="0"] .avatar-wrap { width: 34px; height: 34px; }
  .table-controls .player-seat[data-seat="0"] .seat-name { max-width: 84px; }
  .table-controls .settings-button { width: 38px; height: 38px; }
  .table-controls :is(.turn-actions, .hand-zone, .advice-panel:not(.is-collapsed)) { width: 100%; }
  .table-controls .advice-panel {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "av title move toggle" "cards cards cards apply";
    gap: 4px 5px;
    padding: 4px 6px;
  }
  .table-controls .advice-panel.is-collapsed {
    justify-self: end;
    grid-template-columns: auto auto auto;
    grid-template-areas: "av title toggle";
  }
  .table-controls .advice-avatar { width: 26px; height: 26px; }
  .table-controls .advice-apply { min-height: 34px; padding-inline: 7px; }
  .table-controls .advice-toggle { min-height: 30px; min-width: 42px; padding-inline: 6px; }
  .table-controls .advice-card { min-width: 23px; padding-inline: 3px; }
  .table-controls .advice-move strong { font-size: 13px; }
  .table-controls .hand.hand--rows { padding-top: 10px; }
  .table-controls .turn-actions { gap: clamp(4px, 1.8vw, 9px); }
  .table-controls .turn-actions .action-button { min-width: min(18vw, 66px); min-height: 40px; }
  .active-table .result-reopen-button { top: 88px; }
}

@media (orientation: portrait) and (max-height: 660px) {
  .active-table { --card-w: clamp(40px, min(14vw, 8vh), 52px); }
  .active-table .table-card-row .playing-card { --card-w: clamp(38px, 13vw, 49px); }
  .table-card-row + .table-card-row { margin-top: calc(clamp(38px, 13vw, 49px) * -.44); }
  .table-controls .turn-clock { width: 36px; height: 38px; }
}

@media (orientation: portrait) and (max-height: 600px) {
  .active-table { --card-w: clamp(38px, min(13vw, 7vh), 48px); }
  .table-info { gap: 5px; padding-block: 6px 3px; }
  .active-table .topbar { padding-inline: 6px; gap: 4px; font-size: 10px; }
  .active-table .topbar strong { font-size: 10px; }
  .active-table .topbar .dot { width: 5px; height: 5px; }
  .active-table .landlord-cards--revealed { gap: 2px; padding: 2px 3px; }
  .active-table .landlord-cards-caption { margin: 0 1px; font-size: 9px; }
  .active-table .landlord-mini-card { min-width: 23px; height: 20px; padding-inline: 2px; }
  .active-table .landlord-mini-card strong { font-size: 14px; }
  .active-table .landlord-mini-card span { font-size: 10px; }
  .active-table .landlord-mini-card.is-joker strong { font-size: 10px; }
  .table-field { padding-block: 4px 6px; }
  .table-controls { gap: 4px; padding-top: 3px; }
  .table-controls .hand.hand--rows { padding-top: 8px; }
  .table-controls .hand-row + .hand-row { margin-top: calc(var(--card-h) * -.51); }
  .table-controls .settings-button { width: 34px; height: 34px; }
  .table-controls .advice-card { min-width: 20px; }
  .table-controls .advice-toggle { min-height: 28px; }
  .table-card-row + .table-card-row { margin-top: calc(clamp(38px, 13vw, 49px) * -.57); }
}

@media (orientation: landscape) and (max-height: 560px) {
  .active-table { --table-edge: clamp(8px, 1.8vw, 20px); --card-w: clamp(40px, 15vh, 76px); }
  .table-info { padding: 4px 0; }
  .active-table .topbar { min-height: 28px; padding-block: 3px; }
  .active-table .landlord-cards--revealed { padding-block: 2px; }
  .active-table .landlord-mini-card { height: 22px; }
  .active-table .landlord-mini-card strong { font-size: 15px; }
  .table-field { gap: 4px; padding: 3px 0 5px; }
  .active-table .table-card-row .playing-card { --card-w: clamp(34px, 13vh, 63px); }
  .table-card-row + .table-card-row { margin-top: calc(clamp(34px, 13vh, 63px) * -.5); }
  .active-table .avatar-wrap { width: clamp(30px, 11vh, 55px); height: clamp(30px, 11vh, 55px); }
  .active-table .seat-name { max-width: 76px; font-size: 11px; }
  .active-table .seat-score, .active-table .player-seat .hand-count { padding-inline: 4px; font-size: 10px; }
  .active-table .last-move { gap: 4px; }
  .active-table .landlord-cards--waiting .playing-card { --card-w: clamp(32px, 12vh, 55px); }
  .table-controls {
    grid-template-areas: "turn-tools turn-tools turn-tools" "player hand settings";
    gap: 4px 6px;
    padding-top: 2px;
  }
  .turn-tools {
    grid-area: turn-tools;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2vw, 18px);
    max-width: 100%;
  }
  .turn-tools:empty { display: none; }
  .table-controls .turn-actions { flex: none; }
  .table-controls .advice-panel { gap: 4px 6px; }
  .table-controls .action-button { min-width: 62px; }
  .table-controls .player-seat[data-seat="0"] {
    grid-template-columns: auto auto;
    grid-template-areas: "avatar name" "avatar role" "score cards" "status status";
    column-gap: 2px;
  }
  .table-controls .hand { padding-top: 8px; }
  .table-controls .hand .playing-card.selected { top: -7px; }
  .active-table .result-reopen-button { top: 42px; }
}

@media (orientation: landscape) and (max-height: 360px) {
  .active-table { --card-w: clamp(38px, 12.2vh, 46px); }
  .table-opponents .player-seat[data-seat] {
    grid-template-columns: auto auto auto;
    grid-template-areas: "avatar name name" "avatar role role" "score cards status";
    justify-items: start;
    column-gap: 2px;
  }
  .table-opponents .player-seat[data-seat="2"] {
    grid-template-areas: "name name avatar" "role role avatar" "status score cards";
    justify-items: end;
  }
  .table-opponents .avatar-wrap { width: 30px; height: 30px; }
  .active-table .player-seat[data-seat] .seat-role > * { padding-inline: 3px; font-size: 9px; }
  .active-table .player-seat .role-badge.is-landlord img { width: 12px; }
  .table-opponents .seat-thinking, .table-opponents .seat-pass { padding-inline: 4px; font-size: 10px; }
  .table-opponents .seat-thinking { grid-area: status; white-space: normal; }
  .table-controls .advice-panel {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas: "avatar title move apply toggle" "cards cards cards cards cards";
    justify-content: start;
    gap: 3px 5px;
  }
  .table-controls .advice-avatar { grid-area: avatar; width: 23px; height: 23px; }
  .table-controls .advice-panel header strong { grid-area: title; font-size: 12px; }
  .table-controls .advice-panel :is(.advice-empty, .advice-move) { grid-area: move; }
  .table-controls .advice-panel .advice-reason { grid-area: cards; font-size: 11px; }
  .table-controls .advice-cards { grid-area: cards; gap: 2px; }
  .table-controls .advice-card { min-width: 20px; font-size: 10px; padding-inline: 3px; }
  .table-controls .advice-apply { grid-area: apply; min-height: 24px; padding-inline: 6px; }
  .table-controls .advice-toggle { grid-area: toggle; min-height: 24px; padding-inline: 5px; }
  .table-controls .advice-panel.is-collapsed {
    grid-template-columns: repeat(3, auto);
    grid-template-areas: "avatar title toggle";
  }
  .active-table .table-cards:has(.table-card-row + .table-card-row) .playing-card { --card-w: 34px; }
  .table-card-row + .table-card-row { margin-top: -23px; }
  .table-controls .advice-panel:has(.advice-reason) {
    grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "avatar title move cards toggle";
  }
  .table-controls .advice-panel .advice-reason { min-width: 0; }
}

/* 牌桌视线落在公牌，回合和选择状态留在操作区。 */
#game:has(.active-table)::before,
#game:has(.active-table)::after { display: none; }

.table-field { position: relative; isolation: isolate; }
.table-field::before {
  content: '';
  grid-area: center;
  align-self: center;
  justify-self: center;
  position: absolute;
  z-index: -1;
  width: min(100%, 710px);
  aspect-ratio: 2.8;
  max-height: 100%;
  border: 1px solid rgba(233, 200, 112, .25);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(253, 227, 170, .09), rgba(7, 26, 17, .08) 65%, rgba(4, 23, 13, .2));
  box-shadow: inset 0 0 0 5px rgba(8, 37, 23, .18), 0 0 0 5px rgba(233, 200, 112, .07);
  pointer-events: none;
}
.active-table .last-move { gap: 8px; }
.active-table .last-move > .last-move-label:has(.last-move-player) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 8px 3px 3px;
  border-radius: 7px;
  background: #102d20;
  font-weight: 600;
}
.last-move-player {
  max-width: 11em;
  padding: 1px 6px;
  overflow: hidden;
  border-radius: 4px;
  background: #2b523d;
  color: #fff4dc;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.last-move-player.is-landlord { background: #85351f; color: #fff1d3; }
.last-move-detail { white-space: nowrap; }
.active-table .seat-score { color: var(--muted); }
.active-table .ai-badge { background: #b6d9c1; color: #183c2b; }

.table-controls .turn-actions { gap: 10px; }
.turn-status {
  display: inline-flex;
  flex: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  min-width: 83px;
  color: #ffe6a4;
  white-space: nowrap;
}
.turn-status-label { font-size: 12px; font-weight: 800; line-height: 1.15; }
.table-controls .turn-clock {
  width: auto;
  min-width: 32px;
  height: 23px;
  padding: 0 6px;
  border: 1px solid #a78c50;
  border-radius: 7px;
  background: #132f22;
  color: #fff3c8;
  font-size: 15px;
  line-height: 1;
}
.table-controls .turn-clock.is-urgent { border-color: #f2aa89; background: #6a2c20; color: #fff1de; }
.table-controls .action-button { min-height: 43px; }
.table-controls .action-button:disabled {
  border: 1px solid rgba(211, 208, 183, .26);
  background: #30483a;
  color: #eee7d7;
  box-shadow: none;
  opacity: 1;
  filter: none;
}
.table-controls [data-play] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 100px;
  padding-block: 4px;
  font-size: 15px;
  line-height: 1.1;
}
[data-selection-count] { font-size: 10px; font-weight: 700; white-space: nowrap; }
.table-controls [data-apply-advice] {
  border: 1px solid #a58d54;
  background: #254d36;
  color: #fff0c6;
  box-shadow: none;
  text-shadow: none;
}
.table-controls .advice-card.is-red { color: #a52a26; }
.table-controls .hand .playing-card.suggested { box-shadow: 0 4px 9px rgba(0, 0, 0, .28); }
.table-controls .hand .playing-card.suggested::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 2px solid #d6a743;
  border-radius: inherit;
  pointer-events: none;
}
.table-controls .hand .playing-card.selected {
  filter: none;
  box-shadow: 0 6px 10px rgba(0, 0, 0, .45);
}
.table-controls .hand .playing-card.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid #e8b74d;
  border-radius: inherit;
  pointer-events: none;
}
.active-table :is(.action-button, .advice-apply, .advice-toggle, .settings-button, .playing-card):focus-visible {
  outline: 2px solid #fff5d2;
  outline-offset: 2px;
  z-index: 2;
}

.result-score.is-mine { border-color: #c8a75c; background: #234535; }
.result-score.is-gain strong { color: #b8ebc6; }
.result-score.is-loss strong { color: #ffc2a8; }
.result-actions .result-review-button {
  border-color: #b89753;
  background: #1c4431;
  color: #fff1cd;
}
.result-panel .result-summary { padding-top: 4px; }
.result-panel .reveal-row .landlord-mini-card { box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }

@media (min-width: 860px) and (min-height: 561px) {
  .table-field { width: min(100%, 1040px); grid-template-columns: minmax(104px, auto) minmax(0, 1fr) minmax(104px, auto); }
  .table-controls { grid-template-columns: minmax(114px, 1fr) minmax(0, 7fr) minmax(114px, 1fr); }
}
@media (orientation: portrait) {
  .table-field::before { width: min(100%, 540px); aspect-ratio: 2.9; }
  .table-controls .turn-actions { gap: clamp(4px, 2vw, 10px); }
  .table-controls .action-button { min-height: 41px; }
  .table-controls .turn-actions [data-bid] { min-width: clamp(44px, 14vw, 60px); padding-inline: 5px; }
  .table-controls [data-play] { min-width: 90px; }
  .turn-status { min-width: 73px; }
  .table-controls .advice-panel:has(.advice-cards .advice-card:nth-child(10)) {
    grid-template-areas: "av title move toggle" "cards cards cards cards" "apply apply apply apply";
  }
  .table-controls .advice-panel:has(.advice-cards .advice-card:nth-child(10)) .advice-cards {
    gap: 2px;
    padding-block: 1px;
  }
  .table-controls .advice-panel:has(.advice-cards .advice-card:nth-child(10)) .advice-apply {
    justify-self: end;
    min-height: 28px;
  }
}
@media (orientation: landscape) and (max-height: 360px) {
  .turn-status { min-width: 65px; }
  .table-controls .turn-actions { gap: 5px; }
  .table-controls .action-button { min-height: 34px; }
  .table-controls [data-play] { min-width: 76px; }
  .table-controls .turn-clock { height: 19px; font-size: 12px; }
  .turn-status-label { font-size: 11px; }
}

/* 顶栏右侧「关于」：点开看本页 h1 和介绍（原始 HTML 就有，搜索引擎和真人看到的是同一段）；收起时不占牌桌 */
.site-about { justify-self: end; min-width: 0; }
.site-about > summary {
  display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px;
  color: var(--ink); background: rgba(255, 255, 255, 0.12); font-weight: 800; white-space: nowrap; cursor: pointer; list-style: none;
}
.site-about > summary::-webkit-details-marker { display: none; }
.site-about[open] > summary { color: #0b2118; background: var(--gold); }
.site-about-panel {
  position: fixed; z-index: 61; top: calc(var(--site-bar-h) + 6px); right: max(8px, env(safe-area-inset-right, 0px));
  width: min(440px, calc(100vw - 16px)); max-height: calc(100% - var(--site-bar-h) - 16px); overflow: auto; box-sizing: border-box;
  padding: 14px 16px; border: 1.5px solid var(--w-gold-rim, rgba(212, 175, 95, 0.62)); border-radius: 14px;
  background: #0d2a1e; color: var(--ink); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  font-size: 14px; line-height: 1.7; text-align: left; user-select: text; -webkit-user-select: text;
}
.site-about-panel h1 { margin: 0 0 8px; color: var(--gold); font-size: 17px; line-height: 1.4; }
.site-about-panel p { margin: 0 0 8px; }
.site-about-panel p:last-child { margin-bottom: 0; }
@media (max-height: 560px) and (orientation: landscape) { .site-about > summary { min-height: 24px; } }
/* ===== 12-01 英文 / 繁体牌桌（/en/doudizhu/、/zh-hant/doudizhu/）：图上带简体字的地方换成现排的字 ===== */
html:lang(en) #game::before { content: "Doudizhu AI"; letter-spacing: 0.06em; }
html:lang(zh-Hant) #game::before { content: "鬥地主AI"; }
.result-banner-text { margin: 0 auto 6px; color: #ffd75e; font-size: clamp(22px, 5vw, 34px); font-weight: 900; line-height: 1.15; text-align: center; text-shadow: 0 2px 0 #a24a00, 0 4px 10px rgba(0, 0, 0, 0.45); }
.fx-word { position: absolute; transform: translate(-50%, -50%); color: #ffd75e; font-weight: 900; white-space: nowrap; letter-spacing: 0.04em; text-shadow: 0 3px 0 #a24a00, 0 0 18px rgba(255, 150, 40, 0.7); animation: fx-show var(--dur) ease var(--delay) both; }
.fx-word.fx-pop { animation: fx-pop var(--dur) cubic-bezier(.2, 1.4, .4, 1) var(--delay) both; }
/* 顶栏右侧：语言切换（简体 / 繁體 / English，普通链接）+「关于」；窄屏收掉中间的站名给它腾地方（牌桌中央水印有站名） */
.site-right { justify-self: end; display: flex; align-items: center; gap: 8px; min-width: 0; }
.site-lang { display: inline-flex; gap: 8px; font-size: 12px; white-space: nowrap; }
.site-lang a { color: var(--ink); opacity: 0.78; text-decoration: none; }
.site-lang a[aria-current] { opacity: 1; font-weight: 900; color: var(--gold); }
@media (max-width: 520px) {
  .site-bar { grid-template-columns: auto 1fr; }
  .site-bar .site-name { display: none; }
  .site-lang { gap: 6px; font-size: 11px; }
}
