:root {
  --bg: #0f1115;
  --panel: #171a21;
  --line: #262b35;
  --text: #e6e8ee;
  --muted: #8b93a1;
  --accent: #e0533f;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* 让系统状态栏/上下留白露出背景图 */
html { background: transparent; }
body { background-color: transparent; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ---------- 顶栏 ---------- */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  /* 跟随「实体框透明度」 */
  background-color: rgba(18, 21, 27, calc(var(--panel-alpha, 1) * 0.92)) !important;
  backdrop-filter: blur(3px);
}

.me {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 10px;
}
.me:hover { background: #1b1f27; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #232833;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 600;
  overflow: hidden; flex: 0 0 auto;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.topacts { display: flex; gap: 8px; }

.ghost {
  background: #1b1f27;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
}
.ghost:hover { background: #222834; }
.ghost:active { transform: translateY(1px); }

/* ---------- 主页：横屏三入口 ---------- */
.home {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 18px 24px 26px;
}

.entry {
  width: min(460px, 72vw);
  padding: clamp(12px, 2.6vh, 22px) 20px;
  font-size: clamp(19px, 3.2vh, 26px);
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid #333a47;
  border-radius: 12px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.entry:hover { background: #1d222b; border-color: #4a5464; }
.entry:active { transform: scale(.985); }

/* ---------- 通用视图 ---------- */
.view {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px 20px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.view-head h2 { font-size: 17px; margin: 0; font-weight: 600; }

.view-body {
  flex: 1 1 auto;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--muted);
  background: #14171d;
  min-height: 0;
}

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: grid; place-items: center;
  padding: 12px; z-index: 40;
}
.mask[hidden] { display: none; }

.sheet {
  width: min(680px, 92vw);
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: #14171d;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.sheet-body { padding: 14px; overflow-y: auto; color: var(--muted); font-size: 14px; }

/* hidden 优先于 display:flex */
[hidden] { display: none !important; }

/* 视图里的竖向按钮组（与主页同款） */
.stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 2.4vh, 20px);
  padding: clamp(10px, 3vh, 28px) 0;
}
.stack .entry { width: min(460px, 72vw); }
.view-body { border-style: solid; border-color: transparent; background: transparent; padding: 0; }
.ph { color: var(--muted); text-align: center; margin: 40px 0; }
/* 建房间表单 */
.roomform {
  width: min(560px, 92vw);
  margin: clamp(8px, 2vh, 20px) auto 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: clamp(14px, 2.6vh, 22px) clamp(16px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 16px);
}
.rf-row { display: flex; align-items: center; gap: 12px; }
.rf-title { color: var(--muted); font-size: 15px; }
.rf-title b { color: var(--text); font-weight: 600; }
.rf-label { flex: 0 0 auto; color: var(--text); font-size: 15px; }
.rf-input {
  flex: 1 1 auto;
  min-width: 0;
  background: #12151b;
  border: 1px solid #333a47;
  border-radius: 9px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 15px;
  outline: none;
}
.rf-input:focus { border-color: #5a6474; }
.rf-input::placeholder { color: #5f6775; }
.rf-actions { display: flex; justify-content: flex-end; }

.primary {
  background: var(--accent);
  border: 1px solid #b8402f;
  color: #fff;
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.primary:hover { filter: brightness(1.06); }
.primary:active { transform: translateY(1px); }
/* 房间卡片 */
.roomcard {
  width: min(620px, 94vw);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: clamp(14px, 2.6vh, 20px) clamp(16px, 3vw, 24px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 15px;
}
.rc-line { display: flex; gap: 8px; align-items: baseline; }
.rc-grid { display: flex; gap: 28px; flex-wrap: wrap; }
.rc-k { color: var(--muted); flex: 0 0 auto; }
.rc-v { color: var(--text); }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: 1px; }
.rc-wait { margin-top: clamp(8px, 1.6vh, 14px); color: var(--muted); }
.rc-count { color: var(--text); }
.rc-players { display: flex; gap: 8px; flex-wrap: wrap; }
.rc-chip {
  background: #1d222b;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  color: var(--text);
}
.rc-actions { display: flex; justify-content: center; margin-top: clamp(8px, 1.8vh, 16px); }

.danger {
  background: #2a1b1b;
  border: 1px solid #6b2f2b;
  color: #ff8b7d;
  border-radius: 10px;
  padding: 9px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.danger:hover { background: #35201f; }
/* 加入房间：左大厅 + 右房间列表 */
.joinwrap {
  display: grid;
  grid-template-columns: minmax(200px, 26%) 1fr;
  gap: clamp(12px, 2vw, 22px);
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.lobby {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
  min-height: 0;
}
.lobby-head {
  padding: 10px 14px;
  font-size: 20px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.lobby-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  min-height: 80px;
}
.lobby-tip { color: var(--muted); margin: 0; }
.lobby-line { padding: 2px 0; word-break: break-all; }
.lobby-input { border-top: 1px solid var(--line); padding: 8px; }
.lobby-input .rf-input { width: 100%; }

.rooms { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.rooms-head { display: flex; align-items: center; justify-content: space-between; }
.rooms-title { color: var(--muted); font-size: 14px; }
.rooms-list {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.4vh, 12px);
  padding-right: 4px;
}

.rrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: clamp(10px, 1.8vh, 16px) clamp(12px, 2vw, 18px);
}
.rrow-name { font-size: clamp(16px, 2.4vh, 20px); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.rrow-mode { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rrow-act { flex: 0 0 auto; }
.rrow .lock { font-size: 15px; }
.ghost[disabled] { opacity: .5; cursor: not-allowed; }

/* 筛选弹层 */
.fgroup { margin-bottom: 14px; }
.flabel { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.fopts { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: #1b1f27;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  cursor: pointer;
}
.chip.on { background: #2b1a17; border-color: #8a3a2d; color: #ffb3a6; }
.frow { display: flex; gap: 10px; justify-content: flex-end; }
/* 矮屏（手机横屏）：筛选面板更紧凑，按钮固定可见 */
@media (max-height: 430px) {
  .sheet { max-height: 96vh; }
  .sheet-head { padding: 7px 12px; }
  .sheet-body { padding: 10px 12px; }
  .fgroup { margin-bottom: 9px; }
  .flabel { margin-bottom: 4px; font-size: 12px; }
  .chip { padding: 5px 11px; font-size: 13px; }
  .frow {
    position: sticky;
    bottom: -10px;
    background: #14171d;
    padding: 8px 0 2px;
    margin-bottom: 0;
    z-index: 2;
  }
}

/* ================= PVP 对局棋盘 ================= */
.board {
  position: relative;
  display: grid;
  grid-template-columns: 150px 1fr 170px;
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas:
    "stat op   shell"
    "stat op   shell"
    "stat info shell"
    "me   act  act";
  gap: clamp(6px, 1.2vh, 12px);
  height: 100%;
  min-height: 0;
  padding: 0 clamp(6px, 1vw, 12px);
}

.b-stat { grid-area: stat; align-self: start; }
.b-op { grid-area: op; display: flex; justify-content: center; align-items: flex-start; }
.b-shell { grid-area: shell; align-self: start; }
.b-info { grid-area: info; display: flex; align-items: center; justify-content: center; }
.b-me { grid-area: me; align-self: end; }
.b-act { grid-area: act; display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; }

.box {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 8px 12px;
}
.bx-k { color: var(--muted); font-size: 12px; }
.bx-k.small { font-size: 11px; margin-top: 4px; }
.bx-v { color: var(--text); font-size: 16px; font-weight: 600; }
.bx-v.small { font-size: 13px; font-weight: 500; }

/* 对局信息：半透明底 */
.info-box {
  width: min(560px, 100%);
  max-height: 100%;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: rgba(23, 26, 33, .55);
  backdrop-filter: blur(2px);
  color: var(--text);
  padding: 12px 16px;
  font-size: 14px;
  text-align: center;
  line-height: 1.6;
}

/* 边上的两个抽屉按钮 */
.edge {
  position: absolute;
  top: 42%;
  width: 26px;
  padding: 16px 5px;
  background: rgba(23, 26, 33, .8);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.1;
  writing-mode: vertical-rl;
  border-radius: 8px;
  cursor: pointer;
}
.edge-l { left: -2px; }
.edge-r { right: -2px; }
.edge:hover { color: var(--text); }

/* 玩家卡 */
.gcard {
  display: flex;
  gap: 10px;
  align-items: center;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 9px 12px;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.gcard.gturn {
  border-color: #d9a441;
  box-shadow: 0 0 0 1px rgba(217, 164, 65, .45), 0 0 14px rgba(217, 164, 65, .18);
}
.gcard.glegal { border: 2.5px solid #35d07f; cursor: pointer; box-shadow: 0 0 0 3px rgba(53, 208, 127, .25), inset 0 0 22px rgba(53, 208, 127, .12); }
.gcard.glegal:hover { background: #16281f; border-color: #4ff09a; box-shadow: 0 0 0 4px rgba(79, 240, 154, .3); }
.gcard.gsel { border: 2.5px solid #4ff09a; box-shadow: 0 0 0 4px rgba(79, 240, 154, .45); }
.gcard.gdim { opacity: .45; }

.gc-av {
  width: 40px; height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #232833;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-weight: 700;
}
.gc-main { flex: 1 1 auto; min-width: 0; }
.gc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gc-name { font-weight: 600; font-size: 16px; }
.gc-hpnum { color: var(--muted); font-size: 12px; }
.gc-hp {
  height: 8px;
  background: #232833;
  border-radius: 5px;
  margin: 5px 0 6px;
  overflow: hidden;
}
.gc-hp > i { display: block; height: 100%; background: linear-gradient(90deg, #35c07a, #58d68d); transition: width .25s; }
.gc-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gc-skills { color: var(--muted); font-size: 12px; }
.gc-items { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.gitem {
  background: #1d222b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 6px;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
}
.gitem:hover:not([disabled]) { border-color: #5a6474; }
.gitem[disabled] { opacity: .45; cursor: default; }
.gc-none { color: var(--muted); font-size: 12px; font-weight: 400; }

/* 开枪 / 输入 */
.shoot { min-width: 96px; padding: 10px 22px; font-size: 16px; }
.b-act .rf-input { width: min(300px, 40vw); }

/* 聊天 / 日志：半透明浮层 */
.overlay {
  position: absolute;
  top: 56px;
  bottom: 12px;
  width: min(340px, 42vw);
  display: flex;
  flex-direction: column;
  background: rgba(20, 23, 29, .82);
  backdrop-filter: blur(6px);
  border: 1px solid var(--line);
  border-radius: 12px;
  z-index: 30;
  overflow: hidden;
}
#ovChat { left: 44px; }
#ovLog { right: 44px; }
.overlay[hidden] { display: none !important; }
.ov-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.ov-body { flex: 1 1 auto; overflow-y: auto; padding: 10px 12px; font-size: 13px; }
.ov-line { padding: 2px 0; word-break: break-word; }
.ov-line b { color: #c9d1e0; }

/* 矮屏微调 */
@media (max-height: 460px) {
  .board { grid-template-columns: 128px 1fr 140px; gap: 6px; }
  .gcard { padding: 7px 10px; }
  .gc-av { width: 34px; height: 34px; }
  .gc-name { font-size: 15px; }
  .info-box { padding: 8px 12px; font-size: 13px; }
  .overlay { top: 48px; }
}

/* ---- 棋盘布局修正（覆盖前面的网格） ---- */
.board {
  display: grid !important;
  grid-template-columns: clamp(140px, 16vw, 200px) 1fr clamp(140px, 16vw, 200px) !important;
  grid-template-rows: auto 1fr auto !important;
  grid-template-areas:
    "stat op   shell"
    "info info info"
    "me   me   act" !important;
  gap: clamp(8px, 1.4vh, 14px) !important;
  padding: 0 clamp(10px, 2vw, 26px) !important;
}
.b-stat { grid-area: stat !important; align-self: start !important; }
.b-op { grid-area: op !important; justify-self: center !important; align-self: start !important; width: 100%; display: flex; justify-content: center; }
.b-shell { grid-area: shell !important; justify-self: end !important; align-self: start !important; }
.b-info { grid-area: info !important; align-self: center !important; }
.b-me { grid-area: me !important; align-self: end !important; justify-self: start !important; width: 100%; }
.b-act {
  grid-area: act !important;
  align-self: end !important;
  justify-self: end !important;
  display: flex; align-items: center; gap: 10px;
}

.gcard { width: 100% !important; max-width: 560px; }
.b-me .gcard { max-width: 560px; }
.gc-items { flex-wrap: nowrap; }
.gcard .gitem[disabled] { opacity: .62; }
.gc-skills { white-space: nowrap; }
.info-box { width: min(680px, 92%); }

/* 枪口按钮在右下，输入框在它右边 */
.shoot { min-width: 110px; }
.b-act .rf-input { width: min(320px, 34vw); }

/* 道具图标在对手卡上也清晰可见（只是不可点） */
.gcard .gitem[disabled] { opacity: 1; filter: grayscale(.35) brightness(.85); }
.gitem { font-size: 16px; padding: 3px 7px; }

/* 中间信息框：加高、虚线更明显 */
.info-box {
  min-height: clamp(84px, 16vh, 150px);
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed rgba(120, 132, 150, .55);
  background: rgba(23, 26, 33, .55);
}

/* 玩家卡加宽 */
.gcard { max-width: 760px !important; }
.b-me .gcard { max-width: 760px !important; }
.b-op .gcard { max-width: 720px !important; }
@media (min-width: 1100px) {
  .board { grid-template-columns: 180px 1fr 180px !important; }
  .gcard { max-width: 820px !important; }
}

/* 子弹数：红/灰 emoji */
.shell-dots {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin: 6px 0 4px;
  max-width: 150px;
  line-height: 1;
}
.shell-dots .sh { font-size: 15px; }

/* 中间信息：两行 */
.info-box {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  text-align: center;
}
.info-line { color: var(--text); font-size: 14px; }
.info-line.dim { color: var(--muted); font-size: 13px; }

/* 修开枪按钮压住自己玩家卡：给底部留出右侧空间 */
.b-me { padding-right: clamp(150px, 20vw, 300px) !important; }
.b-me .gcard { max-width: 100% !important; }
.b-act {
  position: relative;
  z-index: 3;
}
@media (max-height: 460px) {
  .b-me { padding-right: clamp(130px, 22vw, 240px) !important; }
}

/* 窄屏（手机横屏）：自己卡收窄，开枪/输入留在右边，避免重叠 */
@media (max-width: 900px) {
  .b-me { padding-right: 0 !important; }
  .b-me .gcard { max-width: 58% !important; }
  .b-act .rf-input { width: min(240px, 26vw); }
  .shoot { min-width: 84px; padding: 8px 14px; font-size: 15px; }
}
/* 极矮屏（手机横屏 390 高）压缩，保证不出滚动条 */
@media (max-height: 430px) {
  .view { padding: 6px 10px 8px !important; }
  .view-head { margin-bottom: 6px !important; }
  .view-head h2 { font-size: 15px !important; }
  .board { gap: 5px !important; }
  .box { padding: 5px 9px !important; }
  .bx-v { font-size: 14px !important; }
  .info-box { min-height: 52px !important; padding: 6px 10px !important; }
  .info-line { font-size: 12.5px !important; }
  .info-line.dim { font-size: 11.5px !important; }
  .gcard { padding: 5px 8px !important; }
  .gc-av { width: 28px !important; height: 28px !important; font-size: 13px !important; }
  .gc-name { font-size: 14px !important; }
  .gc-hp { height: 6px; margin: 3px 0 4px; }
  .gitem { font-size: 14px !important; padding: 2px 5px !important; }
  .gc-skills, .gc-none { font-size: 11px !important; }
}

/* 三条信息：给足高度 */
.info-box { min-height: clamp(86px, 15vh, 132px) !important; gap: 3px; }
.info-line { line-height: 1.35; }
@media (max-height: 430px) {
  .info-box { min-height: 62px !important; }
  .info-line { font-size: 11.5px !important; }
  .info-line.dim { font-size: 10.5px !important; }
}

/* 三条信息：最上面淡、最下面（最新）亮 */
.info-box { justify-content: flex-end !important; }
.info-line { color: var(--muted); font-size: 13px; }
.info-line:last-child { color: var(--text); font-size: 14px; }

/* 桌面：开枪/输入固定右侧，自己卡让它变宽 */
@media (min-width: 901px) {
  .board {
    grid-template-columns: clamp(150px, 15vw, 190px) 1fr clamp(150px, 15vw, 190px) !important;
    grid-template-areas:
      "stat op    shell"
      "info info  info"
      "me   me    act" !important;
  }
  .b-me { padding-right: clamp(120px, 16vw, 200px) !important; }
}

/* 窄屏：开枪和输入放到下面一行，玩家卡占满整行 */
@media (max-width: 900px) {
  .board {
    grid-template-areas:
      "stat op    shell"
      "info info  info"
      "me   me    me"
      "act  act   act" !important;
    grid-template-rows: auto 1fr auto auto !important;
  }
  .b-me { padding-right: 0 !important; }
  .b-me .gcard, .b-op .gcard { max-width: 100% !important; }
  .b-act { justify-self: stretch !important; justify-content: flex-end; }
}


/* 撤回上一轮「尽量宽」的改动，恢复到此前的尺寸 */
.view.wide { max-width: none; }
@media (min-width: 1100px) {
  .board { grid-template-columns: 180px 1fr 180px; }
}

/* ===== 按草图：自己卡短一些，开枪在右、输入框在开枪下面 ===== */
.b-me { padding-right: 0 !important; }
.b-me .gcard {
  width: min(520px, 46vw) !important;
  max-width: min(520px, 46vw) !important;
}
.b-act {
  flex-direction: column !important;
  align-items: flex-end !important;
  gap: 8px !important;
  justify-self: end !important;
}
.b-act .rf-input { width: min(420px, 40vw) !important; }
.shoot { align-self: flex-end; }

@media (max-width: 900px) {
  .b-me .gcard { width: min(430px, 52vw) !important; max-width: min(430px, 52vw) !important; }
  .b-act .rf-input { width: min(300px, 34vw) !important; }
}

/* 手机上别把开枪+输入叠成两行（会撑出滚动条），并压缩信息框 */
@media (max-width: 900px) {
  .b-act { flex-direction: row !important; align-items: center !important; gap: 8px !important; }
  .b-act .rf-input { width: min(260px, 30vw) !important; }
  .info-box { min-height: 44px !important; }
}
@media (max-height: 430px) {
  .info-box { min-height: 40px !important; }
  .view { padding-bottom: 4px !important; }
}

/* ===== 严格按草图：两张玩家卡同宽、居中；开枪在右，输入框在开枪下面 ===== */
.b-op, .b-me { justify-content: center !important; display: flex !important; padding: 0 !important; }
.b-op .gcard, .b-me .gcard {
  width: min(470px, 42vw) !important;
  max-width: min(470px, 42vw) !important;
  min-width: 300px;
}
.b-act {
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  justify-self: end !important;
  align-self: end !important;
}
.b-act .shoot { width: 110px; }
.b-act .rf-input { width: min(330px, 26vw) !important; }

@media (max-width: 900px) {
  .b-op .gcard, .b-me .gcard { width: min(400px, 45vw) !important; max-width: min(400px, 45vw) !important; min-width: 240px; }
  .b-act .rf-input { width: min(240px, 26vw) !important; }
  .b-act .shoot { width: 92px; }
}
@media (max-height: 430px) {
  .info-box { min-height: 40px !important; }
}

/* ===== 精修：两张卡都在视口居中，开枪/输入固定在右下角 ===== */
.board {
  position: relative !important;
  grid-template-areas:
    "stat op    shell"
    "info info  info"
    "me   me    me" !important;
  grid-template-rows: auto 1fr auto !important;
}
.b-op { grid-area: op !important; justify-content: center !important; }
.b-me { grid-area: me !important; justify-content: center !important; padding-bottom: 6px; }
.b-act {
  position: absolute !important;
  right: clamp(10px, 2vw, 28px);
  bottom: 6px;
  flex-direction: column !important;
  align-items: flex-end !important;
  gap: 8px !important;
  z-index: 5;
}
.b-op .gcard, .b-me .gcard { width: min(470px, 40vw) !important; max-width: min(470px, 40vw) !important; }

@media (max-width: 900px) {
  .b-op .gcard, .b-me .gcard { width: min(360px, 38vw) !important; max-width: min(360px, 38vw) !important; min-width: 220px; }
  .b-act { right: 8px; bottom: 4px; gap: 6px !important; }
  .b-act .rf-input { width: min(210px, 24vw) !important; }
  .b-act .shoot { width: 84px; padding: 7px 12px; font-size: 14px; }
}

/* 手机：对局信息框缩短（宽度收窄，居中） */
@media (max-width: 900px) {
  .info-box {
    width: min(420px, 58vw) !important;
    min-height: 40px !important;
    margin: 0 auto;
    padding: 6px 12px !important;
  }
}

/* ===== 技能/升级 选择弹窗 ===== */
.picker-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  display: grid;
  place-items: center;
  z-index: 40;
}
.picker {
  width: min(720px, 88%);
  max-height: 92%;
  background: rgba(20, 23, 29, .96);
  border: 1px solid #3a4150;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.pk-head {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 10px 44px;
  border-bottom: 1px solid var(--line);
}
.pk-title { font-size: 20px; font-weight: 600; }
.pk-x {
  position: absolute; right: 10px; top: 8px;
  width: 30px; height: 30px;
  background: none; border: 0;
  color: var(--muted); font-size: 20px; cursor: pointer;
}
.pk-x:hover { color: var(--text); }

.pk-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; flex: 1 1 auto; min-height: 0; }
.pk-col {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 12px;
  background: none;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.pk-col:last-child { border-right: 0; }
.pk-col:hover { background: rgba(255, 255, 255, .04); }
.pk-name { font-size: 15px; font-weight: 600; }
.pk-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }

@media (max-height: 430px) {
  .picker { width: min(680px, 92%); }
  .pk-title { font-size: 16px; }
  .pk-col { padding: 8px 10px; gap: 6px; }
  .pk-name { font-size: 13.5px; }
  .pk-desc { font-size: 11.5px; }
}

/* 梅菲斯特选道具：横排卡片 */
.mf-cols { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important; }
.mf-item { border-right: 1px solid var(--line); }

/* ===== 虎牢关：四座布局（自己在下，逆时针） ===== */
.hboard {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "stat top shell"
    "left info right"
    "me   me  act";
  gap: clamp(8px, 1.4vh, 14px);
  height: 100%;
  padding: 0 clamp(10px, 2vw, 24px);
}
.hb-stat { grid-area: stat; align-self: start; }
.hb-shell { grid-area: shell; justify-self: end; align-self: start; }
.hb-info { grid-area: info; display: flex; align-items: center; justify-content: center; }
.hb-act { grid-area: act; align-self: end; justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hb-act .rf-input { width: min(300px, 26vw); }

.hcard {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 8px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  width: min(340px, 30vw);
}
.hcard.top { grid-area: top; justify-self: center; }
.hcard.left { grid-area: left; justify-self: start; align-self: center; }
.hcard.right { grid-area: right; justify-self: end; align-self: center; }
.hcard.bottom { grid-area: me; justify-self: center; align-self: end; }
.hcard.mine { border-color: #d9a441; box-shadow: 0 0 0 1px rgba(217,164,65,.45); }

.hc-av {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 50%; background: #232833; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 20px;
}
.hc-main { flex: 1 1 auto; min-width: 0; }
.hc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hc-name { font-weight: 600; font-size: 15px; }
.hc-hpnum { color: var(--muted); font-size: 12px; }
.hc-hp { height: 8px; background: #232833; border-radius: 5px; margin: 4px 0 5px; overflow: hidden; }
.hc-hp > i { display: block; height: 100%; background: linear-gradient(90deg,#35c07a,#58d68d); }
.hc-line { font-size: 12px; color: var(--muted); }
.hc-line.dim { opacity: .8; }

@media (max-height: 430px) {
  .hcard { width: min(280px, 30vw); padding: 6px 9px; }
  .hc-av { width: 32px; height: 32px; font-size: 16px; }
}

/* 角色标记：头像左边的小 emoji */
.hc-tag {
  font-size: 17px;
  line-height: 1;
  flex: 0 0 auto;
  margin-right: -2px;
}

/* 手机横屏：虎牢关整页压缩，不出滚动条 */
@media (max-height: 430px) {
  .hboard { gap: 4px !important; padding: 0 6px !important; }
  .hcard { width: min(300px, 32vw) !important; padding: 4px 7px !important; gap: 6px !important; }
  .hc-av { width: 26px !important; height: 26px !important; font-size: 13px !important; }
  .hc-tag { font-size: 13px !important; }
  .hc-name { font-size: 13px !important; }
  .hc-hpnum { font-size: 10px !important; }
  .hc-hp { height: 5px !important; margin: 2px 0 3px !important; }
  .hc-line { font-size: 10.5px !important; }
  .hb-stat .box, .hb-shell .box { padding: 4px 8px !important; }
  .hb-stat .bx-v { font-size: 13px !important; }
  .hb-stat .bx-k, .hb-shell .bx-k { font-size: 10px !important; }
  .hb-info .info-box { min-height: 40px !important; font-size: 11px !important; padding: 4px 8px !important; }
  .hb-act { gap: 4px !important; }
  .hb-act .shoot { padding: 6px 14px !important; font-size: 13px !important; min-width: 74px; }
  .hb-act .rf-input { padding: 5px 8px !important; font-size: 12px !important; width: min(230px, 26vw) !important; }
  .view { padding: 4px 8px 4px !important; }
  .view-head { margin-bottom: 3px !important; }
  .view-head h2 { font-size: 13px !important; }
  .view-head .ghost { padding: 4px 9px !important; font-size: 12px !important; }
}

/* 手机横屏：留出两侧抽屉的空间，卡片再缩一点，横向也不溢出 */
@media (max-height: 430px) {
  .hboard { padding: 0 22px !important; }
  .hcard { width: min(260px, 27vw) !important; }
  .edge { width: 18px !important; padding: 10px 3px !important; font-size: 10px !important; }
  .edge-l { left: 1px !important; }
  .edge-r { right: 1px !important; }
  .hb-act .rf-input { width: min(200px, 24vw) !important; }
  body { overflow-x: hidden; }
}

/* 缩放后不让残留布局撑出滚动条 */
html, body { overflow-x: hidden; }
.view-body { overflow: hidden; }
.hboard { /* will-change 去掉：它会让 fixed 子元素以 .hboard 为基准 */ }


/* ===== 虎牢关：四座对齐（覆盖前面规则） ===== */
.hboard {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  grid-template-areas:
    "stat top    shell"
    "left info   right"
    "me   me     act" !important;
  gap: clamp(6px, 1.2vh, 14px) clamp(8px, 1.4vw, 18px) !important;
  padding: 0 clamp(26px, 3vw, 40px) !important;
  height: 100%;
  box-sizing: border-box;
}
.hcard {
  width: 100% !important;
  max-width: 340px !important;
  min-width: 0 !important;
  justify-self: stretch !important;
  box-sizing: border-box;
}
.hcard.top { justify-self: center !important; }
.hcard.left { justify-self: end !important; }
.hcard.right { justify-self: start !important; }
.hcard.bottom { justify-self: center !important; }
.hc-name, .hc-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-height: 430px) {
  .hboard { padding: 0 clamp(20px, 3vw, 30px) !important; gap: 4px 6px !important; }
  .hcard { max-width: none !important; }
  .hc-line { font-size: 10px !important; }
}

/* 底部“我”卡与上方卡同宽同列（对齐信息框中线） */
.hboard {
  grid-template-areas:
    "stat top  shell"
    "left info right"
    ".    me   act" !important;
}
.hcard.bottom { justify-self: center !important; width: 100% !important; max-width: 340px !important; }

/* 手机横屏：虎牢关信息框上下拉长 */
@media (max-height: 430px) {
  .hb-info .info-box {
    min-height: 96px !important;
    padding: 10px 12px !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
  }
}


/* PVP 卡片：技能/道具行允许换行，避免溢出被裁 */
.gc-bottom { flex-wrap: wrap; row-gap: 4px; align-items: flex-start; }
.gc-skills { white-space: normal !important; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.gc-items { flex-wrap: wrap !important; }
.gcard { height: auto !important; }


/* 斗地主：三座（左/右/下，逆时针） */
.ddb {
  grid-template-areas:
    "stat .    shell"
    "left info right"
    ".    me   act" !important;
}


/* 斗地主三视角（按草图） */
.ddb.view-landlord {
  grid-template-areas:
    "stat .    shell"
    "left info right"
    ".    me   act" !important;
}
.ddb.view-f1, .ddb.view-f2 {
  grid-template-areas:
    "stat top  shell"
    "left info ."
    ".    me   act" !important;
}
.ddb.view-f2 {
  grid-template-areas:
    "stat top  shell"
    ".    info right"
    ".    me   act" !important;
}
.hcard.top { grid-area: top; justify-self: center; align-self: start; }


/* 斗地主：农民面对面（上=另一个农民），地主在侧位 */
.ddb.view-f1 {
  grid-template-areas:
    "stat top  shell"
    "left info ."
    ".    me   act" !important;
}
.ddb.view-f2 {
  grid-template-areas:
    "stat top  shell"
    ".    info right"
    ".    me   act" !important;
}


/* QQ 登录弹窗 */
.login-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 60; }
.login-box { width: min(340px, 86vw); background: #1b2029; border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 10px; }
.login-title { font-size: 16px; font-weight: 600; }
.login-row { display: flex; gap: 8px; }
.login-row .rf-input { flex: 1; }
.login-tip { font-size: 12px; color: var(--muted); min-height: 16px; line-height: 1.5; word-break: break-all; }

/* 登录弹窗：QQ 与昵称分隔 */
.login-sep {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0;
}

/* 登录弹窗：emoji 头像选择 */
.emoji-pick {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  max-height: 108px;
  overflow-y: auto;
}
.emoji-btn {
  font-size: 17px;
  line-height: 1;
  padding: 4px 0;
  background: #232833;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.emoji-btn.gsel { border-color: #d9a441; box-shadow: 0 0 0 1px rgba(217,164,65,.5); }

/* 登录弹窗：emoji 输入框 */
.emoji-input { text-align: center; font-size: 16px; }

/* ===== 设置面板 ===== */
.set-sec { margin-bottom: 14px; }
.set-h { font-size: 13px; color: var(--muted); margin: 6px 0 8px; letter-spacing: .06em; }
.set-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 7px 0; border-bottom: 1px dashed rgba(255,255,255,.07);
  font-size: 14px;
}
.set-row:last-child { border-bottom: 0; }
.set-btns { display: flex; gap: 8px; }
.set-row input[type=range] { width: 150px; accent-color: #e0553d; }
.set-row b { color: #e8ecf3; font-weight: 600; }

/* 开关 */
.sw { position: relative; width: 42px; height: 24px; display: inline-block; }
.sw input { display: none; }
.sw i {
  position: absolute; inset: 0; background: #2a303c; border-radius: 999px;
  transition: background .15s; cursor: pointer;
}
.sw i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: #e8ecf3; border-radius: 50%; transition: transform .15s;
}
.sw input:checked + i { background: #e0553d; }
.sw input:checked + i::after { transform: translateX(18px); }

/* 背景与透明度：由 settings.js 设置 CSS 变量 */
:root { --panel-alpha: 1; --bg-home: none; --bg-game: none; }

body {
  background-image: var(--bg-home);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
body.bg-game { background-image: var(--bg-game); }

/* 实体框（面板）透明度 */
:root { --panel: rgba(23, 26, 33, var(--panel-alpha)); }
.box, .gcard, .hcard, .rrow, .entry, .rc, .sheet, .picker, .login-box, .info-box {
  background-color: rgba(23, 26, 33, calc(var(--panel-alpha) * 0.92)) !important;
  backdrop-filter: blur(2px);
}

/* ===== 浅色模式 ===== */
html[data-theme='light'] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #d9dde4;
  --text: #1a1d23;
  --muted: #6b7280;
}
html[data-theme='light'] body { background: var(--bg); color: var(--text); }
html[data-theme='light'] .box,
html[data-theme='light'] .gcard,
html[data-theme='light'] .hcard,
html[data-theme='light'] .rrow,
html[data-theme='light'] .entry,
html[data-theme='light'] .rc,
html[data-theme='light'] .sheet,
html[data-theme='light'] .picker,
html[data-theme='light'] .login-box,
html[data-theme='light'] .info-box {
  background-color: rgba(255, 255, 255, calc(var(--panel-alpha) * 0.97)) !important;
  color: #1a1d23;
  border-color: #d9dde4;
}
html[data-theme='light'] .topbar,
html[data-theme='light'] .view-head { border-color: #e2e6ec; }
html[data-theme='light'] .rf-input {
  background: #f7f8fa; color: #1a1d23; border-color: #d9dde4;
}
html[data-theme='light'] .ghost { background: #eef1f5; color: #1a1d23; border-color: #d9dde4; }
html[data-theme='light'] .edge { background: #ffffff; color: #4b5563; border-color: #d9dde4; }

/* ===== 规则 / 技能池 ===== */
.rule-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: rgba(23,26,33,.55); }
.rc-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.rc-head b { font-size: 15px; }
.rc-tag { font-size: 12px; color: var(--muted); }
.rc-list { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; line-height: 1.75; color: #d5dbe6; }
.rc-list li { margin: 2px 0; }
.rc-btns { display: flex; gap: 8px; margin-top: 6px; }
.rule-sec-title { font-size: 13px; color: var(--muted); margin: 14px 0 6px; letter-spacing: .05em; }
.rule-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.rule-item { display: grid; grid-template-columns: 22px 64px 1fr; gap: 6px; align-items: start; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.ri-e { font-size: 15px; }
.ri-n { color: #e8ecf3; }
.ri-d { color: var(--muted); line-height: 1.5; }
.rule-tip { font-size: 12px; color: var(--muted); margin-top: 10px; }

.sk-list { display: grid; gap: 6px; }
.sk-row { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }
.sk-e { font-size: 17px; }
.sk-main { display: grid; gap: 2px; }
.sk-main b { font-size: 14px; }
.sk-main i { font-style: normal; font-size: 11px; color: #e0553d; }
.sk-main em { font-style: normal; font-size: 12px; color: var(--muted); line-height: 1.55; }

html[data-theme='light'] .rule-card { background: rgba(255,255,255,.9); }
html[data-theme='light'] .rc-list { color: #374151; }

/* ===== 玩家说话气泡（移植自旧版） ===== */
.bubble {
  position: fixed;
  z-index: 9999;
  max-width: 210px;
  padding: 6px 10px;
  border-radius: 12px;
  background: #f4f6fb;
  color: #1a1c22;
  font-size: 12.5px;
  line-height: 1.45;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(.92);
  transform-origin: left bottom;
  transition: opacity .18s ease, transform .18s cubic-bezier(.2,.9,.3,1.2);
  word-break: break-word;
  white-space: pre-wrap;
}
.bubble.on { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; cursor: pointer; }
.bubble::after {
  content: '';
  position: absolute; left: 8px; bottom: -5px;
  width: 10px; height: 10px;
  background: #f4f6fb;
  transform: rotate(45deg);
  border-radius: 2px;
}
html[data-theme='light'] .bubble { background: #ffffff; color: #1a1c22; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
html[data-theme='light'] .bubble::after { background: #ffffff; }

/* ===== 内置表情面板 + 图片气泡 ===== */
.stk-panel {
  position: fixed;
  right: 16px; bottom: 84px;
  width: min(360px, 92vw);
  max-height: 300px;
  overflow-y: auto;
  background: rgba(23,26,33,.97);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  z-index: 9998;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.stk-btn { background: #232833; border: 1px solid var(--line); border-radius: 8px; padding: 2px; cursor: pointer; }
.stk-btn img { width: 100%; height: 64px; object-fit: contain; display: block; }
.stk-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12px; text-align: center; padding: 12px; }
.bubble .bub-img { display: block; max-width: 120px; max-height: 120px; border-radius: 8px; margin-top: 2px; }
.bubble.has-img { padding: 4px; }
html[data-theme='light'] .stk-panel { background: #fff; }
html[data-theme='light'] .stk-btn { background: #f3f5f9; }

/* 表情分页 */
.stk-tabs { grid-column: 1 / -1; display: flex; gap: 8px; margin-bottom: 6px; }
.stk-tab {
  flex: 1; padding: 7px 0; border-radius: 9px; cursor: pointer;
  background: #232833; border: 1px solid var(--line); color: #cfd6e3; font-size: 13px;
}
.stk-tab i { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 4px; }
.stk-tab.on { border-color: #d9a441; color: #ffd75e; box-shadow: 0 0 0 1px rgba(217,164,65,.35); }
.stk-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

/* 上帝预演标记 */
.god-mark {
  position: absolute; top: 6px; right: 8px;
  background: rgba(255,215,94,.15); border: 1px solid rgba(255,215,94,.55);
  border-radius: 8px; padding: 1px 5px; font-size: 13px; cursor: pointer; line-height: 1.2;
}
.gcard { position: relative; }

/* ===== 表情互动按钮（砸蛋/送花/碰杯/扔鞋） ===== */
.emote-bar { position: absolute; top: 4px; right: 62px; display: flex; gap: 2px; }
.emote-btn {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px; padding: 1px 5px; font-size: 14px; cursor: pointer; line-height: 1.3;
}
.emote-btn:hover { background: rgba(255,255,255,.14); }
.flyer {
  position: fixed; z-index: 10000; pointer-events: none;
  will-change: transform, opacity;
}

/* ===== 开枪 / 互动特效元素 ===== */
.fx-el { position: fixed; z-index: 10001; pointer-events: none; line-height: 1; will-change: transform, opacity; }
.fx-gun { filter: drop-shadow(0 2px 4px rgba(0,0,0,.5)); }
/* 被打中：边框变红 + 抖动 */
@keyframes fxShake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-7px, 2px); }
  30% { transform: translate(6px, -2px); }
  45% { transform: translate(-5px, 1px); }
  60% { transform: translate(4px, -1px); }
  80% { transform: translate(-2px, 0); }
}
.gcard.fx-hurt, .hcard.fx-hurt {
  border-color: #ff4d4d !important;
  box-shadow: 0 0 0 2px rgba(255,77,77,.85), 0 0 22px rgba(255,60,60,.55) !important;
  animation: fxShake .42s linear 1;
}
.gcard.fx-hurt .hpbar, .hcard.fx-hurt .hpbar { background: #ff4d4d !important; }

/* ===== 手铐锁链 ===== */
.chain-overlay {
  position: absolute; inset: 0;
  display: flex; justify-content: center; gap: 26%; align-items: flex-start;   /* 两条链以卡片中心对称 */
  pointer-events: none; overflow: hidden; z-index: 6; border-radius: inherit;
  /* 只覆盖头像那一带，别糊住技能/道具文字 */
  opacity: .85;
}
.hcard .chain-overlay { inset: 0; max-height: 100%; }
.chain-overlay .chain-col { max-height: 100%; overflow: hidden; }
.chain-col {
  display: flex; flex-direction: column; align-items: center;
  font-size: 22px; line-height: .92;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.75));
  animation: chainDrop 420ms cubic-bezier(.2,.8,.3,1.15) both;
}
.chain-link { opacity: .95; }
@keyframes chainDrop {
  from { transform: translateY(-118%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
/* 解开：猛抽上去 → 回弹一下 → 再抽走淡出（共 500ms） */
.chain-overlay.chain-out .chain-col {
  animation: chainLift 500ms cubic-bezier(.3,.7,.35,1) both;
}
@keyframes chainLift {
  0%   { transform: translateY(0);     opacity: 1; }
  46%  { transform: translateY(-135%); opacity: 1; }
  62%  { transform: translateY(-104%); opacity: 1; }   /* 回弹 */
  78%  { transform: translateY(-132%); opacity: .9; }
  100% { transform: translateY(-160%); opacity: 0; }
}
.gcard.is-cuffed, .hcard.is-cuffed { border-color: #8fb6ff !important; }

/* 技能触发漂浮 */
.fx-skillpop { filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }

/* ===== 阵亡：瞬间变灰 + 中央 😵 ===== */
.gcard.is-dead, .hcard.is-dead {
  filter: grayscale(1) brightness(.62);
  border-color: #4a4f59 !important;
  box-shadow: none !important;
}
.gcard.is-dead .chain-overlay, .hcard.is-dead .chain-overlay { filter: grayscale(1); }
.dead-mark {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 62px; line-height: 1;
  z-index: 8; pointer-events: none;
  text-shadow: 0 4px 14px rgba(0,0,0,.65);
}

/* 设置面板状态行 */
.set-status {
  font-size: 12px; color: #ffd75e; line-height: 1.5;
  margin: 2px 0 8px; word-break: break-all;
}
.set-status:empty { display: none; }

/* 设置面板构建号 */
.set-build { font-size: 11px; color: var(--muted); margin-bottom: 8px; letter-spacing: .04em; }

/* 浅色模式：顶栏跟随透明度 */
html[data-theme='light'] .topbar {
  background-color: rgba(255, 255, 255, calc(var(--panel-alpha, 1) * 0.95)) !important;
}

/* 登录弹窗：右上角关闭 + 右下角退出登录 */
.login-box { position: relative; }
.login-x {
  position: absolute; top: 8px; right: 10px;
  width: 30px; height: 30px; line-height: 1;
  border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  color: #cfd6e3; font-size: 15px; padding: 0;
}
.login-x:hover { background: rgba(255,255,255,.14); }
.login-foot { display: flex; justify-content: flex-end; margin-top: 10px; }
.login-logout {
  background: none; border: 0; cursor: pointer;
  color: #ff7b6b; font-size: 13px; padding: 6px 2px; text-decoration: underline;
}
html[data-theme='light'] .login-x { background: #eef1f5; color: #1a1d23; }

/* ===== 登录弹窗：可滚动（手机横屏放不下时）===== */
.login-mask {
  position: fixed; inset: 0; z-index: 9990;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 10px;
  background: rgba(0, 0, 0, .62);
}
.login-box {
  max-height: none;
  margin: auto;
}
@media (max-height: 560px) {
  .login-mask { align-items: flex-start; }
  .login-box {
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 auto;
  }
}

/* ===== 手机：整体字号小一号 ===== */
@media (max-width: 900px), (max-height: 500px) {
  body { zoom: 0.92; }
  .login-title { font-size: 15px; }
  .login-box { width: min(92vw, 420px); padding: 12px 14px; }
  .rf-input { font-size: 13px; padding: 8px 10px; }
  .login-row button { font-size: 13px; padding: 8px 14px; }
}

/* ===== 手机：非对局页允许滚动，避免按钮被挤掉 ===== */
@media (max-width: 900px), (max-height: 500px) {
  body:not(.bg-game) { height: auto; min-height: 100dvh; overflow-y: auto; }
  body:not(.bg-game) .view { min-height: auto; }
  body:not(.bg-game) .view-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: none;
  }
  /* 房间页按钮别贴着底部手势区 */
  body:not(.bg-game) .rc-actions,
  body:not(.bg-game) .rf-actions { padding-bottom: 10px; }
}

/* 被动技能图标（不可点击，灰一点区分） */
.gskill-p {
  opacity: .62;
  border-style: dashed !important;
  cursor: default;
}

.set-diag { font-size: 11px; color: #ffd75e; line-height: 1.6; margin: 0 0 8px; word-break: break-all; }

/* 加入房间：房号直连 */
.join-code-box {
  display: flex; gap: 8px; align-items: center;
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px dashed var(--line); border-radius: 12px;
}
.join-code-box .rf-input { flex: 1 1 auto; }
.join-code-box button { flex: 0 0 auto; }

.rrow-code { font-size: 11px; color: var(--muted); margin-left: 6px; letter-spacing: .04em; }

/* 玩家头像图片（QQ 头像） */
.gc-av .av-img, .hc-av .av-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.gc-av, .hc-av { overflow: hidden; }

/* 对局中「结束对局」按钮 */
.endroom { margin-top: 6px; font-size: 12px; padding: 4px 10px; }

/* 旧站特效元素：命中碎片 / 爆裂环 */
.impact {
  position: fixed; z-index: 10002; pointer-events: none;
  line-height: 1; will-change: transform, opacity;
}
.impact-ring {
  position: fixed; z-index: 10001; pointer-events: none;
  border-radius: 50%;
}

/* 气泡尾巴固定在左下角，指向头像 */
.bubble::after {
  left: 10px;
  bottom: -5px;
  transform: rotate(45deg);
}

/* ===== 对局页：矮屏（手机横屏）不要被 1fr 撑开，整体居中 ===== */
body.bg-game .view,
body.bg-game .view-body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.board, .hboard {
  height: 100%;
  min-height: 0;
  align-content: center;
}
@media (max-height: 900px) {
  .board {
    grid-template-rows: auto auto auto !important;
    gap: clamp(4px, 0.8vh, 8px) !important;
    align-content: center !important;
  }
  .b-info { align-self: center !important; }
  .info-box {
    max-height: 30vh;
    overflow-y: auto;
    padding: 6px 10px !important;
    line-height: 1.45 !important;
  }
  .b-me .gcard, .b-op .gcard { padding: 6px 8px !important; }
  .b-act { gap: 6px !important; }
}

/* ===== 矮屏对局：以「对局信息」为对称轴，上下两张卡等距贴住 ===== */
@media (max-height: 900px) {
  body.bg-game .board {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    padding: 54px 12px 66px !important;
    grid-template-areas: none !important;
    grid-template-rows: none !important;
  }
  /* 左上/右上两块改成绝对定位，不参与中间的对称布局 */
  body.bg-game .b-stat { position: absolute !important; left: 10px; top: 8px; }
  body.bg-game .b-shell { position: absolute !important; right: 10px; top: 8px; }
  body.bg-game .b-op,
  body.bg-game .b-info,
  body.bg-game .b-me {
    width: auto !important;
    margin: 0 !important;
    align-self: center !important;
    justify-self: center !important;
  }
  body.bg-game .b-op .gcard,
  body.bg-game .b-me .gcard { width: min(470px, 44vw) !important; }
  body.bg-game .b-me { padding-bottom: 0 !important; }
  body.bg-game .info-box { max-height: 28vh; }
}

/* 信息框宽度与卡片协调（矮屏对称布局下 auto 会缩太窄） */
@media (max-height: 900px) {
  body.bg-game .b-info { width: min(680px, 52vw) !important; }
  body.bg-game .b-info .info-box { width: 100% !important; }
}

/* ===== 对局页（矮屏）：信息栏固定正中，两张玩家卡对称贴上下边 ===== */
@media (max-height: 900px) {
  body.bg-game .board {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr auto 1fr !important;
    grid-template-areas: none !important;
    align-items: stretch !important;
    justify-items: center !important;
    padding: 12px 12px 12px !important;
    gap: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    align-content: stretch !important;
  }
  body.bg-game .b-stat { position: absolute !important; left: 10px; top: 8px; }
  body.bg-game .b-shell { position: absolute !important; right: 10px; top: 8px; }

  body.bg-game .b-op {
    grid-row: 1 !important; grid-column: 1 !important;
    align-self: start !important; justify-self: center !important;
    width: auto !important;
  }
  body.bg-game .b-info {
    grid-row: 2 !important; grid-column: 1 !important;
    align-self: center !important; justify-self: center !important;
    width: min(680px, 52vw) !important;
  }
  body.bg-game .b-info .info-box { width: 100% !important; }
  body.bg-game .b-me {
    grid-row: 3 !important; grid-column: 1 !important;
    align-self: end !important; justify-self: center !important;
    width: auto !important; padding-bottom: 0 !important;
  }
  body.bg-game .b-op .gcard,
  body.bg-game .b-me .gcard { width: min(470px, 44vw) !important; }
  body.bg-game .info-box { max-height: 26vh; }
}

/* 气泡翻到头像下方时：尾巴改到左上角 */
.bubble.below::after {
  bottom: auto;
  top: -6px;
  left: 10px;
}

.sh-unknown { font-style: normal; letter-spacing: 6px; color: var(--muted); }

/* 🗿 罗水彩蛋：玩家框旁边的消息/配图 */
.roger-note {
  position: fixed;
  min-width: 180px;
  box-sizing: border-box;
  z-index: 9999;
  max-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(24, 22, 26, .96);
  border: 1px solid rgba(217, 164, 65, .55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  color: #f1e8d8;
  font-size: 13px;
  line-height: 1.45;
  animation: rnIn .18s ease-out;
}
.roger-note .rn-img { width: 100%; border-radius: 8px; display: block; }
@keyframes rnIn { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }

/* 瞄准中：斗地主/虎牢关的卡也亮绿框 */
body.aiming .hcard {
  border: 2.5px solid #35d07f !important;
  box-shadow: 0 0 0 3px rgba(53, 208, 127, .25), inset 0 0 22px rgba(53, 208, 127, .12);
  cursor: pointer;
}
body.aiming .hcard.mine { border-color: #4ff09a !important; }

/* 🗿 罗水彩蛋：在小屏上进一步收窄，避免挡到对局 */
.roger-note { max-width: min(240px, 26vw); }
.roger-note .rn-img { width: 100%; height: auto; max-height: none; object-fit: contain; }
@media (max-height: 900px) {
  /* 矮屏：整条窄一点、图限高但保持比例（不裁剪） */
  .roger-note { max-width: min(170px, 30vw); font-size: 11px; padding: 6px 8px; }
  .roger-note .rn-img { width: auto; max-width: 100%; max-height: 84px; height: auto; margin: 0 auto; }
}

/* 极矮屏（<430px 高）：再压一档，彻底不挡对局信息 */
@media (max-height: 430px) {
  .roger-note { max-width: min(150px, 28vw); font-size: 10px; padding: 5px 7px; }
  .roger-note .rn-img { max-height: 64px; }
}

/* 主页「继续对局」提示条 */
.resume-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 14px;
  border: 1px solid rgba(53, 208, 127, .45);
  background: rgba(53, 208, 127, .08);
  border-radius: 12px; font-size: 13px; color: #d8f5e4;
}
.resume-bar .primary, .resume-bar .ghost { padding: 6px 12px; font-size: 13px; }
/* 对局中「保存退出」按钮 */
.saveroom { margin-top: 6px; font-size: 12px; padding: 4px 10px; }

/* 背景取图诊断行 */
.set-bg-diag { font-size: 11px; color: #8fcfae; margin: 4px 0 6px; line-height: 1.4; word-break: break-all; }

/* 联机抽卡：等待对手 */
.picker-wait { padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.05); color: #cfcfd6; font-size: 13px; text-align: center; }

/* 本局结束：下一局 / 结算 */
.round-ask {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 6px 0; padding: 8px 12px; border-radius: 10px;
  background: rgba(217,164,65,.12); border: 1px solid rgba(217,164,65,.45);
  color: #f3e6cf; font-size: 13px;
}
.round-ask .primary, .round-ask .ghost { padding: 5px 12px; font-size: 13px; }


/* 背景层：固定在最大视口（lvh），软键盘弹起时不会缩放/位移 */
#bgLayer {
  position: fixed;
  left: 0; top: 0;
  width: 100vw;
  height: 100lvh;
  z-index: -1;
  pointer-events: none;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
/* 对局页禁止滚动，避免键盘把页面顶起来 */
body.bg-game { position: fixed; inset: 0; overflow: hidden; }


/* 软键盘弹起时用「稳定视口高度」排版，避免界面跳动 */
body.bg-game { height: var(--app-vh, 100dvh); }
body.bg-game .view, body.bg-game .view-body, body.bg-game .board {
  height: var(--app-vh, 100dvh) !important;
  min-height: 0;
}
/* 斗地主/虎牢关：棋盘从顶栏下面开始，高度要减掉上方占位，否则最下面那张卡会被推出屏幕 */
body.bg-game .hboard {
  height: var(--hboard-h, 100%) !important;
  max-height: var(--hboard-h, 100%) !important;
  min-height: 0;
  overflow: visible;          /* 别把最下面的自己卡裁掉 */
}
#bgLayer { height: var(--app-vh, 100lvh); }
body.bg-game .b-act { position: absolute !important; bottom: 8px; right: 12px; }
@media (max-height: 900px) {
  body.bg-game .b-act { bottom: 6px; }
}


/* 键盘锁尺寸：对局内一律不用 vh 做内外边距，避免软键盘改变卡片高度 */
body.bg-game .gcard { padding: 8px 10px !important; }
body.bg-game .gcard .gc-bar { height: 8px !important; }
body.bg-game .info-box { padding: 8px 12px !important; }
body.bg-game .b-act { gap: 8px !important; }
body.bg-game .b-act .shoot { height: 40px !important; }
body.bg-game .b-act .rf-input { height: 34px !important; }
body.bg-game .edge { height: 96px !important; }


/* 键盘锁：一旦冻结，尺寸只认 --app-vh，不用 vh/vh 计算 */
html.kb-lock body.bg-game,
html.kb-lock body.bg-game .view,
html.kb-lock body.bg-game .view-body,
html.kb-lock body.bg-game .board,
html.kb-lock body.bg-game .hboard {
  height: var(--app-vh, 100dvh) !important;
  max-height: var(--app-vh, 100dvh) !important;
  overflow: hidden !important;
}
html.kb-lock body.bg-game .b-info { max-height: 26vh; }


/* 操作区：坐标来自 layoutGame 写死的 CSS 变量，键盘弹起也不会动 */
body.bg-game .b-act {
  position: fixed !important;
  top: var(--act-top, auto) !important;
  bottom: auto !important;
  right: 12px !important;
  left: auto !important;
  transform: none !important;
  z-index: 4;
}


/* 背景层挂在 html 上，不受 body zoom 影响 */
#bgLayer { zoom: 1 !important; left: 0 !important; top: 0 !important; }

/* 聊天「发送」按钮：和输入框同高，紧挨在右侧 */
.b-act .sendbtn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 9px;
}
@media (max-height: 900px) {
  .b-act .sendbtn { height: 32px; padding: 0 10px; font-size: 12px; }
}

/* 聊天行：输入框 + 发送 + 表情 同一行 */
.chat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}
.chat-row .rf-input { flex: 1 1 auto; min-width: 0; }
.chat-row .sendbtn { flex: 0 0 auto; height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.chat-row #btnSticker { flex: 0 0 auto; height: 34px; width: 40px; padding: 0; font-size: 18px; }
@media (max-height: 900px) {
  .chat-row .sendbtn, .chat-row #btnSticker { height: 32px; }
  .chat-row .sendbtn { padding: 0 10px; font-size: 12px; }
}


/* 对局三块：默认位置（防闪）——JS 排布前也不会跳到别处 */
body.bg-game .b-me {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: var(--me-top, auto); bottom: var(--me-bottom, 10px); z-index: 3;
}
body.bg-game .b-op {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: var(--op-top, 96px); z-index: 3;
}
body.bg-game .b-info {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: var(--info-top, 42%); z-index: 2;
}


/* 开枪动画：自绘手枪（SVG，枪口朝右，靠 rotate 指向目标） */
.fx-gun { display: flex; align-items: center; justify-content: center; }
.fx-gun-svg { display: block; }
.fx-el { display: flex; align-items: center; justify-content: center; }


/* 炸裂命中（刀 +1 / 暴击） */
body.fx-big { animation: fxScreenShake .5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes fxScreenShake {
  10%, 90% { transform: translate(-2px, 1px) }
  20%, 80% { transform: translate(4px, -2px) }
  30%, 50%, 70% { transform: translate(-6px, 2px) }
  40%, 60% { transform: translate(6px, -1px) }
}
.fx-flash {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(255,86,60,.55), rgba(255,60,40,.18) 45%, transparent 70%);
  animation: fxFlash .45s ease-out forwards;
}
@keyframes fxFlash { from { opacity: 0 } 18% { opacity: 1 } to { opacity: 0 } }
.fx-wave {
  position: fixed; z-index: 69; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  border-radius: 50%; pointer-events: none;
  border: 3px solid rgba(255,120,80,.9);
  box-shadow: 0 0 24px rgba(255,96,60,.8), inset 0 0 18px rgba(255,140,90,.6);
  animation: fxWave .6s cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes fxWave {
  from { transform: scale(.4); opacity: 1 }
  to { transform: scale(9); opacity: 0 }
}

/* ===== 聊天条：更短，且层级低于玩家卡 ===== */
/* ① 输入框缩短（覆盖前面所有宽度规则） */
body.bg-game .b-act .chat-row { max-width: min(300px, 30vw) !important; }
body.bg-game .b-act .chat-row .rf-input { width: auto !important; min-width: 0 !important; flex: 1 1 auto !important; }
body.bg-game .b-act .chat-row #btnSticker { width: 38px !important; }
@media (max-height: 900px) {
  body.bg-game .b-act .chat-row { max-width: min(250px, 30vw) !important; }
}

/* ② 层级：玩家卡在上，聊天条在下（不再盖住卡片） */
body.bg-game .b-me,
body.bg-game .b-op,
body.bg-game .b-info { z-index: 6 !important; }
body.bg-game .b-act { z-index: 2 !important; }
body.bg-game .b-act .chat-row { position: relative; z-index: 1; }
body.bg-game .b-act .chat-row .rf-input { position: relative; z-index: 1; }



/* 链条：已铐住的卡在重渲染后只静态显示，不重播植入动画（消除闪烁） */
.chain-overlay.chain-static,
.chain-overlay.chain-static .chain-col,
.chain-overlay.chain-static .chain-link {
  animation: none !important;
  opacity: 1 !important;
  transform: none !important;
}
/* 阵亡 😵：只有第一次出现在时的轻微淡入，其它时候直接显示 */
.dead-mark { animation: none; }
.dead-mark.fresh { animation: deadIn .18s ease-out both; }
@keyframes deadIn { from { opacity: 0 } to { opacity: 1 } }

/* 重复道具：右下角小角标 ×N */
.gitem-stack { position: relative; }
.gitem-stack .gitem-n {
  position: absolute;
  right: -3px; bottom: -3px;
  font-style: normal;
  font-size: 10px;
  line-height: 1;
  padding: 1px 3px;
  border-radius: 6px;
  background: #2b3140;
  color: #d7f0e0;
  border: 1px solid rgba(255,255,255,.18);
  pointer-events: none;
}

/* 续局投票提示 */
.vote-tip { font-size: 12px; color: #a8b0c0; }


/* 瞄准态：可选目标卡片绿色描边（斗地主/虎牢关） */
.hcard.hlegal { border: 2.5px solid #35d07f !important; cursor: pointer; box-shadow: 0 0 0 3px rgba(53,208,127,.22); }
body.aiming .hcard { cursor: pointer; }

/* 局末投票条：浮在两张卡片之间，始终在卡片上层，避免被玩家卡遮住按钮 */
body.bg-game .round-ask {
  position: fixed !important;
  left: 50%;
  transform: translateX(-50%);
  top: var(--info-top, 46%);
  z-index: 14 !important;
  max-width: min(720px, 94vw);
  margin: 0 !important;
  background: rgba(23,26,33,.94);
  border: 1px solid rgba(217,164,65,.55);
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  justify-content: center;
}
body.bg-game .round-ask button { pointer-events: auto !important; }


/* 玩家数值面板（点卡上的 ⬆️） */
.stat-btn {
  position: absolute; right: 6px; top: 4px;
  width: 22px; height: 22px; padding: 0; line-height: 1;
  font-size: 13px; border-radius: 6px; cursor: pointer;
  background: rgba(35,40,51,.9); border: 1px solid var(--line); color: #dfe6f2;
  z-index: 9;
}
.stat-btn:hover { border-color: #d9a441; color: #ffd75e; }
.stat-panel {
  position: fixed; z-index: 9997;
  width: 196px; padding: 8px 10px;
  background: rgba(23,26,33,.98);
  border: 1px solid rgba(217,164,65,.5);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.55);
  font-size: 12px; color: #dfe6f2;
}
.stat-panel .sp-head { font-size: 12px; color: #ffd75e; margin-bottom: 6px; }
.stat-panel .sp-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.stat-panel .sp-k { color: #a8b0c0; }
.stat-panel .sp-v { color: #e8ecf3; }
.stat-panel .sp-v i { font-style: normal; color: #7fd48a; margin-left: 2px; }
.gcard { position: relative; }


/* 头像点击区：加大触摸目标，避免边缘点不到 */
.topbar { padding-top: max(6px, env(safe-area-inset-top, 0px)); }
.topbar .me, .topbar #btnMe { min-height: 40px; }
.topbar .avatar { width: 32px; height: 32px; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.topbar .nickname { padding-right: 4px; }


/* 未登录横幅 */
.login-banner {
  margin: 10px auto; max-width: 520px; padding: 10px 14px; cursor: pointer;
  border-radius: 10px; text-align: center; font-size: 14px;
  background: rgba(217,164,65,.16); border: 1px solid rgba(217,164,65,.55); color: #ffd75e;
}
/* 页面报错横幅：方便用户截图反馈 */
.err-banner {
  position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 99999;
  background: rgba(180,40,40,.95); color: #fff; font-size: 12px;
  padding: 8px 10px; border-radius: 8px; word-break: break-all; display: none;
}


/* 三种模式的卡片都要能承载绝对定位的互动条 */
.hcard { position: relative; }
.hcard .emote-bar { top: 3px; right: 58px; }
.hcard .emote-btn { font-size: 13px; padding: 0 4px; }




/* 三种模式卡片统一尺寸：左右上下一样长一样宽 */
body.bg-game .hboard .hcard {
  width: min(330px, 30vw) !important;
  max-width: min(330px, 30vw) !important;
  min-width: 0 !important;
}
/* 自己的卡钉在底部（宽度同其他卡，不再拉长） */
body.bg-game .hcard.bottom {
  position: fixed !important;
  left: 50% !important;
  transform: translateX(-50%);
  bottom: 8px !important;
  width: min(330px, 30vw) !important;
  max-width: min(330px, 30vw) !important;
  z-index: 5;
  margin: 0 !important;
  align-self: auto !important;
}
/* 底部那一行不再占高度（自己的卡已固定），对局信息才会真正上下居中 */
body.bg-game .hboard {
  grid-template-rows: auto 1fr 0 !important;
}
body.bg-game .hb-info {
  align-self: center !important;
  justify-self: center !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.bg-game .hb-info .info-box {
  width: min(600px, 54vw);
  margin: 0 auto;
}


/* —— 绝对定位排版（斗地主 / 虎牢关）—— */
body.bg-game .hboard {
  display: block !important;
  position: relative;
  padding: 0 !important;
}
body.bg-game .hboard .hcard {
  position: fixed !important;
  height: var(--hcard-h, 96px) !important;
  min-height: var(--hcard-h, 96px) !important;
  overflow: hidden;
  margin: 0 !important;
  width: var(--hcard-w, min(330px, 30vw)) !important;
  max-width: var(--hcard-w, min(330px, 30vw)) !important;
  min-width: 0 !important;
}
body.bg-game .hboard .hcard.top {
  left: 50% !important;
  transform: translateX(-50%);
  top: 58px !important;              /* 贴顶栏下沿，给中间的信息框腾出空间 */
  align-self: auto !important;
}
body.bg-game .hboard .hcard.left {
  left: 12px !important;
  top: 50% !important;
  transform: translateY(-50%);
  align-self: auto !important;
  justify-self: auto !important;
}
body.bg-game .hboard .hcard.right {
  right: 12px !important;
  left: auto !important;
  top: 50% !important;
  transform: translateY(-50%);
  align-self: auto !important;
  justify-self: auto !important;
}
body.bg-game .hboard .hcard.bottom {
  left: 50% !important;
  transform: translateX(-50%);
  bottom: 8px !important;
  top: auto !important;
  z-index: 5;
}
/* 对局信息：真正上下居中（视口正中），宽度按两侧卡片留白算 */
body.bg-game .hb-info {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
  width: var(--info-w, min(560px, 46vw));
  z-index: 4;
  align-self: auto !important;
  justify-self: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.bg-game .hb-info .info-box {
  width: 100% !important;
  margin: 0 !important;
  max-height: 34vh;
  overflow: auto;
}


/* 矮屏（手机横屏）卡片高度统一压到 84 */
@media (max-height: 560px) {
  body.bg-game .hboard .hcard .hc-main { gap: 1px !important; }
  body.bg-game .hboard .hcard .hc-top { margin-bottom: 1px !important; }
  body.bg-game .hboard .hcard .hc-hp { height: 6px !important; margin: 2px 0 !important; }
}


/* 侧栏与操作区不再被撑满（棋盘改成 block 后它们会占满整行） */
body.bg-game .hb-stat { position: fixed !important; left: 12px !important; top: 92px !important; }
body.bg-game .hb-shell { position: fixed !important; right: 12px !important; top: 92px !important; }
body.bg-game .hb-act { position: fixed !important; right: 12px !important; bottom: 8px !important; }
body.bg-game .hb-stat .box,
body.bg-game .hb-shell .box { width: fit-content !important; max-width: 42vw; }


/* 矮屏：侧卡下移，避开左上角轮次面板；轮次面板压缩成一行信息 */
@media (max-height: 560px) {
  body.bg-game .hboard .hcard.left,
  body.bg-game .hboard .hcard.right { top: 60% !important; }
  body.bg-game .hb-stat .bx-k:nth-of-type(2),
  body.bg-game .hb-stat .bx-v.small { display: none !important; }
  body.bg-game .hb-stat .box { padding: 6px 10px !important; }
  body.bg-game .hb-stat .bx-v { font-size: 15px !important; }
  body.bg-game .hb-stat .saveroom,
  body.bg-game .hb-stat .endroom { font-size: 11px !important; padding: 3px 8px !important; }
}


/* 「是否再来一局」投票栏（斗地主 / 虎牢关） */
.again-ask {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
  z-index: 14 !important;
  max-width: min(760px, 94vw);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  padding: 12px 16px !important;
  background: rgba(23,26,33,.96) !important;
  border: 1px solid rgba(217,164,65,.55) !important;
  box-shadow: 0 12px 34px rgba(0,0,0,.6);
}
.again-ask .again-title { color: #ffd75e; font-size: 15px; }
.again-ask button { pointer-events: auto !important; }


/* 互动条左移后，血量数字永远不会被压住 */
.gcard .gc-hpnum, .hcard .hc-hpnum { position: relative; z-index: 2; }
@media (max-width: 700px) {
  .emote-bar { right: 54px; }
  .hcard .emote-bar { right: 50px; }
  .emote-btn { padding: 1px 3px; font-size: 13px; }
}


/* 导入表情：删除模式 + 站内提示 */
.stk-btn.stk-removable { position: relative; border-color: rgba(230,90,90,.7); }
.stk-btn .stk-x {
  position: absolute; right: -4px; top: -4px; width: 16px; height: 16px; line-height: 16px;
  border-radius: 50%; background: #d64545; color: #fff; font-size: 11px; text-align: center;
  font-style: normal; box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.stk-delbar {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 12px; color: #ffd75e; padding: 2px 2px 6px;
}
.stk-delbar button { padding: 2px 10px; font-size: 12px; }
.stk-toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(8px);
  z-index: 10001; max-width: 90vw; padding: 8px 14px; border-radius: 10px;
  background: rgba(23,26,33,.97); border: 1px solid rgba(217,164,65,.55); color: #ffd75e;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.stk-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }





/* 矮屏卡片高度（道具行必须可见） */
@media (max-height: 560px) {
  body.bg-game .hboard .hcard { height: 88px !important; min-height: 88px !important; }
  body.bg-game .hboard .hcard .hc-line { display: block !important; font-size: 10.5px !important; line-height: 1.3 !important; margin: 0 !important; }
  body.bg-game .hboard .hcard .it-btn { min-width: 22px !important; height: 20px !important; font-size: 12px !important; padding: 0 3px !important; }
}


/* 斗地主/虎牢关：同类道具合并成「图标 + ×N 角标」 */
.it-btn.it-stack, .it-ro.it-stack { position: relative; }
.it-n {
  position: absolute; right: -6px; bottom: -4px;
  min-width: 12px; height: 12px; line-height: 11px;
  padding: 0 2px; border-radius: 8px;
  background: #2b303a; color: #fff;
  font-size: 8.5px; font-style: normal; text-align: center;
  border: 1px solid rgba(255,255,255,.22);
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
  pointer-events: none; z-index: 2;
}
.it-ro { display: inline-flex; align-items: center; position: relative; margin-right: 12px; font-size: 16px; }
.it-btn.it-stack { margin-right: 9px; }


/* 道具行不能被 ellipsis 裁掉角标：允许溢出、留出底部空间放 ×N */
body.bg-game .hboard .hcard .hc-line:last-child {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  padding-bottom: 5px !important;
  line-height: 1.35 !important;
}
body.bg-game .hboard .hcard .it-btn { overflow: visible !important; }
body.bg-game .hboard .hcard .it-ro { overflow: visible !important; }


/* PVP 卡片：带技能行也能塞进矮屏（之前技能栏一多，底部那张卡会被顶出屏幕） */
@media (max-height: 700px) {
  body.bg-game .gcard .gc-main { gap: 1px !important; }
  body.bg-game .gcard .gc-top { margin-bottom: 1px !important; }
  body.bg-game .gcard .gc-hp { height: 6px !important; }
  body.bg-game .gcard .gitem {
    height: 22px !important; min-width: 22px !important;
    padding: 0 5px !important; font-size: 13px !important; line-height: 1 !important;
  }
  body.bg-game .gcard .gitem-n { font-size: 9px !important; right: -2px !important; bottom: -2px !important; }
  body.bg-game .gcard .hc-line, body.bg-game .gcard .gc-line { line-height: 1.15 !important; font-size: 10.5px !important; }
  body.bg-game .b-me { padding-bottom: 2px !important; }
}


/* 血条 + 几/几 同一行（PVP 卡片）：血条缩到 70% 左右，数值放右边，不再被 ⬆️ 盖住 */
.gc-hprow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 4px;
}
.gc-hprow .gc-hp {
  flex: 1 1 auto;
  max-width: 72%;
  margin: 0 !important;
}
.gc-hprow .gc-hpnum {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* ⬆️ 挪到卡片右上角外面一点，别压在血条/数值上 */
.gcard .stat-btn { right: 4px; top: 3px; }






/* 血条 + 几/几 同一行（斗地主/虎牢关卡片，和 PVP 一致） */
.hc-hprow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 4px;
}
.hc-hprow .hc-hp {
  flex: 1 1 auto;
  max-width: 72%;
  margin: 0 !important;
}
.hc-hprow .hc-hpnum {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}


/* 斗地主/虎牢关：昵称固定在卡片左上角（头像上方空位），互动栏贴最右
   —— 用绝对定位 + right 预留，卡片再窄也不会把昵称挤出去 */
body.bg-game .hboard .hcard { position: relative; }
body.bg-game .hboard .hcard .hc-main { padding-top: 21px; }   /* 给绝对定位的昵称让位，行高不变 */
body.bg-game .hboard .hcard .hc-top {
  position: absolute;
  left: 8px;
  top: 3px;
  right: 124px;                 /* 右侧给互动栏（约 109px）留出空位 */
  margin: 0;
  max-width: none;
}
body.bg-game .hboard .hcard .hc-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
body.bg-game .hboard .hcard .emote-bar {
  right: 4px !important;
  top: 2px !important;
}
body.bg-game .hboard .hcard .emote-btn { font-size: 12px; padding: 0 2px; }
/* 互动条压在「名字那一行」的右侧空档里（.hc-top 已经留了 right:124px），
   血量行不用让位，否则「3/3」会被挤掉 */
body.bg-game .hboard .hcard .emote-bar { z-index: 7; }


/* 本地小提示（只在点击者自己屏幕上出现） */
.local-tip {
  bottom: 84px;
  padding: 7px 14px;
  font-size: 12.5px;
  border-radius: 999px;
  background: rgba(20,23,30,.94);
  border-color: rgba(255,255,255,.18);
  color: #e8ecf3;
}


/* 非自己回合：开枪按钮置灰但仍可点（点了只弹本地气泡） */
.primary.shoot.is-locked {
  opacity: .45;
  filter: grayscale(.4);
}


/* 结算卡：固定居中浮在棋盘上，别被角色卡裁掉 */
.round-ask.settle-card {
  position: fixed;
  left: 50%;
  bottom: 13%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(18, 18, 22, 0.94);
  border: 1px solid rgba(255, 208, 70, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-width: min(92vw, 520px);
  white-space: nowrap;
}
.round-ask.settle-card .primary { padding: 6px 14px; }
/* 结束态：行动条整行收起，只留结算卡 */
.b-act.is-ended { display: none !important; }
.end-hint { padding: 10px 14px; color: #ffd046; font-size: 15px; }


/* 结束对局的选择框 */
.endroom-picker { max-width: min(92vw, 460px); }
.endroom-picker .pk-sub { padding: 2px 4px 10px; color: #b9b9c3; font-size: 14px; }
.endroom-btns { display: flex; gap: 10px; padding: 4px 2px 6px; flex-wrap: wrap; }
.endroom-btns .primary, .endroom-btns .ghost { flex: 1 1 40%; padding: 10px 14px; border-radius: 12px; }

/* 选人（瞄准）时：卡片里的道具/技能按钮不再抢点击 —— 整张卡 = 选这个玩家 */
body.aiming .gcard [data-item],
body.aiming .gcard [data-skill],
body.aiming .gcard [data-godpreview],
body.aiming .hcard [data-item],
body.aiming .hcard [data-skill] {
  pointer-events: none !important;
}
/* 点上去给个手势，让人知道"点整张卡=选他" */
body.aiming .gcard,
body.aiming .hcard { cursor: pointer; }
