/* =============================================================================
 * style.css —— 像素军工风 UI
 * 配色：韶峰红（湘潭大学标准色）+ 迷彩绿 + 沙金，整体暗色舞台让画面更突出
 * ========================================================================== */

:root {
  --bg: #070a10;
  --bg2: #0d1219;
  --panel: #141c28;
  --panel2: #1b2534;
  --line: #2c3a52;
  --line-lt: #3d5070;
  --txt: #e6edf7;
  --txt-dim: #93a3ba;
  --red: #b52b2b;      /* 韶峰红 */
  --red-lt: #e04a3a;
  --green: #79a84b;    /* 迷彩绿 */
  --gold: #f0c257;
  --blue: #4a90d9;
  --shadow: 0 6px 0 rgba(0, 0, 0, .45);
  --font: "Microsoft YaHei", "PingFang SC", "Heiti SC", sans-serif;
  --mono: "Courier New", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  /* 移动端：禁止双击缩放 / 长按菜单 / 橡皮筋回弹，避免误触打断对战 */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* 输入框仍要能选中、能唤起软键盘 */
input, textarea {
  -webkit-user-select: text;
  user-select: text;
  touch-action: manipulation;
}

body::before { /* 背景网格，增强像素/军事感 */
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .022) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* ------------------------------ 画布容器 ------------------------------ */
#stageWrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none; /* 手指在画面上滑动不要触发页面滚动/缩放 */
  background: #000;
  border: 3px solid #24304a;
  box-shadow: 0 0 0 3px #0a0e14, 0 14px 40px rgba(0, 0, 0, .7);
}

/* ------------------------------ 界面层 ------------------------------ */
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  pointer-events: auto;
  animation: fade .18s ease-out;
  overflow: auto;
  touch-action: pan-y; /* 界面层仍需可滚动（选人页内容较长） */
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; }

@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(.86); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes blink { 50% { opacity: .45; } }

