/* ==========================================================================
   台球爆破 (Billiards Blast) - 样式表
   特色：竖屏优先、复古波普/无厘头搞笑风格、大触控按键、高对比度粗边框
   ========================================================================== */

:root {
  --bg-color: #f7e8a4;
  --panel-bg: #fffdf0;
  --border-color: #1a1a1a;
  --primary-btn: #ff4757;
  --primary-btn-hover: #ff6b81;
  --success-btn: #2ed573;
  --accent-blue: #1e90ff;
  --accent-gold: #ffa502;
  --felt-green: #1f8a4c;
  --wood-brown: #7b3f00;
  --text-main: #111111;
  --border-thick: 3px solid var(--border-color);
  --shadow-comic: 4px 4px 0px var(--border-color);
  --shadow-comic-pressed: 1px 1px 0px var(--border-color);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  background-color: var(--bg-color);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
}

/* 竖屏移动设备外壳容器（手机铺满；PC 居中留暗边） */
#app {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0 auto;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  box-shadow: none;
  border-left: none;
  border-right: none;
}

@media (min-width: 900px) {
  html, body { background-color: #2b2b2b; }
  #app {
    max-width: clamp(22rem, 92vw, 48rem);
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
    border-left: var(--border-thick);
    border-right: var(--border-thick);
  }
}

/* 顶部通用提示/对局状态栏 (矮版单行：状态一行+视角+商店+暂停) */
.top-hud {
  position: relative;
  width: 100%;
  height: clamp(2.4rem, 6vmin, 2.8rem);
  background: var(--panel-bg);
  border-bottom: var(--border-thick);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
  z-index: 20;
  box-shadow: 0 2px 0 var(--border-color);
  flex-shrink: 0;
}

.hud-info-single {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.hud-info-single .hud-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.hud-info-single .hud-label {
  color: #555;
  font-size: 11px;
}

.hud-val-red { color: #d63031; font-weight: 900; }
.hud-val-cyan { color: #00cec9; font-weight: 900; }
.hud-divider { color: #bbb; font-weight: normal; font-size: 10px; }

.hud-controls-single {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hud-tag {
  display: inline-block;
  background: var(--accent-gold);
  border: 2px solid var(--border-color);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: #fff;
}

.comic-btn.btn-hud-icon {
  min-width: clamp(2.4rem, 8vmin, 3.2rem);
  min-height: clamp(1.9rem, 5.4vmin, 2.4rem);
  padding: 0.25rem 0.7rem;
  font-size: clamp(0.95rem, 3.2vmin, 1.15rem);
  border-radius: 0.4rem;
  line-height: 1;
}

/* 通用无厘头粗边框按钮 */
.comic-btn {
  box-sizing: border-box;
  background: var(--panel-bg);
  border: var(--border-thick);
  box-shadow: var(--shadow-comic);
  border-radius: 8px;
  font-weight: 900;
  font-size: 14px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-main);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.comic-btn:active {
  transform: translate(3px, 3px);
  box-shadow: var(--shadow-comic-pressed);
}

.comic-btn.btn-primary {
  background: var(--primary-btn);
  color: #ffffff;
}

.comic-btn.btn-success {
  background: var(--success-btn);
  color: #111111;
}

.comic-btn.btn-blue {
  background: var(--accent-blue);
  color: #ffffff;
}

.comic-btn.btn-gold {
  background: var(--accent-gold);
  color: #111111;
}

.comic-btn.btn-sm {
  padding: 5px 8px;
  font-size: 12px;
  box-shadow: 2px 2px 0 var(--border-color);
}

.comic-btn.btn-sm:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--border-color);
}

.comic-btn.btn-xs {
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 900;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  box-shadow: 1.5px 1.5px 0 var(--border-color);
  cursor: pointer;
  line-height: 1.2;
}

.comic-btn.btn-xs:active {
  transform: translate(1px, 1px);
  box-shadow: 0 0 0 var(--border-color);
}

.comic-btn.btn-big {
  font-size: 18px;
  padding: 14px 24px;
  width: 100%;
}

/* 主屏幕 / 画布区域 */
#canvas-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: auto;
  margin-top: 0;
  overflow: hidden;
  background: #1e272e;
  /* 瞄准态：画布与底栏纵向分栏，底栏占位不压桌 */
  display: flex;
  flex-direction: column;
}

#gameCanvas {
  display: block;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  touch-action: none;
}

/* 击球操作栏：占位布局，自适应 %/clamp/vmin + safe-area */
#aim-control-overlay {
  --aim-pad-x: clamp(0.5rem, 2.2vw, 1rem);
  --aim-pad-y: clamp(0.4rem, 1.4vmin, 0.75rem);
  --aim-gap: clamp(0.3rem, 1.2vmin, 0.55rem);
  --aim-tap: clamp(2.6rem, 7.5vmin, 3.4rem);
  --aim-font: clamp(0.68rem, 2.6vmin, 0.9rem);
  --aim-font-sm: clamp(0.58rem, 2.2vmin, 0.78rem);
  position: relative;
  bottom: auto;
  left: auto;
  right: auto;
  flex: 0 0 auto;
  width: 100%;
  max-height: min(42vh, 46%);
  overflow: auto;
  background: rgba(255, 253, 240, 0.96);
  border-top: var(--border-thick);
  box-shadow: 0 -0.3vmin 0.8vmin rgba(0, 0, 0, 0.25);
  padding: var(--aim-pad-y) var(--aim-pad-x);
  padding-bottom: calc(var(--aim-pad-y) + max(1.2vmin, env(safe-area-inset-bottom, 0px)) + 1.6vmin);
  display: flex;
  flex-direction: column;
  gap: var(--aim-gap);
  z-index: 25;
  box-sizing: border-box;
}

#aim-control-overlay.hidden {
  display: none !important;
}

/* 底栏不出滚动条：内容本就按尺寸适配，露条即视为溢出bug */
#aim-control-overlay { scrollbar-width: none; }
#aim-control-overlay::-webkit-scrollbar { display: none; }

.overlay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--aim-gap, 0.4rem);
}

.cue-status-row,
.cue-status-3col {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 5px; /* 钉死；两缝共 10px，列宽用 calc 扣掉 */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden; /* 禁止总宽撑出父盒裁切「全局」 */
}

/* 遗留壳带 hidden 必须真隐藏：上方 display:flex !important 会盖掉 UA 的 [hidden] 规则 */
#aim-control-overlay .cue-status-3col[hidden] {
  display: none !important;
}

.cue-col {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

/* 底栏 50% 杆说明 / 25% 道具简效 / 25% 切换全局；gap:5px*2=10px */
.cue-col-cue,
.cue-info-badge.cue-col-cue {
  flex: 0 0 calc((100% - 10px) * 0.5) !important;
  width: calc((100% - 10px) * 0.5) !important;
  max-width: calc((100% - 10px) * 0.5) !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.cue-col-item,
.item-info-badge.cue-col-item {
  flex: 0 0 calc((100% - 10px) * 0.25) !important;
  width: calc((100% - 10px) * 0.25) !important;
  max-width: calc((100% - 10px) * 0.25) !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.cue-col-global {
  flex: 0 0 calc((100% - 10px) * 0.25);
  width: calc((100% - 10px) * 0.25);
  max-width: calc((100% - 10px) * 0.25);
  min-width: 0;
}

#btn-aim-back-hall {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: clamp(2.8rem, 8.5vmin, 3.8rem);
  font-size: clamp(0.78rem, 3vmin, 1.05rem);
  font-weight: 900;
  padding: 0.35em 0.3em;
  margin: 0;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  writing-mode: horizontal-tb !important;
  flex: 1 1 auto;
  box-shadow: 2px 2px 0 var(--border-color);
}

.item-info-badge {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 2px;
  padding: 4px 6px;
  background: #fffdf0;
  border: 2px solid #111;
  border-radius: 8px;
  min-width: 0;
  overflow: hidden;
}
.item-info-line {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.item-info-icon { font-size: 16px; flex: 0 0 auto; }
.item-info-name {
  font-size: clamp(0.58rem, 2.2vmin, 0.78rem);
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.item-info-desc {
  font-size: clamp(0.5rem, 1.9vmin, 0.68rem);
  font-weight: 700;
  color: #555;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 中栏两行：上行杆名+上限，下行星级+属性；禁竖排 */
.cue-info-badge {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: center;
  gap: clamp(0.15rem, 0.6vmin, 0.35rem);
  box-sizing: border-box;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  background: #fff;
  border: max(1px, 0.15vmin) solid var(--border-color);
  border-radius: clamp(0.3rem, 1vmin, 0.5rem);
  padding: clamp(0.25rem, 1vmin, 0.45rem) clamp(0.3rem, 1.2vmin, 0.55rem);
  font-size: var(--aim-font-sm, clamp(0.58rem, 2.2vmin, 0.78rem));
  font-weight: 800;
  box-shadow: 0.15vmin 0.15vmin 0 var(--border-color);
  min-width: 0;
}

.cue-info-line {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: clamp(0.2rem, 0.9vmin, 0.4rem);
  width: 100%;
  min-width: 0;
  writing-mode: horizontal-tb !important;
  overflow: hidden;
}

.cue-name-line {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(0.25rem, 1vmin, 0.45rem);
  width: 100%;
  min-width: 0;
}

.cue-name-text {
  display: inline-block !important;
  max-width: 68%;
  box-sizing: border-box;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  white-space: nowrap !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(0.72rem, 2.8vmin, 0.95rem);
  line-height: 1.3;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: 0;
  text-align: center;
}

.cue-meta-line {
  justify-content: center;
}

.cue-stars {
  color: #f39c12;
  font-weight: 900;
  letter-spacing: -0.05em;
  white-space: nowrap !important;
  writing-mode: horizontal-tb !important;
  font-size: clamp(0.65rem, 2.4vmin, 0.85rem);
}

.cue-uses-tag {
  background: #6c5ce7;
  color: #fff;
  padding: 0.12em 0.4em;
  border-radius: 0.3em;
  font-size: var(--aim-font-sm, clamp(0.58rem, 2.2vmin, 0.78rem));
  font-weight: 900;
  white-space: nowrap !important;
  writing-mode: horizontal-tb !important;
}

.cue-uses-tag:empty {
  display: none;
}

.cue-info-badge .hud-tag {
  white-space: nowrap !important;
  writing-mode: horizontal-tb !important;
  flex: 0 0 auto;
  font-size: var(--aim-font-sm, clamp(0.58rem, 2.2vmin, 0.78rem));
  padding: 0.1em 0.35em;
  color: #fff;
}

.cue-limit-tag {
  background: #eb4d4b;
  color: #fff;
  padding: 0.12em 0.4em;
  border-radius: 0.3em;
  font-size: var(--aim-font-sm, clamp(0.58rem, 2.2vmin, 0.78rem));
  font-weight: 900;
  white-space: nowrap !important;
  writing-mode: horizontal-tb !important;
  flex: 0 0 auto;
}

.cue-desc-track {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.cue-desc-text {
  display: inline-block;
  width: max-content;
  max-width: none;
  min-width: 0;
  font-size: var(--aim-font-sm, clamp(0.52rem, 2vmin, 0.72rem));
  font-weight: 700;
  color: #333;
  line-height: 1.2;
  text-align: left;
  white-space: nowrap;
  overflow: visible;
  animation: cueDescMarquee 12s linear infinite;
}

.cue-desc-text.is-static {
  display: block;
  width: 100%;
  animation: none;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

@keyframes cueDescMarquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.slot-box.selected {
  background: #ffeaa7;
  box-shadow: inset 0 0 0 2px #ffa502;
}


.power-shoot-row {
  display: flex;
  align-items: flex-end;
  gap: clamp(0.35rem, 1.4vmin, 0.65rem);
  flex-shrink: 0;
  padding-bottom: 0.15vmin;
  width: 100%;
}

/* 力度蓄力滑块与指示（弹性单位） */
.power-slider-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(0.15rem, 0.7vmin, 0.35rem);
}

.power-label-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--aim-font-sm, clamp(0.58rem, 2.2vmin, 0.78rem));
  font-weight: 900;
}

.power-numeric {
  font-weight: 900;
  color: #ff4757;
  background: #fff;
  border: max(1px, 0.12vmin) solid #111;
  padding: 0 0.35em;
  border-radius: 0.25em;
}

.power-label {
  font-size: var(--aim-font, clamp(0.68rem, 2.6vmin, 0.9rem));
  font-weight: 900;
}

#power-slider {
  width: 100%;
  height: clamp(1.2rem, 3.8vmin, 1.7rem);
  accent-color: #ff4757;
  cursor: pointer;
}

.power-meter {
  width: 100%;
  height: clamp(0.9rem, 2.8vmin, 1.25rem);
  background: #e0e0e0;
  border: max(1px, 0.15vmin) solid var(--border-color);
  border-radius: 0.35em;
  position: relative;
  overflow: hidden;
}

.power-fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #2ed573 0%, #ffa502 60%, #ff4757 85%, #ff0055 100%);
  transition: width 0.05s ease, background 0.2s ease;
}

.power-marker-fly {
  position: absolute;
  left: 70%;
  top: 0;
  bottom: 0;
  width: max(2px, 0.25vmin);
  background: #000;
  border-right: max(1px, 0.1vmin) dashed yellow;
}

.power-meter-text {
  position: absolute;
  top: 0.1em;
  right: 0.4em;
  font-size: var(--aim-font-sm, clamp(0.58rem, 2.2vmin, 0.78rem));
  font-weight: 900;
  color: #ff0000;
  text-shadow: 0.08em 0.08em 0 #fff;
}

.btn-shoot-hot {
  min-width: clamp(3.4rem, 14vmin, 5.2rem);
  min-height: clamp(2.8rem, 8.5vmin, 3.6rem);
  width: clamp(3.4rem, 18%, 5.5rem);
  font-size: clamp(0.95rem, 3.4vmin, 1.25rem);
  padding: 0.35em 0.55em;
  flex: 0 0 auto;
  margin-bottom: 0.2vmin;
  writing-mode: horizontal-tb !important;
  white-space: nowrap !important;
}

/* 窄屏：禁止折行；永远 50/25/25；只缩字 + ellipsis */
@media (max-width: 420px) {
  .cue-status-3col {
    flex-wrap: nowrap !important;
  }
  .cue-col-cue,
  .cue-info-badge.cue-col-cue {
    flex: 0 0 calc((100% - 10px) * 0.5) !important;
    width: calc((100% - 10px) * 0.5) !important;
    max-width: calc((100% - 10px) * 0.5) !important;
    order: 0 !important;
    min-width: 0 !important;
  }
  .cue-col-item,
  .item-info-badge.cue-col-item,
  .cue-col-global {
    flex: 0 0 calc((100% - 10px) * 0.25) !important;
    width: calc((100% - 10px) * 0.25) !important;
    max-width: calc((100% - 10px) * 0.25) !important;
    order: 0 !important;
    min-width: 0 !important;
  }
  #aim-control-overlay {
    max-height: min(48vh, 52%);
    --aim-font: clamp(0.55rem, 2.2vmin, 0.78rem);
    --aim-font-sm: clamp(0.48rem, 1.9vmin, 0.68rem);
    --aim-tap: clamp(2.2rem, 6.5vmin, 2.9rem);
    --aim-gap: 0.2rem;
  }
  .cue-name-text,
  .cue-limit-tag,
  .cue-uses-tag,
  .cue-stars,
  .hud-tag,
  .item-info-name,
  #btn-aim-back-hall {
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    writing-mode: horizontal-tb !important;
  }
}

