/* 《坟桌》界面主题：旧纸、墨、朱砂、灯油琥珀。所有屏幕共用这些 token。 */
:root {
  /* 色 */
  --ink-900: #0b0d10;          /* 夜底 */
  --ink-800: #14181d;
  --ink-700: #1e242b;
  --mist-500: #6f8196;         /* 冷雾灰蓝：次要信息 */
  --mist-300: #a9b6c4;
  --paper-100: #e6dcc3;        /* 旧纸：牌面、弹窗底 */
  --paper-200: #d2c5a4;
  --paper-300: #b3a37d;
  --paper-ink: #2a2118;        /* 纸上墨字 */
  --cinnabar: #a8321f;         /* 朱砂：红花色、危险、鬼来方向 */
  --cinnabar-dim: #6e2417;
  --amber: #e0a24a;            /* 灯油琥珀：主操作、当前行动者 */
  --amber-dim: #8a6226;
  --bone: #cfd3cf;             /* 破瓷：弹量、鬼相关提示 */

  /* 形 */
  --radius-s: 3px;             /* 纸角几乎是直的，只磨一点 */
  --radius-m: 5px;
  --line: 1px solid rgba(230, 220, 195, 0.22);
  --shadow-paper: 0 2px 0 rgba(0, 0, 0, 0.55), 0 10px 24px rgba(0, 0, 0, 0.5);

  /* 距 */
  --gap-1: 4px; --gap-2: 8px; --gap-3: 12px; --gap-4: 16px; --gap-5: 24px;
  --hit: 44px;                 /* 最小触控高度 */

  /* 动 */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 110ms; --t-mid: 220ms; --t-slow: 520ms;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  /* 手牌尺寸：跟着视口的宽和高一起收，手机横屏也放得下 */
  --card-w: clamp(40px, min(5.4vw, 12.5vh), 88px);
  --card-h: calc(var(--card-w) * 1.43);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: var(--ink-900); color: var(--paper-100);
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
#stage { position: fixed; inset: 0; touch-action: none; }
#stage canvas { display: block; width: 100%; height: 100%; }

/* 界面层与各屏容器都不拦点击（画面要能拖拽转头、点射），只有控件拦 */
#ui { position: fixed; inset: 0; pointer-events: none; font-size: 15px; line-height: 1.45; }
.screen { position: absolute; inset: 0; pointer-events: none; display: none; }
#ui[data-screen="title"] #title-screen { display: block; }
#ui[data-screen="hud"] #hud { display: block; }
#ui button, #ui .modal-backdrop, #ui .panel-paper { pointer-events: auto; }
p, h1, h2, ul { margin: 0; padding: 0; }

/* ---------- 按钮（canonical：主 / 次 共用同一骨架；外壳为九宫格切图，文字在独立内容层） ---------- */
[hidden] { display: none !important; }
.btn {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-height: 46px; min-width: 76px; padding: 0 22px; border: 0;
  font: inherit; font-size: 16px; line-height: 1.2; letter-spacing: 0.1em; text-indent: 0.1em; white-space: nowrap; color: var(--paper-100);
  background: none; cursor: pointer; --bw: 15px 18px;
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
/* 外壳是独立一层九宫格，文字留在按钮自己的内容层里 */
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-style: solid; border-color: transparent; border-width: var(--bw);
}
.btn-ghost::before { border-image: url("assets/ui_btn_secondary.webp") 33.3% 17.5% fill / var(--bw) stretch; }
.btn-primary::before { border-image: url("assets/ui_btn_primary.webp") 33.3% 14% fill / var(--bw) stretch; }
.btn-primary { color: var(--paper-ink); }
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px) scale(0.985); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.btn[disabled] { opacity: 0.38; cursor: default; filter: none; transform: none; }
.btn-ghost[aria-pressed="true"] { color: var(--amber); filter: brightness(1.25); }
.btn-small { min-width: 64px; font-size: 14px; padding: 0 18px; }
.btn-big { min-height: 56px; min-width: 168px; font-size: 20px; padding: 0 30px; --bw: 18px 24px; }
.btn-gun { min-height: 58px; min-width: 112px; font-size: 19px; padding: 0 26px; --bw: 19px 22px; }
.btn.urge { animation: urge 0.9s var(--ease) infinite alternate; }
@keyframes urge { to { filter: brightness(1.5); color: var(--amber); } }

