/* ==========================================================================
   堑壕前线 Trench Front — 二次元军事 UI
   高饱和 + 粗描边字 + 圆角磨砂面板，整体走动画游戏 HUD 的语言。
   ========================================================================== */

:root {
  --ink: #10131c;
  --ink-2: #1b2030;
  --paper: #f4f1ea;
  --line: rgba(255, 255, 255, .16);
  --gold: #ffcf5c;
  --danger: #ff4d5e;
  --team0: #4db8ff;
  --team1: #ff7a4d;
  --font: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05070c;
  color: var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body { user-select: none; }

.hidden { display: none !important; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
}

/* ------------------------------------------------------------ 背景 */
.menu-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 22% 12%, rgba(255, 176, 92, .28), transparent 62%),
    radial-gradient(900px 620px at 84% 78%, rgba(70, 120, 200, .30), transparent 66%),
    linear-gradient(168deg, #2a3348 0%, #1a2030 46%, #0d1017 100%);
}
.menu-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image:
    repeating-linear-gradient(102deg, rgba(255,255,255,.045) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(-14deg, rgba(0,0,0,.16) 0 3px, transparent 3px 13px);
}

/* ------------------------------------------------------------ 主菜单 */
.menu-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 12px 24px 24px;
  margin-top: 64px;
  height: calc(100% - 64px);
  overflow: auto;
}

.logo { margin: 0; text-align: center; line-height: 1; }
.logo-cn {
  display: block;
  font-size: clamp(40px, 7.4vw, 88px);
  font-weight: 900;
  letter-spacing: .12em;
  color: #fff;
  text-shadow:
    0 4px 0 #8f3418, 0 7px 0 #4a1c0c,
    4px 0 0 #10131c, -4px 0 0 #10131c, 0 4px 0 #10131c,
    0 0 42px rgba(255, 160, 70, .6);
}
.logo-en {
  display: block;
  margin-top: 12px;
  font-size: clamp(12px, 1.5vw, 20px);
  font-weight: 800;
  letter-spacing: .62em;
  color: var(--gold);
  text-shadow: 0 2px 0 #3a2408;
}
.logo-sub {
  margin: 12px 0 18px;
  font-size: 14px;
  letter-spacing: .22em;
  color: rgba(244, 241, 234, .72);
}

.panel {
  background: linear-gradient(180deg, rgba(30, 38, 56, .94), rgba(16, 20, 30, .96));
  border: 2px solid rgba(255, 255, 255, .16);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
  backdrop-filter: blur(9px);
}

.menu-panel {
  width: min(430px, 92vw);
  padding: 24px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2em;
  color: rgba(244, 241, 234, .62);
}

#input-name {
  width: 100%;
  padding: 13px 15px;
  font-family: var(--font);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, .38);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#input-name:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 207, 92, .18); }

.switch-field { flex-direction: row; align-items: center; justify-content: space-between; }