/* pad：保持 50/25/25，底栏收矮让台面吃满剩余区 */
@media (min-width: 768px) {
  .cue-status-3col {
    flex-wrap: nowrap !important;
  }
  .cue-col-cue,
  .cue-info-badge.cue-col-cue {
    flex: 0 0 calc((100% - 10px) * 0.5);
    width: calc((100% - 10px) * 0.5) !important;
    max-width: calc((100% - 10px) * 0.5);
    order: 0;
    min-width: 0;
  }
  .cue-col-item,
  .item-info-badge.cue-col-item,
  .cue-col-global {
    flex: 0 0 calc((100% - 10px) * 0.25);
    width: calc((100% - 10px) * 0.25);
    max-width: calc((100% - 10px) * 0.25);
    min-width: 0;
  }
  #aim-control-overlay {
    max-height: min(32vh, 36%);
    --aim-tap: clamp(2.8rem, 6vmin, 3.6rem);
  }
}

@media (min-width: 1024px) {
  #aim-control-overlay {
    max-height: min(28vh, 32%);
  }
}


/* 全场漫游控制浮层与道具栏 */
#hall-control-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 22;
}

#hall-control-overlay.hidden {
  display: none;
}

/* 全局视角投掷道具栏 (仅 count>0 时显示，紧凑浮于大厅底部，无厚底栏) */
.hall-throw-bar {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: 96%;
  background: rgba(255, 253, 240, 0.95);
  border: var(--border-thick);
  border-radius: 10px;
  box-shadow: var(--shadow-comic);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  z-index: 23;
  overflow-x: auto;
}

.hall-throw-label {
  font-size: 11px;
  font-weight: 900;
  color: #d63031;
  white-space: nowrap;
}

.hall-throw-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.hall-throw-chips .item-chip {
  min-height: 30px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: #f1f2f6;
  border: 1.5px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.hall-throw-chips .item-chip:active {
  transform: translate(1px, 1px);
}

.item-badge {
  font-size: 11px;
  color: #ff4757;
  font-weight: 900;
}

/* 跨桌双倍得分横幅 */
.toast-banner {
  position: absolute;
  top: 85px;
  left: 14px;
  right: 14px;
  background: linear-gradient(135deg, #ffd32a 0%, #ff9f43 100%);
  border: 3px solid #111;
  box-shadow: 0 6px 0 #111;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  z-index: 35;
  animation: toast-bounce 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-banner.hidden {
  display: none;
}

.toast-title {
  font-size: 16px;
  font-weight: 900;
  color: #d63031;
  text-shadow: 1px 1px 0 #fff;
}

.toast-desc {
  font-size: 12px;
  font-weight: 800;
  color: #111;
  margin-top: 3px;
}

@keyframes toast-bounce {
  0% { transform: scale(0.6) translateY(-20px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* 战报跑马灯 (超薄 20px，位于顶栏下方) */
#battle-ticker {
  position: relative;
  width: 100%;
  height: 20px;
  background: rgba(0, 0, 0, 0.85);
  color: #ffd32a;
  font-size: 10.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  white-space: nowrap;
  z-index: 18;
  pointer-events: none;
  flex-shrink: 0;
}

#battle-ticker span {
  animation: ticker-slide 12s linear infinite;
}

@keyframes ticker-slide {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* 获得道具短提示 Toast (桌内瞄准与全场通用，勿铺芯片挡台) */
.toast-item-gain {
  position: absolute;
  top: clamp(2.4rem, 8vmin, 3.6rem);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17, 17, 17, 0.94);
  color: #ffd32a;
  border: 0.12rem solid #ffd32a;
  box-shadow: 0 0.25rem 0.85rem rgba(0, 0, 0, 0.55);
  border-radius: clamp(0.9rem, 3vmin, 1.25rem);
  padding: clamp(0.35rem, 1.2vmin, 0.55rem) clamp(0.85rem, 3vmin, 1.2rem);
  font-size: clamp(0.72rem, 2.6vmin, 0.95rem);
  font-weight: 900;
  z-index: 80;
  pointer-events: none;
  white-space: nowrap;
  max-width: min(92%, 22rem);
  overflow: hidden;
  text-overflow: ellipsis;
  animation: toast-fade-in 0.2s ease-out;
}

.toast-item-gain.hidden {
  display: none;
}

/* 全局浮动 Toast 提示（个人中心/大厅/全屏通用） */
.global-toast {
  position: fixed;
  top: clamp(1.6rem, 5vmin, 2.8rem);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 18, 22, 0.95);
  color: #ffd32a;
  border: 2px solid #ffd32a;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.65), 0 0 10px rgba(255, 211, 42, 0.25);
  border-radius: clamp(1rem, 3vmin, 1.4rem);
  padding: clamp(0.45rem, 1.5vmin, 0.7rem) clamp(1.2rem, 4vmin, 1.8rem);
  font-size: clamp(0.85rem, 2.8vmin, 1.05rem);
  font-weight: 900;
  z-index: 10000;
  pointer-events: none;
  white-space: nowrap;
  max-width: min(92vw, 26rem);
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  animation: toast-fade-in 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.global-toast.hidden {
  display: none !important;
}

@keyframes toast-fade-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 弹窗通用样式 */
.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-dialog {
  background: var(--panel-bg);
  border: var(--border-thick);
  box-shadow: 6px 6px 0 var(--border-color);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 18px;
  overflow: hidden;
  animation: modal-pop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modal-pop {
  0% { transform: scale(0.85); }
  100% { transform: scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px dashed var(--border-color);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.modal-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-main);
  text-shadow: 1px 1px 0 var(--accent-gold);
}

.modal-body {
  overflow-y: auto;
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  padding-right: 4px;
}

.modal-footer {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ==========================================================================
   启动加载层：标题曲等关键资源就绪后再露主菜单
   ========================================================================== */
body.is-booting #app {
  visibility: hidden;
  pointer-events: none;
}

.boot-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #1a1c1e;
  background-image:
    radial-gradient(ellipse at 50% 30%, rgba(254, 211, 48, 0.18) 0%, transparent 55%),
    linear-gradient(180deg, #242628 0%, #121314 100%);
  color: #f6eedb;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.boot-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-loader-inner {
  width: min(320px, 86vw);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.boot-ball {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #fff 0 14%, transparent 15%),
    radial-gradient(circle at 50% 50%, #f5f5f5 0 42%, #111 43% 100%);
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.35), 0 0 0 3px #2d3436;
  animation: boot-bounce 0.85s ease-in-out infinite;
}

@keyframes boot-bounce {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  40% { transform: translateY(-18px) scale(1.02, 0.98); }
  55% { transform: translateY(0) scale(1.08, 0.9); }
  70% { transform: translateY(-6px) scale(1, 1); }
}

.boot-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-shadow: 2px 2px 0 #000;
}

.boot-label {
  font-size: 0.95rem;
  opacity: 0.9;
  letter-spacing: 0.2em;
}

.boot-bar {
  width: 100%;
  height: 10px;
  border-radius: 6px;
  background: #2d3436;
  border: 2px solid #636e72;
  overflow: hidden;
  box-sizing: border-box;
}

.boot-bar-fill {
  height: 100%;
  width: 4%;
  background: linear-gradient(90deg, #fdcb6e, #ffeaa7);
  border-radius: 4px;
  transition: width 0.25s ease;
}

.boot-status {
  font-size: 0.78rem;
  opacity: 0.72;
  min-height: 1.2em;
}

.boot-tap-hint {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #ffeaa7;
  text-shadow: 0 0 12px rgba(253, 203, 110, 0.45);
  animation: boot-pulse 1.15s ease-in-out infinite;
}

.boot-tap-hint.hidden {
  display: none;
}

.boot-loader.is-ready {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.boot-loader.is-ready .boot-bar {
  opacity: 0.55;
}

.boot-loader.is-ready .boot-label {
  letter-spacing: 0.28em;
}

@keyframes boot-pulse {
  0%, 100% { opacity: 0.55; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

/* ==========================================================================
   主菜单界面 (竖屏优先、脱狱者/监狱建筑师像素工整美化)
   ========================================================================== */
#screen-menu {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* 典狱长档案纸 / 蓝图工程方格底纹 (纯CSS，零包体，无CDN) */
  background-color: #f6eedb;
  background-image:
    linear-gradient(rgba(45, 52, 54, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 52, 54, 0.05) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 18%, rgba(254, 211, 48, 0.28) 0%, transparent 70%);
  background-size: 16px 16px, 16px 16px, 100% 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  gap: clamp(14px, 3vh, 24px);
  z-index: 40;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
}

#screen-menu.hidden {
  display: none;
}

/* 顶部安全警示带与监区档案标牌 */
.menu-top-dossier {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.menu-hazard-tape {
  width: 100%;
  height: 8px;
  border-radius: 2px;
  border: 2px solid #1a1a1a;
  background: repeating-linear-gradient(-45deg, #f1c40f 0, #f1c40f 10px, #2d3436 10px, #2d3436 20px);
  box-shadow: 2px 2px 0 #1a1a1a;
}

.menu-dossier-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Courier New", Courier, monospace, -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: #4a5568;
  padding: 1px 2px;
  letter-spacing: 0.3px;
}

.dossier-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.dossier-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2ed573;
  display: inline-block;
  box-shadow: 0 0 5px #2ed573;
}

.dossier-ver {
  color: #718096;
  font-weight: 700;
}

/* 品牌标题与史莱姆微弹动动画 */
.menu-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: clamp(4px, 1.5vh, 12px) 0;
  flex-shrink: 0;
}

/* 主菜单：标题与按钮成一组居中，避免上下拉开留空 */
#screen-menu > .menu-brand {
  margin: 0;
  gap: 6px;
  flex: 0 0 auto;
  animation: menuTitleFadeInDown 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#screen-menu > .menu-brand .menu-title.menu-title-logo {
  font-size: 0;
  letter-spacing: 0;
  text-shadow: none;
  line-height: 0;
  padding: 0;
}
#screen-menu > .menu-brand .menu-title.menu-title-logo picture {
  display: block;
}
#screen-menu > .menu-actions {
  width: min(100%, 460px);
  gap: 12px;
  margin: 0 auto;
  animation: menuActionsFadeInUp 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
}

/* 主菜单游戏图标（含 BARCADE）：史莱姆弹跳容器内整图跳动 + 默认可见 */
.menu-game-logo {
  display: block;
  width: auto;
  height: clamp(300px, min(56vh, 92vw), 480px);
  max-width: min(98vw, 520px);
  object-fit: contain;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.4s ease-out;
  will-change: opacity;
}

.menu-game-logo.is-loaded {
  opacity: 1;
}

@keyframes menuTitleFadeInDown {
  0% {
    opacity: 0;
    transform: translate3d(0, -32px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes menuActionsFadeInUp {
  0% {
    opacity: 0;
    transform: translate3d(0, 36px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #screen-menu > .menu-brand,
  #screen-menu > .menu-actions {
    animation-duration: 0.15s;
    transform: none !important;
  }
  .menu-game-logo {
    transition-duration: 0.15s;
  }
}
#screen-menu .menu-btn-hero {
  min-height: 56px;
}
#screen-menu .menu-sub-actions {
  gap: 10px;
  margin-top: 2px;
}

/* BARCADE 团队署名：夹在标题与按钮之间 */
.menu-studio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  background: linear-gradient(180deg, #16325c 0%, #0f274f 100%);
  border: 2px solid #071224;
  border-radius: 999px;
  box-shadow: 3px 3px 0 #071224;
}
.menu-studio-logo {
  width: 28px;
  height: 28px;
  display: block;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 2px solid #071224;
  background: #0f274f;
  object-fit: cover;
}
.menu-studio-name {
  font-family: Impact, "Arial Black", "DIN Alternate", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #e8f0ff;
  text-shadow: 0 1px 0 #071224;
  white-space: nowrap;
}

/* 史莱姆微跳动：密采样 + linear，避免每段 ease 在关键帧处急停再启动 */
.menu-title-slime {
  display: inline-block;
  transform-origin: center bottom;
  animation: slimeMicroBounce 2.6s linear infinite;
  will-change: transform;
  backface-visibility: hidden;
}

@keyframes slimeMicroBounce {
  0%, 8% { transform: translate3d(0, 0, 0) scale(1, 1); }
  12% { transform: translate3d(0, 0.3px, 0) scale(1.006, 0.994); }
  16% { transform: translate3d(0, 2.1px, 0) scale(1.044, 0.956); }
  20% { transform: translate3d(0, 2.1px, 0) scale(1.047, 0.953); }
  24% { transform: translate3d(0, -0.3px, 0) scale(1.025, 0.981); }
  28% { transform: translate3d(0, -4.5px, 0) scale(0.985, 1.029); }
  32% { transform: translate3d(0, -6.9px, 0) scale(0.963, 1.057); }
  36% { transform: translate3d(0, -7.1px, 0) scale(0.963, 1.056); }
  40% { transform: translate3d(0, -6.2px, 0) scale(0.986, 1.024); }
  44% { transform: translate3d(0, -5.3px, 0) scale(1.009, 0.992); }
  48% { transform: translate3d(0, -4.9px, 0) scale(1.013, 0.987); }
  52% { transform: translate3d(0, -2.6px, 0) scale(1.022, 0.978); }
  56% { transform: translate3d(0, 0.7px, 0) scale(1.035, 0.965); }
  60% { transform: translate3d(0, 1.8px, 0) scale(1.04, 0.96); }
  64% { transform: translate3d(0, 0.9px, 0) scale(1.023, 0.977); }
  68% { transform: translate3d(0, -0.9px, 0) scale(0.992, 1.008); }
  72% { transform: translate3d(0, -1px, 0) scale(0.989, 1.011); }
  76% { transform: translate3d(0, -0.6px, 0) scale(0.994, 1.006); }
  80% { transform: translate3d(0, -0.1px, 0) scale(0.999, 1.001); }
  84%, 100% { transform: translate3d(0, 0, 0) scale(1, 1); }
}

.menu-title {
  font-family: Impact, "Arial Black", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(26px, 7.2vw, 32px);
  font-weight: 900;
  color: #eb3b5a;
  text-shadow:
    2px 2px 0 #ffffff,
    -1.5px -1.5px 0 #ffffff,
    1.5px -1.5px 0 #ffffff,
    -1.5px 1.5px 0 #ffffff,
    4px 4px 0 #1a1a1a;
  line-height: 1.15;
  letter-spacing: -0.5px;
  margin: 0;
  padding: 0 4px;
}

.menu-subtitle-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  background: #ffffff;
  border: 2px solid #1a1a1a;
  box-shadow: 2px 2px 0 #1a1a1a;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 800;
  color: #2d3436;
}

.subtitle-pin {
  font-size: 12px;
}

/* 典狱长核心治安条例告示板 (整齐色块卡片式布局) */
.menu-bulletin-board {
  position: relative;
  width: 100%;
  background: #ffffff;
  border: var(--border-thick);
  box-shadow: var(--shadow-comic);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.bulletin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #2d3436;
  color: #f5f6fa;
  padding: 7px 12px;
  border-bottom: 2px solid #1a1a1a;
  font-size: 12px;
  font-weight: 900;
}

.bulletin-bar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.3px;
}

.bulletin-icon {
  font-size: 14px;
}

.bulletin-stamp {
  font-family: "Courier New", Courier, monospace, sans-serif;
  font-size: 10px;
  font-weight: 900;
  background: #eb3b5a;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #1a1a1a;
  letter-spacing: 0.5px;
  transform: rotate(-1deg);
  box-shadow: 1px 1px 0 #1a1a1a;
}

.bulletin-cards-grid {
  padding: clamp(8px, 1.4vh, 12px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(8px, 1.4vh, 10px);
  background: #fdfdfd;
}

@media (max-width: 330px) {
  .bulletin-cards-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.rule-block {
  background: #ffffff;
  border: 2px solid #1a1a1a;
  border-radius: 6px;
  padding: clamp(6px, 1.2vh, 9px) clamp(8px, 1.8vw, 10px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rule-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  font-weight: 900;
  border-bottom: 1.5px dashed rgba(0, 0, 0, 0.15);
  padding-bottom: 3px;
}

.rule-badge {
  font-size: 11px;
  font-weight: 900;
}

.rule-type {
  font-size: 9px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid #1a1a1a;
  background: #fff;
}

.rule-block-desc {
  font-size: 11px;
  color: #2f3542;
  line-height: 1.35;
  font-weight: 600;
}

.rule-block-desc b {
  font-weight: 900;
}

/* 4大规整色块卡片区分 (黄/蓝/红/绿) */
.block-yellow {
  border-left: 5px solid #f39c12;
  background: #fffdf5;
}
.block-yellow .rule-badge {
  color: #d35400;
}
.block-yellow .rule-type {
  background: #fef5e7;
  color: #d35400;
}

.block-blue {
  border-left: 5px solid #3498db;
  background: #f5f9fd;
}
.block-blue .rule-badge {
  color: #2980b9;
}
.block-blue .rule-type {
  background: #ebf5fb;
  color: #2980b9;
}

.block-red {
  border-left: 5px solid #e74c3c;
  background: #fdf5f5;
}
.block-red .rule-badge {
  color: #c0392b;
}
.block-red .rule-type {
  background: #fdedec;
  color: #c0392b;
}

.block-green {
  border-left: 5px solid #2ecc71;
  background: #f4fbf7;
}
.block-green .rule-badge {
  color: #27ae60;
}
.block-green .rule-type {
  background: #eafaf1;
  color: #27ae60;
}

/* 操作按钮区域 (主次层次分明) */
.menu-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

/* 头部特级大按钮：立即开打 */
.menu-btn-hero {
  width: 100%;
  min-height: 52px;
  background: linear-gradient(180deg, #ff4757 0%, #ee384a 100%);
  border: var(--border-thick);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 5px 0 #1a1a1a;
  border-radius: 8px;
  color: #ffffff;
  padding: 8px 14px;
  cursor: pointer;
  position: relative;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.menu-btn-hero:hover {
  background: linear-gradient(180deg, #ff6b6b 0%, #f04b5c 100%);
}

.menu-btn-hero:active {
  transform: translateY(3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 2px 0 #1a1a1a;
}

.hero-btn-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  pointer-events: none;
}

.hero-btn-icon {
  font-size: 22px;
}

.hero-btn-text {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.5px;
  text-shadow: 1.5px 1.5px 0 #1a1a1a;
}

.hero-btn-tag {
  font-size: 11px;
  font-weight: 900;
  background: #ffffff;
  color: #ee384a;
  padding: 2px 8px;
  border-radius: 4px;
  border: 2px solid #1a1a1a;
  box-shadow: 1px 1px 0 #1a1a1a;
}

/* 双列次级功能按钮 (图鉴 & 规则) */
.menu-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.menu-btn-sub {
  min-height: 48px;
  border: var(--border-thick);
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.4), var(--shadow-comic);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}

.menu-btn-sub:active {
  transform: translate(2px, 2px);
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.2), var(--shadow-comic-pressed);
}

.menu-btn-gold {
  background: linear-gradient(180deg, #ffa502 0%, #f39c12 100%);
  color: #111111;
}

.menu-btn-blue {
  background: linear-gradient(180deg, #1e90ff 0%, #0984e3 100%);
  color: #ffffff;
}

.sub-btn-icon {
  font-size: 20px;
  pointer-events: none;
}

.sub-btn-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  pointer-events: none;
}

.sub-btn-title {
  font-size: 13px;
  font-weight: 900;
}

.sub-btn-tag {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.9;
}

/* 蓝图底部文件标注 */
.menu-footer-note {
  font-family: "Courier New", Courier, monospace, -apple-system, sans-serif;
  font-size: 10px;
  font-weight: 800;
  color: #747d8c;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  letter-spacing: 0.2px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.footer-bracket {
  color: #a4b0be;
  font-weight: 900;
}

/* 图鉴弹窗内部标签切换 */
.compendium-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.comp-tab-btn {
  flex: 1;
  padding: 8px;
  background: #eee;
  border: 2px solid var(--border-color);
  font-weight: 900;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}

.comp-tab-btn.active {
  background: var(--accent-gold);
  border-color: #111;
}

.comp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.comp-card {
  background: #fff;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: 2px 2px 0 var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.comp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 900;
  font-size: 14px;
}

.badge-status {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #111;
  font-weight: 800;
}

.badge-implemented {
  background: #2ed573;
  color: #111;
}

.badge-planned {
  background: #a4b0be;
  color: #fff;
}

.comp-desc {
  font-size: 12px;
  color: #444;
}

.comp-effect {
  font-size: 11px;
  color: #e84118;
  font-weight: 700;
}

/* 结算弹窗特殊效果 */
.settlement-card {
  background: #ffeaa7;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 800;
}

.settlement-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.settlement-title-win {
  color: #d63031;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
}

.settlement-title-lose {
  color: #2f3542;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
}

/* 20改) 全局禁走动：隐藏虚拟摇杆 */
#virtual-joystick-container {
  display: none !important;
}

#virtual-joystick-handle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary-btn);
  border: 2px solid #111;
  box-shadow: 2px 2px 0 #000;
  pointer-events: none;
  transform: translate(0, 0);
  transition: transform 0.05s ease;
}

#hall-action-btn {
  min-height: 44px;
  font-size: 14px;
  padding: 8px 14px;
  box-shadow: var(--shadow-comic);
}


/* 35/36 指定球桌选择弹窗样式 (竖屏点选优化) */
.table-selector-dialog {
  max-width: 440px;
}

.table-selector-desc {
  font-size: 13px;
  font-weight: 800;
  color: #333;
  margin-bottom: 10px;
  line-height: 1.4;
  background: #f1f2f6;
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 4px solid var(--primary-btn);
}

.table-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 2px;
}

.table-select-card {
  background: #fff;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--border-color);
  transition: all 0.15s ease;
  user-select: none;
}

.table-select-card:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 var(--border-color);
}

.table-select-card.selected {
  background: #fff9e6;
  border-color: #ff9f43;
  box-shadow: 0 0 0 2px #ff9f43, 3px 3px 0 #111;
}

.table-select-card.default-target {
  border-color: #ff4757;
}

.table-select-card.disabled {
  opacity: 0.45;
  background: #dfe4ea;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.8);
}

.table-select-card .card-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 900;
  font-size: 13px;
  flex-wrap: wrap;
}

.table-select-card .card-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 800;
  color: #57606f;
}

.table-select-card .badge {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 900;
}

.badge-default {
  background: #ff4757;
  color: #fff;
}

.badge-player {
  background: #2ed573;
  color: #fff;
}

.badge-dead {
  background: #747d8c;
  color: #fff;
}

.badge-ruin {
  background: #2f3542;
  color: #ff4757;
}

/* 暂停模态弹窗 */
.pause-dialog {
  max-width: 330px;
  text-align: center;
  padding: 16px 18px 24px;
  box-sizing: border-box;
}

.pause-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 4px 14px 2px;
  box-sizing: border-box;
}