/* ------------------------------ 通用组件 ------------------------------ */
.btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 11px 20px;
  min-width: 150px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #f4f8ff;
  background: linear-gradient(180deg, #253349, #18222f);
  border: 2px solid var(--line-lt);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, background .15s;
  user-select: none;
}
.btn span { font-size: 11px; font-weight: 400; color: var(--txt-dim); }
.btn:hover { background: linear-gradient(180deg, #2f4059, #1d2836); border-color: var(--gold); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0, 0, 0, .45); }
.btn.big { padding: 16px 26px; font-size: 18px; min-width: 230px; }
.btn.go {
  background: linear-gradient(180deg, #cf4436, #8f2222);
  border-color: #ff9b7a;
}
.btn.go:hover { background: linear-gradient(180deg, #e25544, #a32a2a); }
.btn.ghost { background: #131b26; color: var(--txt-dim); }
.btn.small { min-width: auto; padding: 7px 14px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  margin: 0 3px 3px 0;
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  color: #fff6dd;
  background: #22304a;
  border: 1px solid #46587a;
  border-bottom-width: 3px;
}

.card {
  width: min(980px, 96vw);
  max-height: 94vh;
  overflow: auto;
  padding: 22px 26px;
  background: rgba(15, 21, 31, .95);
  border: 2px solid var(--line);
  box-shadow: 0 0 0 3px #06090f, 0 18px 50px rgba(0, 0, 0, .6);
  animation: pop .2s ease-out;
}
.card.narrow { width: min(420px, 92vw); text-align: center; }
.card.wide { width: min(1060px, 96vw); }
.card.center { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.big-title {
  margin: 4px 0 10px;
  font-size: 26px;
  letter-spacing: 8px;
  color: var(--gold);
  text-shadow: 0 3px 0 #000;
}
.dim { color: var(--txt-dim); font-size: 13px; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--txt-dim); }

/* ------------------------------ 标题页 ------------------------------ */
.title-wrap { text-align: center; animation: pop .35s ease-out; }
.logo h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 58px);
  letter-spacing: 6px;
  color: #fff;
  text-shadow:
    0 0 0 #000, 4px 4px 0 var(--red), -3px -2px 0 rgba(121, 168, 75, .8),
    0 8px 24px rgba(0, 0, 0, .8);
  animation: logoFloat 3.2s ease-in-out infinite;
}
@keyframes logoFloat { 50% { transform: translateY(-6px); } }
.logo .sub {
  margin: 10px 0 4px;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 6px;
  color: var(--gold);
}
.logo .desc { margin: 0 0 26px; font-size: 13px; color: var(--txt-dim); }
.menu { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.foot { margin-top: 24px; font-size: 12px; color: #5c6b82; }

/* ------------------------------ 选人页 ------------------------------ */
.bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: rgba(10, 14, 21, .9);
  border-bottom: 2px solid var(--line);
}
.bar h2 { margin: 0; font-size: 20px; letter-spacing: 4px; color: var(--gold); }
.bar-right { font-size: 13px; color: var(--txt-dim); }

.sel-body {
  display: flex;
  gap: 16px;
  width: min(1180px, 96vw);
  max-height: 88vh;
  overflow: auto;
  padding: 62px 4px 8px;
}

.panel {
  padding: 14px;
  background: rgba(15, 21, 31, .95);
  border: 2px solid var(--line);
  box-shadow: 0 0 0 3px #06090f;
}
.panel.chars { flex: 1 1 640px; }
.panel.setup { flex: 0 0 320px; display: flex; flex-direction: column; gap: 12px; }

.seg { display: flex; gap: 8px; margin-bottom: 12px; }
.seg button {
  padding: 8px 14px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--txt-dim);
  background: #131b26;
  border: 2px solid var(--line);
  cursor: pointer;
}
.seg button.on { color: #fff; background: #25334a; border-color: var(--gold); }

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.char-card {
  position: relative;
  padding: 10px 12px 12px;
  text-align: center;
  background: linear-gradient(180deg, #1b2434, #131a26);
  border: 2px solid var(--line);
  cursor: pointer;
  transition: transform .1s, border-color .15s;
  overflow: hidden;
}
.char-card:hover { transform: translateY(-3px); border-color: var(--line-lt); }
/* 「随机征召」卡片：金色虚线边框，与普通兵种区分 */
.char-card.card-random {
  border-style: dashed;
  border-color: var(--gold);
  background: linear-gradient(180deg, #23212a, #14161c);
}
.char-card.card-random .ccode { color: #ffd76a; }
.char-card.sel-p1 { border-color: var(--green); box-shadow: inset 0 0 0 2px rgba(121, 168, 75, .3); }
.char-card.sel-p2 { border-color: var(--blue); box-shadow: inset 0 0 0 2px rgba(74, 144, 217, .3); }
.char-card canvas { display: block; margin: 0 auto; image-rendering: pixelated; }
.char-card .cname { margin-top: 4px; font-size: 17px; font-weight: 700; }
.char-card .ccode {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: 2px;
}
.char-card .tags { margin: 6px 0; display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.char-card .tags i {
  padding: 2px 6px;
  font-size: 10px;
  font-style: normal;
  color: #cfe0f5;
  background: #26344a;
  border: 1px solid #3a4c68;
}
.char-card .desc { font-size: 11px; line-height: 1.5; color: var(--txt-dim); }
.badge {
  position: absolute;
  top: 6px; left: 6px;
  padding: 2px 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: #0b0e14;
}
.badge.p1 { background: var(--green); }
.badge.p2 { background: var(--blue); color: #fff; }

.stat-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 10px; color: var(--txt-dim); }
.stat-row b { width: 34px; text-align: right; font-weight: 400; color: #b9c8dd; }
.pips { display: flex; gap: 2px; }
.pips i { width: 8px; height: 6px; background: #2a3547; }
.pips i.on { background: var(--gold); }

.field { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-size: 12px; color: var(--txt-dim); letter-spacing: 1px; }
input[type="text"], #inp-name, #res-name {
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 14px;
  color: #fff;
  background: #0d131d;
  border: 2px solid var(--line);
  outline: none;
}
input:focus { border-color: var(--gold); }

.diff { display: flex; flex-direction: column; gap: 5px; }
.diff button {
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 13px;
  text-align: left;
  color: var(--txt-dim);
  background: #131b26;
  border: 2px solid var(--line);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.diff button.on { color: #fff; border-color: currentColor; background: #1f2b3c; }
.diff button em { font-style: normal; font-size: 11px; opacity: .8; }

.stage-row { display: flex; gap: 8px; }
.stage-opt {
  flex: 1;
  padding: 4px;
  text-align: center;
  background: #131b26;
  border: 2px solid var(--line);
  cursor: pointer;
}
.stage-opt.on { border-color: var(--gold); }
.stage-opt.rand canvas { filter: saturate(1.15); }
.stage-opt.rand span { color: var(--gold); }
.stage-opt.rand.on span { color: #fff; }
.stage-opt canvas { display: block; width: 100%; image-rendering: pixelated; }
.stage-opt span { display: block; padding: 3px 0; font-size: 11px; color: var(--txt-dim); }
.stage-opt.on span { color: #fff; }

.moves { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--txt-dim); }
.moves .mv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: #101724;
  border-left: 3px solid var(--green);
}
.moves .mv b { color: #dce6f5; font-weight: 600; }
.moves .mv.sp { border-left-color: var(--gold); }
.moves .mv.sp b { color: var(--gold); }

/* ------------------------------ 结算页 ------------------------------ */
.res-head { text-align: center; margin-bottom: 16px; }
.res-head h2 { margin: 0; font-size: 34px; letter-spacing: 10px; text-shadow: 0 4px 0 #000; }
.res-head h2.win { color: var(--gold); }
.res-head h2.lose { color: #8fa3bd; }
.res-head p { margin: 6px 0 0; font-size: 13px; color: var(--txt-dim); }

.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.res-col {
  padding: 12px 14px;
  background: #101724;
  border: 1px solid var(--line);
}
.res-col h3 {
  margin: 0 0 10px;
  padding-bottom: 6px;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
}
.rounds { display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.rounds .r {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: #16202f;
  border-left: 3px solid var(--line-lt);
}
.rounds .r.w1 { border-left-color: var(--green); }
.rounds .r.w2 { border-left-color: var(--blue); }
.rounds .r b { font-family: var(--mono); }

table.stats { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.stats th, table.stats td { padding: 5px 6px; text-align: center; border-bottom: 1px solid #1d2738; }
table.stats th { color: var(--txt-dim); font-weight: 400; }
table.stats td.name { text-align: left; color: var(--txt-dim); }
table.stats td b { font-family: var(--mono); color: #e8eef7; }

ul.items { margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
ul.items li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; color: var(--txt-dim); }
ul.items li b { font-family: var(--mono); color: #dfe8f5; font-weight: 400; }
.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 2px solid var(--line);
  font-size: 13px;
  color: var(--txt-dim);
}
.total b { font-family: var(--mono); font-size: 26px; color: var(--gold); }
.rank-line { margin-top: 8px; font-size: 12px; color: var(--green); min-height: 18px; }
.submit-row { display: flex; gap: 6px; margin-top: 8px; }
.submit-row input { flex: 1; min-width: 0; }

.res-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ------------------------------ 排行榜 ------------------------------ */
.table-wrap { max-height: 56vh; overflow: auto; }
table.board { width: 100%; border-collapse: collapse; font-size: 13px; }
table.board th {
  position: sticky; top: 0;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--gold);
  background: #131b26;
  border-bottom: 2px solid var(--line);
}
table.board td { padding: 7px 6px; text-align: center; border-bottom: 1px solid #1a2434; }
table.board td.nm { text-align: left; color: #e8eef7; }
table.board td.sc { font-family: var(--mono); color: var(--gold); }
table.board tr:nth-child(1) td { background: rgba(240, 194, 87, .07); }
table.board tr:nth-child(2) td { background: rgba(200, 210, 230, .05); }
table.board tr:nth-child(3) td { background: rgba(181, 43, 43, .06); }

/* ------------------------------ 帮助页 ------------------------------ */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.help-grid h3 { margin: 0 0 10px; font-size: 14px; letter-spacing: 2px; color: var(--gold); }
table.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
table.keys td { padding: 5px 4px; border-bottom: 1px solid #1a2434; color: var(--txt-dim); }
ul.rules { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.8; color: var(--txt-dim); }
ul.rules b { color: #e8eef7; }

/* ------------------------------ 小屏适配 ------------------------------ */
@media (max-width: 900px) {
  .sel-body { flex-direction: column; padding-top: 66px; }
  .panel.setup { flex: 1 1 auto; }
  .res-grid { grid-template-columns: 1fr; }
  .card.wide { padding: 16px; }
}

/* =============================================================================
 * 虚拟手柄 & 移动端适配（配合 js/touch.js）
 * --tp-s 为整体缩放系数，由 JS 依屏幕短边自动计算，保证不同机型手感一致
 * ========================================================================== */
#touchpad {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  pointer-events: none;
  --tp-s: 1;
  --tp-b: calc(56px * var(--tp-s));    /* 普通按键直径 */
  --tp-g: calc(9px * var(--tp-s));     /* 按键间距 */
  --tp-joy: calc(128px * var(--tp-s)); /* 摇杆底座直径 */
}

/* 单人对战只显示 1P 一套；双人对战左右各一套 */
#touchpad .tp-pad { position: absolute; top: 0; bottom: 0; pointer-events: none; }
#touchpad.solo .tp-pad.p1 { left: 0; right: 0; }
#touchpad.solo .tp-pad.p2 { display: none; }
#touchpad.duo .tp-pad.p1 { left: 0; width: 50%; }
#touchpad.duo .tp-pad.p2 { right: 0; width: 50%; }
#touchpad.idle .tp-pad { display: none; }

/* ------------------------------ 摇杆 ------------------------------ */
.tp-joy { position: absolute; bottom: calc(16px * var(--tp-s)); pointer-events: none; }
.tp-joy-base {
  position: relative;
  width: var(--tp-joy);
  height: var(--tp-joy);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  background: radial-gradient(circle at 40% 34%, rgba(45, 62, 88, .58), rgba(10, 15, 23, .5));
  border: 2px solid rgba(150, 175, 210, .38);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .32), 0 4px 0 rgba(0, 0, 0, .35);
}
.tp-joy-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(52px * var(--tp-s));
  height: calc(52px * var(--tp-s));
  margin-left: calc(-26px * var(--tp-s));
  margin-top: calc(-26px * var(--tp-s));
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 38% 32%, rgba(127, 176, 79, .92), rgba(52, 74, 33, .85));
  border: 2px solid rgba(205, 230, 165, .6);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .45);
}
.tp-joy-hint { position: absolute; inset: 0; pointer-events: none; opacity: .55; }
.tp-joy-hint b, .tp-joy-hint i {
  position: absolute;
  font-family: var(--mono);
  font-size: calc(10px * var(--tp-s));
  color: #d3e2f6;
}
.tp-joy-hint b:nth-of-type(1) { left: 50%; top: 7%; transform: translateX(-50%); }
.tp-joy-hint b:nth-of-type(2) { left: 50%; bottom: 7%; transform: translateX(-50%); }
.tp-joy-hint i:nth-of-type(1) { left: 8%; top: 50%; transform: translateY(-50%); }
.tp-joy-hint i:nth-of-type(2) { right: 8%; top: 50%; transform: translateY(-50%); }

/* ------------------------------ 按键区 ------------------------------ */
.tp-btns {
  position: absolute;
  bottom: calc(16px * var(--tp-s));
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(3, var(--tp-b));
  grid-template-rows: repeat(3, var(--tp-b));
  gap: var(--tp-g);
  grid-template-areas:
    "sp jp dd"
    "bk at at"
    "bk at at";
  align-items: center;
  justify-items: center;
}
.tp-b {
  width: var(--tp-b);
  height: var(--tp-b);
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #e9f0fa;
  background: radial-gradient(circle at 38% 30%, rgba(62, 82, 112, .72), rgba(12, 18, 28, .62));
  border: 2px solid rgba(150, 175, 210, .45);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .35), 0 3px 0 rgba(0, 0, 0, .42);
  transition: transform .05s linear, background .05s linear, border-color .05s linear;
}
.tp-b b { font-size: calc(13px * var(--tp-s)); letter-spacing: 1px; font-weight: 700; }
.tp-b i { font-style: normal; font-family: var(--mono); font-size: calc(10px * var(--tp-s)); color: #93a3ba; }
.tp-b.sp { grid-area: sp; }
.tp-b.jp { grid-area: jp; }
.tp-b.dd { grid-area: dd; }
.tp-b.bk { grid-area: bk; }
.tp-b.at {
  grid-area: at;
  width: calc(var(--tp-b) * 2 + var(--tp-g));
  height: calc(var(--tp-b) * 2 + var(--tp-g));
  border-color: rgba(224, 74, 58, .62);
}
.tp-b.at b { font-size: calc(18px * var(--tp-s)); }
.tp-b.on {
  transform: translateY(2px) scale(.96);
  background: radial-gradient(circle at 38% 30%, rgba(240, 194, 87, .9), rgba(138, 90, 20, .8));
  border-color: var(--gold);
  color: #1a1206;
}
.tp-b.on i { color: rgba(40, 28, 8, .75); }
.tp-b.at.on {
  background: radial-gradient(circle at 38% 30%, rgba(240, 96, 74, .95), rgba(122, 26, 20, .88));
  border-color: #ff8b72;
  color: #fff;
}
.tp-b.at.on i { color: rgba(255, 255, 255, .8); }

/* 单人：摇杆靠左、按键靠右；双人：各自半屏内左右分开 */
#touchpad.solo .tp-pad.p1 .tp-joy { left: calc(22px * var(--tp-s)); }
#touchpad.solo .tp-pad.p1 .tp-btns { right: calc(20px * var(--tp-s)); }
#touchpad.duo .tp-pad.p1 .tp-joy { left: calc(12px * var(--tp-s)); }
#touchpad.duo .tp-pad.p1 .tp-btns { right: calc(10px * var(--tp-s)); }
#touchpad.duo .tp-pad.p2 .tp-btns { left: calc(10px * var(--tp-s)); }
#touchpad.duo .tp-pad.p2 .tp-joy { right: calc(12px * var(--tp-s)); }
/* 双人模式下两套手柄都缩小一档，避免半屏塞不下 */
#touchpad.duo { --tp-b: calc(44px * var(--tp-s)); --tp-joy: calc(104px * var(--tp-s)); }

/* 刘海屏 / 圆角屏安全区 */
@supports (padding: env(safe-area-inset-left)) {
  #touchpad.solo .tp-pad.p1 .tp-joy { left: calc(22px * var(--tp-s) + env(safe-area-inset-left)); }
  #touchpad.solo .tp-pad.p1 .tp-btns { right: calc(20px * var(--tp-s) + env(safe-area-inset-right)); }
  #touchpad.duo .tp-pad.p1 .tp-joy { left: calc(12px * var(--tp-s) + env(safe-area-inset-left)); }
  #touchpad.duo .tp-pad.p2 .tp-joy { right: calc(12px * var(--tp-s) + env(safe-area-inset-right)); }
}

/* ------------------------------ 底部工具条 ------------------------------ */
.tp-bar {
  position: absolute;
  left: 50%;
  bottom: calc(8px * var(--tp-s));
  transform: translateX(-50%);
  display: flex;
  gap: calc(8px * var(--tp-s));
  pointer-events: auto;
  z-index: 3;
}
.tp-tool {
  pointer-events: auto;
  touch-action: none;
  font-family: var(--font);
  font-size: calc(11px * var(--tp-s));
  padding: calc(6px * var(--tp-s)) calc(13px * var(--tp-s));
  color: #dce6f4;
  background: rgba(12, 18, 28, .74);
  border: 2px solid rgba(120, 145, 180, .42);
  border-radius: 999px;
  cursor: pointer;
}
.tp-tool:active { transform: translateY(1px); }
.tp-tool.off { color: #8ea0b8; border-color: rgba(120, 145, 180, .24); }

/* ------------------------------ 操作端徽标 ------------------------------ */
.dbadge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--txt-dim);
  border: 1px solid var(--line);
  background: rgba(20, 28, 40, .7);
}
.dbadge.on { color: var(--gold); border-color: rgba(240, 194, 87, .5); }

/* ------------------------------ 竖屏提示 ------------------------------ */
#rotate-tip {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 7, 12, .93);
  text-align: center;
  pointer-events: none;
}
#rotate-tip.show { display: flex; }
.rt-in { padding: 20px 28px; }
.rt-phone {
  width: 46px;
  height: 78px;
  margin: 0 auto;
  border: 3px solid var(--gold);
  border-radius: 9px;
  animation: rtRot 1.9s ease-in-out infinite;
}
@keyframes rtRot {
  0%, 35% { transform: rotate(0); }
  65%, 100% { transform: rotate(-90deg); }
}
.rt-in p { margin: 18px 0 6px; font-size: 18px; letter-spacing: 3px; color: var(--gold); }
.rt-in span { font-size: 12.5px; color: var(--txt-dim); }

/* ------------------------------ 触屏界面微调 ------------------------------ */
@media (pointer: coarse) {
  /* 手指点击目标放大，避免误触 */
  .btn { padding: 13px 20px; font-size: 15px; }
  .btn.small { padding: 10px 16px; font-size: 14px; }
  .char-card { min-width: 132px; }
  .stage-opt { min-width: 132px; }
  .card { max-height: 92vh; overflow: auto; }
}