.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 13px 7px 8px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  color: rgba(244, 241, 234, .55);
  background: rgba(0, 0, 0, .38);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  cursor: pointer;
}
.switch i { width: 20px; height: 20px; border-radius: 50%; background: #5b6579; transition: background .15s, box-shadow .15s; }
.switch.on { color: #14181f; background: var(--gold); border-color: #ffe7a8; }
.switch.on i { background: #2f7d32; box-shadow: 0 0 10px rgba(120, 240, 140, .9); }
.switch:disabled { cursor: default; }

.bot-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bot-row > span { font-size: 12px; font-weight: 700; letter-spacing: .2em; color: rgba(244, 241, 234, .62); }
.bot-row.off { opacity: .34; pointer-events: none; }

.seg { display: flex; gap: 6px; }
.seg button {
  min-width: 44px;
  padding: 8px 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 800;
  color: rgba(244, 241, 234, .7);
  background: rgba(0, 0, 0, .38);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 9px;
  cursor: pointer;
}
.seg button.on { color: #14181f; background: var(--gold); border-color: #ffe7a8; }

.map-field { display: flex; flex-direction: column; gap: 8px; }
.map-label { font-size: 12px; font-weight: 700; letter-spacing: .2em; color: rgba(244, 241, 234, .62); }
.map-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.map-btn {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
  font-family: var(--font);
  color: rgba(244, 241, 234, .78);
  background: rgba(0, 0, 0, .38);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.map-btn b { font-size: 14px; font-weight: 900; letter-spacing: .06em; }
.map-btn span { font-size: 10.5px; font-weight: 700; line-height: 1.4; color: rgba(244, 241, 234, .45); }
.map-btn:hover { border-color: rgba(255, 207, 92, .5); }
.map-btn.on { color: #14181f; background: var(--gold); border-color: #ffe7a8; }
.map-btn.on span { color: rgba(43, 21, 8, .68); }
@media (max-width: 560px) { .map-row { grid-template-columns: 1fr; } }

.big-btn {
  margin-top: 4px;
  padding: 16px;
  font-family: var(--font);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: .18em;
  color: #2b1508;
  background: linear-gradient(180deg, #ffd97a, #f0a230);
  border: 3px solid #fff1cc;
  border-radius: 13px;
  cursor: pointer;
  box-shadow: 0 7px 0 #a45f14, 0 14px 26px rgba(255, 150, 40, .3);
  transition: transform .08s, box-shadow .08s;
}
.big-btn:hover { filter: brightness(1.07); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 3px 0 #a45f14; }
.big-btn:disabled { filter: grayscale(.7) brightness(.72); cursor: not-allowed; transform: none; box-shadow: 0 5px 0 #555; }
.big-btn.small { font-size: 16px; padding: 13px 30px; letter-spacing: .12em; }

.ghost-btn {
  padding: 13px 22px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .1em;
  color: rgba(244, 241, 234, .8);
  background: rgba(0, 0, 0, .3);
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 11px;
  cursor: pointer;
}
.ghost-btn:hover { border-color: rgba(255, 255, 255, .4); color: #fff; }
.ghost-btn.on { color: #14181f; background: var(--gold); border-color: #ffe7a8; }

.mini-btn {
  padding: 6px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  color: rgba(244, 241, 234, .82);
  background: rgba(0, 0, 0, .4);
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.mini-btn:hover { border-color: rgba(255, 255, 255, .45); color: #fff; }

/* ------------------------------------------------------------ 界面语言 */
.lang-chip {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 5;
  min-width: 58px;
  padding: 9px 14px;
  font: 800 13px/1 var(--font);
  letter-spacing: .12em;
  color: rgba(244, 241, 234, .82);
  background: rgba(0, 0, 0, .38);
  border: 2px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  cursor: pointer;
}
.lang-chip:hover { color: #fff; border-color: rgba(255, 255, 255, .45); }

.lang-row { display: flex; gap: 8px; }
.lang-row .room-btn { flex: 1; padding: 11px 10px; }

.hint { margin: 0; font-size: 11.5px; line-height: 1.7; text-align: center; color: rgba(244, 241, 234, .5); }
.hint.dim { color: rgba(244, 241, 234, .34); }
.error { min-height: 18px; margin: 0; font-size: 13px; font-weight: 700; color: var(--danger); }

/* ------------------------------------------------------------ 兵种选择 */
.select-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 26px clamp(18px, 4vw, 60px) 22px;
  gap: 14px;
  overflow: auto;
}
.select-head h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); font-weight: 900; letter-spacing: .1em; text-shadow: 0 3px 0 rgba(0,0,0,.5); }
.select-head p { margin: 6px 0 0; font-size: 13px; color: rgba(244, 241, 234, .58); }

.class-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  flex: 0 0 auto;
}
@media (max-width: 860px) { .class-row { grid-template-columns: repeat(2, 1fr); } }

.class-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 14px;
  background: linear-gradient(180deg, rgba(28, 34, 50, .93), rgba(14, 17, 25, .96));
  border: 2px solid rgba(255, 255, 255, .13);
  border-radius: 16px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.class-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 130px;
  background: radial-gradient(120px 90px at 50% 26%, var(--tc, #fff), transparent 72%);
  opacity: .3;
  pointer-events: none;
}
.class-card:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, .34); }
.class-card.on {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 207, 92, .22), 0 16px 34px rgba(0, 0, 0, .5);
}
.class-card canvas { position: relative; width: 100%; height: auto; aspect-ratio: 3 / 3.4; image-rendering: auto; }
.cc-name { position: relative; margin-top: 6px; font-size: 19px; font-weight: 900; letter-spacing: .08em; }
.cc-en { position: relative; font-size: 10px; font-weight: 800; letter-spacing: .3em; color: rgba(244, 241, 234, .42); }
.cc-role { position: relative; margin-top: 7px; font-size: 11.5px; font-weight: 800; color: var(--tc, #fff); }
.cc-tag { position: relative; margin-top: 4px; font-size: 11px; line-height: 1.5; color: rgba(244, 241, 234, .55); }
.cc-stats { position: relative; display: flex; gap: 10px; margin-top: 9px; font-size: 11px; color: rgba(244, 241, 234, .62); }
.cc-stats b { color: #fff; }

.weapon-block { flex: 0 0 auto; min-height: auto; display: flex; flex-direction: column; gap: 10px; }
.weapon-block h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .28em;
  color: rgba(244, 241, 234, .58);
}

.weapon-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 860px) { .weapon-row { grid-template-columns: 1fr; } }

.weapon-card {
  padding: 13px 14px;
  background: linear-gradient(180deg, rgba(28, 34, 50, .9), rgba(14, 17, 25, .95));
  border: 2px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.weapon-card:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, .3); }
.weapon-card.on { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 207, 92, .2); }
.wc-name { font-size: 14.5px; font-weight: 800; }
.wc-en { font-size: 10px; font-weight: 700; letter-spacing: .16em; color: rgba(244, 241, 234, .4); }
.wc-desc { margin: 8px 0 10px; font-size: 11.5px; line-height: 1.55; color: rgba(244, 241, 234, .62); }
.wc-bar { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 8px; margin-top: 5px; font-size: 10.5px; color: rgba(244, 241, 234, .5); }
.wc-bar i { display: block; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.wc-bar i b { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--tc, #ffcf5c), #fff); }
.wc-tag { display: inline-block; margin-top: 9px; padding: 3px 8px; font-size: 10px; font-weight: 800; border-radius: 6px; background: rgba(255, 207, 92, .18); color: var(--gold); }

.select-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 4px; }
.team-note { font-size: 12.5px; font-weight: 700; letter-spacing: .1em; color: rgba(244, 241, 234, .55); }
.team-note b { color: var(--gold); }

/* ------------------------------------------------------------ HUD */
#screen-hud { z-index: 5; pointer-events: none; }

#topbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 18px;
  background: rgba(8, 11, 18, .62);
  border: 2px solid rgba(255, 255, 255, .12);
  border-radius: 13px;
  backdrop-filter: blur(7px);
}
.tb-score { display: flex; align-items: center; gap: 9px; }
.tb-name { font-size: 11px; font-weight: 800; letter-spacing: .14em; }
#tb-name-0 { color: var(--team0); }
#tb-name-1 { color: var(--team1); }
.tb-num { font-size: 27px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
#tb-score-0 { color: var(--team0); text-shadow: 0 0 16px rgba(77, 184, 255, .6); }
#tb-score-1 { color: var(--team1); text-shadow: 0 0 16px rgba(255, 122, 77, .6); }
.tb-center { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: center; gap: 4px; padding: 0 12px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
#tb-timer { font-size: 17px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--gold); }
.tb-limit { font-size: 10px; color: rgba(244, 241, 234, .45); }
.tb-limit b { color: rgba(244, 241, 234, .8); }
.tb-map { flex-basis: 100%; text-align: center; font-size: 10px; font-weight: 700; letter-spacing: .16em; color: rgba(244, 241, 234, .5); }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair .ch {
  position: absolute;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 0 3px rgba(0, 0, 0, .9);
  transition: transform .05s linear;
}
#crosshair.aiming .ch { opacity: 0; }
.ch-t, .ch-b { width: 2px; height: 9px; left: -1px; }
.ch-l, .ch-r { width: 9px; height: 2px; top: -1px; }
.ch-t { bottom: var(--gap, 8px); } .ch-b { top: var(--gap, 8px); }
.ch-l { right: var(--gap, 8px); }  .ch-r { left: var(--gap, 8px); }
.ch-dot {
  position: absolute;
  left: -1.5px; top: -1.5px;
  width: 3px; height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, .9);
}
#hitmarker {
  position: absolute;
  left: -20px; top: -20px;
  width: 40px; height: 40px;
  opacity: 0;
  stroke: #fff;
  stroke-width: 3.2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, .9));
}
#hitmarker.show { animation: hm .26s ease-out; }
#hitmarker.kill { stroke: var(--danger); }
@keyframes hm { 0% { opacity: 1; transform: scale(.55); } 100% { opacity: 0; transform: scale(1.35); } }

/* Damage numbers: one floating label per confirmed hit, drifted off the crosshair
   so a burst of shots reads as a stack rather than a single blinking value. */
#dmg-pops { position: absolute; left: 0; top: 0; }
.dmg-pop {
  position: absolute;
  left: 0; top: 0;
  --dx: 0px;
  font: 800 19px/1 var(--font);
  color: #fff;
  pointer-events: none;
  white-space: nowrap;
  text-shadow: 0 0 4px rgba(0, 0, 0, .95), 0 0 12px rgba(0, 0, 0, .65);
  animation: dmg-pop .72s cubic-bezier(.2, .7, .3, 1) forwards;
}
.dmg-pop.head { color: #ffd54a; font-size: 24px; }
.dmg-pop.kill { color: var(--danger); }
@keyframes dmg-pop {
  0% { opacity: 0; transform: translate(calc(-50% + var(--dx)), -50%) scale(.55); }
  18% { opacity: 1; transform: translate(calc(-50% + var(--dx)), -74%) scale(1.14); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% - 46px)) scale(1); }
}

#damage-vignette {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 38%, rgba(190, 20, 40, .78) 100%);
  transition: opacity .35s ease-out;
}
/* Directional hit marker: a red wedge pinned to the screen edge in the direction
   the damage came from. --dir is the bearing in degrees, 0 = straight ahead,
   growing clockwise, which is also how conic-gradient counts. */
#hit-dir {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  --dir: 0deg;
  background: conic-gradient(from calc(var(--dir) - 27deg),
    rgba(214, 30, 52, 0) 0deg,
    rgba(214, 30, 52, .95) 27deg,
    rgba(214, 30, 52, 0) 54deg,
    rgba(214, 30, 52, 0) 360deg);
  -webkit-mask-image: radial-gradient(circle at center, transparent 24%, #000 70%);
  mask-image: radial-gradient(circle at center, transparent 24%, #000 70%);
  transition: opacity .45s ease-out;
}
#suppress-blur {
  position: absolute;
  inset: 0;
  opacity: 0;
  backdrop-filter: blur(3.2px) saturate(.72);
  background: radial-gradient(ellipse at center, transparent 34%, rgba(20, 20, 30, .5) 100%);
  transition: opacity .25s;
}

#killfeed { position: absolute; top: 66px; right: 16px; width: max-content; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.kf {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 800;
  background: rgba(8, 11, 18, .68);
  border-left: 3px solid #888;
  border-radius: 7px;
  animation: slidein .2s ease-out;
}
@keyframes slidein { from { opacity: 0; transform: translateX(22px); } }
.kf.me { border-left-color: var(--gold); }
.kf.victim { border-left-color: var(--danger); }
.kf .who { color: #fff; }
.kf .wep { font-size: 10.5px; color: rgba(244, 241, 234, .5); }
.kf .hs { color: var(--gold); font-size: 15px; }

#chat-log { position: absolute; left: 16px; bottom: 118px; display: flex; flex-direction: column; gap: 4px; max-width: 42vw; }
.chat-line { padding: 4px 10px; font-size: 12.5px; background: rgba(8, 11, 18, .6); border-radius: 6px; }
.chat-line b { margin-right: 6px; }

#statusbar {
  position: absolute;
  left: 22px; right: 22px; bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.hp-wrap { display: flex; flex-direction: column; gap: 5px; width: min(290px, 34vw); }
.hp-bar {
  position: relative;
  height: 15px;
  background: rgba(8, 11, 18, .72);
  border: 2px solid rgba(255, 255, 255, .2);
  border-radius: 8px;
  overflow: hidden;
}
#hp-fill {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, #64e07a, #b6f36a);
  transition: width .18s ease-out, background .2s;
}
.hp-bar.low #hp-fill { background: linear-gradient(90deg, #ff4340, #ff9060); }
.hp-text { display: flex; align-items: baseline; gap: 9px; }
#hp-num { font-size: 26px; font-weight: 900; line-height: 1; text-shadow: 0 2px 6px rgba(0, 0, 0, .85); }
#hp-cls { font-size: 12px; font-weight: 800; letter-spacing: .16em; color: rgba(244, 241, 234, .62); }

.ammo-wrap { position: relative; display: flex; align-items: baseline; gap: 5px; text-shadow: 0 2px 6px rgba(0, 0, 0, .85); }
#ammo-mag { font-size: 42px; font-weight: 900; line-height: .9; font-variant-numeric: tabular-nums; }
.ammo-wrap.empty #ammo-mag { color: var(--danger); }
#ammo-max { font-size: 17px; font-weight: 800; color: rgba(244, 241, 234, .55); }
#ammo-reserve { font-size: 17px; font-weight: 800; color: rgba(244, 241, 234, .82); margin-left: 7px; font-variant-numeric: tabular-nums; }
#ammo-reserve.dry { color: var(--danger); }
.reload-bar {
  position: absolute;
  left: 0; right: 0; bottom: -9px;
  height: 4px;
  background: rgba(255, 255, 255, .16);
  border-radius: 3px;
  overflow: hidden;
  opacity: 0;
}
.ammo-wrap.reloading .reload-bar { opacity: 1; }
.reload-bar i { display: block; height: 100%; width: 0; background: var(--gold); }
#reload-text {
  position: absolute; right: 0; top: -16px;
  font-size: 11px; font-weight: 800; letter-spacing: .2em; color: var(--gold);
}

#ability-chip {
  position: absolute;
  left: 50%; bottom: 20px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 15px 7px 8px;
  background: rgba(8, 11, 18, .68);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
}
#ability-chip.ready { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 207, 92, .28); }
.ab-key {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  font-size: 13px; font-weight: 900;
  color: #14181f; background: var(--gold);
  border-radius: 7px;
}
.ab-body { display: flex; flex-direction: column; gap: 4px; }
.ab-body b { font-size: 12.5px; font-weight: 800; letter-spacing: .1em; }
.ab-cd { width: 92px; height: 4px; background: rgba(255, 255, 255, .16); border-radius: 3px; overflow: hidden; }
.ab-cd i { display: block; height: 100%; width: 100%; background: var(--gold); }
/* While a thrown ability is charged the same bar reads as a power meter. */
#ability-chip.charging { border-color: #ffe08a; }
#ability-chip.charging .ab-cd i { background: #ffe08a; }

