/* ===== Dungeon Drifter — Styles ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  background: #0a0a12;
  color: #eee;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  user-select: none;
}
#game-root {
  position: relative;
  width: 100vw; height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
#game-canvas {
  background: #0e0e18;
  border: 2px solid #2a2a3e;
  box-shadow: 0 0 40px rgba(120, 60, 200, 0.2);
  image-rendering: pixelated;
  cursor: crosshair;
  max-width: 100%;
  max-height: 100%;
}

/* HUD */
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 10px 16px;
  /* V2.7.4 iPhone 刘海/灵动岛适配 */
  padding-top: max(10px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  pointer-events: none;
  z-index: 5;
}
.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.hp-wrap { display: flex; align-items: center; gap: 8px; min-width: 240px; }
.hp-bar {
  width: 220px; height: 18px;
  background: #1a1a2a;
  border: 1px solid #444;
  border-radius: 9px;
  overflow: hidden;
}
#hp-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff4d6d, #ff8aa2);
  transition: width 0.2s;
}
#hp-text { font-size: 13px; color: #ffb0b8; }
.meta {
  display: flex; gap: 18px;
  font-size: 14px; color: #cfc8ff;
  text-shadow: 0 0 6px rgba(0,0,0,0.6);
}
.meta b { color: #ffe17a; }
.skill-wrap { display: flex; gap: 10px; }
.skill-icon {
  position: relative;
  width: 56px; height: 56px;
  background: #1a1a2a;
  border: 1px solid #555;
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end;
  padding-bottom: 4px;
  font-size: 11px;
  color: #aaa;
  overflow: hidden;
}
.skill-icon .skill-key {
  position: absolute; top: 4px; left: 50%;
  transform: translateX(-50%);
  font-size: 10px; color: #fff; font-weight: bold;
  background: rgba(0,0,0,0.4); padding: 1px 4px; border-radius: 3px;
}
.skill-icon .skill-glyph {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  font-size: 20px;
  pointer-events: none;
}
.skill-icon .skill-name {
  position: relative; z-index: 2;
  color: #ffe17a;
}
.skill-cd {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 0;
  background: rgba(0,0,0,0.65);
  transition: height 0.05s linear;
}
#perks-list {
  margin-top: 8px;
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 12px;
}
.perk-tag {
  background: rgba(80, 60, 140, 0.65);
  border: 1px solid #8a6cff;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
}
.perk-tag .stack { color: #ffe17a; margin-left: 4px; font-weight: bold; }

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 12, 0.78);
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  backdrop-filter: blur(3px);
}
.overlay.hidden, .hidden { display: none !important; }
.panel {
  background: linear-gradient(160deg, #1c1830, #0e0c1c);
  border: 1px solid #4a3d80;
  padding: 32px 48px;
  border-radius: 14px;
  text-align: center;
  min-width: 360px;
  box-shadow: 0 6px 30px rgba(80, 50, 200, 0.4);
  /* V2.7.4 内容超过屏幕时可滚动 */
  max-height: 92vh;
  max-width: 96vw;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
/* V2.7.4 自定义滚动条（更细） */
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb { background: rgba(106,85,194,0.5); border-radius: 3px; }
.panel h1 {
  font-size: 44px; line-height: 1;
  background: linear-gradient(180deg, #ffe17a, #ff7d5b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 4px;
  margin-bottom: 8px;
}
.panel h2 { font-size: 28px; margin-bottom: 20px; color: #ffe17a; }
.dead-title { color: #ff6680 !important; }
.win-title { color: #7dffaf !important; }
.subtitle {
  color: #a89bd8;
  letter-spacing: 6px;
  margin-bottom: 28px;
  font-size: 13px;
}
.btn {
  display: block;
  margin: 10px auto;
  padding: 10px 28px;
  width: 240px;
  background: #2a224a;
  color: #fff;
  border: 1px solid #6a55c2;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 2px;
}
.btn:hover {
  background: #3d3170;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(110, 80, 220, 0.5);
}
.help {
  margin-top: 18px;
  text-align: left;
  background: rgba(0,0,0,0.3);
  padding: 14px 18px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.9;
  color: #d6d0ff;
}
.result {
  margin: 16px 0 24px;
  font-size: 15px;
  color: #cfc8ff;
  line-height: 1.8;
}
.result b { color: #ffe17a; }

/* Perk cards */
#perk-cards {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  justify-content: center;
}
.perk-card {
  width: 180px;
  padding: 18px 14px;
  background: linear-gradient(160deg, #2a1f50, #14102a);
  border: 1px solid #6a55c2;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s;
}
.perk-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(140, 90, 255, 0.5);
  border-color: #ffe17a;
}
.perk-card .perk-icon {
  font-size: 36px;
  margin-bottom: 8px;
  display: block;
}
.perk-card .perk-name {
  font-size: 16px;
  color: #ffe17a;
  font-weight: bold;
  margin-bottom: 6px;
}
.perk-card .perk-desc {
  font-size: 12px;
  color: #cfc8ff;
  line-height: 1.5;
}
.perk-card.rare { border-color: #ff8a4d; }
.perk-card.rare .perk-name { color: #ff8a4d; }
.perk-card.weapon { border-color: #7dffaf; background: linear-gradient(160deg, #1a3a2a, #14102a); }
.perk-card.weapon .perk-name { color: #7dffaf; }

/* ===== V2 ===== */
/* Weapon slots */
#weapon-slots {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.weapon-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(20, 18, 36, 0.78);
  border: 1px solid #4a3d80;
  border-radius: 6px;
  font-size: 11px;
  color: #888;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.45;
  transition: all 0.18s;
}
.weapon-slot.owned {
  opacity: 1;
  color: #cfc8ff;
}
.weapon-slot.current {
  border-color: #ffe17a;
  box-shadow: 0 0 12px rgba(255, 225, 122, 0.5);
  background: rgba(50, 38, 76, 0.85);
}
.weapon-slot .wk { color: #ffe17a; font-weight: bold; }
.weapon-slot .wi { font-size: 16px; }
.weapon-slot .wn { color: inherit; }
.weapon-slot .wl {
  color: #7dffaf;
  font-weight: bold;
  background: rgba(0,0,0,0.4);
  padding: 0 4px;
  border-radius: 3px;
  margin-left: 2px;
}

/* HP low pulse */
.hp-bar.low {
  animation: hpLowPulse 0.6s ease-in-out infinite;
}
@keyframes hpLowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 109, 0); }
  50% { box-shadow: 0 0 14px 2px rgba(255, 77, 109, 0.7); }
}
.hp-bar { box-shadow: 0 0 0 0 transparent; transition: box-shadow 0.2s; }

/* Settings panel */
.settings-panel { min-width: 460px; max-width: 520px; }
#settings-body {
  text-align: left;
  margin: 14px 0 18px;
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
  border-bottom: 1px solid rgba(106, 85, 194, 0.3);
}
.set-row:last-child { border-bottom: none; }
.set-row label {
  color: #cfc8ff;
  font-size: 14px;
}
.set-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}
.set-ctrl input[type="checkbox"] {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: #7dffaf;
}
.set-ctrl input[type="range"] {
  width: 140px;
  accent-color: #ffe17a;
}
.set-ctrl select {
  background: #2a224a;
  color: #fff;
  border: 1px solid #6a55c2;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
  cursor: pointer;
}
.set-val {
  color: #ffe17a;
  font-size: 12px;
  min-width: 36px;
  text-align: right;
}

/* Scoreboard on death/win */
.scoreboard {
  margin-top: 14px;
  padding: 10px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  border: 1px solid rgba(106, 85, 194, 0.4);
  font-size: 12px;
}
.sb-title {
  color: #ffe17a;
  font-weight: bold;
  margin-bottom: 6px;
  text-align: center;
  font-size: 13px;
}
.sb-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 4px;
  color: #cfc8ff;
}
.sb-row > span:first-child { color: #ffe17a; min-width: 24px; }
.sb-result.win { color: #7dffaf; }
.sb-result.dead { color: #ff6680; }

/* Character select */
.char-panel { min-width: 720px; max-width: 820px; }
.char-hint {
  color: #a89bd8;
  font-size: 12px;
  margin-bottom: 14px;
  letter-spacing: 1px;
}
#char-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 6px 0 18px;
}
.char-card {
  padding: 14px 12px;
  background: linear-gradient(160deg, #1c1830, #0e0c1c);
  border: 2px solid #4a3d80;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.18s;
}
.char-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(140, 90, 255, 0.45);
  border-color: #ffe17a;
}
.char-card.last {
  border-color: #7dffaf;
  box-shadow: 0 0 16px rgba(125, 255, 175, 0.35);
}
.char-emoji {
  font-size: 44px;
  margin-bottom: 4px;
  line-height: 1;
}
.char-name {
  font-size: 17px;
  font-weight: bold;
  margin-bottom: 6px;
  letter-spacing: 2px;
}
.char-blurb {
  font-size: 12px;
  color: #cfc8ff;
  line-height: 1.5;
  min-height: 36px;
  margin-bottom: 8px;
}
.char-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  color: #ffe17a;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 0;
  border-radius: 4px;
}

/* V2.2 ultimate skill */
.skill-icon.ultimate {
  border-color: #ffe17a;
  background: linear-gradient(160deg, #2a224a, #1a1230);
  box-shadow: 0 0 8px rgba(255, 225, 122, 0.3);
}
.skill-icon.ultimate.active {
  animation: ultActive 0.4s ease-in-out infinite alternate;
}
@keyframes ultActive {
  from { box-shadow: 0 0 6px rgba(255, 225, 122, 0.5); }
  to { box-shadow: 0 0 18px rgba(255, 225, 122, 0.95), 0 0 30px rgba(255, 138, 77, 0.6); }
}

/* Synergy / awakening tags */
.perk-tag.synergy {
  background: linear-gradient(90deg, #4a3380, #803348);
  border-color: #ff8a4d;
  color: #fff;
  font-weight: bold;
  animation: synGlow 2.4s ease-in-out infinite;
}
@keyframes synGlow {
  0%, 100% { box-shadow: 0 0 4px rgba(255, 138, 77, 0.4); }
  50% { box-shadow: 0 0 12px rgba(255, 138, 77, 0.8); }
}
.perk-tag.awaken {
  background: linear-gradient(90deg, #803333, #ff5d8b);
  border-color: #ffe17a;
  color: #fff;
  font-weight: bold;
}

/* ===== V2.3 移动端适配 =====
 * V2.6 修正：仅在 pointer:coarse（真触屏设备）时启用，避免桌面窄窗口被误伤。
 * V2.7.4 加入：safe-area / 紧凑横屏 / panel 滚动 / perk 横排 2 列 / 角色 3 列
 */
@media (pointer: coarse) {
  /* canvas 等比缩放铺满屏幕 */
  #game-canvas {
    width: 100vw;
    height: auto;
    max-height: 100vh;
    border: none;
    box-shadow: none;
    cursor: default;
  }
  /* 横屏更舒服 */
  @media (orientation: portrait) {
    #game-canvas { width: 100vw; }
  }
  /* 设置面板/角色选择面板在小屏占满 */
  .panel { min-width: 88vw !important; padding: 18px 14px; max-height: 90vh; }
  .panel h1 { font-size: 28px; margin-bottom: 4px; }
  .panel h2 { font-size: 20px; margin-bottom: 12px; }
  .subtitle { margin-bottom: 16px; font-size: 12px; letter-spacing: 4px; }
  .btn { width: 80vw; max-width: 280px; padding: 12px 16px; font-size: 14px; margin: 6px auto; }
  .char-panel { max-width: 96vw !important; }
  /* V2.7.4：手机横屏 6 个角色 3 列更紧凑（原 2 列要竖滚） */
  #char-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .char-card { padding: 6px 4px; }
  .char-emoji { font-size: 28px; margin-bottom: 2px; }
  .char-name { font-size: 12px; letter-spacing: 0; margin-bottom: 4px; }
  .char-blurb { font-size: 10px; min-height: 0; line-height: 1.3; margin-bottom: 4px; }
  .char-stats { font-size: 10px; gap: 8px; padding: 2px 0; }
  /* HUD 小屏紧凑 */
  #hud { padding: 6px 8px; padding-top: max(6px, env(safe-area-inset-top)); }
  .hp-wrap { min-width: 130px; }
  .hp-bar { width: 110px; height: 14px; }
  #hp-text { font-size: 11px; }
  .meta { gap: 8px; font-size: 11px; }
  .skill-icon { width: 44px; height: 44px; }
  .skill-icon .skill-glyph { font-size: 16px; }
  .skill-icon .skill-name { font-size: 9px; }
  .skill-icon .skill-key { font-size: 9px; }
  #weapon-slots { display: none; }   /* 武器槽用画布上的虚拟按钮 1-4 */
  /* 操作说明文本紧凑 */
  .help { font-size: 11px; line-height: 1.5; padding: 10px 12px; }
  .help p { margin: 0; }
  .set-row label { font-size: 12px; }
  .set-row { padding: 6px 4px; }
  .set-ctrl input[type="range"] { width: 100px; }
  /* V2.7.4：默认横排 2 列卡（横屏空间够，竖排会溢出）；竖屏才竖排 */
  #perk-cards { flex-direction: row; flex-wrap: wrap; gap: 8px; justify-content: center; }
  .perk-card { width: calc(33% - 8px); min-width: 130px; max-width: 180px; padding: 10px 6px; }
  .perk-card .perk-icon { font-size: 24px; margin-bottom: 4px; }
  .perk-card .perk-name { font-size: 12px; margin-bottom: 4px; }
  .perk-card .perk-desc { font-size: 10px; line-height: 1.3; }
}

/* V2.7.4：触屏 + 竖屏（过渡态，遮罩没关）保留竖排，因为宽度太小 */
@media (pointer: coarse) and (orientation: portrait) {
  #perk-cards { flex-direction: column; }
  .perk-card { width: 84vw; max-width: 320px; }
  #char-grid { grid-template-columns: repeat(2, 1fr); }
}

/* V2.7.4：手机横屏（高度极小）— 主菜单按钮缩小、subtitle 隐藏 */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 480px) {
  .panel { padding: 12px 14px; }
  .panel h1 { font-size: 24px; line-height: 1.05; margin-bottom: 2px; }
  .subtitle { display: none; }
  .btn { padding: 8px 14px; font-size: 13px; margin: 4px auto; width: 60vw; max-width: 240px; }
  .help { max-height: 38vh; overflow-y: auto; font-size: 10px; line-height: 1.4; }
}

/* 触屏：禁用文本选中 + 长按菜单 */
@media (pointer: coarse) {
  body, canvas { -webkit-user-select: none; -webkit-touch-callout: none; }
  #game-canvas { touch-action: none; }
}

/* V2.6 桌面窄窗温和适配：仅在 pointer:fine + 窄屏时收紧，不竖排卡牌 */
@media (pointer: fine) and (max-width: 980px) {
  /* 词条三选一面板溢出修复：缩小卡牌宽度而不是竖排 */
  #perk-cards { gap: 10px; }
  .perk-card { width: 150px; padding: 14px 10px; }
  .perk-card .perk-icon { font-size: 30px; }
  .perk-card .perk-name { font-size: 14px; }
  .perk-card .perk-desc { font-size: 11px; }
  .panel { padding: 22px 28px; }
  .settings-panel, .char-panel { min-width: 92vw !important; }
}
@media (pointer: fine) and (max-width: 720px) {
  /* 极窄桌面窗口（很少见，但兜底）：词条改竖排 */
  #perk-cards { flex-direction: column; }
  .perk-card { width: 280px; }
}

/* ===== V2.5 横屏强制 + 全屏 + 竖屏遮罩 ===== */
#rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: linear-gradient(160deg, #1c1830 0%, #0a0a12 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cfc8ff;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}
/* V2.7.1：用户点"进入全屏/已横屏"后强制永久隐藏，
 * 优先级最高，覆盖所有 media query */
#rotate-overlay.force-hidden,
#rotate-overlay.hidden.force-hidden {
  display: none !important;
}
.rotate-content {
  text-align: center;
  padding: 30px;
}
.rotate-icon {
  font-size: 64px;
  margin-bottom: 18px;
  animation: rotateHint 2s ease-in-out infinite;
}
@keyframes rotateHint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}
.rotate-title {
  font-size: 22px;
  color: #ffe17a;
  font-weight: bold;
  margin-bottom: 10px;
  letter-spacing: 2px;
}
.rotate-hint {
  font-size: 14px;
  color: #a89bd8;
  margin-bottom: 24px;
}
/* V2.7.1：遮罩里两个按钮明显可点 */
#rotate-overlay .btn {
  margin: 6px;
  padding: 12px 28px;
  font-size: 16px;
  cursor: pointer;
  /* 防止 iOS Safari 长按弹菜单 / 双击放大 */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}
#rotate-overlay .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #cfc8ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* 触屏 + 竖屏 → 显示遮罩 */
@media (pointer: coarse) and (orientation: portrait) {
  #rotate-overlay:not(.hidden) { display: flex; }
}
@media (pointer: coarse) and (orientation: landscape) {
  #rotate-overlay { display: none !important; }
}
/* 桌面/键鼠：永不显示遮罩 */
@media (pointer: fine) {
  #rotate-overlay { display: none !important; }
}

/* 移动端横屏：让 canvas 等比铺满视口（短边对齐） */
@media (pointer: coarse) and (orientation: landscape) {
  html, body { width: 100vw; height: 100vh; }
  #game-root {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #000;
  }
  #game-canvas {
    /* 等比缩放：以 vh 为参照（短边在横屏下是 height） */
    height: 100vh !important;
    width: calc(100vh * 1.5) !important;     /* 960 / 640 = 1.5 */
    max-width: 100vw;
    max-height: 100vh;
    border: none;
    box-shadow: none;
    /* 视口宽度不够时（极端横屏比例 < 1.5），按 vw 反缩 */
  }
  /* 极宽屏（>1.5）→ 上面的宽度算法可能超过 vw，max-width 会兜底 */
  /* 极窄屏（<1.5，如部分平板 4:3）→ 改用 width 100vw 反算高度 */
  @media (max-aspect-ratio: 3/2) {
    #game-canvas {
      width: 100vw !important;
      height: calc(100vw / 1.5) !important;
    }
  }
}