.pause-dialog .btn-big {
  font-size: 16px;
  padding: 11px 20px;
}

.pause-status-banner {
  background: #eef2f7;
  border: 2px dashed #4b6584;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #2c3e50;
  line-height: 1.4;
  margin-bottom: 12px;
}

.pause-actions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
}

.pause-actions-list #btn-pause-lobby {
  margin-bottom: 4px;
}

.pause-sub-row {
  display: flex;
  gap: 8px;
}


/* ===== 地板主题平铺 + 菜单选择 ===== */
#canvas-wrapper {
  background-color: #1e272e;
  background-image: var(--floor-tile, none);
  background-repeat: repeat;
  background-size: clamp(96px, 28vmin, 160px) auto;
}

#gameCanvas.floor-transparent-bg {
  background: transparent;
}

.theme-picker {
  width: min(92%, 420px);
  margin: 0 auto 12px;
  padding: 10px 12px;
  background: rgba(255, 253, 240, 0.95);
  border: var(--border-thick);
  border-radius: 10px;
  box-shadow: var(--shadow-comic);
  box-sizing: border-box;
}

.theme-picker-title {
  font-weight: 900;
  font-size: clamp(0.75rem, 2.8vmin, 0.95rem);
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-picker-hint {
  font-size: 0.72em;
  font-weight: 700;
  color: #666;
}

.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.theme-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  min-height: 64px;
  font-size: clamp(0.58rem, 2.2vmin, 0.72rem);
  font-weight: 900;
  cursor: pointer;
  border: 2px solid #111;
  border-radius: 8px;
  background: #fff;
  box-shadow: 2px 2px 0 #111;
}

.theme-chip .theme-swatch {
  width: 100%;
  height: 28px;
  border-radius: 4px;
  border: 1px solid #333;
  background-size: cover;
  background-repeat: repeat;
  background-position: center;
}

.theme-chip.selected {
  background: #ffeaa7;
  outline: 3px solid #0984e3;
}

.theme-chip .theme-chip-name {
  text-align: center;
  line-height: 1.2;
  writing-mode: horizontal-tb;
  white-space: normal;
}

