/* 雷霆前线 · 移动端触控按键 + 小屏适配 */

/* ---------------- 屏幕按键 ---------------- */
.tc-ui {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  pointer-events: none;
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.tc-ui > * { touch-action: none; }

/* 右侧滑动区域：拖动画面转视角 */
.tc-look {
  position: absolute;
  top: 0; right: 0;
  width: 62%; height: 100%;
  pointer-events: auto;
  touch-action: none;
}

.tc-pause {
  position: absolute;
  top: 12px; right: 12px;
  width: 40px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  color: #cfe4f2;
  font-size: 13px;
  letter-spacing: 2px;
  background: rgba(8, 16, 22, .62);
  border: 1px solid rgba(90, 150, 190, .45);
  border-radius: 8px;
  backdrop-filter: blur(4px);
}
.tc-pause.on { background: rgba(55, 198, 255, .32); }

/* 左虚拟摇杆 */
.tc-stick {
  position: absolute;
  left: 18px; bottom: 26px;
  width: 136px; height: 136px;
  pointer-events: auto;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(12, 24, 33, .30) 0%, rgba(8, 16, 23, .48) 68%, rgba(8, 16, 23, .66) 100%);
  border: 1px solid rgba(120, 180, 215, .30);
  box-shadow: inset 0 0 26px rgba(55, 198, 255, .07), 0 4px 20px rgba(0, 0, 0, .35);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
.tc-stick.active { border-color: rgba(55, 198, 255, .65); }
.tc-stick-ring {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 1px dashed rgba(130, 190, 225, .22);
  display: flex; align-items: center; justify-content: center;
}
.tc-stick-knob {
  position: absolute;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(90, 190, 240, .70), rgba(20, 60, 85, .82));
  border: 1px solid rgba(150, 220, 255, .8);
  box-shadow: 0 0 18px rgba(55, 198, 255, .45), inset 0 0 12px rgba(255, 255, 255, .18);
  will-change: transform;
}
.tc-stick-label {
  position: absolute; bottom: -20px; left: 0; right: 0;
  text-align: center; font-size: 10px; letter-spacing: 3px;
  color: rgba(190, 220, 238, .6);
}

/* 右侧按键组 */
.tc-cluster {
  position: absolute;
  right: 14px; bottom: 22px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}