/* ===== V2.7.5 移动端虚拟控制（HTML 层，与 canvas 解耦） =====
 * 修复点：
 *   1) 右上暂停按钮原画在 canvas 内，被刘海/灵动岛遮挡 + 缩放后过小 → 改 HTML 用 safe-area-inset 避开
 *   2) 右下三键原 r=38（76px）过大 → 改 vmin 单位自适应，横屏 360px 高度下也合理
 *   3) 输入与画板分离：HTML 按钮独立于 canvas 缩放，触摸响应更稳
 */
#mobile-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;     /* 容器透传，子按钮单独激活 */
  z-index: 8;               /* HUD(5) 之上，overlay(10) 之下，菜单显示时按钮自动被遮罩盖住 */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#mobile-controls.hidden { display: none !important; }
.mc-btn {
  pointer-events: auto;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(26, 26, 42, 0.55);
  border: 1.5px solid #6a55c2;
  color: #fff;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s, background 0.1s;
  backdrop-filter: blur(2px);
}
.mc-btn:active, .mc-btn.pressed {
  transform: scale(0.92);
  background: rgba(61, 49, 112, 0.85);
}
.mc-sub {
  font-size: 8px;
  color: #ffe17a;
  font-weight: bold;
  letter-spacing: 1px;
  margin-top: 2px;
  line-height: 1;
}