@media (max-width: 420px) {
  .theme-picker-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 菜单主题选择已移除（开局随机） */
#theme-picker, .theme-picker { display: none !important; }

/* ==========================================================================
   台球爆破 V1 专属组件样式 (9:16 竖屏, LIVE FEED, 敌方5桌状态卡, 双道具槽, 蓄力条)
   ========================================================================== */

/* 界面2: 正式游戏 */
.screen-game {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background-color: var(--bg-color);
}

.top-hud .hud-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.hud-brand {
  font-weight: 900;
  font-size: clamp(0.75rem, 2.6vmin, 0.95rem);
  color: #d63031;
}
.hud-sub {
  font-size: clamp(0.58rem, 2vmin, 0.72rem);
  font-weight: 900;
  background: #ffeaa7;
  padding: 0.08em 0.4em;
  border-radius: 4px;
  border: 1px solid #111;
}
.top-hud .hud-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* LIVE FEED (Hall+Table 共用：左 70% 战报，只播新消息) */
.status-combo {
  width: 100%;
  flex: 0 0 auto;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
}
.live-feed-box {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #1e272e;
  border: 0.12rem solid #2d3436;
  padding: 0.4rem 0.55rem;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  box-shadow: inset 0 0 0 0.05rem rgba(253, 203, 110, 0.12);
  box-sizing: border-box;
  touch-action: none;
}
.live-feed-track {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}
.live-feed-list {
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* 溢出时只裁最旧的一行 */
  align-items: stretch;
  gap: 0.2rem;
  width: 100%;
  min-height: 0;
}
.feed-item {
  font-size: clamp(0.62rem, 2.1vmin, 0.78rem);
  font-weight: 800;
  color: #f1f2f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  flex: 0 0 auto;
}
.feed-item.highlight {
  color: #f1c40f;
}

/* 敌方区域 (V1 §18–21) */
.enemy-area {
  width: 100%;
  padding: 6px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #2d3436;
  border-bottom: 2.5px solid #111;
}
.enemy-card {
  position: relative;
  background: #1e8449;
  border: 2px solid #6d3b14;
  border-radius: 6px;
  padding: 3px 6px;
  color: #fff;
  box-shadow: 2px 2px 0 #111;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
  user-select: none;
}
.enemy-card-wide {
  grid-column: span 2;
  width: 65%;
  margin: 0 auto;
}
.enemy-card.drag-target-hover {
  box-shadow: 0 0 14px #f1c40f !important;
  outline: 3px solid #f1c40f;
  transform: scale(1.03);
}
.enemy-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 900;
}
.enemy-num {
  background: #d63031;
  color: #fff;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 10px;
}
.enemy-name {
  color: #f5f6fa;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.enemy-hp {
  font-size: 11px;
  font-weight: 900;
  color: #ff4757;
  letter-spacing: 2px;
}
.enemy-hp.danger {
  animation: heartPulse 0.8s infinite alternate;
}
@keyframes heartPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 1px #ff4757); }
  100% { transform: scale(1.18); filter: drop-shadow(0 0 6px #ff4757); }
}
.enemy-balls {
  font-size: 10px;
  font-weight: 800;
  color: #dcdde1;
}
.enemy-balls.warn {
  color: #ffa502;
  font-weight: 900;
  animation: bounceWarn 0.6s infinite alternate;
}
@keyframes bounceWarn {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}
.enemy-buffs {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.buff-badge {
  font-size: 9px;
  font-weight: 800;
  background: rgba(0,0,0,0.65);
  padding: 1px 3px;
  border-radius: 3px;
  border: 1px solid #70a1ff;
  color: #70a1ff;
}
.enemy-ko-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}
.enemy-ko-overlay.hidden {
  display: none !important;
}
.enemy-ko-overlay span {
  font-size: 26px;
  font-weight: 900;
  color: #ff4757;
  text-shadow: 2px 2px 0 #000, 0 0 8px #000;
  letter-spacing: 2px;
}

/* 道具槽位置 (V1 §22 & §6) */
.item-slots-row {
  height: 48px;
  background: var(--panel-bg);
  border-bottom: 2.5px solid #111;
  display: flex;
  padding: 3px 8px;
  gap: 8px;
  flex-shrink: 0;
}
.slot-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.slot-header {
  font-size: 10px;
  font-weight: 900;
  color: #444;
  margin-bottom: 2px;
}
.slot-box {
  flex: 1;
  background: #f1f2f6;
  border: 2px solid #111;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 6px;
  position: relative;
  transition: transform 0.15s ease, background 0.15s ease;
}
.slot-box.flash-anim {
  animation: slotFlash 0.5s ease;
}
@keyframes slotFlash {
  0% { transform: scale(1); background: #f1c40f; }
  50% { transform: scale(1.08); background: #ffa502; }
  100% { transform: scale(1); background: #f1f2f6; }
}
.slot-interactive {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.slot-interactive:active {
  cursor: grabbing;
}
.slot-icon {
  font-size: 18px;
}
.slot-info {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  flex: 1;
  overflow: hidden;
}
.slot-name {
  font-size: 12px;
  font-weight: 900;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-meta {
  font-size: 10px;
  color: #666;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-desc {
  font-size: 9px;
  color: #333;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-switch-btn {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 8px;
  border: 2px solid #111;
  border-radius: 6px;
  background: #ffd32a;
  cursor: pointer;
}
.slot-cue-switch { cursor: pointer; }
.player-cue-hud {
  margin: 2px 0 4px;
  padding: 4px 6px;
  background: rgba(255,255,255,0.88);
  border: 2px solid #111;
  border-radius: 6px;
  text-align: left;
}
.player-cue-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 900;
}
.player-cue-line #player-cue-rarity { color: #c0392b; }
.player-cue-line #player-cue-tag {
  background: #ffa502;
  color: #111;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid #111;
}
.player-cue-name { font-size: 13px; font-weight: 900; }
.player-cue-desc { font-size: 11px; font-weight: 700; color: #333; line-height: 1.25; }
.drag-handle-hint {
  font-size: 9px;
  font-weight: 900;
  background: #ffa502;
  color: #111;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid #111;
}

/* 我方主桌悬浮信息 */
.player-table-hud {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: calc(100% - 16px);
  margin: 6px 8px 4px;
  background: linear-gradient(180deg, #2f3542 0%, #1e272e 100%);
  border: 2.5px solid #ffa502;
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  pointer-events: none;
  z-index: 6;
  box-shadow: 0 3px 0 #111, 0 4px 10px rgba(0,0,0,0.35);
  white-space: nowrap;
  box-sizing: border-box;
}
.hearts-display {
  color: #ff4757;
  font-size: 13px;
  letter-spacing: 2px;
}
.player-hud-ping {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  letter-spacing: 0.5px;
}
.lobby-ping-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  margin-left: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* 底部蓄力条与击球控制区 (V1 §10) */
.bottom-controls-bar {
  height: 44px;
  background: var(--panel-bg);
  border-top: 2.5px solid #111;
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 8px;
  z-index: 10;
  flex-shrink: 0;
}
.power-meter-container {
  flex: 1;
  height: 32px;
  background: #2f3542;
  border: 2px solid #111;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.power-meter-track {
  width: 100%;
  height: 100%;
  position: relative;
}
.power-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #2ed573 0%, #ffa502 60%, #ff4757 100%);
  transition: width 0.04s linear;
}
.power-meter-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 1px 1px 2px #000;
}

/* —— 右侧竖向定力度条（Table）：垂直居中 —— */
#screen-game[data-view="table"] .table-power-rail {
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.25rem, 1vmin, 0.45rem);
}
/* 操作方式切换按钮 */
.btn-control-mode {
  flex: 0 0 auto;
  width: 100%;
  padding: 0.3rem 0;
  font-size: clamp(0.65rem, 2.2vmin, 0.8rem);
  font-weight: 700;
  text-align: center;
  border-radius: 0.35rem;
  background: #2f3542;
  color: #dfe4ea;
  border: 1px solid #57606f;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s;
}
.btn-control-mode:active { background: #57606f; }
.btn-control-mode.is-mode-b { background: #1e90ff; color: #fff; border-color: #1e90ff; }
#screen-game[data-view="table"] .power-meter-vertical {
  flex: 0 0 52%; /* 蓄力条居中，约占右栏一半高度 */
  min-height: 0;
  width: 100%;
  height: auto;
  align-self: stretch;
  border-radius: clamp(0.35rem, 1.2vmin, 0.55rem);
  border: 0.15rem solid #111;
  background: #1e272e;
  touch-action: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  cursor: ns-resize;
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-track {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  cursor: ns-resize;
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-track * {
  pointer-events: none !important;
  touch-action: none !important;
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  min-height: 0;
  transition: height 0.04s linear, background 0.12s ease;
  background: linear-gradient(180deg, #2ed573 0%, #ffa502 55%, #ff4757 100%);
}
#screen-game[data-view="table"] .power-meter-vertical.is-low .power-meter-fill {
  background: linear-gradient(180deg, #2ed573 0%, #7bed9f 100%);
}
#screen-game[data-view="table"] .power-meter-vertical.is-mid .power-meter-fill {
  background: linear-gradient(180deg, #ffa502 0%, #ffd32a 100%);
}
#screen-game[data-view="table"] .power-meter-vertical.is-high .power-meter-fill {
  background: linear-gradient(180deg, #ff6b81 0%, #ff4757 100%);
}
#screen-game[data-view="table"] .power-meter-vertical.is-disabled {
  opacity: 0.42;
  pointer-events: none;
  filter: grayscale(0.35);
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-tick {
  position: absolute;
  left: 12%;
  right: 12%;
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.28);
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-tick[data-p="25"] { top: 25%; }
#screen-game[data-view="table"] .power-meter-vertical .power-meter-tick[data-p="50"] { top: 50%; }
#screen-game[data-view="table"] .power-meter-vertical .power-meter-tick[data-p="75"] { top: 75%; }
#screen-game[data-view="table"] .power-meter-vertical .power-meter-knob {
  position: absolute;
  left: 0;
  right: 0;
  top: 0%;
  height: 0;
  z-index: 2;
  pointer-events: none;
  transform: translateY(-50%);
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-knob::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: clamp(0.35rem, 1.4vmin, 0.55rem);
  transform: translateY(-50%);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 0 0.08rem #111, 0 0.1rem 0.25rem rgba(0, 0, 0, 0.45);
}
#screen-game[data-view="table"] .power-meter-vertical .power-meter-text {
  position: absolute;
  left: 50%;
  top: 0.4rem;
  transform: translateX(-50%);
  z-index: 3;
  font-size: clamp(0.85rem, 3.2vmin, 1.15rem);
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 0.2rem #000, 1px 1px 2px #000, -1px -1px 1px #000;
  writing-mode: horizontal-tb;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.02em;
}
#screen-game[data-view="table"] .btn-rail-global {
  flex: 0 0 auto;
  margin-top: 0.15rem; /* 右栏：贴在力度条下方 */
  width: 100%;
  min-height: clamp(2.6rem, 8vmin, 3.2rem);
  padding: 0.25rem 0.15rem;
  font-size: clamp(0.85rem, 3.2vmin, 1.1rem);
  font-weight: 900;
  line-height: 1.1;
  box-sizing: border-box;
}

/* —— 底栏六人状态条：身份 / 血点+剩球 / 装备，少字少行 —— */
.table-roster {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--aim-gap, clamp(0.25rem, 1vmin, 0.45rem));
  width: 100%;
  min-width: 0;
  container-type: inline-size;
  container-name: roster;
}
.roster-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.32rem, 1.1vmin, 0.5rem);
  min-width: 0;
  height: clamp(4.2rem, 13vmin, 5.5rem);
  min-height: clamp(4.2rem, 13vmin, 5.5rem);
  max-height: clamp(4.2rem, 13vmin, 5.5rem);
  padding: clamp(0.28rem, 1vmin, 0.45rem) clamp(0.3rem, 1.1vmin, 0.5rem);
  background: linear-gradient(180deg, #343b3f 0%, #2d3436 100%);
  border: 0.12rem solid #1a1a1a;
  border-radius: clamp(0.35rem, 1.1vmin, 0.5rem);
  color: #fff;
  font-size: clamp(0.7rem, 2.6vmin, 0.92rem);
  line-height: 1.1;
  box-sizing: border-box;
  overflow: hidden;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0.05rem 0 rgba(255, 255, 255, 0.06);
}
/* 与遗留 .rail-rival-btn 叠用时夺回 gap/底色/高度，避免行距贴死与灰底盖渐变 */
.roster-card.rail-rival-btn {
  gap: clamp(0.32rem, 1.1vmin, 0.5rem);
  min-height: clamp(4.2rem, 13vmin, 5.5rem);
  height: clamp(4.2rem, 13vmin, 5.5rem);
  max-height: clamp(4.2rem, 13vmin, 5.5rem);
  padding: clamp(0.28rem, 1vmin, 0.45rem) clamp(0.3rem, 1.1vmin, 0.5rem);
  background: linear-gradient(180deg, #343b3f 0%, #2d3436 100%);
  border: 0.12rem solid #1a1a1a;
  border-radius: clamp(0.35rem, 1.1vmin, 0.5rem);
  font-size: clamp(0.7rem, 2.6vmin, 0.92rem);
  line-height: 1.1;
  flex-shrink: 1;
}
.roster-card.is-self {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #274a72 0%, #1e3a5f 100%);
  border-color: #fdcb6e;
  box-shadow: 0 0 0 0.1rem rgba(253, 203, 110, 0.45), inset 0 0.05rem 0 rgba(255, 255, 255, 0.08);
}
.roster-card.is-ko {
  opacity: 0.42;
  filter: grayscale(0.5);
}
.roster-card.is-targetable {
  cursor: pointer;
  border-color: #ff6b6b;
  box-shadow: 0 0 0 0.12rem rgba(255, 107, 107, 0.55);
  animation: rosterPulse 1.1s ease-in-out infinite;
}
.roster-card.is-targetable-ally {
  cursor: pointer;
  border-color: #74b9ff;
  box-shadow: 0 0 0 0.12rem rgba(116, 185, 255, 0.6);
  animation: rosterPulseAlly 1.1s ease-in-out infinite;
}
.roster-card.is-targetable:active,
.roster-card.is-targetable-ally:active {
  transform: scale(0.97);
}
.roster-card.is-drag-hover {
  transform: scale(1.04);
  filter: brightness(1.12);
}
.roster-card.is-targetable.is-drag-hover {
  box-shadow: 0 0 0 0.18rem rgba(255, 107, 107, 0.9);
}
.roster-card.is-targetable-ally.is-drag-hover {
  box-shadow: 0 0 0 0.18rem rgba(116, 185, 255, 0.95);
}
@keyframes rosterPulse {
  0%, 100% { box-shadow: 0 0 0 0.08rem rgba(116, 185, 255, 0.35); }
  50% { box-shadow: 0 0 0 0.16rem rgba(116, 185, 255, 0.75); }
}
@keyframes rosterPulseAlly {
  0%, 100% { box-shadow: 0 0 0 0.08rem rgba(116, 185, 255, 0.4); }
  50% { box-shadow: 0 0 0 0.18rem rgba(9, 132, 227, 0.85); }
}
.roster-card .rc-top {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
}
.roster-card .rc-avatar {
  flex: 0 0 auto;
  font-size: clamp(1.05rem, 3.8vmin, 1.35rem);
  line-height: 1;
}
.roster-card .rc-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-weight: 900;
  font-size: clamp(0.72rem, 2.7vmin, 0.92rem);
  text-align: center;
}
.roster-card .rc-name .rc-balls {
  margin-left: 0.1rem;
}
.roster-card .rc-name-text {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.roster-card .rc-who {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 900;
  font-size: clamp(0.72rem, 2.7vmin, 0.92rem);
}
/* 桌号徽章：名字左侧，①-⑥ 一眼定位谁的球桌 */
.roster-card .rc-seat {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.12em;
  height: 1.12em;
  padding: 0 0.12em;
  border-radius: 0.28em;
  background: #57606f;
  color: #ffeaa7;
  font-size: 0.88em;
  font-weight: 900;
  line-height: 1;
  border: 1px solid rgba(0, 0, 0, 0.55);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}
.roster-card.is-self .rc-seat {
  background: #e8b33c;
  color: #1b1b1b;
  text-shadow: none;
  border-color: rgba(0, 0, 0, 0.6);
}
.roster-card .rc-you {
  flex: 0 0 auto;
  background: #e84118;
  color: #fff;
  font-size: 0.68em;
  font-weight: 900;
  padding: 0.02rem 0.2rem;
  border-radius: 0.2rem;
  border: 1px solid #111;
}
.roster-card .rc-vitals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 1.45rem;
}
.roster-card .rc-balls {
  flex: 0 0 auto;
  min-width: 1.05rem;
  padding: 0.06rem 0.32rem;
  border-radius: 999px;
  background: rgba(116, 185, 255, 0.32);
  border: 1px solid rgba(116, 185, 255, 0.55);
  color: #a9d3ff;
  font-size: clamp(0.68rem, 2.4vmin, 0.88rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.15;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}
.roster-card .rc-hearts {
  flex: 0 0 auto;
  color: #ff6b6b;
  font-size: clamp(1.2rem, 4.4vmin, 1.55rem);
  letter-spacing: 0.06em;
  line-height: 1;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}
.roster-card .rc-ko {
  font-size: clamp(0.62rem, 2.2vmin, 0.78rem);
  font-weight: 900;
  color: #b2bec3;
  letter-spacing: 0.04em;
}
.roster-card .rc-gear {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.22rem;
  align-items: center;
  height: clamp(1rem, 3.6vmin, 1.3rem);
  min-height: clamp(1rem, 3.6vmin, 1.3rem);
  overflow: hidden;
  font-size: clamp(0.92rem, 3.2vmin, 1.2rem);
  line-height: 1;
  opacity: 0.92;
}
.roster-card .rc-gear .rc-cue,
.roster-card .rc-gear .rc-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.04rem;
}
.roster-card .rc-gear .rc-cue-uses {
  font-size: 0.55em;
  font-weight: 900;
  color: #ffeaa7;
  line-height: 1;
}

/* 自己卡：敌袭角标 / 状态行 / 受击闪 */
.roster-card .rc-threat {
  position: absolute;
  top: -0.4rem;
  left: 50%;
  transform: translateX(-50%);
  background: #ff4757;
  color: #fff;
  font-size: clamp(0.58rem, 2.1vmin, 0.72rem);
  font-weight: 900;
  padding: 0.04rem 0.3rem;
  border-radius: 0.28rem;
  border: 1.5px solid #fff;
  box-shadow: 0 0 8px #ff4757;
  white-space: nowrap;
  animation: rcThreatPulse 0.4s infinite alternate ease-in-out;
  z-index: 10;
  pointer-events: none;
}
.roster-card .rc-threat.hidden { display: none; }
@keyframes rcThreatPulse {
  0% { transform: translateX(-50%) scale(0.92); opacity: 0.85; }
  100% { transform: translateX(-50%) scale(1.1); opacity: 1; box-shadow: 0 0 14px #ff4757; }
}
.roster-card .rc-status {
  width: 100%;
  height: 0.95em;
  min-height: 0.95em;
  max-width: 100%;
  font-size: clamp(0.56rem, 2vmin, 0.72rem);
  font-weight: 800;
  color: #fdcb6e;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  visibility: visible;
}
.roster-card .rc-status:empty {
  display: none;
  height: 0;
  min-height: 0;
}
.roster-card.is-self.is-damaged {
  border-color: #ff4757 !important;
  background: #4a151b !important;
  box-shadow: 0 0 14px rgba(255, 71, 87, 0.85) !important;
}
.roster-card.is-self.is-blocked {
  border-color: #00d2d3 !important;
  background: #12333b !important;
  box-shadow: 0 0 14px rgba(0, 210, 211, 0.85) !important;
}
.roster-card.is-self.is-debuffed {
  border-color: #ffa502 !important;
  background: #3b2c12 !important;
  box-shadow: 0 0 12px rgba(255, 165, 2, 0.8) !important;
}
.roster-card.is-self.is-healed {
  border-color: #2ed573 !important;
  background: #143a24 !important;
  box-shadow: 0 0 12px rgba(46, 213, 115, 0.8) !important;
}

@container roster (max-width: 18rem) {
  .roster-card .rc-gear { font-size: clamp(0.72rem, 2.8vmin, 0.95rem); gap: 0.1rem; }
  .roster-card .rc-who { font-size: clamp(0.58rem, 2.2vmin, 0.72rem); }
}
@supports not (container-type: inline-size) {
  @media (orientation: portrait) and (max-width: 30rem) {
    .roster-card .rc-gear { font-size: clamp(0.72rem, 2.8vmin, 0.95rem); gap: 0.1rem; }
  }
}

/* 横屏：高度稀缺宽度富裕——六人卡改横排一行，压扁卡片，省高度给桌子 */
@media (orientation: landscape) {
  .table-roster { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .roster-card {
    height: clamp(2.9rem, 9.5vmin, 3.8rem);
    min-height: clamp(2.9rem, 9.5vmin, 3.8rem);
    max-height: clamp(2.9rem, 9.5vmin, 3.8rem);
    gap: clamp(0.14rem, 0.7vmin, 0.3rem);
    padding: clamp(0.12rem, 0.6vmin, 0.26rem) clamp(0.18rem, 0.7vmin, 0.36rem);
  }
  .roster-card .rc-who { font-size: clamp(0.56rem, 2vmin, 0.72rem); }
  .roster-card .rc-avatar { font-size: clamp(0.8rem, 2.8vmin, 1.05rem); }
  .roster-card .rc-balls { font-size: clamp(0.58rem, 2vmin, 0.74rem); padding: 0.04rem 0.22rem; }
  .roster-card .rc-hearts { font-size: clamp(1.05rem, 3.6vmin, 1.28rem); }
  .roster-card .rc-vitals { gap: 0; min-height: 1.15rem; }
  .roster-card.rail-rival-btn {
    gap: clamp(0.14rem, 0.7vmin, 0.3rem);
    height: clamp(2.9rem, 9.5vmin, 3.8rem);
    min-height: clamp(2.9rem, 9.5vmin, 3.8rem);
    max-height: clamp(2.9rem, 9.5vmin, 3.8rem);
    padding: clamp(0.12rem, 0.6vmin, 0.26rem) clamp(0.18rem, 0.7vmin, 0.36rem);
  }
  .roster-card .rc-gear {
    height: clamp(0.75rem, 2.6vmin, 1rem);
    min-height: clamp(0.75rem, 2.6vmin, 1rem);
    font-size: clamp(0.72rem, 2.5vmin, 0.95rem);
    gap: 0.14rem;
  }
  .roster-card .rc-status {
    height: 0.85em;
    min-height: 0.85em;
    font-size: clamp(0.46rem, 1.6vmin, 0.58rem);
  }
}

.btn-shoot-mobile {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
}

/* 界面1: 等待配对界面 (V1 §15) */
.screen-menu {
  position: absolute;
  inset: 0;
  z-index: 50;
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow-y: auto;
}
.match-waiting-panel {
  background: #fffdf0;
  border: var(--border-thick);
  border-radius: 12px;
  padding: 12px;
  margin: 12px 0;
  box-shadow: var(--shadow-comic);
}
.match-header-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}
.match-status-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-count-badge {
  font-size: 13px;
  font-weight: 900;
  background: #2ed573;
  color: #111;
  margin-left: 0;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1.5px solid #111;
  flex: 0 0 auto;
  white-space: nowrap;
}
.match-seats-grid {
  display: grid;
  grid-template-columns: 1fr; /* one seat per row */
  gap: 8px;
  width: 100%;
}
.match-seat .seat-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-seat .seat-status {
  flex: 0 0 auto;
  margin-left: auto;
}
.match-seat .seat-kick {
  flex: 0 0 auto;
}

.match-seat {
  background: #f1f2f6;
  border: 2px solid #111;
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.match-seat.player-seat {
  background: #e8f0fe;
  border-color: #1e90ff;
}
.seat-badge {
  font-size: 10px;
  font-weight: 900;
  background: #ffa502;
  padding: 1px 4px;
  border-radius: 3px;
}
.seat-avatar {
  font-size: 16px;
}
.seat-name {
  font-size: 11px;
  font-weight: 900;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-status.ready {
  font-size: 10px;
  font-weight: 900;
  color: #2ed573;
}
.match-summary-rules {
  font-size: 11px;
  color: #555;
  margin-top: 10px;
  text-align: center;
  font-weight: 800;
  display: flex;
  justify-content: space-around;
}

/* 拖拽代理镜像 */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  font-size: 32px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

#player-table-hud { flex-wrap: wrap; gap: 0.2rem 0.6rem; padding: 0.3rem 0.5rem; }
#player-table-hud.critical { border-color: #ff7373; }
#app { height: 100dvh; }
#enemy-area, #btn-shoot-mobile { display: none !important; }
#canvas-wrapper {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  position: relative;
  overflow: hidden;
  --table-rail-left: 0px;
  --table-rail-right: 0px;
}
#gameCanvas, #slot-item-box, #slot-item-box-2, #slot-item-box-3 { touch-action: none; }
#screen-game .top-hud { flex: 0 0 clamp(2.4rem, 6vmin, 2.8rem); }
#screen-game #item-slots-row { order: 5; height: clamp(4.2rem, 12vmin, 5.6rem); }
#item-slots-row .slot-container[hidden],
#item-slots-row[hidden] { display: none !important; }
#screen-game #aim-control-overlay { order: 6; flex: 0 0 auto; }
#screen-game .status-combo {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 0 0 auto;
  gap: 0.35rem;
  padding: 0.18rem 0.35rem 0.22rem;
  margin: 0;
  max-height: 4.8rem;
  box-sizing: border-box;
  overflow: hidden;
}
#screen-game #live-feed-box {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  min-height: calc(3 * 1.35 * clamp(0.62rem, 2vmin, 0.78rem) + 0.55rem + 4px);
  height: auto;
  max-height: 4.6rem;
  margin: 0;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  border: 1.5px solid rgba(253, 203, 110, 0.35);
  border-radius: 0.55rem;
  background: rgba(15, 20, 24, 0.92);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  padding: 0.2rem 0.4rem;
}
#screen-game #live-feed-box > .live-feed-track {
  align-self: stretch;
}
#screen-game #live-feed-list {
  max-height: none;
  overflow: hidden;
}
/* 右盒只留延迟徽标：自己血量/剩球统一看桌毡信息牌与底栏六人卡 */
#screen-game #player-table-hud {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 0;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 0.18rem 0.3rem;
  flex-wrap: nowrap;
  gap: 0.08rem;
  overflow: hidden;
  pointer-events: none;
  box-shadow: none;
}
#screen-game #player-table-hud .player-hud-ping {
  font-size: clamp(0.62rem, 2vmin, 0.74rem);
  padding: 0.1rem 0.3rem;
  white-space: nowrap;
}