#event-toast {
  position: absolute;
  left: 50%; top: 27%;
  transform: translateX(-50%);
  padding: 10px 26px;
  font-size: 21px; font-weight: 900; letter-spacing: .14em;
  color: #fff;
  background: rgba(8, 11, 18, .72);
  border: 2px solid var(--gold);
  border-radius: 12px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .6);
}

.mode-btn.suggested {
  border-color: rgba(255, 207, 92, .55);
  background: rgba(255, 207, 92, .09);
  animation: tut-pulse 2.4s ease-in-out infinite;
}
@keyframes tut-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 207, 92, .0); }
  50% { box-shadow: 0 0 0 3px rgba(255, 207, 92, .16); }
}

.local-actions { display: flex; gap: 10px; margin-top: 10px; }

/* ------------------------------------------------------------ 新手指引 */
#tutorial {
  position: fixed; inset: 0; z-index: 30;
  /* Space kept free above the panel (top bar + the room chip). The panel's
     height budget is derived from it, so the buttons at its bottom are always
     on screen: see .tut-panel below. */
  --tut-top: 92px;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--tut-top) 16px 16px;
  pointer-events: none;           /* the game stays playable underneath */
}
/* In a match the panel moves out of the way: top-right corner, narrow, so the
   crosshair and the middle of the screen stay clear while the player shoots. */
#tutorial.in-game {
  --tut-top: 96px;
  align-items: flex-start; justify-content: flex-end;
  padding: var(--tut-top) 18px 16px;
}
/* A column: the header, the tip and the buttons are fixed, and only the step
   list scrolls. The panel used to scroll as a whole, which pushed its bottom --
   the "start practising" / "done" buttons -- out of sight on any window shorter
   than the page (a laptop, a preview pane, a zoomed browser), leaving the
   player with no visible way forward. */
#tutorial .tut-panel {
  pointer-events: auto;
  display: flex; flex-direction: column;
  width: min(560px, 94vw);
  max-height: calc(100vh - var(--tut-top) - 16px);
  overflow: hidden;
  padding: 16px 18px; border-radius: 14px;
  background: rgba(8, 11, 18, .93);
  border: 1px solid rgba(255, 207, 92, .35);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
  color: rgba(244, 241, 234, .92);
}
#tutorial.in-game .tut-panel {
  width: min(330px, 46vw);
  max-height: min(56vh, calc(100vh - var(--tut-top) - 16px));
  padding: 11px 13px;
  background: rgba(8, 11, 18, .84);
}
#tutorial.in-game .tut-list { margin: 9px 0 6px; gap: 5px; }
#tutorial.in-game .tut-list li { padding: 5px 8px; font-size: 12px; }
#tutorial.in-game .tut-tip { display: none; }
#tutorial header {
  flex: 0 0 auto;                 /* never scrolls away with the steps */
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
#tutorial header b { font-size: 16px; letter-spacing: .16em; color: #ffcf5c; }
.tut-count { font-size: 12px; letter-spacing: .16em; color: rgba(244, 241, 234, .55); }
.tut-count.all { color: #7ee08a; }
#tutorial .tut-list {
  flex: 1 1 auto; min-height: 0;  /* the one part that gives way when space is tight */
  overflow-y: auto; overscroll-behavior: contain;
  list-style: none; margin: 12px 0 8px; padding: 0 4px 0 0;
  display: flex; flex-direction: column; gap: 7px;
}
#tutorial .tut-list::-webkit-scrollbar { width: 8px; }
#tutorial .tut-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, .04); border-radius: 4px; }
#tutorial .tut-list::-webkit-scrollbar-thumb {
  background: rgba(255, 207, 92, .35); border-radius: 4px;
}
#tutorial .tut-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 207, 92, .55); }
#tutorial .tut-list { scrollbar-width: thin; scrollbar-color: rgba(255, 207, 92, .45) rgba(255, 255, 255, .04); }
#tutorial .tut-list li {
  display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: baseline;
  padding: 7px 10px; border-radius: 9px; background: rgba(255, 255, 255, .04);
  border: 1px solid transparent; font-size: 13px; line-height: 1.5;
}
#tutorial .tut-list li.now { background: rgba(255, 207, 92, .12); border-color: rgba(255, 207, 92, .45); }
#tutorial .tut-list li.done { opacity: .55; }
#tutorial .tut-list li.done b::after { content: ' ✔'; color: #7ee08a; }
#tutorial .tut-list b { white-space: nowrap; }
#tutorial .key {
  font: 700 11.5px/1.6 var(--mono, monospace); letter-spacing: .06em;
  padding: 0 6px; border-radius: 5px; color: #ffcf5c; background: rgba(255, 207, 92, .12);
}
#tutorial .txt { color: rgba(244, 241, 234, .78); }
.tut-tip {
  flex: 0 0 auto;
  margin: 0 0 12px; padding: 9px 11px; border-radius: 9px; font-size: 12.5px; line-height: 1.6;
  background: rgba(120, 200, 255, .08); border: 1px solid rgba(120, 200, 255, .22);
  color: rgba(220, 235, 255, .85);
}
#tutorial footer {
  flex: 0 0 auto;                 /* the way onward stays on screen */
  display: flex; gap: 8px; justify-content: flex-end;
}
#tutorial .ghost-btn, #tutorial .big-btn { font-size: 13px; }