/* ---------- 右上 ---------- */
#top-right {
  position: absolute; z-index: 30; top: calc(var(--gap-2) + var(--safe-t)); right: calc(var(--gap-3) + var(--safe-r));
  display: flex; gap: var(--gap-2);
}
#ui:not([data-screen="hud"]) #btn-rules { display: none; }
#ui[data-screen="loading"] #top-right { display: none; }
/* 「看桌」：只在牌局中、主角视点转头看别处时出现 */
#btn-center { display: none; }
#ui[data-screen="hud"].turned:not(.gun):not(.third) #btn-center { display: inline-flex; }

/* ---------- 标题：左下标题块，右侧三分之二留给亮着灯的牌桌 ---------- */
#title-block {
  position: absolute; left: calc(5vw + var(--safe-l)); bottom: calc(9vh + var(--safe-b)); max-width: min(560px, 88vw);
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--gap-3);
  padding: var(--gap-4) var(--gap-5) var(--gap-4) 0;
}
#title-block::before {
  content: ""; position: absolute; z-index: -1; inset: -40px -80px -60px -200px;
  background: radial-gradient(ellipse at 30% 60%, rgba(11, 13, 16, 0.82), rgba(11, 13, 16, 0) 70%);
}
.title-name { font-size: clamp(64px, 13vh, 132px); line-height: 1; letter-spacing: 0.16em; color: var(--paper-100); text-shadow: 0 2px 0 #000, 0 0 36px rgba(224, 162, 74, 0.32); }
.title-lead { font-size: clamp(15px, 2.3vh, 19px); color: var(--mist-300); letter-spacing: 0.08em; line-height: 1.7; text-shadow: 0 1px 2px #000; }
.title-record { min-height: 1.4em; font-size: 14px; color: var(--amber); letter-spacing: 0.06em; text-shadow: 0 1px 2px #000; }

/* ---------- 信息牌（canonical：顶部「当前要压」与牌友名签共用） ---------- */
.hud-plate {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--gap-2);
  min-height: 40px; padding: 0 var(--gap-2);
  border-style: solid; border-color: transparent; border-width: 11px 20px;
  border-image: url("assets/ui_hud_plate.webp") 31.25% 5.33% fill / 11px 20px stretch;
  color: var(--paper-100); letter-spacing: 0.06em; line-height: 1.15; white-space: nowrap;
}
#hud-top {
  position: absolute; top: calc(var(--gap-2) + var(--safe-t)); left: calc(var(--gap-3) + var(--safe-l)); right: calc(170px + var(--safe-r));
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap-2) var(--gap-4);
}
#turn-label { min-width: 9em; font-size: 17px; letter-spacing: 0.08em; color: var(--mist-300); text-shadow: 0 1px 3px #000, 0 0 10px #000; }
#turn-label.mine { color: var(--amber); font-size: 20px; }
#lead-plate { font-size: 15px; max-width: 100%; }
#lead-cards { display: inline-flex; gap: 3px; flex-wrap: wrap; }
#lead-cards:empty { display: none; }