#screen-game[data-view="hall"] #aim-control-overlay,
#screen-game[data-view="hall"] #item-slots-row,
#screen-game[data-view="hall"] #slot-cue-container,
#screen-game[data-view="hall"] #table-loadout-rail,
#screen-game[data-view="hall"] #table-rival-rail { display: none; }
#screen-game[data-view="table"] #item-slots-row { display: none; }
#screen-game[data-view="table"] #aim-control-overlay { display: flex; }
/* 右盒只留延迟徽标，Hall/Table 统一常驻；血量剩球统一看桌毡牌与底栏六人卡 */
#screen-game[data-view="table"] #live-feed-box {
  flex: 1 1 auto;
  max-width: none;
}
#screen-game[data-view="table"] #canvas-wrapper {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  --table-rail-left: calc(0.15rem + clamp(3.8rem, 15vw, 5.4rem));
  --table-rail-right: calc(0.15rem + clamp(2.4rem, 9.5vw, 3.3rem));
}
#screen-game[data-view="table"] #gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
#screen-game[data-view="table"] #table-loadout-rail,
#screen-game[data-view="table"] #table-rival-rail {
  position: absolute;
  top: 0.25rem;
  bottom: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.12rem 0.08rem;
  margin: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none; /* 隐藏滚动条：轨道内位移动画/密集内容不弹条 */
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  z-index: 8;
  pointer-events: auto;
  box-sizing: border-box;
}
#screen-game[data-view="table"] #table-loadout-rail::-webkit-scrollbar,
#screen-game[data-view="table"] #table-rival-rail::-webkit-scrollbar {
  display: none;
}
#screen-game[data-view="table"] #table-loadout-rail {
  left: 0;
  width: var(--table-rail-left);
}
#screen-game[data-view="table"] #table-rival-rail {
  right: 0;
  width: var(--table-rail-right);
}
#screen-game[data-view="hall"] #canvas-wrapper {
  display: block;
}
#screen-game[data-view="table"] #toast-item-gain {
  z-index: 90;
}