/* The English steps are longer than the Chinese ones; these keep the whole
   panel (list + buttons) on one screen as it is in Chinese. Scoped to the
   English page, so the Chinese layout does not move a pixel. */
html[lang="en"] #tutorial { --tut-top: 68px; }
html[lang="en"] #tutorial .tut-list { gap: 5px; margin: 9px 0 7px; }
html[lang="en"] #tutorial .tut-list li { padding: 6px 9px; font-size: 12.4px; line-height: 1.42; }
html[lang="en"] #tutorial .tut-tip { font-size: 12px; margin-bottom: 9px; padding: 8px 10px; }

/* ------------------------------------------------------- 联机房间（房号） */
.room-field {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(12, 16, 24, .55);
  border: 1px solid rgba(255, 255, 255, .09);
}
.room-label { font-size: 12.5px; letter-spacing: .16em; color: rgba(244, 241, 234, .62); }
.room-row { display: flex; gap: 8px; }
.room-btn {
  flex: 1; padding: 9px 10px; border-radius: 9px; cursor: pointer;
  font: 700 14px/1 var(--font); color: rgba(244, 241, 234, .72);
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .12);
}
.room-btn:hover { background: rgba(255, 255, 255, .1); }
.room-btn.on { color: #12151c; background: #ffcf5c; border-color: #ffcf5c; }
#input-room {
  padding: 10px 12px; border-radius: 9px; letter-spacing: .3em; text-align: center;
  font: 700 17px/1 var(--mono, monospace); color: #fff;
  background: rgba(8, 11, 18, .9); border: 2px solid rgba(255, 207, 92, .55);
  outline: none;
}
#input-room:focus { border-color: #ffcf5c; }

#room-chip {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(8, 11, 18, .72); border: 1px solid rgba(255, 207, 92, .45);
  font-size: 13px; letter-spacing: .12em; color: rgba(244, 241, 234, .8);
}
#room-chip b { font-size: 15px; letter-spacing: .22em; color: #ffcf5c; }
.rc-copy { font-size: 11.5px; color: rgba(244, 241, 234, .5); }
#room-chip.copied .rc-copy { color: #7ee08a; }

#lockslot {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  background: rgba(5, 7, 12, .5);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.lock-title { margin: 0; font-size: 25px; font-weight: 900; letter-spacing: .18em; text-shadow: 0 4px 0 rgba(0, 0, 0, .6); }
.lock-sub { margin: 0; font-size: 12.5px; letter-spacing: .16em; color: rgba(244, 241, 234, .6); }

/* Pointer lock refused: show a retry / open-in-new-tab explanation without
   obscuring the scene. There is no alternative mouse steering mode. */
#lockslot.soft {
  background: none;
  backdrop-filter: none;
  justify-content: flex-start;
  padding-top: 82px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .9);
}
#lockslot.soft .lock-title { font-size: 15px; letter-spacing: .14em; color: #ffcf5c; }
#lockslot.soft .lock-sub { font-size: 12.5px; letter-spacing: .1em; max-width: min(760px, 88vw); line-height: 1.6; }

/* The room strip on the class screen: the host arrived here straight from
   「创建房间」, so the code and the invite button have to come along. */