.seat-tag { position: absolute; left: 0; top: 0; flex-direction: column; gap: 0; min-height: 44px; font-size: 13px; will-change: transform; visibility: hidden; opacity: 0.92; }
.seat-name { font-size: 15px; }
.seat-count { color: var(--mist-300); font-size: 12px; }
.seat-tag.active .seat-name { color: var(--amber); }
.seat-tag.active { opacity: 1; filter: brightness(1.2); }
.seat-note {
  position: absolute; left: 50%; bottom: calc(100% + 14px); transform: translate(-50%, 6px); padding: 2px 10px;
  background: var(--paper-100); color: var(--paper-ink); border-radius: var(--radius-s); font-size: 14px; white-space: nowrap;
  opacity: 0; transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease); box-shadow: var(--shadow-paper);
}
.seat-note.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 纸牌（canonical：手牌与小牌共用；点数花色为代码文字） ---------- */
.card {
  position: relative; isolation: isolate; flex: none; width: var(--card-w); height: var(--card-h); padding: 0; border: 0; overflow: hidden;
  background: none; color: var(--paper-ink); font: inherit; cursor: pointer; --cbw: 7px 8px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6));
  transition: transform var(--t-fast) var(--ease), filter var(--t-fast) var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  border-style: solid; border-color: transparent; border-width: var(--cbw);
  border-image: url("assets/ui_card_face.webp") 11.25% 16.07% fill / var(--cbw) stretch;
}
.card.red { color: var(--cinnabar); }
.card-rank { position: absolute; left: 10%; top: 6%; width: 1.3em; text-align: center; font-size: calc(var(--card-w) * 0.36); line-height: 1; letter-spacing: -0.04em; }
.card-suit { position: absolute; left: 10%; top: calc(6% + var(--card-w) * 0.38); width: 1.56em; text-align: center; font-size: calc(var(--card-w) * 0.3); line-height: 1; }
.card-pip { position: absolute; right: 12%; bottom: 8%; font-size: calc(var(--card-w) * 0.6); line-height: 1; opacity: 0.9; }
button.card:hover { transform: translateY(-5px); }
button.card.selected { transform: translateY(calc(var(--card-h) * -0.2)); filter: drop-shadow(0 0 0 var(--amber)) drop-shadow(0 0 6px rgba(224, 162, 74, 0.9)) drop-shadow(0 6px 6px rgba(0, 0, 0, 0.6)); }
button.card:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.card-mini {
  display: inline-flex; align-items: center; justify-content: center; gap: 1px; width: auto; height: auto; min-width: 34px; padding: 4px 6px;
  --cbw: 4px 5px; font-size: 14px; line-height: 1.15; filter: none; cursor: default; overflow: visible;
}
.card-mini .card-rank, .card-mini .card-suit { position: static; width: auto; font-size: inherit; letter-spacing: 0; }

/* ---------- 底部：状态 | 手牌 + 出牌按钮 | 拿枪 ---------- */
#hud-bottom {
  position: absolute; left: calc(var(--gap-3) + var(--safe-l)); right: calc(var(--gap-3) + var(--safe-r)); bottom: calc(var(--gap-2) + var(--safe-b));
  display: grid; grid-template-columns: minmax(96px, auto) minmax(0, 1fr) minmax(112px, auto); align-items: end; gap: var(--gap-3);
}
#status { display: flex; flex-direction: column; gap: var(--gap-1); padding-bottom: var(--gap-2); text-shadow: 0 1px 3px #000; }
.status-row { display: flex; align-items: center; gap: var(--gap-2); }
.status-label { color: var(--mist-300); font-size: 14px; letter-spacing: 0.1em; }
.status-score { color: var(--bone); font-size: 15px; letter-spacing: 0.08em; min-width: 5em; }
.dots { display: inline-flex; gap: 6px; align-items: center; }
.dot { display: block; width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0.45; transition: background var(--t-mid) var(--ease), opacity var(--t-mid) var(--ease); }
.dot.on { background: currentColor; opacity: 1; }
.life { color: var(--amber); }
.ammo { color: var(--bone); }
.ammo .dot { border-radius: 2px; width: 9px; height: 17px; }
.ammo.reloading { animation: blink 0.36s linear infinite alternate; }
@keyframes blink { to { opacity: 0.45; } }

#hand-wrap { display: flex; flex-direction: column; align-items: stretch; gap: var(--gap-2); min-width: 0; }
#actions { display: flex; justify-content: flex-end; gap: var(--gap-2); padding-right: 2%; }
#hand { display: flex; justify-content: center; align-items: flex-end; min-height: var(--card-h); --overlap: 0px; padding-top: calc(var(--card-h) * 0.22); }
#hand .card + .card { margin-left: var(--overlap); }
#hand.two-rows { flex-wrap: wrap; row-gap: 4px; --overlap: -6px !important; padding-top: 10px; }
#hand.two-rows .card { --card-w: clamp(40px, 12.2vw, 56px); }
#hand.shake { animation: shake 0.32s linear; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