.rail-section-label {
  font-size: clamp(0.55rem, 1.9vmin, 0.7rem);
  font-weight: 900;
  color: #fdcb6e;
  text-align: center;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.rail-cue-list,
.rail-item-list,
.rail-rival-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  align-items: stretch;
}
.rail-cue-btn,
.rail-item-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.14rem;
  min-height: clamp(3.2rem, 9.5vmin, 4.2rem);
  padding: 0.24rem 0.12rem;
  background: linear-gradient(180deg, #3a4245 0%, #2d3436 100%);
  border: 0.12rem solid #111;
  border-radius: 0.5rem;
  color: #fff;
  cursor: pointer;
  font-size: clamp(0.6rem, 2.2vmin, 0.8rem);
  line-height: 1.15;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.rail-cue-btn .rail-icon,
.rail-item-btn .rail-icon { font-size: clamp(1.3rem, 4vmin, 1.7rem); }
.rail-cue-btn.is-active {
  border-color: #fdcb6e;
  box-shadow: 0 0 0 0.12rem rgba(253, 203, 110, 0.55);
  background: linear-gradient(180deg, #4a3814 0%, #3d2e10 100%);
}
.rail-item-btn.is-selected {
  border-color: #74b9ff;
  box-shadow: 0 0 0 0.12rem rgba(116, 185, 255, 0.55);
  background: linear-gradient(180deg, #24506f 0%, #1a3a55 100%);
}
.rail-item-btn.is-empty {
  opacity: 0.45;
  pointer-events: none;
}
.rail-cue-btn.is-empty {
  opacity: 0.45;
  pointer-events: none;
}
.rail-item-btn.is-passive {
  border-style: dashed;
}
.rail-passive-tag {
  font-size: 0.55em;
  font-weight: 800;
  color: #a29bfe;
  letter-spacing: 0.04em;
}
.rail-item-btn.is-item-in,
.roster-card .rc-item.is-item-in {
  animation: item-arrive 0.72s ease;
}
@keyframes item-arrive {
  0% { transform: scale(0.55); filter: brightness(2.4); }
  45% { transform: scale(1.18); filter: brightness(1.7); }
  100% { transform: scale(1); filter: none; }
}
.item-vanish {
  position: fixed;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  font-size: clamp(1.3rem, 4vmin, 1.8rem);
  border-radius: 0.5rem;
  background: rgba(255, 211, 42, 0.28);
  box-shadow: 0 0 14px rgba(255, 211, 42, 0.85);
  animation: item-vanish 0.55s ease forwards;
}
@keyframes item-vanish {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.55) translateY(-10%); opacity: 0; filter: brightness(2.2); }
}
.rail-rival-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: clamp(3rem, 8.5vmin, 3.8rem);
  padding: 0.2rem 0.15rem;
  background: #636e72;
  border: 2px solid #111;
  border-radius: 0.5rem;
  color: #fff;
  cursor: pointer;
  font-size: clamp(0.55rem, 1.9vmin, 0.72rem);
  line-height: 1.15;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.rail-rival-btn:active { transform: scale(0.96); }
.rail-rival-btn.is-ko { opacity: 0.4; pointer-events: none; }
.rail-rival-btn.has-iframe { box-shadow: 0 0 0 2px #00d2d3; }
.rail-rival-btn .rr-avatar { font-size: clamp(1.15rem, 3.6vmin, 1.5rem); }
.rail-rival-btn .rr-hp { color: #ff7675; font-size: clamp(0.52rem, 1.8vmin, 0.68rem); }
.rail-rival-btn .rr-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#screen-menu { overflow-y: auto; padding: 18px; }
#screen-menu .match-waiting-panel, #screen-menu .menu-actions { width: min(100%, 650px); margin-left: auto; margin-right: auto; }
.drag-ghost {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  transform: translate(-50%, -130%);
  font-size: 16px;
  color: white;
  background: #292929;
  padding: 8px;
  border-radius: 6px;
}
.drag-ghost.is-returning {
  transform: translate(-50%, -50%);
  will-change: left, top, opacity, transform;
}
.match-countdown {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  pointer-events: none;
  font-size: clamp(4.5rem, 18vmin, 8rem);
  font-weight: 900;
  line-height: 1;
  color: #fffef2;
  text-shadow: 0 0.08em 0 #111, 0 0 0.35em rgba(255, 211, 42, 0.85);
}
.match-countdown.hidden { display: none; }
.rail-label-buff { color: #2ed573; }
.rail-label-foe { color: #ff7675; }
.rail-item-list-buff .rail-item-btn:not(.is-empty) {
  border-color: #1e8449;
  background: linear-gradient(180deg, #1e4d32 0%, #145a32 100%);
}
.rail-item-list-foe .rail-item-btn:not(.is-empty) {
  border-color: #c0392b;
  background: linear-gradient(180deg, #6b2a24 0%, #4a1c18 100%);
}
.rail-item-btn:not(.is-empty) { touch-action: none; }
@media (orientation: landscape) and (max-height: 500px) {
  #screen-game .top-hud { flex-basis: clamp(2rem, 8vh, 2.4rem); height: clamp(2rem, 8vh, 2.4rem); }
  #screen-game .status-combo { flex: 0 0 auto; }
  #screen-game #item-slots-row { height: clamp(3.2rem, 14vh, 4.2rem); }
  #screen-menu { display: block; }
  #screen-menu.hidden { display: none; }
  #screen-menu .menu-brand { display: none; }
}

/* 矮横屏压缩档：隐藏滚动条后栏内容必须真装得下，否则杆/道具按钮被推出视野 */
@media (orientation: landscape) and (max-height: 800px) {
  #screen-game[data-view="table"] .rail-section-label { font-size: 0.5rem; line-height: 1; }
  #screen-game[data-view="table"] .rail-cue-list,
  #screen-game[data-view="table"] .rail-item-list,
  #screen-game[data-view="table"] .rail-rival-list { gap: 0.18rem; }
  #screen-game[data-view="table"] .rail-cue-btn,
  #screen-game[data-view="table"] .rail-item-btn,
  #screen-game[data-view="table"] .rail-rival-btn { min-height: 2.7rem; padding: 0.14rem 0.1rem; gap: 0.06rem; }
}
@media (orientation: landscape) and (max-height: 560px) {
  #screen-game #live-feed-box { min-height: calc(3 * 1.25 * 0.58rem + 0.45rem); max-height: 3.6rem; }
  #screen-game .feed-item { font-size: 0.58rem; }
  #screen-game[data-view="table"] #table-loadout-rail,
  #screen-game[data-view="table"] #table-rival-rail { gap: 0.1rem; padding: 0.06rem; }
  #screen-game[data-view="table"] .rail-section-label { font-size: 0.45rem; }
  #screen-game[data-view="table"] .rail-cue-list,
  #screen-game[data-view="table"] .rail-item-list,
  #screen-game[data-view="table"] .rail-rival-list { gap: 0.1rem; }
  #screen-game[data-view="table"] .rail-cue-btn,
  #screen-game[data-view="table"] .rail-item-btn { min-height: 1.5rem; padding: 0.06rem 0.08rem; gap: 0.18rem; font-size: 0.62rem; flex-direction: row; }
  #screen-game[data-view="table"] .rail-cue-btn .rail-icon,
  #screen-game[data-view="table"] .rail-item-btn .rail-icon { font-size: 0.95rem; }
  #screen-game[data-view="table"] .rail-rival-btn { min-height: 2.4rem; padding: 0.06rem 0.08rem; gap: 0.03rem; font-size: 0.48rem; }
  #screen-game[data-view="table"] .rail-rival-btn .rr-avatar { font-size: 0.95rem; }
  #screen-game[data-view="table"] .rail-rival-btn .rr-hp { font-size: 0.45rem; }
  #screen-game .status-combo { max-height: 2.85rem; }
  /* pip 已铺满底栏，竖屏不再单独缩尺寸 */
  /* 矮横屏：底栏单行六卡压到最扁，力度条恢复吃满剩余高度 */
  #screen-game[data-view="table"] #aim-control-overlay { padding-top: 0.15rem; padding-bottom: calc(0.15rem + max(0.5vmin, env(safe-area-inset-bottom, 0px))); }
  #screen-game[data-view="table"] .roster-card {
    height: 2.9rem;
    min-height: 2.9rem;
    max-height: 2.9rem;
    padding: 0.1rem 0.14rem;
    gap: 0.1rem;
  }
  #screen-game[data-view="table"] .roster-card .rc-who { font-size: 0.5rem; }
  #screen-game[data-view="table"] .roster-card .rc-avatar { font-size: 0.72rem; }
  #screen-game[data-view="table"] .roster-card .rc-you { font-size: 0.58em; padding: 0.01rem 0.12rem; }
  #screen-game[data-view="table"] .roster-card .rc-seat { font-size: 0.66em; min-width: 1em; height: 1em; }
  #screen-game[data-view="table"] .roster-card .rc-balls { font-size: 0.52rem; padding: 0.02rem 0.18rem; }
  #screen-game[data-view="table"] .roster-card .rc-hearts { font-size: 0.95rem; }
  #screen-game[data-view="table"] .roster-card .rc-vitals { gap: 0; min-height: 1.05rem; }
  #screen-game[data-view="table"] .roster-card.rail-rival-btn {
    height: 2.9rem;
    min-height: 2.9rem;
    max-height: 2.9rem;
    padding: 0.1rem 0.14rem;
    gap: 0.1rem;
  }
  #screen-game[data-view="table"] .roster-card .rc-gear {
    height: 0.7rem;
    min-height: 0.7rem;
    font-size: 0.65rem;
    gap: 0.1rem;
  }
  #screen-game[data-view="table"] .roster-card .rc-status {
    height: 0.65em;
    min-height: 0.65em;
    font-size: 0.42rem;
  }
  #screen-game[data-view="table"] .roster-card .rc-threat { font-size: 0.42rem; top: -0.28rem; }
  #screen-game[data-view="table"] .power-meter-vertical { flex: 1 1 auto; }
}

/* ==========================================================================
   联机大厅 / 房间页
   ========================================================================== */
.screen-menu.hidden { display: none; }
.comic-btn:disabled { opacity: 0.45; cursor: not-allowed; }

#screen-lobby, #screen-room {
  justify-content: flex-start;
  gap: 12px;
  /* 与主菜单一致的蓝图方格底纹 */
  background-color: #f6eedb;
  background-image:
    linear-gradient(rgba(45, 52, 54, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 52, 54, 0.05) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 12%, rgba(254, 211, 48, 0.35) 0%, transparent 75%);
  background-size: 16px 16px, 16px 16px, 100% 100%;
}
#screen-lobby .lobby-panel, #screen-lobby .lobby-actions,
#screen-room .room-panel, #screen-room .room-actions, #screen-room .room-code-bar {
  width: min(100%, 650px);
  margin-left: auto;
  margin-right: auto;
}
.menu-title.lobby-title { font-size: clamp(24px, 7vmin, 34px); }

/* 联机大厅页控件 */
.lobby-code-row { display: flex; gap: 8px; margin-bottom: 8px; }
.lobby-code-input {
  flex: 1;
  min-width: 0;
  border: var(--border-thick);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: #ffffff;
  color: var(--text-main);
  user-select: text;
  -webkit-user-select: text;
}
.lobby-action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lobby-btn { width: 100%; }
.lobby-msg { min-height: 18px; font-size: 12px; font-weight: 800; text-align: center; color: #d63031; margin-top: 8px; }
.lobby-msg.ok { color: #27ae60; }
.room-last-result {
  margin: 6px 10px 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(46, 213, 115, 0.12);
  border: 1px solid rgba(46, 213, 115, 0.45);
  color: #2ed573;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

#incoming-threat {
  position: absolute;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  z-index: 30;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(231, 76, 60, 0.92);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  pointer-events: none;
}
#incoming-threat.is-on { display: flex; }

/* 受击红边 / 自增益蓝边 */
.hit-edge-flash {
  position: absolute;
  inset: 0;
  z-index: 28;
  pointer-events: none;
  opacity: 0;
  border-radius: inherit;
  box-shadow: none;
  transition: none;
}
.hit-edge-flash.is-on.is-red {
  animation: hitEdgeFlashRed 1.15s ease-out 1;
}
.hit-edge-flash.is-on.is-blue {
  animation: hitEdgeFlashBlue 1.15s ease-out 1;
}
@keyframes hitEdgeFlashRed {
  0% { opacity: 1; box-shadow: inset 0 0 0 3px rgba(255, 71, 87, 0.95), inset 0 0 28px 10px rgba(255, 71, 87, 0.55); }
  35% { opacity: 0.85; box-shadow: inset 0 0 0 4px rgba(255, 71, 87, 0.8), inset 0 0 36px 14px rgba(255, 71, 87, 0.4); }
  100% { opacity: 0; box-shadow: inset 0 0 0 0 rgba(255, 71, 87, 0), inset 0 0 0 0 rgba(255, 71, 87, 0); }
}
@keyframes hitEdgeFlashBlue {
  0% { opacity: 1; box-shadow: inset 0 0 0 3px rgba(54, 162, 255, 0.95), inset 0 0 28px 10px rgba(54, 162, 255, 0.5); }
  35% { opacity: 0.85; box-shadow: inset 0 0 0 4px rgba(54, 162, 255, 0.8), inset 0 0 36px 14px rgba(54, 162, 255, 0.38); }
  100% { opacity: 0; box-shadow: inset 0 0 0 0 rgba(54, 162, 255, 0), inset 0 0 0 0 rgba(54, 162, 255, 0); }
}

.live-feed-box { position: relative; }
#net-status {
  flex: 0 0 auto;
  align-self: center;
  margin: 0 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(214, 48, 49, 0.88);
  color: #fff;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
#net-status[hidden] { display: none; }
#match-pulse {
  position: static;
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 0.04rem;
  margin-right: 0.4rem;
  padding: 0.1rem 0.42rem 0.1rem 0.3rem;
  max-width: 46%;
  min-width: 0;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 211, 42, 0.55);
  background: #14181c;
  box-shadow: none;
  color: #f5f6fa;
  line-height: 1.18;
  overflow: hidden;
}
#match-pulse .mp-line {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}
#match-pulse .mp-tag {
  flex: 0 0 auto;
  font-size: 0.52rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #1a1204;
  background: #ffd32a;
  border-radius: 999px;
  padding: 0.1rem 0.3rem;
}
#match-pulse .mp-name {
  font-size: clamp(0.62rem, 2vmin, 0.76rem);
  font-weight: 900;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