.select-room {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center;
  margin: 0 auto 14px; padding: 8px 14px; width: fit-content; max-width: 94vw;
  border: 1px solid rgba(255, 207, 92, .3); border-radius: 999px;
  background: rgba(8, 11, 18, .72); font-size: 13px;
}
.select-room .sr-label { letter-spacing: .18em; font-size: 11px; color: rgba(244, 241, 234, .55); }
.select-room b { font: 700 17px/1 var(--mono, monospace); letter-spacing: .12em; color: #ffcf5c; }
.select-room .ghost-btn { font-size: 12.5px; padding: 5px 10px; }

/* -------------------------------------------------- 暂停菜单 / 邀请面板 */
.pause-panel, .invite-panel {
  width: min(520px, 92vw);
  padding: 22px 24px;
  border-radius: 16px;
  background: rgba(8, 11, 18, .95);
  border: 1px solid rgba(255, 207, 92, .35);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .65);
  color: rgba(244, 241, 234, .92);
  text-align: center;
}
.invite-panel { width: min(640px, 94vw); text-align: left; }
.pause-title { margin: 0 0 8px; font-size: 28px; font-weight: 900; letter-spacing: .22em; color: #ffcf5c; }
.pause-note { margin: 0 0 18px; font-size: 13.5px; line-height: 1.7; color: rgba(244, 241, 234, .72); }
.pause-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pause-hint { margin: 16px 0 0; font-size: 12px; letter-spacing: .1em; color: rgba(244, 241, 234, .45); }
.pause-hint b { color: rgba(255, 207, 92, .9); }

/* The prompt slot's optional button (a page that cannot capture the mouse). */
.lock-action { margin: 10px 0 0; pointer-events: auto; }
#lockslot.soft .lock-action { margin-top: 12px; }

.invite-title { margin: 0 0 8px; font-size: 20px; letter-spacing: .1em; color: #ffcf5c; }
.invite-step { margin: 0 0 12px; font-size: 13px; line-height: 1.7; color: rgba(244, 241, 234, .8); }
.invite-code {
  width: 100%; min-height: 96px; resize: vertical;
  font: 12px/1.5 var(--mono, monospace);
  color: rgba(244, 241, 234, .92); background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; padding: 10px 12px;
  word-break: break-all;
}
.invite-code:focus { outline: none; border-color: rgba(255, 207, 92, .55); }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.invite-actions .big-btn.small, .invite-actions .ghost-btn { font-size: 13px; }
.invite-stun { display: flex; gap: 8px; margin-top: 14px; font-size: 12px; line-height: 1.6; color: rgba(244, 241, 234, .66); }
.invite-stun input { margin-top: 3px; }
.invite-status { margin: 10px 0 0; font-size: 12.5px; min-height: 18px; }
.invite-status.ok { color: #7ee08a; }
.invite-status.bad { color: var(--danger); }
.invite-help { margin: 6px 0 0; font-size: 12px; color: rgba(244, 241, 234, .5); }
.debug-link { color: #ffcf5c; text-decoration: underline dotted; }

/* ------------------------------------------------------------ 覆盖层 */
/* The pause menu and the invite panel are page-level, not HUD widgets: the menu
   itself has a "join with an invite code" button, so the panel has to render
   over the menu too (inside #screen-hud it appeared inside a hidden box). */
#pause, #invite { position: fixed; z-index: 35; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 7, 12, .58);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.death-panel { width: min(460px, 92vw); padding: 26px; text-align: center; }
.death-title { margin: 0; font-size: 32px; font-weight: 900; letter-spacing: .14em; color: var(--danger); text-shadow: 0 4px 0 rgba(0, 0, 0, .55); }
.death-by { margin: 10px 0 0; font-size: 13.5px; color: rgba(244, 241, 234, .72); }
.death-by b { color: #fff; }
.death-count { margin: 14px 0 16px; font-size: 13px; letter-spacing: .1em; color: rgba(244, 241, 234, .6); }
.death-count b { font-size: 24px; color: var(--gold); }
.death-loadout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.dl-btn {
  padding: 10px 6px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 800;
  color: rgba(244, 241, 234, .72);
  background: rgba(0, 0, 0, .34);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  cursor: pointer;
}
.dl-btn.on { color: #14181f; background: var(--gold); border-color: #ffe7a8; }
.dl-sub { grid-column: 1 / -1; font-size: 11px; color: rgba(244, 241, 234, .5); }

.sb-panel { width: min(880px, 94vw); padding: 20px 22px; }
.sb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sb-head h3 { margin: 0; font-size: 20px; font-weight: 900; letter-spacing: .16em; }
#sb-timer { font-size: 18px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.sb-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .sb-teams { grid-template-columns: 1fr; } }
.sb-team-head { padding: 7px 12px; font-size: 13px; font-weight: 900; letter-spacing: .14em; border-radius: 8px 8px 0 0; }
.sb-team table { width: 100%; border-collapse: collapse; }
.sb-team td { padding: 6px 12px; font-size: 12.5px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.sb-team tr.me td { background: rgba(255, 207, 92, .13); font-weight: 800; }
.sb-team tr.dead td { opacity: .45; }
.sb-team td.k, .sb-team td.d { text-align: right; font-variant-numeric: tabular-nums; width: 44px; }
.sb-cls { font-size: 10px; font-weight: 800; letter-spacing: .1em; opacity: .7; }

.result-panel { width: min(520px, 92vw); padding: 30px; text-align: center; }
#result-title { margin: 0; font-size: 36px; font-weight: 900; letter-spacing: .16em; text-shadow: 0 4px 0 rgba(0, 0, 0, .55); }
.result-score { margin: 14px 0 6px; font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; }
#result-0 { color: var(--team0); } #result-1 { color: var(--team1); }
.result-sub { margin: 0; font-size: 12.5px; letter-spacing: .16em; color: rgba(244, 241, 234, .55); }
.result-mvp { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; }
.mvp-row { display: flex; justify-content: space-between; padding: 6px 12px; font-size: 12.5px; background: rgba(255, 255, 255, .05); border-radius: 7px; }
.mvp-row b { color: var(--gold); }

/* ------------------------------------------------------------ 启动画面 */
#boot, #map-load { display: grid; place-items: center; background: #05070c; z-index: 40; }
.boot-text { font-size: 14px; letter-spacing: .28em; color: rgba(244, 241, 234, .55); }

/* ------------------------------------------------------------ 模式按钮 */
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .mode-row { grid-template-columns: 1fr; } }

.mode-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  font-family: var(--font);
  text-align: left;
  color: #2b1508;
  background: linear-gradient(180deg, #ffd97a, #f0a230);
  border: 3px solid #fff1cc;
  border-radius: 13px;
  cursor: pointer;
  box-shadow: 0 6px 0 #a45f14, 0 12px 22px rgba(255, 150, 40, .26);
  transition: transform .08s, box-shadow .08s, filter .12s;
}
.mode-btn b { font-size: 16px; font-weight: 900; letter-spacing: .1em; }
.mode-btn span { font-size: 10.5px; font-weight: 700; line-height: 1.5; color: rgba(43, 21, 8, .68); }
/* English subtitles run a line longer than the Chinese ones, which makes the
   main menu taller than it needs to be. Scoped to the English page, so the
   Chinese layout is byte-for-byte what it always was. */
html[lang="en"] .mode-btn span { font-size: 9.7px; line-height: 1.42; }

.mode-btn:hover { filter: brightness(1.07); }
.mode-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #a45f14; }

/* ------------------------------------------------------------ 设置模式 */
.settings-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 24px clamp(18px, 4vw, 54px) 20px;
  gap: 14px;
  overflow: auto;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 18px;
  align-items: start;
}
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }

.rig-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(30, 38, 56, .94), rgba(16, 20, 30, .96));
  border: 2px solid rgba(255, 255, 255, .16);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
}
#rig-preview {
  display: block;
  width: 100%;
  height: min(48vh, 420px);
  border-radius: 12px;
  background: radial-gradient(600px 320px at 50% 20%, rgba(120, 160, 230, .22), transparent 70%), #0d1017;
}
.rig-stage-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.rig-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(30, 38, 56, .94), rgba(16, 20, 30, .96));
  border: 2px solid rgba(255, 255, 255, .16);
  border-radius: 18px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.rig-h3 { margin: 4px 0 0; font-size: 13px; font-weight: 900; letter-spacing: .16em; color: rgba(244, 241, 234, .78); }
.rig-h3 span { color: var(--gold); }

.rig-panel input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, .38);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 10px;
  outline: none;
}
.rig-panel input[type="text"]:focus { border-color: var(--gold); }
.rig-panel input[type="file"] { font-size: 12px; color: rgba(244, 241, 234, .7); }
.rig-panel input[type="range"] { width: 100%; accent-color: var(--gold); }
.rig-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.rig-bones { display: flex; flex-direction: column; gap: 7px; max-height: 220px; overflow: auto; }
.rig-bone-row { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 8px; }
.rig-bone-row > span { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; color: rgba(244, 241, 234, .68); }
.rig-bone-row select {
  width: 100%;
  padding: 6px 8px;
  font-family: var(--font);
  font-size: 12px;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  border: 2px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  outline: none;
}
.rig-bone-row select:focus { border-color: var(--gold); }
.rig-bone-row.on > span { color: var(--gold); }
.rig-bone-row.on select { border-color: var(--gold); }
.rig-panel #rig-status { text-align: left; }
.rig-offsets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rig-offsets .field > span b { color: var(--gold); font-variant-numeric: tabular-nums; }

.rig-shared-block { display: flex; flex-direction: column; gap: 8px; }
.rig-shared { display: flex; flex-wrap: wrap; gap: 8px; }
.rig-shared-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .06);
  border: 2px solid rgba(255, 255, 255, .12);
  border-radius: 11px;
}
.rig-shared-row.on { border-color: var(--gold); background: rgba(255, 207, 92, .14); }
.rig-shared-row b { font-size: 13px; font-weight: 900; }
.rig-shared-row em { font-style: normal; font-size: 11px; color: rgba(244, 241, 234, .45); }

/* Separate grenade inventory; Q remains the class ability. */
#grenade-chip { position:absolute; left:50%; bottom:80px; transform:translateX(-50%); display:flex; align-items:center; gap:10px; padding:8px 13px 8px 8px; background:rgba(8,11,18,.82); border:1px solid rgba(255,207,92,.4); border-radius:12px; min-width:210px; }
#grenade-chip.charging { border-color:#ffe08a; box-shadow:0 0 18px #ffb52d44; }
#grenade-chip small { font-size:10px; color:#bdc6d0; }
.grenade-cycle { font-size:11px; color:var(--gold); margin-left:auto; }
#grenade-chip .ab-cd { width:130px; }
#flash-veil { position:fixed; inset:0; background:#fff; opacity:0; pointer-events:none; z-index:1000; }