#gun-cluster { display: flex; flex-direction: column; align-items: flex-end; gap: var(--gap-2); }
.gun-row { display: flex; align-items: center; gap: var(--gap-2); }

/* 拿枪时：手牌和出牌按钮收起，出现准星与操作提示 */
#ui.gun #hand-wrap { visibility: hidden; }
/* 「旁观找鬼 / 回座」与出牌同一行；拿枪时这一行收起，但它留着，随时能切换视角 */
#ui.gun #btn-view { visibility: visible; }
#gun-hint {
  position: absolute; left: 50%; bottom: calc(var(--gap-4) + var(--safe-b)); transform: translateX(-50%); display: none; max-width: 56vw; text-align: center;
  color: var(--bone); font-size: 15px; letter-spacing: 0.08em; text-shadow: 0 1px 3px #000, 0 0 12px #000;
}
#ui.gun #gun-hint { display: block; }
#crosshair { position: absolute; left: 0; top: 0; width: 34px; height: 34px; opacity: 0; display: none; }
#ui.gun #crosshair { display: block; }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: var(--bone); box-shadow: 0 0 2px #000; }
#crosshair::before { left: 50%; top: 0; width: 1.5px; height: 100%; transform: translateX(-50%); -webkit-mask: linear-gradient(#000 0 34%, transparent 34% 66%, #000 66%); mask: linear-gradient(#000 0 34%, transparent 34% 66%, #000 66%); }
#crosshair::after { top: 50%; left: 0; height: 1.5px; width: 100%; transform: translateY(-50%); -webkit-mask: linear-gradient(90deg, #000 0 34%, transparent 34% 66%, #000 66%); mask: linear-gradient(90deg, #000 0 34%, transparent 34% 66%, #000 66%); }
#crosshair.fire { animation: xfire 0.18s var(--ease); }
@keyframes xfire { from { scale: 1.7; } to { scale: 1; } }

/* ---------- 来鬼方向：贴着屏幕边缘的朱砂渐变 + 箭头 + 文字 ---------- */
#ghost-alert {
  position: absolute; display: flex; align-items: center; gap: var(--gap-2); padding: var(--gap-3) var(--gap-4);
  color: #f3d9cf; font-size: 16px; letter-spacing: 0.08em; text-shadow: 0 1px 3px #000; white-space: nowrap;
  animation: alert 0.9s var(--ease) infinite alternate;
}
#ghost-alert[hidden] { display: none; }
@keyframes alert { from { opacity: 0.72; } to { opacity: 1; } }
.alert-arrow { width: 0; height: 0; border: 9px solid transparent; flex: none; }
#ghost-alert[data-dir="left"] { left: 0; top: 38%; padding-left: calc(var(--gap-3) + var(--safe-l)); padding-right: 64px; background: linear-gradient(90deg, rgba(168, 50, 31, 0.78), rgba(168, 50, 31, 0)); }
#ghost-alert[data-dir="left"] .alert-arrow { border-right-color: #f3d9cf; border-left-width: 0; }
#ghost-alert[data-dir="right"] { right: 0; top: 38%; flex-direction: row-reverse; padding-right: calc(var(--gap-3) + var(--safe-r)); padding-left: 64px; background: linear-gradient(270deg, rgba(168, 50, 31, 0.78), rgba(168, 50, 31, 0)); }
#ghost-alert[data-dir="right"] .alert-arrow { border-left-color: #f3d9cf; border-right-width: 0; }
#ghost-alert[data-dir="front"] { left: 50%; top: calc(64px + var(--safe-t)); transform: translateX(-50%); flex-direction: column; padding: var(--gap-2) 48px 28px; background: radial-gradient(ellipse at 50% 0%, rgba(168, 50, 31, 0.8), rgba(168, 50, 31, 0) 70%); }
#ghost-alert[data-dir="front"] .alert-arrow { border-bottom-color: #f3d9cf; border-top-width: 0; }
#ghost-alert[data-dir="back"] { left: 50%; bottom: calc(var(--card-h) + 120px + var(--safe-b)); transform: translateX(-50%); flex-direction: column-reverse; padding: 28px 48px var(--gap-2); background: radial-gradient(ellipse at 50% 100%, rgba(168, 50, 31, 0.8), rgba(168, 50, 31, 0) 70%); }
#ghost-alert[data-dir="back"] .alert-arrow { border-top-color: #f3d9cf; border-bottom-width: 0; }