#match-pulse .mp-hearts {
  flex: 0 0 auto;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: #ff6b6b;
}
#match-pulse .mp-stat,
#match-pulse .mp-alive {
  font-size: 0.58rem;
  font-weight: 800;
  color: #dfe6e9;
}
#match-pulse .mp-stat::before { content: "· "; color: #636e72; }
#match-pulse .mp-alive { color: #b2bec3; }
#match-pulse[hidden] { display: none; }
.feed-item { display: block; }
.feed-item.is-mine { color: #ffeaa7; font-weight: 900; }
.feed-item.is-critical { color: #ff7675; }
.feed-item.is-drama { color: #a29bfe; }
.lobby-list-title { font-size: 12px; font-weight: 900; color: #555; margin: 6px 0 6px; }
.lobby-room-list { display: flex; flex-direction: column; gap: 6px; }
.lobby-room-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f2f6;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 8px;
}
.lobby-room-row.locked { opacity: 0.55; }
.room-row-code {
  font-family: "Courier New", Courier, monospace;
  font-weight: 900;
  background: #ffe08a;
  border: 1.5px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}
.room-row-name { flex: 1; font-size: 12px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-row-count { font-size: 11px; font-weight: 900; }

/* 主菜单联机入口按钮配色 */
.menu-btn-online { background: linear-gradient(180deg, #00cec9 0%, #01a3a4 100%); }
.menu-btn-online:hover { background: linear-gradient(180deg, #3fe0db 0%, #0bbfc0 100%); }
.menu-btn-online .hero-btn-tag { color: #01a3a4; }

/* 房间内页：房间码常显条 */
.room-code-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-bg);
  border: var(--border-thick);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: var(--shadow-comic);
  font-weight: 900;
  font-size: 13px;
}
#room-code-text {
  font-family: "Courier New", Courier, monospace;
  font-size: 18px;
  letter-spacing: 3px;
  background: #ffe08a;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  padding: 1px 10px;
  user-select: text;
  -webkit-user-select: text;
}
.room-lock-badge { font-size: 11px; font-weight: 900; color: #d63031; }
.room-lock-badge.hidden { display: none; }

/* 席位踢人按钮与状态 */
.seat-kick {
  border: 2px solid var(--border-color);
  background: var(--primary-btn);
  color: #ffffff;
  font-weight: 900;
  border-radius: 5px;
  width: 22px;
  height: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.match-seat .seat-kick[hidden] { display: none; }
.match-seat.empty-seat { opacity: 0.5; }
.seat-status { font-size: 10px; font-weight: 900; flex-shrink: 0; }
.seat-status.waiting { color: #e67e22; }
.match-seat.locked-by-host { border-style: dashed; }


/* ==================== Table 视图 · iPad 设计稿弹性布局 ==================== */
#screen-game[data-view="table"] {
  --ui-panel: #1f2833;
  --ui-panel-2: #26303c;
  --ui-line: #3a4654;
  --ui-text: #e8edf2;
  --ui-muted: #9aa7b4;
  --ui-gold: #f5c542;
  --ui-gap: clamp(0.25rem, 1.2vmin, 0.6rem);
  background: #151b22;
}
#screen-game[data-view="table"] .top-hud {
  background: #fdf8ea;
}
#screen-game[data-view="table"] #live-feed-box .live-feed-track { display: none; }

#screen-game[data-view="table"] #canvas-wrapper {
  --table-rail-left: clamp(5.4rem, 23vw, 12rem);
  --table-rail-right: clamp(2.8rem, 10vw, 5.2rem);
  padding: 0;
}

/* 左栏：资料卡 + 战况日志 + 全局 */
#screen-game[data-view="table"] #table-profile-rail {
  position: absolute;
  top: var(--ui-gap);
  bottom: var(--ui-gap);
  left: var(--ui-gap);
  width: calc(var(--table-rail-left) - var(--ui-gap));
  display: flex;
  flex-direction: column;
  gap: var(--ui-gap);
  min-height: 0;
  z-index: 8;
  box-sizing: border-box;
  color: var(--ui-text);
}
#screen-game[data-view="hall"] #table-profile-rail { display: none; }
.profile-card,
.battle-log {
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: clamp(0.4rem, 1.4vmin, 0.8rem);
  box-sizing: border-box;
}
.profile-card {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.15rem, 0.8vmin, 0.45rem);
  padding: clamp(0.35rem, 1.4vmin, 0.8rem) clamp(0.25rem, 1vmin, 0.6rem);
}
.profile-avatar {
  width: clamp(2.2rem, 11vw, 5.2rem);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.1rem, 5.5vw, 2.6rem);
  font-weight: 900;
  color: #1f2833;
  background: radial-gradient(circle at 35% 30%, #fff6d8, #f5c542 70%);
  border: clamp(0.12rem, 0.5vw, 0.25rem) solid #1b4f8a;
  box-shadow: 0 0 0 0.12rem #5aa9ff;
}
.profile-name {
  max-width: 100%;
  font-weight: 900;
  font-size: clamp(0.7rem, 2.6vw, 1.15rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-seat {
  font-size: clamp(0.6rem, 2vw, 0.9rem);
  color: var(--ui-muted);
  font-weight: 700;
}
.profile-rank,
.profile-stats {
  width: 100%;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-line);
  border-radius: clamp(0.3rem, 1vmin, 0.55rem);
  padding: clamp(0.15rem, 0.7vmin, 0.4rem) clamp(0.2rem, 0.8vmin, 0.45rem);
  box-sizing: border-box;
  font-size: clamp(0.58rem, 2vw, 0.9rem);
}
.profile-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3em;
  color: var(--ui-gold);
  font-weight: 900;
}
.profile-stats {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.profile-stats > div {
  display: flex;
  justify-content: space-between;
  color: var(--ui-muted);
}
.profile-stats b { color: var(--ui-gold); }
.profile-hp {
  width: 100%;
  margin-top: 0.1rem;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-line);
  border-radius: clamp(0.3rem, 1vmin, 0.55rem);
  padding: clamp(0.25rem, 0.9vmin, 0.5rem) clamp(0.2rem, 0.8vmin, 0.45rem);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.profile-hp-label {
  font-size: clamp(0.55rem, 1.9vw, 0.8rem);
  font-weight: 800;
  color: var(--ui-muted);
  letter-spacing: 0.12em;
}
.profile-hp-hearts {
  color: #ff5a6a;
  font-size: clamp(0.85rem, 3.4vw, 1.45rem);
  letter-spacing: 0.1em;
  line-height: 1;
  font-weight: 900;
}
.profile-hp.is-critical {
  border-color: #ff4757;
  box-shadow: 0 0 0 1px rgba(255, 71, 87, 0.45);
}
.profile-hp.is-ko .profile-hp-hearts {
  color: #95a5a6;
  letter-spacing: 0;
  font-size: clamp(0.75rem, 2.8vw, 1.1rem);
}
.profile-vitals {
  width: 100%;
  background: var(--ui-panel-2);
  border: 1px solid var(--ui-line);
  border-radius: clamp(0.3rem, 1vmin, 0.55rem);
  padding: clamp(0.2rem, 0.8vmin, 0.45rem);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.profile-hearts {
  color: #ff5a6a;
  font-size: clamp(0.75rem, 3vw, 1.35rem);
  letter-spacing: 0.08em;
  line-height: 1;
}
.profile-balls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: clamp(0.58rem, 2vw, 0.9rem);
  color: #7fb8ff;
  font-weight: 700;
}
.profile-balls b { color: #fff; font-size: 1.25em; }

.battle-log {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: clamp(0.3rem, 1.1vmin, 0.65rem);
  overflow: hidden;
}
.battle-log-title {
  flex: 0 0 auto;
  font-weight: 900;
  color: var(--ui-gold);
  font-size: clamp(0.72rem, 2.4vw, 1.1rem);
  padding-bottom: 0.25rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid var(--ui-line);
}
.battle-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: clamp(0.2rem, 0.9vmin, 0.5rem);
}
.battle-log-list::-webkit-scrollbar { display: none; }
.battle-log-item {
  display: flex;
  flex-direction: column;
  gap: 0.06rem;
  font-size: clamp(0.66rem, 2.3vw, 0.98rem);
  line-height: 1.3;
  color: var(--ui-text);
}
.battle-log-time { color: var(--ui-muted); font-size: 0.85em; }
.battle-log-text { word-break: break-all; }
.battle-log-item.is-mine .battle-log-text { color: var(--ui-gold); }
.battle-log-item.is-critical .battle-log-text { color: #ff7675; }

#screen-game[data-view="table"] #table-profile-rail .btn-rail-global {
  flex: 0 0 auto;
  width: 100%;
  margin: 0;
  min-height: clamp(2.4rem, 7vmin, 3.4rem);
  background: var(--ui-panel-2);
  color: var(--ui-text);
  border: 1px solid var(--ui-line);
  border-radius: clamp(0.4rem, 1.4vmin, 0.8rem);
  box-shadow: none;
  font-size: clamp(0.7rem, 2.6vw, 1.1rem);
}

/* 右栏：力度条面板与操作模式切换 */
#screen-game[data-view="table"] #table-rival-rail {
  top: var(--ui-gap);
  bottom: var(--ui-gap);
  right: var(--ui-gap);
  width: calc(var(--table-rail-right) - var(--ui-gap));
  padding: clamp(0.2rem, 0.8vmin, 0.45rem);
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: clamp(0.4rem, 1.4vmin, 0.8rem);
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  align-items: stretch !important;
  gap: clamp(0.25rem, 1vmin, 0.5rem);
  overflow: hidden !important;
  box-sizing: border-box;
}
#screen-game[data-view="table"] .power-meter-vertical {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  border: 1px solid #0d1116;
  background: #10151b;
  border-radius: clamp(0.35rem, 1.2vmin, 0.55rem);
  box-sizing: border-box;
}
#screen-game[data-view="table"] .btn-control-mode {
  flex: 0 0 auto !important;
  width: 100% !important;
  min-height: clamp(2.2rem, 6vmin, 3rem);
  margin: 0;
  padding: clamp(0.25rem, 0.8vmin, 0.4rem) 0.1rem;
  font-size: clamp(0.72rem, 2.5vmin, 0.9rem);
  font-weight: 900;
  text-align: center;
  border-radius: clamp(0.35rem, 1.2vmin, 0.55rem);
  background: #2f3542;
  color: #f1f2f6;
  border: 1px solid #57606f;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  display: flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}
#screen-game[data-view="table"] .btn-control-mode:active {
  background: #57606f;
  transform: scale(0.96);
}
#screen-game[data-view="table"] .btn-control-mode.is-mode-b {
  background: #1e90ff;
  color: #ffffff;
  border-color: #70a1ff;
  box-shadow: 0 0 10px rgba(30, 144, 255, 0.6);
}

/* 底栏：深色面板 + 三组道具 + 六人卡 */
#screen-game[data-view="table"] #aim-control-overlay {
  background: #1a2129;
  border-top: 1px solid var(--ui-line);
  box-shadow: none;
  max-height: min(46vh, 50%);
  overflow-x: visible; /* 底栏三组槽位右边框勿被裁 */
  overflow-y: auto;
}
#screen-game[data-view="table"] #aim-control-overlay #table-loadout-rail {
  position: static;
  width: 100%;
  height: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ui-gap);
  padding: 0;
  overflow: visible;
  background: transparent;
}
#screen-game[data-view="table"] #aim-control-overlay #table-loadout-rail[hidden] { display: none; }
.loadout-group {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.15rem, 0.7vmin, 0.35rem);
  padding: clamp(0.2rem, 0.8vmin, 0.45rem);
  border-radius: clamp(0.35rem, 1.2vmin, 0.7rem);
  border-top: 2px solid var(--group-color);
  background: rgba(255, 255, 255, 0.03);
  box-sizing: border-box;
  overflow: visible; /* 勿裁切右侧槽位边框（iPad 常见） */
}
.loadout-group-cue { --group-color: #2ed573; }
.loadout-group-buff { --group-color: #3b9dff; }
.loadout-group-foe { --group-color: #ff5a5a; }
.loadout-group .rail-section-label {
  color: var(--group-color);
  font-size: clamp(0.58rem, 2vw, 0.95rem);
}
#screen-game[data-view="table"] .loadout-group .rail-cue-list,
#screen-game[data-view="table"] .loadout-group .rail-item-list {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: clamp(0.15rem, 0.8vmin, 0.45rem);
  width: 100%;
  min-width: 0;
  /* 两格应均分撑满；禁止横向滚动裁掉最后一格右边框 */
  overflow: visible;
  box-sizing: border-box;
}
.loadout-group .rail-cue-list::-webkit-scrollbar,
.loadout-group .rail-item-list::-webkit-scrollbar { display: none; }
#screen-game[data-view="table"] .loadout-group .rail-cue-btn,
#screen-game[data-view="table"] .loadout-group .rail-item-btn {
  flex: 1 1 0;
  min-width: 0; /* 允许在分组内收缩，避免 2×min-width 撑破再被 overflow 切边 */
  max-width: 100%;
  min-height: clamp(2.8rem, 9vmin, 4.6rem);
  padding: clamp(0.12rem, 0.6vmin, 0.35rem);
  font-size: clamp(0.68rem, 2.2vw, 1rem);
  border: 1.5px solid var(--group-color);
  background: rgba(0, 0, 0, 0.25);
  border-radius: clamp(0.3rem, 1vmin, 0.55rem);
  box-sizing: border-box;
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn .rail-icon,
#screen-game[data-view="table"] .loadout-group .rail-item-btn .rail-icon {
  font-size: clamp(1rem, 4.2vw, 2rem);
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn.is-active {
  border-color: var(--ui-gold);
  box-shadow: 0 0 0 0.12rem rgba(245, 197, 66, 0.5);
  background: rgba(245, 197, 66, 0.12);
}
#screen-game[data-view="table"] .loadout-group .rail-item-btn.is-empty {
  border-style: dashed;
  border-color: var(--ui-line);
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn.is-empty {
  border-style: dashed;
  border-color: var(--ui-line);
}

/* 六人卡：宽屏一行六个，窄手机两行三个 */
#screen-game[data-view="table"] .table-roster {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(0.2rem, 0.9vmin, 0.5rem);
}
#screen-game[data-view="table"] .roster-card,
#screen-game[data-view="table"] .roster-card.rail-rival-btn {
  height: auto;
  min-height: clamp(3.2rem, 10vmin, 5.6rem);
  max-height: none;
  background: var(--ui-panel);
  border: 1px solid var(--ui-line);
  border-radius: clamp(0.35rem, 1.2vmin, 0.7rem);
  gap: clamp(0.15rem, 0.8vmin, 0.45rem);
  padding: clamp(0.2rem, 0.8vmin, 0.45rem) clamp(0.15rem, 0.6vmin, 0.35rem);
  font-size: clamp(0.55rem, 1.9vw, 0.9rem);
}
#screen-game[data-view="table"] .roster-card.is-self {
  border: 2px solid var(--ui-gold);
  box-shadow: 0 0 0.6rem rgba(245, 197, 66, 0.35);
  background: #26303c;
}
#screen-game[data-view="table"] .roster-card .rc-hearts {
  color: #ff5a6a;
  font-size: clamp(0.85rem, 3vw, 1.35rem);
}
@media (orientation: portrait) and (max-width: 479px) {
  #screen-game[data-view="table"] .table-roster { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #screen-game[data-view="table"] .roster-card,
  #screen-game[data-view="table"] .roster-card.rail-rival-btn { min-height: 2.9rem; }
  #screen-game[data-view="table"] .loadout-group .rail-cue-btn span:not(.rail-icon),
  #screen-game[data-view="table"] .loadout-group .rail-item-btn span:not(.rail-icon) {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
@media (orientation: portrait) and (max-width: 359px) {
  #screen-game[data-view="table"] .battle-log-time { display: none; }
  #screen-game[data-view="table"] .profile-seat { display: none; }
}
/* 横屏：左栏收窄，底栏六卡一行 */
@media (orientation: landscape) {
  #screen-game[data-view="table"] #canvas-wrapper {
    --table-rail-left: clamp(6rem, 17vw, 12rem);
    --table-rail-right: clamp(2.8rem, 6vw, 4.6rem);
  }
  #screen-game[data-view="table"] .profile-avatar { width: clamp(2rem, 7vh, 4.2rem); font-size: clamp(1rem, 3.6vh, 2.2rem); }
}
@media (orientation: landscape) and (max-height: 560px) {
  #screen-game[data-view="table"] .profile-avatar,
  #screen-game[data-view="table"] .profile-seat { display: none; }
  #screen-game[data-view="table"] .loadout-group .rail-cue-btn,
  #screen-game[data-view="table"] .loadout-group .rail-item-btn { min-height: 2rem; flex-direction: row; }
  #screen-game[data-view="table"] .loadout-group .rail-section-label { display: none; }
  #screen-game[data-view="table"] #table-profile-rail .battle-log,
  #screen-game[data-view="table"] .profile-rank,
  #screen-game[data-view="table"] .profile-stats { display: none; }
}
@media (orientation: portrait) and (max-height: 700px) {
  #screen-game[data-view="table"] .profile-stats { display: none; }
}
/* 桌内：去掉状态条，延迟徽标并入标题栏 */
#screen-game[data-view="table"] #status-combo { display: none; }
#screen-game .top-hud #player-table-hud {
  width: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}
#screen-game .top-hud #player-table-hud .player-hud-ping {
  font-size: clamp(0.62rem, 2.2vmin, 0.85rem);
  font-weight: 900;
  color: #2d8a4e;
  background: transparent;
  border: none;
  padding: 0 0.2rem;
}
#screen-game .top-hud .hud-left { min-width: 0; }
#screen-game .top-hud #net-status {
  margin: 0;
  font-size: clamp(0.58rem, 2vmin, 0.75rem);
  white-space: nowrap;
}