.rules-field { margin:12px 0; } .rules-field select { padding:10px; color:#eef2f5; background:#192333; border:1px solid #65788d; border-radius:7px; } .rules-field small { color:#b8c8d8; line-height:1.5; }
#objective-hud { position:absolute; top:85px; left:50%; transform:translateX(-50%); text-align:center; width:min(440px,95vw); pointer-events:none; }
#objective-mode { color:#ffe08a; font-size:12px; text-shadow:0 1px 3px #000; }
#objective-cards { display:flex; justify-content:center; gap:8px; margin-top:5px; }
.objective-card { position:relative; min-width:100px; border:1px solid var(--point-color); border-radius:9px; background:#101926df; padding:6px 9px; text-align:left; box-shadow:0 2px 8px #0004; }
.objective-card b { color:var(--point-color); font-size:21px; margin-right:10px; }.objective-distance { font-size:11px; color:#d2deec; }.objective-card small { display:block; font-size:10px; color:#e4ecf4; }
.objective-progress { height:3px; background:#ffffff20; margin-top:5px; }.objective-progress i { display:block; height:100%; }
#objective-status { font-size:11px; margin:5px 0; color:#f2e9c6; text-shadow:0 1px 3px #000,0 1px 5px #000; }

/* One actionable lesson while playing; full checklist remains in the menu. */
#tutorial { z-index:40; }
#tutorial.in-game .tut-list li { display:none; }
#tutorial.in-game .tut-list li.now { display:flex; }
#tutorial.in-game .tut-tip { display:block; font-size:11px; line-height:1.5; }

/* Shared menu/pause mouse setting; HUD text stays independent of 3D quality. */
.sensitivity-field { margin: 12px 0; }
.sensitivity-field > span { display: flex; justify-content: space-between; }
.sensitivity-field output { color: var(--gold); font-variant-numeric: tabular-nums; }
.sensitivity-field input { width: 100%; accent-color: var(--gold); }

/* Explicit mobile mode: touch controls never replace denied desktop lock. */
#mobile-controls { position:absolute; inset:0; z-index:6; pointer-events:none; touch-action:none; -webkit-touch-callout:none; }
#mobile-controls button, .touch-stick, .touch-look { pointer-events:auto; touch-action:none; user-select:none; -webkit-user-select:none; }
.touch-look { position:absolute; left:40%; right:0; top:calc(100px + env(safe-area-inset-top)); bottom:0; }
.touch-stick { position:absolute; left:max(24px, env(safe-area-inset-left)); bottom:max(24px, env(safe-area-inset-bottom)); width:132px; height:132px; border:2px solid #e9f1ff66; border-radius:50%; background:radial-gradient(circle,#16233410,#080f2024); box-shadow:inset 0 0 0 24px #d3e5ff08; display:grid; place-items:center; }
.touch-stick-knob { width:54px; height:54px; border-radius:50%; background:#d6e6ff30; border:2px solid #e7f1ff99; box-shadow:0 3px 12px #0006; pointer-events:none; }
.touch-stick small { position:absolute; bottom:8px; font-size:10px; color:#ecf2ff99; pointer-events:none; }
#mobile-controls button { min-width:46px; min-height:46px; padding:3px 2px; border:1px solid #e6edff66; border-radius:999px; color:#f3f6ff; background:rgba(12,24,45,.16); font:700 10px/1.2 var(--font); overflow-wrap:anywhere; text-shadow:0 1px 3px #000; }
#mobile-controls button.held { color:#ffde8c; border-color:#ffcf5c; background:rgba(255,207,92,.24); box-shadow:0 0 12px #ffcf5c22; }
.touch-tools { position:absolute; right:max(12px, env(safe-area-inset-right)); top:max(10px, env(safe-area-inset-top)); display:flex; gap:5px; }
.touch-actions { position:absolute; right:max(16px, env(safe-area-inset-right)); bottom:max(18px, env(safe-area-inset-bottom)); display:grid; grid-template-columns:repeat(3,50px); gap:7px; }
#mobile-controls .touch-cycle { grid-column:span 2; min-height:44px; }
#mobile-controls .touch-fire { position:absolute; right:max(22px, env(safe-area-inset-right)); bottom:calc(192px + env(safe-area-inset-bottom)); width:74px; height:74px; border-radius:50%; background:rgba(180,70,60,.18); border:2px solid #ffb4a899; font-size:15px; }
.touch-guide { position:absolute; bottom:2px; left:50%; transform:translateX(-50%); margin:0; font-size:10px; color:#dde7f6a0; white-space:nowrap; text-shadow:0 1px 3px #000; }
.mobile-mode #screen-hud > .overlay { z-index:20; }
.mobile-mode #topbar { left:max(12px,env(safe-area-inset-left)); top:max(10px,env(safe-area-inset-top)); transform:none; padding:7px 10px; gap:6px; }
.mobile-mode .tb-name, .mobile-mode .tb-map, .mobile-mode .tb-limit { display:none; }
.mobile-mode .tb-num { font-size:21px; }.mobile-mode .tb-center { padding:0 7px; }
.mobile-mode #statusbar { top:calc(70px + env(safe-area-inset-top)); bottom:auto; left:max(14px,env(safe-area-inset-left)); right:max(14px,env(safe-area-inset-right)); }
.mobile-mode .hp-wrap { width:120px; }.mobile-mode .hp-bar { height:10px; }.mobile-mode #hp-num { font-size:20px; }.mobile-mode #hp-cls { font-size:10px; letter-spacing:0; }
.mobile-mode #ammo-mag { font-size:28px; }.mobile-mode #ammo-max, .mobile-mode #ammo-reserve { font-size:13px; }
.mobile-mode #ability-chip, .mobile-mode #grenade-chip { left:max(12px,env(safe-area-inset-left)); top:calc(120px + env(safe-area-inset-top)); bottom:auto; transform:none; width:156px; min-width:0; padding:7px 9px; border-radius:9px; }
.mobile-mode #grenade-chip { top:calc(168px + env(safe-area-inset-top)); }
.mobile-mode .ab-key, .mobile-mode .grenade-cycle { display:none; }
.mobile-mode .ab-body { min-width:0; width:100%; }.mobile-mode .ab-body b { font-size:10px; letter-spacing:0; }
.mobile-mode .ab-cd, .mobile-mode #grenade-chip .ab-cd { width:100%; }
.mobile-mode #grenade-chip small { font-size:9px; }
.mobile-mode #objective-hud { top:calc(85px + env(safe-area-inset-top)); width:50vw; }
.mobile-mode #killfeed { top:110px; right:12px; font-size:10px; max-width:35vw; }
.mobile-mode #chat-log { bottom:175px; max-width:42vw; max-height:72px; overflow:hidden; }
.mobile-mode .chat-line { font-size:10px; }
.mobile-mode .menu-inner { justify-content:flex-start; padding:24px max(16px,env(safe-area-inset-left)) max(24px,env(safe-area-inset-bottom)); }
.mobile-mode .menu-inner > * { flex-shrink:0; }
.mobile-mode .select-inner { padding:16px; }
.mobile-mode .class-card canvas { max-height:130px; object-fit:contain; }
.mobile-mode .select-foot { flex-shrink:0; }
.mobile-mode .pause-panel, .mobile-mode .invite-panel, .mobile-mode .death-panel, .mobile-mode .sb-panel { max-height:90dvh; overflow:auto; }
@media (max-width:600px) {
  .mobile-mode #objective-hud { top:calc(235px + env(safe-area-inset-top)); width:94vw; }
  .mobile-mode .touch-guide { bottom:160px; max-width:90vw; white-space:normal; text-align:center; }
  .mobile-mode #killfeed { max-width:44vw; }
  .mobile-mode .select-head p { display:none; }
}
@media (max-height:420px) {
  .mobile-mode .touch-stick { width:112px; height:112px; bottom:16px; }
  .mobile-mode .touch-actions { grid-template-columns:repeat(3,48px); gap:5px; bottom:12px; }
  .mobile-mode #mobile-controls .touch-fire { bottom:178px; width:64px; height:64px; }
  .mobile-mode #grenade-chip { top:158px; }
  .mobile-mode #ability-chip { top:112px; }
  .mobile-mode .touch-guide { display:none; }
  .mobile-mode #chat-log { display:none; }
}
/* Lessons describe touch inputs without covering or intercepting the buttons. */
.mobile-mode #tutorial.in-game { --tut-top:112px; padding:112px 176px 8px; justify-content:center; }
.mobile-mode #tutorial.in-game .tut-panel { width:min(360px,100%); max-height:160px; padding:8px 10px; pointer-events:none; }
.mobile-mode #tutorial.in-game header, .mobile-mode #tutorial.in-game .tut-tip { display:none; }
.mobile-mode #tutorial.in-game footer button { pointer-events:auto; padding:5px 9px; min-height:32px; font-size:11px; }
@media (max-width:600px) {
  .mobile-mode #tutorial.in-game { --tut-top:320px; padding:320px 16px 8px; }
  .mobile-mode #tutorial.in-game .tut-panel { width:100%; }
}

.mobile-mode .pause-hint { display:none; }

/* Small phones must keep joystick, combat buttons and score/tools separate. */
.mobile-mode .objective-card { flex:1; min-width:0; }
@media (max-width:360px) {
  .mobile-mode #topbar { max-width:108px; padding:6px; gap:4px; }
  .mobile-mode .tb-num { font-size:15px; }.mobile-mode #tb-timer { font-size:12px; }
  .mobile-mode .tb-score { gap:0; }.mobile-mode .tb-center { padding:0 3px; }
  .mobile-mode .touch-tools { right:max(8px,env(safe-area-inset-right)); gap:4px; }
  .mobile-mode #mobile-controls .touch-tools button { min-width:44px; width:44px; }
  .mobile-mode .touch-stick { left:max(12px,env(safe-area-inset-left)); width:104px; height:104px; }
  .mobile-mode .touch-stick-knob { width:44px; height:44px; }
  .mobile-mode .touch-actions { right:max(12px,env(safe-area-inset-right)); grid-template-columns:repeat(3,48px); gap:5px; }
  .mobile-mode .objective-card { padding:5px; }.mobile-mode .objective-card b { font-size:17px; margin-right:5px; }
  .mobile-mode .objective-distance { font-size:9px; }
}
@media (max-height:350px) and (orientation:landscape) {
  .mobile-mode #statusbar { top:calc(62px + env(safe-area-inset-top)); }
  .mobile-mode #mobile-controls .touch-fire { bottom:calc(166px + env(safe-area-inset-bottom)); width:56px; height:56px; }
  .mobile-mode #ability-chip { top:108px; padding:5px 9px; }
  .mobile-mode #grenade-chip { top:150px; padding:5px 9px; }
  .mobile-mode #grenade-chip small { display:none; }
  .mobile-mode #objective-hud { top:58px; width:calc(100vw - 350px); }
  .mobile-mode #objective-mode, .mobile-mode .objective-card small { display:none; }
  .mobile-mode .objective-card { padding:4px; }.mobile-mode .objective-card b { font-size:16px; margin-right:4px; }
  .mobile-mode .objective-distance, .mobile-mode #objective-status { font-size:9px; }
}

/* Content determines menu height. Never shrink a panel over its own buttons
   or collapse the weapon section into the deploy footer on short PC windows. */
.menu-inner > *, .select-inner > *, .settings-inner > * { flex-shrink:0; }
.menu-panel, .settings-grid > *, .class-row > *, .weapon-row > * { min-width:0; }
.menu-panel { max-width:100%; }
.select-foot, .select-room, .rig-stage-foot, .rig-shared-row, .bot-row, .seg, .local-actions { flex-wrap:wrap; }
.select-foot { flex:0 0 auto; }
.team-note { min-width:0; flex:1 1 140px; }
.room-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(125px,100%),1fr)); }
.room-btn { line-height:1.35; min-height:44px; overflow-wrap:anywhere; }
.mode-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
.mode-btn, .map-btn { min-width:0; overflow-wrap:anywhere; }
.field, .field select, .field input, .rig-bone-row > * { min-width:0; max-width:100%; }
.rig-bone-row { grid-template-columns:88px minmax(0,1fr); }
.settings-inner .select-foot { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(145px,100%),1fr)); }
.pause-panel, .invite-panel, .death-panel, .sb-panel, .result-panel { max-width:100%; max-height:calc(100dvh - 32px); overflow:auto; }
.overlay { padding:16px; overflow:auto; }
#screen-hud > .overlay { z-index:20; }
#tutorial footer { flex-wrap:wrap; }
@media (max-width:520px) {
  .mode-row { grid-template-columns:minmax(0,1fr); }
  .menu-panel { padding:18px 16px; }
  .select-foot .team-note { order:3; flex-basis:100%; text-align:center; }
  #btn-deploy { margin-left:auto; }
  .select-room { gap:8px; }
  .select-room b { overflow-wrap:anywhere; }
}

/* Scores, room-copy button and objectives share real document flow instead
   of absolute offsets that collide when joining a room or changing language. */
.hud-header { position:absolute; top:12px; left:0; right:0; margin:0 auto; width:min(520px,calc(100% - 24px)); display:flex; flex-direction:column; align-items:center; gap:8px; pointer-events:none; z-index:7; }
.hud-header #topbar { position:relative; top:auto; left:auto; transform:none; max-width:100%; min-width:0; }
.match-info { display:flex; flex-direction:column; align-items:center; gap:8px; max-width:100%; width:100%; }
.match-info #room-chip { position:relative; top:auto; left:auto; transform:none; max-width:100%; min-height:36px; font-family:var(--font); pointer-events:auto; touch-action:manipulation; }
.match-info #room-chip b { white-space:nowrap; }
.match-info .rc-copy { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.match-info #objective-hud { position:relative; top:auto; left:auto; transform:none; width:min(440px,100%); }
.loadout-info { display:contents; }
.loadout-info #ability-chip, .loadout-info #grenade-chip { position:fixed; }

/* Landscape keeps the informational stack in the free center lane; the room
   button stays above the swipe surface so it can actually receive touches. */
.mobile-mode .hud-header { display:contents; }
.mobile-mode .hud-header #topbar { position:absolute; left:max(12px,env(safe-area-inset-left)); top:max(10px,env(safe-area-inset-top)); z-index:7; }
.mobile-mode .match-info { position:absolute; top:calc(70px + env(safe-area-inset-top)); left:50%; transform:translateX(-50%); width:calc(100% - 360px); gap:6px; z-index:7; }
.mobile-mode .match-info #room-chip { background:rgba(12,24,45,.16); border-radius:999px; min-height:44px; padding:4px 8px; font-size:11px; letter-spacing:0; }
.mobile-mode .match-info #room-chip b { font-size:13px; letter-spacing:.1em; }
.mobile-mode .match-info #objective-hud { width:100%; }
@media (max-width:700px) {
  body:not(.mobile-mode) .tb-name { display:none; }
  body:not(.mobile-mode) .tb-center { padding:0 6px; }
}
@media (max-width:600px) and (min-height:421px) {
  .mobile-mode .hud-header { position:absolute; display:flex; top:max(10px,env(safe-area-inset-top)); left:max(12px,env(safe-area-inset-left)); right:max(12px,env(safe-area-inset-right)); width:auto; align-items:stretch; }
  .mobile-mode .hud-header #topbar { position:relative; top:auto; left:auto; align-self:flex-start; margin-bottom:52px; }
  .mobile-mode .match-info { position:relative; top:auto; left:auto; transform:none; width:100%; }
  .mobile-mode .loadout-info { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .mobile-mode .loadout-info #ability-chip, .mobile-mode .loadout-info #grenade-chip { position:relative; top:auto; left:auto; bottom:auto; width:auto; min-width:0; transform:none; padding:6px 8px; }
  .mobile-mode .loadout-info .ab-body b { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .mobile-mode .loadout-info #grenade-chip small { display:none; }
  .mobile-mode #objective-mode { display:none; }
  .mobile-mode .objective-card { padding:4px 5px; }
  .mobile-mode .objective-card b { font-size:17px; margin-right:4px; }
  .mobile-mode .objective-card small, .mobile-mode #objective-status { font-size:9px; }
}
@media (max-height:350px) and (orientation:landscape) {
  .mobile-mode .match-info { top:58px; width:calc(100% - 350px); }
}

#scope-overlay { position:fixed; inset:0; z-index:4; pointer-events:none; overflow:hidden; }
.scope-lens { position:absolute; left:50%; top:50%; width:82vmin; height:82vmin; transform:translate(-50%,-50%); border-radius:50%; border:3px solid #131c21; box-shadow:0 0 0 200vmax #020305; background:radial-gradient(circle at 35% 25%,#80c4ff12,transparent 45%,#0b222c40 90%,#02080bd9); }
.scope-lens svg { width:100%; height:100%; fill:#b33329; stroke:#111; stroke-width:.28; }
.scope-active #crosshair { visibility:hidden; }
.mobile-option { display:none; }
.mobile-mode .mobile-option { display:inline-flex; }
#touch-layout-editor { position:fixed; z-index:90; top:max(8px,env(safe-area-inset-top)); left:50%; transform:translateX(-50%); width:min(580px,calc(100% - 20px)); padding:10px; border:1px solid #ffffff40; border-radius:16px; background:#142330ed; color:#fff; text-align:center; }
#touch-layout-editor strong { display:block; font-size:12px; }
#touch-layout-editor button { min-height:44px; padding:6px 14px; margin:4px 3px 0; border:1px solid #ffffff55; border-radius:999px; background:#ffffff15; color:#fff; font:inherit; cursor:pointer; }
#touch-layout-editor [data-layout="save"] { border-color:#bada83; color:#def6b7; }
.layout-status { display:block; color:#ffbda9; font-size:11px; }
.layout-editing #screen-hud > :not(#mobile-controls), .layout-editing .touch-tools, .layout-editing .touch-guide { visibility:hidden; }
.layout-editing .touch-look { pointer-events:none; }
.layout-editing .touch-actions button, .layout-editing .touch-fire, .layout-editing .touch-stick { outline:2px dashed #d9f29b99; outline-offset:2px; cursor:move; }
#mobile-controls.sprinting .touch-stick { border-color:#d9f29b; box-shadow:0 0 12px #d9f29b40; }

/* Kept inside the health column, away from both desktop and touch actions. */
#statusbar .hp-wrap { position:relative; }
#spawn-shield-status { position:absolute; bottom:calc(100% + 3px); left:0; white-space:nowrap; color:#78deff; font-size:11px; font-weight:700; line-height:1.25; letter-spacing:.02em; }
.mobile-mode #spawn-shield-status { font-size:10px; line-height:10px; bottom:calc(100% + 1px); }

/* Secondary occupies the spare third-row touch cell; fire keeps its clear lane. */
.secondary-row .weapon-card { text-align:left; color:inherit; font-family:inherit; }
.slot-help { opacity:.7; font-size:12px; }
#weapon-slot { display:block; font-size:10px; color:var(--gold); margin-bottom:4px; }


/* Redeploy: both inventory slots use touch-sized, keyboard-accessible cards.
   Only the choices scroll; the deploy button always stays within the panel. */
.death-panel { width:min(600px, calc(100vw - 24px)); max-height:calc(100vh - 32px); display:flex; flex-direction:column; overflow:hidden; }
.death-panel > :not(.death-loadout) { flex-shrink:0; }
.death-panel .death-loadout { display:flex; flex-direction:column; gap:14px; overflow-y:auto; min-height:0; padding:2px 4px 12px; margin-bottom:14px; overscroll-behavior:contain; scrollbar-width:thin; }
.death-panel .dl-classes { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; }
.death-panel .dl-weapons { min-width:0; display:flex; flex-direction:column; gap:16px; }
.death-panel .dl-section h3 { margin:0 0 8px; color:var(--gold); font-size:12px; letter-spacing:.06em; text-align:left; }
.death-panel .dl-secondary { border-top:1px solid rgba(255,255,255,.14); padding-top:14px; }
.death-panel .dl-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; }
.death-panel .dl-btn { min-width:0; min-height:44px; font:inherit; font-size:12px; border-radius:9px; overflow-wrap:anywhere; transition:background .12s,border-color .12s; }
.death-panel .dl-card { display:flex; flex-direction:column; align-items:flex-start; justify-content:center; gap:3px; padding:10px 12px; text-align:left; }
.death-panel .dl-card-name { font-weight:700; line-height:1.3; }
.death-panel .dl-card-sub { font-size:10px; opacity:.6; line-height:1.3; }
.death-panel .dl-btn.on { color:var(--paper); border-color:var(--gold); background:rgba(210,176,119,.18); box-shadow:inset 3px 0 var(--gold); }
.death-panel .dl-btn:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
.mobile-mode .death-panel { max-height:calc(100vh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow:hidden; }
@media (max-width:380px) { .death-panel .dl-classes { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-height:480px) {
  .death-panel { padding:12px 18px; }
  .death-panel .death-title { font-size:20px; margin-bottom:4px; }
  .death-panel .death-count { margin:6px 0 8px; }
  .death-panel .death-by { margin-bottom:4px; }
  .death-panel .death-loadout { margin-bottom:8px; }
}

@supports (height:100dvh) {
  .death-panel { max-height:calc(100dvh - 32px); }
  .mobile-mode .death-panel { max-height:calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
}

/* Confirmed eliminations: visual feedback only, never interrupts aim or time. */
#kill-confirm {
  position:fixed; z-index:32; left:50%; top:57%; transform:translate(-50%,0);
  display:flex; align-items:center; gap:12px; max-width:min(360px,80vw);
  padding:10px 20px 10px 13px; border-left:2px solid #d7b579; border-radius:4px;
  color:#f4ead6; background:linear-gradient(90deg,rgba(17,21,25,.91),rgba(17,21,25,.5));
  box-shadow:0 8px 24px #0004; opacity:0; pointer-events:none;
}
#kill-confirm.show { animation:kill-confirm 1.5s ease-out both; }
#kill-confirm > div { display:flex; flex-direction:column; min-width:0; gap:3px; }
#kill-label { color:#d7b579; font-size:10px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
#kill-victim { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:16px; }
#kill-streak { color:#e2be79; font-size:10px; }
#kill-streak:empty { display:none; }
.kill-emblem { font-size:34px; line-height:1; color:#d7b579; }
#kill-confirm.headshot { border-color:#f4cf77; }
#kill-confirm.headshot .kill-emblem { color:#ffdb8f; text-shadow:0 0 13px #ffcd7155; }
#hitmarker.kill.show { animation:kill-marker .48s ease-out both; stroke:#e6bd76; }
@keyframes kill-confirm {
  0% { opacity:0; transform:translate(-50%,12px) scale(.96); }
  12%,72% { opacity:1; transform:translate(-50%,0) scale(1); }
  100% { opacity:0; transform:translate(-50%,-6px) scale(1); }
}
@keyframes kill-marker {
  0% { opacity:1; transform:scale(.55) rotate(-8deg); }
  22% { opacity:1; transform:scale(1.25) rotate(0); }
  65% { opacity:.9; transform:scale(1); }
  100% { opacity:0; transform:scale(1.15); }
}
/* Allow the one-second collapse to read before revealing the existing picker.
   The authoritative countdown starts immediately and is never delayed here. */
#death-veil { position:fixed; inset:0; z-index:30; opacity:0; pointer-events:none;
  background:radial-gradient(ellipse at 50% 44%,transparent 25%,rgba(42,8,9,.42) 100%); }
#death-veil.show { animation:death-veil 1.15s ease-out both; }
@keyframes death-veil { 0% {opacity:0;} 12%,40% {opacity:1;} 100% {opacity:.28;} }
.player-dead #crosshair, .player-dead #kill-confirm { visibility:hidden; }
.death-sequence #death-panel { background:transparent; backdrop-filter:none; }
.death-sequence #death-panel .death-panel { opacity:0; pointer-events:none; }
#death-panel .death-panel { transition:opacity .2s ease-out; }
.mobile-mode #kill-confirm { top:48%; padding:8px 12px; }
@media (prefers-reduced-motion:reduce) {
  #kill-confirm.show { animation:kill-confirm-reduced 1.5s linear both; }
  #hitmarker.kill.show { animation:kill-confirm-reduced .48s linear both; }
  #death-veil.show { animation:none; opacity:.2; }
  #death-panel .death-panel { transition:none; }
  .death-sequence #death-panel .death-panel { opacity:1; pointer-events:auto; }
  @keyframes kill-confirm-reduced { 0%,80% {opacity:1;} 100% {opacity:0;} }
}