/* ---------- 提示条、受击暗角、结局黑幕 ---------- */
#toast {
  position: absolute; z-index: 25; left: 50%; top: 30%; transform: translate(-50%, 8px); max-width: min(88vw, 560px); padding: 8px 18px; text-align: center;
  background: rgba(11, 13, 16, 0.8); border: var(--line); border-radius: var(--radius-m); color: var(--paper-100); font-size: 16px; letter-spacing: 0.06em;
  opacity: 0; transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#fx-vignette { position: absolute; inset: 0; z-index: 9; opacity: 0; background: radial-gradient(ellipse at center, rgba(110, 36, 23, 0) 38%, rgba(110, 36, 23, 0.9) 100%); }
#fx-vignette.hit { animation: vhit 0.9s var(--ease); }
@keyframes vhit { 0% { opacity: 1; } 100% { opacity: 0; } }
#fx-black { position: absolute; inset: 0; z-index: 10; opacity: 0; background: radial-gradient(ellipse at center, #07080a 30%, #150806 100%); transition: opacity 0.35s linear; }

/* ---------- 纸面板（canonical：规则弹窗与结算纸签共用同一张九宫格外壳） ---------- */
#modal-root { position: absolute; inset: 0; z-index: 20; }
.modal-backdrop {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(var(--gap-3) + var(--safe-t)) calc(var(--gap-3) + var(--safe-r)) calc(var(--gap-3) + var(--safe-b)) calc(var(--gap-3) + var(--safe-l));
  background: rgba(7, 8, 10, 0.72);
}
.panel-paper {
  position: relative; display: flex; flex-direction: column; min-height: 0;
  border-style: solid; border-color: transparent; border-width: 36px 40px 30px 36px;
  border-image: url("assets/ui_panel_paper.webp") 7.18% 6.36% fill / 36px 40px 36px 36px stretch;
  color: var(--paper-ink); filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.6));
}
.panel-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 10px 8px; -webkit-overflow-scrolling: touch; }
.panel-title { font-size: clamp(22px, 4vh, 30px); letter-spacing: 0.08em; margin-bottom: var(--gap-3); color: var(--paper-ink); }
.panel-body p { margin-bottom: var(--gap-3); font-size: 16px; line-height: 1.75; }
.panel-body strong { font-weight: inherit; color: var(--cinnabar); padding: 0 3px; border: 1.5px solid var(--cinnabar); border-radius: var(--radius-s); -webkit-text-stroke: 0.6px currentColor; }
.panel-actions { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--gap-3); padding: var(--gap-2) 10px 0; }
.btn.on-paper { filter: none; }
.rules-panel { width: min(640px, 100%); max-height: 100%; }
.modal-x {
  position: absolute; top: -14px; right: -16px; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 28px; line-height: 1; color: var(--paper-ink);
}
.modal-x:focus-visible { outline: 2px solid var(--cinnabar); }

/* 结算：右侧竖长纸签，左侧三分之二留给实时画面（空掉的椅子） */
.result-slip {
  position: absolute; top: calc(56px + var(--safe-t)); right: calc(var(--gap-4) + var(--safe-r)); bottom: calc(var(--gap-4) + var(--safe-b));
  width: min(400px, 44vw); opacity: 0; transform: translateX(28px);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
}
.result-slip.in { opacity: 1; transform: none; }
.result-cause { color: #4a3b2b; }
.result-list { list-style: none; margin: 0 0 var(--gap-3); border-top: 1px solid rgba(42, 33, 24, 0.35); }
.result-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--gap-3); padding: 7px 2px; border-bottom: 1px solid rgba(42, 33, 24, 0.35); font-size: 16px; }
.result-list li.winner { color: var(--cinnabar); }
.r-cards { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 3px; }
.panel-body p.result-score { font-size: 18px; margin-bottom: var(--gap-1); }
.panel-body p.result-record, .panel-body p.result-note { font-size: 14px; color: #5b4a37; margin-bottom: var(--gap-1); }
.result-note:empty { display: none; }

/* ---------- 加载 ---------- */
#loading {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 60%, #1a1610 0%, var(--ink-900) 62%);
  transition: opacity var(--t-slow) var(--ease);
}
#loading.done { opacity: 0; pointer-events: none; }
.loading-inner { display: flex; flex-direction: column; align-items: center; gap: var(--gap-4); padding: var(--gap-5); text-align: center; }
.loading-title { font-size: 64px; letter-spacing: 0.2em; color: var(--paper-100); text-shadow: 0 0 32px rgba(224, 162, 74, 0.35); }
.loading-text { color: var(--mist-300); letter-spacing: 0.1em; }