/* 底部道具：加高，名字+次数完整显示（最多两行） */
#screen-game[data-view="table"] .loadout-group .rail-cue-btn,
#screen-game[data-view="table"] .loadout-group .rail-item-btn {
  min-height: clamp(3.8rem, 12vmin, 5.6rem);
  justify-content: center;
  gap: clamp(0.1rem, 0.5vmin, 0.25rem);
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn span:not(.rail-icon),
#screen-game[data-view="table"] .loadout-group .rail-item-btn span:not(.rail-icon) {
  max-width: 100%;
  white-space: normal;
  overflow: hidden;
  text-overflow: clip;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.15;
  text-align: center;
  word-break: break-all;
}
@media (orientation: landscape) and (max-height: 560px) {
  #screen-game[data-view="table"] .loadout-group .rail-cue-btn,
  #screen-game[data-view="table"] .loadout-group .rail-item-btn { min-height: 2.4rem; }
}
/* 顶栏：按设计稿 标题+标签 | 场馆·服务器 | 信号延迟 */
#screen-game .top-hud .hud-center {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
  align-items: center;
  gap: clamp(0.25rem, 1vw, 0.6rem);
  font-size: clamp(0.55rem, 1.7vw, 0.82rem);
  font-weight: 700;
  color: #4b5561;
  white-space: nowrap;
  overflow: hidden;
}
#screen-game[data-view="table"] .top-hud .hud-center { display: flex; }
#screen-game[data-view="table"] .top-hud #btn-sound,
#screen-game[data-view="table"] .top-hud #btn-pause { display: none; }
.hud-sep { color: #b9bfc6; }
.hud-server-state { display: inline-flex; align-items: center; gap: 0.3em; }
.hud-server-state i {
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  background: #9aa7b4;
  display: inline-block;
}
.hud-server-state[data-state="ok"] i { background: #27ae60; box-shadow: 0 0 0.3em #27ae60; }
.hud-server-state[data-state="warn"] i { background: #f39c12; }
.hud-server-state[data-state="down"] i { background: #e74c3c; }
@media (max-width: 599px) {
  #screen-game .top-hud .hud-center > span:not(.hud-server-state),
  #screen-game .top-hud .hud-center > .hud-sep { display: none; }
}

/* 右栏顶部：音乐 / 暂停 */
.rail-sys-btn {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.05rem;
  width: 100%;
  padding: clamp(0.2rem, 0.9vmin, 0.5rem) 0.1rem;
  border-radius: clamp(0.35rem, 1.2vmin, 0.7rem);
  border: 1px solid var(--ui-line, #3a4654);
  background: #26303c;
  color: #e8edf2;
  font-weight: 900;
  font-size: clamp(0.55rem, 2vw, 0.95rem);
  line-height: 1.1;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.rail-sys-btn small { font-size: 0.85em; color: #9aa7b4; }
.rail-sys-icon { font-size: clamp(0.9rem, 3.4vw, 1.6rem); line-height: 1; }
.rail-sys-btn.rail-sys-pause {
  background: linear-gradient(180deg, #2f80ed 0%, #1c5fc4 100%);
  border-color: #5aa9ff;
}
.rail-sys-btn:active { transform: scale(0.96); }
@media (orientation: landscape) and (max-height: 560px) {
  .rail-sys-btn > span:not(.rail-sys-icon), .rail-sys-btn small { display: none; }
}
/* 顶栏恢复音乐/暂停；战况日志与底栏防抖；球杆名/次数分行 */
#screen-game[data-view="table"] .top-hud #btn-sound,
#screen-game[data-view="table"] .top-hud #btn-pause { display: inline-flex !important; }
#screen-game[data-view="table"] .top-hud .hud-right {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}
#screen-game[data-view="table"] .battle-log-list {
  overflow-anchor: none;
  overscroll-behavior: contain;
  contain: content;
}
#screen-game[data-view="table"] .battle-log-item {
  flex: 0 0 auto;
  min-height: 2.1em;
}
.roster-card .rc-status:empty {
  display: block !important;
  visibility: hidden;
  height: 0.95em;
  min-height: 0.95em;
  content: "";
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn .rail-name,
#screen-game[data-view="table"] .loadout-group .rail-item-btn .rail-name,
#screen-game[data-view="table"] .loadout-group .rail-item-btn span:not(.rail-icon):not(.rail-passive-tag) {
  font-size: clamp(0.72rem, 2.4vw, 1.05rem);
  font-weight: 900;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  letter-spacing: 0.02em;
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn .rail-uses {
  font-size: 0.95em;
  font-weight: 900;
  color: #f5c542;
  line-height: 1;
  letter-spacing: 0.02em;
}
#screen-game[data-view="table"] .loadout-group .rail-cue-btn span:not(.rail-icon):not(.rail-name):not(.rail-uses) {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  text-align: center;
}
/* 左栏去掉血量剩球；段位/积分/胜率略放大；底栏六人卡字号放大 */
#screen-game[data-view="table"] .profile-vitals { display: none !important; }
#screen-game[data-view="table"] .profile-rank {
  font-size: clamp(0.72rem, 2.6vw, 1.15rem);
  padding: clamp(0.22rem, 0.9vmin, 0.5rem) clamp(0.25rem, 1vmin, 0.55rem);
}
#screen-game[data-view="table"] .profile-rank-icon { font-size: 1.15em; }
#screen-game[data-view="table"] .profile-stats {
  font-size: clamp(0.72rem, 2.6vw, 1.15rem);
  padding: clamp(0.22rem, 0.9vmin, 0.5rem) clamp(0.25rem, 1vmin, 0.55rem);
  gap: 0.18rem;
}
#screen-game[data-view="table"] .profile-stats b { font-size: 1.12em; }
#screen-game[data-view="table"] .roster-card,
#screen-game[data-view="table"] .roster-card.rail-rival-btn {
  min-height: clamp(3.6rem, 11.5vmin, 6.2rem);
  font-size: clamp(0.68rem, 2.4vw, 1.05rem);
  gap: clamp(0.2rem, 0.9vmin, 0.5rem);
  padding: clamp(0.25rem, 1vmin, 0.55rem) clamp(0.18rem, 0.8vmin, 0.4rem);
}
#screen-game[data-view="table"] .roster-card .rc-name {
  font-size: clamp(0.72rem, 2.5vw, 1.05rem);
}
#screen-game[data-view="table"] .roster-card .rc-name-text {
  font-size: 1em;
}
#screen-game[data-view="table"] .roster-card .rc-hearts {
  font-size: clamp(1.05rem, 3.8vw, 1.55rem);
}
#screen-game[data-view="table"] .roster-card .rc-balls {
  font-size: clamp(0.7rem, 2.5vw, 1rem);
  padding: 0.08rem 0.28rem;
}
#screen-game[data-view="table"] .roster-card .rc-status {
  font-size: clamp(0.62rem, 2.2vw, 0.85rem);
  height: 1em;
  min-height: 1em;
}
#screen-game[data-view="table"] .roster-card .rc-you {
  font-size: 0.85em;
}
@media (orientation: portrait) and (max-width: 479px) {
  #screen-game[data-view="table"] .roster-card,
  #screen-game[data-view="table"] .roster-card.rail-rival-btn { min-height: 3.2rem; }
}
/* ---- 个人中心 / 排行榜 ---- */
#screen-profile {
  justify-content: flex-start;
  gap: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
}
#screen-profile > .menu-brand {
  margin: 4px 0 0;
}
#screen-profile > .menu-brand .menu-title.lobby-title {
  font-size: clamp(26px, 7vmin, 34px);
}
.profile-panel {
  max-width: 440px;
  width: min(100%, 440px);
  margin-left: auto;
  margin-right: auto;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fffdf7;
}
.profile-hero {
  display: flex;
  align-items: center;
  gap: 12px;
}
.profile-preview-avatar {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-size: 40px;
  line-height: 1;
  background: linear-gradient(180deg, #fff7d6 0%, #ffe08a 100%);
  border: 3px solid #1a1a1a;
  border-radius: 18px;
  box-shadow: 3px 3px 0 #1a1a1a;
}
.profile-hero-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-avatar-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
  gap: 5px;
}
.profile-avatar-pick {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  display: grid;
  place-items: center;
  font-size: clamp(1rem, 4vw, 1.25rem);
  line-height: 1;
  padding: 0;
  border: 1.5px solid #c5c0b0;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}
.profile-avatar-pick:hover {
  border-color: #1a1a1a;
  background: #fff8e1;
}
.profile-avatar-pick.selected {
  background: #ffe08a;
  border: 2px solid #1a1a1a;
  box-shadow: 2px 2px 0 #1a1a1a;
  transform: translateY(-1px);
}
.profile-field-label {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #636e72;
  text-transform: none;
}
.profile-name-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  width: 100%;
}
.profile-name-input {
  flex: 1;
  min-width: 0;
  width: auto;
}
.btn-profile-save {
  flex: 0 0 auto;
  white-space: nowrap;
  padding-left: 12px;
  padding-right: 12px;
}
.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.profile-stat {
  background: #fff;
  border: 1.5px solid #d9d3c2;
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  box-shadow: none;
}
.profile-stat.is-primary {
  background: #fff8e1;
  border-color: #1a1a1a;
  box-shadow: 2px 2px 0 #1a1a1a;
}
.profile-stat span {
  display: block;
  font-size: 10px;
  font-weight: 800;
  color: #8395a7;
}
.profile-stat b {
  display: block;
  font-size: 14px;
  margin-top: 3px;
  color: #1a1a1a;
}
.profile-stat.is-primary b {
  font-size: 15px;
}
.profile-restore-box {
  margin: 0;
  padding: 0;
  border: 1.5px dashed #c5c0b0;
  border-radius: 10px;
  background: #faf7ef;
  overflow: hidden;
}
.profile-restore-summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  color: #636e72;
  padding: 8px 10px;
  user-select: none;
}
.profile-restore-summary::-webkit-details-marker { display: none; }
.profile-restore-summary::before {
  content: "▸ ";
  color: #8395a7;
}
.profile-restore-box[open] .profile-restore-summary::before {
  content: "▾ ";
}
.profile-restore-body {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-restore-row {
  display: flex;
  gap: 6px;
  margin-bottom: 0;
}
.profile-restore-row .lobby-code-input {
  flex: 1;
  min-width: 0;
  font-size: 11px;
}
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 52vh;
  overflow: auto;
}
.leaderboard-row {
  display: grid;
  grid-template-columns: 48px 36px 1fr 56px 64px;
  gap: 6px;
  align-items: center;
  background: #fff;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 8px;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 2px 2px 0 var(--border-color);
}
.leaderboard-row.me { background: #ffe08a; }
.lb-pos { font-family: "Courier New", monospace; }
.lb-av { font-size: 18px; text-align: center; }
.lb-score { text-align: right; }
.lb-tier { font-size: 11px; opacity: 0.8; text-align: right; }
.leaderboard-mine {
  margin-top: 10px;
  padding: 8px 10px;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  font-weight: 900;
  text-align: center;
  background: #fff8e1;
}
.gameover-score-delta {
  margin: 8px 0 4px;
  font-size: 16px;
  font-weight: 900;
  color: #0b6e4f;
  text-align: center;
}

/* 胜负闪屏（结算菜单前） */
.match-result-banner {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.match-result-banner.hidden {
  display: none;
}
.match-result-banner-inner {
  text-align: center;
  padding: 24px 28px;
  animation: match-result-pop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.match-result-banner-title {
  font-size: clamp(2.4rem, 12vmin, 4.2rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.04em;
  text-shadow: 0 0.06em 0 #111, 0 0 0.4em rgba(0, 0, 0, 0.45);
}
.match-result-banner.is-win .match-result-banner-title {
  color: #ffe566;
}
.match-result-banner.is-lose .match-result-banner-title {
  color: #ff8a80;
}
.match-result-banner-sub {
  margin-top: 10px;
  font-size: clamp(1rem, 4.2vmin, 1.35rem);
  font-weight: 800;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 0.05em 0 #111;
  min-height: 1.2em;
}
.match-result-banner-sub:empty {
  display: none;
}
.match-result-banner-hint {
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.72);
}
@keyframes match-result-pop {
  0% { transform: scale(0.72); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@media (max-width: 480px) {
  .profile-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .leaderboard-row { grid-template-columns: 40px 28px 1fr 48px; }
  .lb-tier { display: none; }
}

/* no-select-callout: block long-press text selection / search / translate popups on mobile */
html, body, body * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* ===== 设置菜单（行由 js/main.js SETTINGS_SCHEMA 渲染） ===== */
#modal-settings { z-index: 120; }
.settings-dialog { max-width: 380px; }
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px 6px 4px 0;
}
.settings-row {
  background: #ffffff;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--border-color);
  padding: 10px 12px 4px;
}
.settings-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-row-label {
  flex: 1;
  font-size: 15px;
  font-weight: 900;
  color: var(--text-main);
}
.settings-row-value {
  min-width: 2.4em;
  text-align: right;
  font-size: 14px;
  font-weight: 900;
  color: #57606f;
  font-variant-numeric: tabular-nums;
}
.comic-btn.settings-toggle {
  min-width: 52px;
  min-height: 34px;
  font-size: 14px;
}
.settings-row.is-off .settings-range { opacity: 0.45; }
.settings-range {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 36px;
  margin: 2px 0 0;
  background: transparent;
  cursor: pointer;
  touch-action: none;
  accent-color: var(--accent-gold);
}
.settings-range:focus { outline: none; }
.settings-range::-webkit-slider-runnable-track {
  height: 10px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: linear-gradient(to right, var(--accent-gold) var(--pct, 100%), #dfe4ea var(--pct, 100%));
}
.settings-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--border-color);
  box-shadow: 2px 2px 0 var(--border-color);
}
.settings-range::-moz-range-track {
  height: 10px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: #dfe4ea;
}
.settings-range::-moz-range-progress {
  height: 10px;
  border-radius: 6px;
  background: var(--accent-gold);
}
.settings-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--border-color);
  box-shadow: 2px 2px 0 var(--border-color);
}
/* 主菜单右上角齿轮 */
#screen-menu .menu-settings-btn {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  z-index: 5;
}

/* ===== 语言切换（js/i18n.js） ===== */
.settings-seg {
  display: flex;
  gap: 8px;
  margin: 8px 0 6px;
}
.comic-btn.settings-seg-btn {
  flex: 1;
  min-height: 36px;
  font-size: 14px;
}
#screen-menu .menu-lang-btn {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: calc(max(10px, env(safe-area-inset-right)) + 58px);
  z-index: 5;
  gap: 2px;
  font-size: 13px;
}
.menu-lang-btn span { opacity: 0.5; }
.menu-lang-btn span.is-cur { opacity: 1; color: var(--primary-btn); }
/* English: keep brand on one line */
body[data-lang="en"] .top-hud .hud-brand,
body[data-lang="en"] .top-hud .hud-sub { white-space: nowrap; }
/* i18n-en: rail item/cue names wrap to 2 lines */
body[data-lang="en"] #screen-game[data-view="table"] .loadout-group .rail-cue-btn .rail-name,
body[data-lang="en"] #screen-game[data-view="table"] .loadout-group .rail-item-btn .rail-name {
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
  hyphens: none;
  font-size: clamp(0.55rem, 1.9vw, 0.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* English: threat warning tip enlarged */
body[data-lang="en"] #incoming-threat {
  font-size: 13px;
  padding: 7px 14px;
}