/* 2 行 4 列的小按键组：压低整体高度，避免遮住右下弹药 / 右上击杀信息 */
.tc-grid {
  display: grid;
  grid-template-columns: repeat(4, 54px);
  grid-auto-rows: 54px;
  gap: 8px;
  direction: rtl;
  pointer-events: none;
}
.tc-btn {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 50%;
  color: #dceefb;
  background: radial-gradient(circle at 35% 28%, rgba(30, 56, 74, .72), rgba(8, 16, 23, .78));
  border: 1px solid rgba(110, 180, 220, .48);
  box-shadow: 0 3px 14px rgba(0, 0, 0, .45), inset 0 0 14px rgba(55, 198, 255, .08);
  backdrop-filter: blur(4px);
  touch-action: none;
  transition: transform .08s, background .08s, box-shadow .08s;
  padding: 0;
}
.tc-btn b { font-size: 19px; line-height: 1; font-weight: 600; }
.tc-btn small { font-size: 9px; letter-spacing: 1px; color: rgba(200, 226, 242, .78); }
.tc-btn.sm { width: 54px; height: 54px; }
.tc-btn.sm b { font-size: 17px; }
.tc-btn.on, .tc-btn.latched {
  background: radial-gradient(circle at 35% 28%, rgba(55, 198, 255, .55), rgba(14, 52, 75, .88));
  border-color: rgba(120, 230, 255, .95);
  box-shadow: 0 0 20px rgba(55, 198, 255, .55), inset 0 0 14px rgba(255, 255, 255, .18);
  transform: scale(.93);
}
.tc-btn.latched.on { background: radial-gradient(circle at 35% 28%, rgba(255, 190, 60, .55), rgba(80, 52, 10, .88)); border-color: var(--gold); }
.tc-btn.fire {
  width: 98px; height: 98px;
  margin-left: 4px;
  background: radial-gradient(circle at 35% 28%, rgba(120, 70, 20, .78), rgba(30, 16, 6, .86));
  border: 2px solid rgba(255, 179, 0, .75);
  box-shadow: 0 0 24px rgba(255, 179, 0, .24), inset 0 0 18px rgba(255, 179, 0, .12);
}
.tc-btn.fire b { font-size: 38px; color: #ffd77a; }
.tc-btn.fire small { font-size: 11px; letter-spacing: 3px; color: #ffe0a0; }
.tc-btn.fire.on {
  background: radial-gradient(circle at 35% 28%, rgba(255, 190, 70, .72), rgba(110, 55, 8, .92));
  box-shadow: 0 0 34px rgba(255, 179, 0, .65), inset 0 0 20px rgba(255, 255, 255, .22);
}

/* ---------------- 小屏 / 触屏布局 ---------------- */
@media (max-width: 820px), (pointer: coarse) {
  html, body { overflow: hidden; }

  /* 登录页：上下排布，隐藏长宣传文案 */
  #screen-auth {
    flex-direction: column;
    gap: 18px;
    padding: 24px 14px;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
  }
  .auth-hero { max-width: 100%; text-align: center; }
  .auth-hero h1 { font-size: 30px; letter-spacing: 4px; line-height: 1.2; }
  .auth-hero ul { display: none; }
  .auth-box { width: min(100%, 400px); padding: 24px 20px 20px; }
  .auth-box .input-wrap input { font-size: 16px; }   /* 防 iOS 自动缩放 */

  /* 大厅：导航栏改底部横向 */
  .lobby-topbar { height: 52px; padding: 0 12px; gap: 10px; }
  .profile-name { font-size: 13px; }
  .wallet { font-size: 12px; }
  .lobby-body { flex-direction: column; }
  .content { order: 1; padding: 14px 12px 20px; }
  .rail {
    order: 2;
    width: 100%;
    height: 60px;
    flex-direction: row;
    padding: 4px 2px;
    gap: 0;
    border-right: none;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    flex-shrink: 0;
  }
  .rail-item { flex: 1 0 auto; min-width: 62px; padding: 6px 4px; font-size: 10px; }
  .rail-item svg { width: 20px; height: 20px; }
  .lobby-footer { display: none; }
  .panel-title { flex-wrap: wrap; gap: 6px; }
  .panel-title h2 { font-size: 19px; letter-spacing: 3px; }
  .panel-title span { font-size: 10px; }
  .mode-cards, .map-strip, .goods-grid, .maps-grid {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  .mode-card, .map-strip > *, .goods-grid > *, .maps-grid > * {
    flex: 0 0 168px;
    scroll-snap-align: start;
  }
  .hall-grid { grid-template-columns: 1fr; }
  .armory-layout { grid-template-columns: 1fr; }
  .settings-form { max-width: 100%; }
  .set-row { flex-wrap: wrap; }

  /* 战斗 HUD 缩放 */
  #dnd-badge { top: 54px; right: 12px; }
  #minimap-wrap { width: 104px; top: 10px; left: 10px; }
  #minimap { width: 104px; height: 104px; }
  #hud-topbar { top: 8px; transform: translateX(-50%) scale(.82); transform-origin: top center; }
  #killfeed { top: 76px; right: 8px; max-width: 46vw; }
  #hud-bottom-left { left: 10px; bottom: 172px; }
  #hud-bottom-right { right: 10px; bottom: 172px; }
  #hp-plate, .ammo-plate { transform: scale(.86); transform-origin: bottom left; }
  .hp-plate { transform-origin: bottom left; }
  #scoreboard { transform: scale(.8); transform-origin: center; }
  .end-box { width: min(94vw, 520px); padding: 26px 18px; }
  #end-result { font-size: 34px; letter-spacing: 8px; }
  .end-stats { gap: 5px; }
  .es-num { font-size: 18px; }
  .pm-box { width: min(90vw, 330px); }

  /* 匹配弹窗缩小 */
  .mm-card { transform: scale(.86); transform-origin: center; }
  .mm-roster { max-height: 30vh; overflow-y: auto; }
}

/* 手机横屏且高度很小时再压一档 */
@media (max-height: 460px) and (pointer: coarse) {
  .tc-cluster { bottom: 8px; gap: 6px; }
  .tc-grid { grid-template-columns: repeat(4, 44px); grid-auto-rows: 44px; gap: 6px; }
  .tc-btn.sm { width: 44px; height: 44px; }
  .tc-btn.fire { width: 78px; height: 78px; }
  .tc-btn.fire b { font-size: 30px; }
  .tc-stick { width: 108px; height: 108px; bottom: 10px; left: 10px; }
  .tc-stick-ring { width: 78px; height: 78px; }
  .tc-stick-knob { width: 38px; height: 38px; }
  #hud-bottom-left, #hud-bottom-right { bottom: 128px; }
}

/* 触屏设备隐藏"点击锁定鼠标"提示 */
body.tc-mobile #lock-hint { display: none !important; }
body.tc-mobile .key-legend { display: none; }

/* ---------------- 电脑端键位说明 ---------------- */
.key-legend {
  margin-top: 16px;
  padding: 14px 16px;
  background: rgba(10, 18, 25, .72);
  border: 1px solid var(--line);
  clip-path: var(--chamfer);
}
.key-legend h4 { font-size: 12px; letter-spacing: 3px; color: var(--gold); margin-bottom: 10px; }
.key-legend .kl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 7px 14px; }
.key-legend .kl-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt-dim); }
.key-legend kbd {
  min-width: 30px;
  padding: 2px 6px;
  text-align: center;
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--txt-bright);
  background: #17242f;
  border: 1px solid var(--line-hi);
  border-bottom-width: 2px;
  border-radius: 3px;
}
@media (pointer: coarse) { .key-legend { display: none; } }

/* 移动端：社交面板全宽显示，避免与虚拟按键重叠 */
@media (max-width: 820px) {
  .world-chat {
    top: auto; right: 0; left: 0; bottom: 0; width: 100%;
    height: 42vh; border-left: none; border-right: none; border-bottom: none;
    z-index: 30;
  }
  .lobby-footer { display: none; }
  .team-panel {
    left: 8px; right: 8px; bottom: 150px; width: auto; max-height: 38vh;
  }
  .hud-voice { right: 8px; bottom: 154px; padding: 12px 16px; }
  .voice-status { right: 8px; bottom: 196px; }
}