/* ---------- 矮屏（手机横屏）：收紧间距，按钮仍保持 44px 触控高度 ---------- */
@media (max-height: 480px) {
  #ui { font-size: 14px; }
  .btn { min-height: 44px; font-size: 15px; padding: 0 18px; --bw: 14px 16px; }
  .btn-gun { min-height: 48px; min-width: 92px; font-size: 17px; }
  .btn-big { min-height: 50px; }
  #turn-label, #turn-label.mine { font-size: 16px; min-width: 7em; }
  .hud-plate { min-height: 34px; border-width: 9px 16px; border-image-width: 9px 16px; }
  #lead-plate { font-size: 13px; }
  .seat-tag { min-height: 36px; }
  #hud-bottom { gap: var(--gap-2); bottom: calc(var(--gap-1) + var(--safe-b)); }
  #hand-wrap { gap: var(--gap-1); }
  #toast { top: 22%; font-size: 14px; }
  .title-name { font-size: clamp(48px, 20vh, 84px); }
  #title-block { bottom: calc(5vh + var(--safe-b)); gap: var(--gap-2); }
  .panel-paper { border-width: 26px 30px 22px 26px; border-image-width: 26px 30px 26px 26px; }
  .panel-body p { font-size: 14px; line-height: 1.6; margin-bottom: var(--gap-2); }
  .result-slip { top: calc(50px + var(--safe-t)); bottom: calc(var(--gap-2) + var(--safe-b)); width: min(360px, 46vw); }
  #ghost-alert { font-size: 14px; }
}

/* ---------- 竖屏 / 窄屏：状态与拿枪并排在上一行，手牌占满整行（可两行） ---------- */
@media (max-width: 620px) {
  #hud-top { right: calc(var(--gap-3) + var(--safe-r)); top: calc(60px + var(--safe-t)); }
  #hud-bottom { grid-template-columns: 1fr auto; row-gap: var(--gap-2); }
  #hand-wrap { grid-column: 1 / -1; grid-row: 2; }
  #status { grid-column: 1; grid-row: 1; }
  #gun-cluster { grid-column: 2; grid-row: 1; flex-direction: row; align-items: center; }
  #actions { justify-content: center; padding-right: 0; }
  #actions .btn { min-width: 64px; padding: 0 14px; }
  .title-name { font-size: clamp(56px, min(13vh, 22vw), 132px); }
  #gun-hint { bottom: calc(96px + var(--safe-b)); max-width: 90vw; }
  /* 竖屏底部有两行手牌 + 按钮 + 状态行：背后来鬼的提示抬到它们上方，不被「换弹 / 拿枪」盖住 */
  #ghost-alert[data-dir="back"] { bottom: calc(var(--card-h) * 2 + 190px + var(--safe-b)); white-space: nowrap; }
  .result-slip { top: auto; left: calc(var(--gap-2) + var(--safe-l)); right: calc(var(--gap-2) + var(--safe-r)); bottom: calc(var(--gap-2) + var(--safe-b)); width: auto; max-height: 68vh; transform: translateY(28px); }
  #title-block { left: calc(6vw + var(--safe-l)); bottom: calc(7vh + var(--safe-b)); }
  .loading-title { font-size: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, #loading, .card, .result-slip, #toast, .seat-note { transition: none; }
  #ghost-alert, .btn.urge, #hand.shake, #fx-vignette.hit, #crosshair.fire, .ammo.reloading { animation: none; }
}