/* 右上暂停（避开刘海 / 灵动岛） */
.mc-pause {
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 22px;
  border-color: #ff5d8b;
  background: rgba(40, 20, 35, 0.65);
}

/* 右下三键三角形布局 */
.mc-action-cluster {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  width: 160px;
  height: 130px;
  pointer-events: none;
}
.mc-action {
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 22px;
}
.mc-bomb  { right: 0;  bottom: 0;  border-color: #ff8a4d; }
.mc-shift { right: 56px; bottom: 56px; border-color: #9af2ff; }
.mc-q     { right: 0;  bottom: 70px; border-color: #ffe17a; }

/* 左下武器槽 1-4 */
.mc-weapon-row {
  position: absolute;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.mc-weapon {
  position: static;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 14px;
  border-color: #4a3d80;
}

/* V2.7.5 横屏小屏（手机典型）— 按钮整体缩小 + 距离收紧 */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 480px) {
  .mc-pause { width: 38px; height: 38px; font-size: 18px; }
  .mc-action { width: 48px; height: 48px; font-size: 18px; }
  .mc-action-cluster { width: 130px; height: 110px; }
  .mc-shift { right: 48px; bottom: 48px; }
  .mc-q     { bottom: 60px; }
  .mc-weapon { width: 32px; height: 32px; font-size: 12px; }
  .mc-weapon-row { gap: 4px; }
  .mc-sub { font-size: 7px; }
}

/* V2.7.5 大屏平板 — 按钮可以略大些更易点 */
@media (pointer: coarse) and (orientation: landscape) and (min-height: 600px) {
  .mc-pause { width: 52px; height: 52px; font-size: 26px; }
  .mc-action { width: 68px; height: 68px; font-size: 26px; }
  .mc-action-cluster { width: 180px; height: 150px; }
  .mc-shift { right: 68px; bottom: 68px; }
  .mc-q     { bottom: 80px; }
  .mc-weapon { width: 44px; height: 44px; font-size: 16px; }
}

/* 桌面/键鼠永不显示 */
@media (pointer: fine) {
  #mobile-controls { display: none !important; }
}
