:root {
  --ink: #08090a;
  --panel: rgba(12, 15, 16, 0.82);
  --panel-solid: #101416;
  --line: rgba(234, 218, 170, 0.28);
  --text: #f4efe4;
  --muted: #adb6ad;
  --gold: #e6b85f;
  --red: #9b2e35;
  --jade: #4fa58f;
  --steel: #8da1b3;
  --pad: 12px;
  --panel-w: min(300px, calc(100vw - 24px));
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  touch-action: manipulation;
  background:
    radial-gradient(circle at 16% 12%, rgba(155, 46, 53, 0.32), transparent 34%),
    radial-gradient(circle at 84% 20%, rgba(79, 165, 143, 0.22), transparent 30%),
    linear-gradient(135deg, #070808 0%, #15100f 46%, #09100f 100%);
}

#viewport {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#viewport:active {
  cursor: grabbing;
}

body.network-match #viewport {
  cursor: crosshair;
}

.hud {
  position: fixed;
  z-index: 2;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
}

/* ---------- Top HUD ---------- */

.hud-top {
  top: var(--pad);
  left: var(--pad);
  right: var(--pad);
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  transition: width 0.2s ease, max-width 0.2s ease;
}

.hud-chip {
  display: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--gold);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.hud-chip strong {
  letter-spacing: 0.04em;
  font-size: 13px;
}

.hud-top-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 14px;
}

.hud-top-text {
  min-width: 0;
}

.hud-top-text strong {
  display: block;
  color: var(--gold);
  font-size: 15px;
}

.hud-top-text span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(52vw, 420px);
}

.hud-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.hud-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(230, 184, 95, 0.32);
  background: rgba(0, 0, 0, 0.45);
  color: var(--gold);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.hud-icon-btn:hover {
  background: rgba(230, 184, 95, 0.18);
  border-color: var(--gold);
}

.hud-icon-btn:active {
  background: rgba(230, 184, 95, 0.28);
}

body:fullscreen .hud-icon-btn,
body:-webkit-full-screen .hud-icon-btn {
  border-color: var(--jade);
  color: var(--jade);
}

.meter {
  flex: 0 0 auto;
  width: min(220px, 24vw);
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(230, 184, 95, 0.32);
  background: rgba(255, 255, 255, 0.08);
}

.meter span {
  display: block;
  width: 68%;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--jade));
  animation: breathe 1.8s ease-in-out infinite alternate;
}

.hud-top.is-collapsed {
  right: auto;
  width: auto;
}

.hud-top.is-collapsed .hud-chip {
  display: inline-flex;
}

.hud-top.is-collapsed .hud-top-body {
  display: none;
}

.top-collapse-btn {
  flex: 0 0 auto;
  width: 28px;
  min-height: 28px;
  padding: 0;
  margin-left: 4px;
  border-radius: 4px;
  color: var(--muted);
  background: rgba(8, 9, 10, 0.45);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.top-collapse-btn:hover {
  color: var(--gold);
}

/* ---------- Side panel ---------- */

/* Right edge: keeps the combat HUD (bottom-left) and the debug overlay
   (top-left) unobstructed during play. */
.side-panel {
  right: var(--pad);
  bottom: var(--pad);
  width: var(--panel-w);
  max-height: min(70vh, calc(100vh - 88px));
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.panel-bar {
  flex: 0 0 auto;
  border-bottom: 1px solid transparent;
}

.side-panel:not(.is-collapsed) .panel-bar {
  border-bottom-color: rgba(234, 218, 170, 0.16);
}

.panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.panel-toggle:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.04);
}

.panel-toggle-label {
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.panel-chevron,
.chip-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
  flex: 0 0 auto;
}

.side-panel:not(.is-collapsed) .panel-chevron {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.hud-top:not(.is-collapsed) .chip-chevron {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.panel-body {
  display: grid;
  gap: 12px;
  padding: 12px;
  overflow: auto;
  overscroll-behavior: contain;
}

.side-panel.is-collapsed {
  width: auto;
  max-height: none;
}

.side-panel.is-collapsed .panel-body {
  display: none;
}

.side-panel.is-collapsed .panel-toggle {
  min-width: 108px;
}

.panel-grid {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

select,
input,
button {
  min-height: 36px;
  border: 1px solid rgba(234, 218, 170, 0.28);
  color: var(--text);
  background: rgba(8, 9, 10, 0.68);
  font: inherit;
}

select {
  width: 100%;
  padding: 0 10px;
}

input {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(230, 184, 95, 0.82);
  box-shadow: 0 0 0 2px rgba(230, 184, 95, 0.1);
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.buttons button,
#idleButton,
#attackButton,
#cameraButton {
  padding: 0 12px;
  color: #fff5dd;
  background: linear-gradient(180deg, rgba(155, 46, 53, 0.86), rgba(58, 22, 23, 0.92));
}

button:hover,
select:hover {
  border-color: rgba(230, 184, 95, 0.72);
}

.buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.npc-spawn-grid {
  margin-bottom: 8px;
}

.npc-spawn-buttons button {
  padding: 0 10px;
  color: #eef6ff;
  background: linear-gradient(180deg, rgba(46, 92, 155, 0.88), rgba(22, 38, 72, 0.94));
}

.npc-spawn-hint {
  margin: 8px 2px 0;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(214, 224, 240, 0.72);
}

.panel-section {
  border-top: 1px solid rgba(234, 218, 170, 0.14);
  padding-top: 4px;
}

.panel-section summary {
  list-style: none;
  cursor: pointer;
  color: var(--steel);
  font-size: 12px;
  padding: 8px 2px;
  user-select: none;
}

.panel-section summary::-webkit-details-marker {
  display: none;
}

.panel-section summary::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 8px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  vertical-align: 2px;
  transition: transform 0.18s ease;
}

.panel-section[open] summary::after {
  transform: rotate(-135deg);
  vertical-align: -1px;
}

#debugStats {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  color: var(--muted);
  font-size: 11px;
  padding-bottom: 2px;
}

#debugStats dt {
  color: var(--steel);
}

#debugStats dd {
  margin: 0;
  text-align: right;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Debug overlay (top-left, semi-transparent) ---------- */

.debug-overlay {
  /* Sits below the top HUD bar instead of on top of it. */
  top: calc(var(--pad) + 56px);
  left: var(--pad);
  right: auto;
  width: auto;
  max-width: 280px;
  background: rgba(12, 10, 8, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(230, 184, 95, 0.2);
  border-radius: 4px;
  padding: 0;
  overflow: hidden;
  z-index: 100;
}

.debug-overlay-header {
  display: flex;
  align-items: center;
}

.debug-overlay-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: var(--gold);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.debug-overlay-toggle:hover {
  background: rgba(230, 184, 95, 0.08);
}

.debug-overlay-chevron {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.debug-overlay.is-collapsed .debug-overlay-chevron {
  transform: rotate(-135deg);
}

.debug-overlay-body {
  padding: 2px 10px 6px;
  max-height: 320px;
  overflow-y: auto;
}

.debug-overlay.is-collapsed .debug-overlay-body {
  display: none;
}

@keyframes breathe {
  from {
    transform: translateX(-18%);
  }
  to {
    transform: translateX(8%);
  }
}

/* ---------- Narrow / short viewports ---------- */

@media (max-width: 720px), (max-height: 560px) {
  :root {
    --pad: 8px;
  }

  .meter {
    display: none;
  }

  .hud-top-text span {
    max-width: 58vw;
  }

  .side-panel {
    max-height: min(58vh, calc(100vh - 72px));
  }

  .panel-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-grid label:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 420px) {
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .buttons {
    grid-template-columns: 1fr;
  }
}

/* ---------- Multiplayer ---------- */

.network-body {
  display: grid;
  gap: 9px;
  padding: 2px 0 4px;
}

.network-status-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.network-status-row > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-status-row > span:last-child {
  color: var(--steel);
  font-variant-numeric: tabular-nums;
}

.network-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(230, 184, 95, 0.58);
}

#networkStatus[data-state="connected"] ~ #networkLatency,
#networkStatus[data-state="connected"] {
  color: #99d9c5;
}

.network-status-row:has(#networkStatus[data-state="connected"]) .network-dot {
  background: var(--jade);
  box-shadow: 0 0 8px rgba(79, 165, 143, 0.72);
}

.network-status-row:has(#networkStatus[data-state="error"]) .network-dot,
.network-status-row:has(#networkStatus[data-state="offline"]) .network-dot,
.network-status-row:has(#networkStatus[data-state="disconnected"]) .network-dot {
  background: var(--red);
  box-shadow: 0 0 8px rgba(155, 46, 53, 0.72);
}

.network-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 8px;
}

.network-room-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 66px;
  gap: 7px;
}

.network-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.network-actions button {
  padding: 0 8px;
  font-size: 12px;
}

#createRoomButton,
#readyButton {
  color: #fff5dd;
  background: linear-gradient(180deg, rgba(155, 46, 53, 0.86), rgba(58, 22, 23, 0.92));
}

.network-health {
  display: grid;
  gap: 4px;
}

.network-health-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

.network-health-label strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.network-health-track {
  height: 6px;
  overflow: hidden;
  border: 1px solid rgba(234, 218, 170, 0.2);
  background: rgba(0, 0, 0, 0.34);
}

.network-health-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #8f2930, #d2574f);
  transition: width 0.16s ease-out;
}

.network-roster {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
}

.network-roster li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 3px 5px;
  border: 1px solid rgba(234, 218, 170, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.network-roster li.is-local {
  border-color: rgba(230, 184, 95, 0.26);
}

.network-roster li.empty {
  display: block;
  color: var(--muted);
  text-align: center;
}

.player-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--steel);
}

.player-dot.team-1 {
  background: var(--jade);
}

.player-dot.team-2 {
  background: #c84c52;
}

.player-dot.team-3 {
  background: var(--gold);
}

.player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-score,
.player-ready {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.combat-status {
  min-height: 2.5em;
  margin: 0;
  color: var(--steel);
  font-size: 11px;
  line-height: 1.35;
}

.combat-status.is-error {
  color: #ef9292;
}

/* ---------- Original-style launcher ---------- */

:root {
  --game-brightness: 1;
  --game-contrast: 1;
  --launcher-ink: #07090a;
  --launcher-panel: rgba(11, 13, 15, 0.93);
  --launcher-panel-soft: rgba(18, 21, 23, 0.88);
  --launcher-line: rgba(188, 202, 202, 0.26);
  --launcher-line-bright: rgba(225, 230, 219, 0.58);
  --launcher-red: #b43b30;
  --launcher-red-bright: #ec6957;
  --launcher-cyan: #96b8b6;
  --launcher-paper: #e8e2d3;
}

#viewport {
  filter: brightness(var(--game-brightness)) contrast(var(--game-contrast));
  transition: filter 260ms ease, transform 500ms ease;
}

body.menu-open #viewport {
  filter:
    brightness(calc(var(--game-brightness) * 0.38))
    contrast(calc(var(--game-contrast) * 1.14))
    saturate(0.58);
  transform: scale(1.018);
}

body.menu-open .hud {
  opacity: 0;
  pointer-events: none;
}

.launcher[hidden],
.launcher-screen[hidden],
.room-panel[hidden],
[hidden] {
  display: none !important;
}

.launcher {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: clamp(220px, 24vw, 360px) minmax(0, 1fr);
  min-height: 100dvh;
  color: var(--launcher-paper);
  isolation: isolate;
  overflow: hidden;
}

.launcher::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(90deg, rgba(4, 6, 7, 0.98) 0 21%, rgba(5, 7, 8, 0.78) 43%, rgba(5, 7, 8, 0.9) 100%),
    radial-gradient(circle at 76% 40%, rgba(153, 44, 31, 0.2), transparent 32%);
}

.launcher::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  opacity: 0.12;
  background-image: url("/legacy/texture/kmulogo003.bmp");
  background-size: 280px 280px;
  mix-blend-mode: screen;
  pointer-events: none;
}

.launcher-atmosphere {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.launcher-atmosphere::before,
.launcher-atmosphere::after {
  content: "";
  position: absolute;
  width: 46vw;
  height: 46vw;
  border: 1px solid rgba(193, 211, 207, 0.08);
  transform: rotate(42deg);
}

.launcher-atmosphere::before {
  right: -18vw;
  top: -22vw;
  box-shadow: 0 0 80px rgba(115, 153, 149, 0.08);
}

.launcher-atmosphere::after {
  right: 8vw;
  bottom: -38vw;
  border-color: rgba(209, 67, 48, 0.1);
}

.launcher-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: clamp(28px, 5vw, 74px);
  border-right: 1px solid var(--launcher-line);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.58)),
    linear-gradient(145deg, rgba(128, 41, 29, 0.3), transparent 40%);
}

.launcher-brand::after {
  content: "";
  position: absolute;
  top: 6%;
  bottom: 6%;
  right: -1px;
  width: 1px;
  background: linear-gradient(transparent, var(--launcher-red-bright), transparent);
  opacity: 0.7;
}

.launcher-era,
.launcher-kicker,
.launcher-version,
.launcher-eyebrow,
.screen-heading span,
.stage-selection-label,
.launcher-footer {
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.launcher-era {
  color: var(--launcher-cyan);
  font-size: 10px;
  writing-mode: vertical-rl;
  position: absolute;
  left: 24px;
  top: 28px;
}

.launcher-brand h1 {
  display: grid;
  gap: 2px;
  margin: 0;
  font-family: "STKaiti", "KaiTi", "FangSong", serif;
  font-size: clamp(50px, 6.8vw, 96px);
  font-weight: 500;
  line-height: 0.88;
  letter-spacing: -0.1em;
  text-shadow:
    0 4px 0 rgba(0, 0, 0, 0.9),
    0 0 22px rgba(206, 58, 43, 0.35);
}

.launcher-brand h1 span:first-child {
  color: #f1ece0;
}

.launcher-brand h1 span:last-child {
  margin-left: 0.34em;
  color: var(--launcher-red-bright);
}

.launcher-brand p {
  margin: 26px 0 0;
  color: rgba(232, 226, 211, 0.56);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
  letter-spacing: 0.42em;
  writing-mode: vertical-rl;
  align-self: flex-end;
  min-height: 170px;
}

.launcher-seal {
  position: absolute;
  left: clamp(30px, 5vw, 72px);
  bottom: clamp(30px, 6vh, 70px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(215, 79, 61, 0.78);
  color: rgba(226, 94, 73, 0.92);
  font: 700 22px/1 "STKaiti", "KaiTi", serif;
  transform: rotate(-6deg);
}

.launcher-shell {
  min-width: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: clamp(22px, 4vw, 58px) clamp(24px, 5vw, 76px) 18px;
}

.launcher-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--launcher-line);
}

.launcher-kicker,
.launcher-version {
  display: block;
  color: rgba(151, 184, 181, 0.66);
  font-size: 9px;
}

.launcher-header h2 {
  margin: 7px 0 0;
  color: var(--launcher-paper);
  font: 400 clamp(22px, 2.5vw, 34px)/1.1 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.12em;
}

.launcher-screen {
  min-height: 0;
  animation: launcher-in 240ms ease both;
}

.launcher-main-screen {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(330px, 1.15fr);
  align-items: center;
  gap: clamp(36px, 7vw, 112px);
}

.launcher-main-copy {
  align-self: center;
  max-width: 400px;
}

.launcher-eyebrow {
  margin: 0 0 16px;
  color: var(--launcher-red-bright);
  font-size: 10px;
}

.launcher-main-copy h3 {
  margin: 0;
  font: 400 clamp(40px, 6vw, 78px)/0.98 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.04em;
}

.launcher-main-copy > p:last-child {
  max-width: 320px;
  margin: 24px 0 0;
  color: rgba(232, 226, 211, 0.54);
  font-size: 13px;
  line-height: 1.9;
}

.launcher-nav {
  display: grid;
  gap: 8px;
  align-content: center;
}

.launcher-nav-button {
  width: 100%;
  min-height: 70px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 10px 20px 10px 10px;
  border: 1px solid transparent;
  border-bottom-color: rgba(200, 214, 209, 0.18);
  color: rgba(232, 226, 211, 0.82);
  background: linear-gradient(90deg, rgba(23, 27, 28, 0.78), rgba(10, 12, 13, 0.35));
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.launcher-nav-button:hover,
.launcher-nav-button:focus-visible {
  border-color: rgba(223, 230, 217, 0.38);
  border-left-color: var(--launcher-red-bright);
  outline: none;
  background: linear-gradient(90deg, rgba(108, 34, 28, 0.64), rgba(17, 21, 22, 0.65));
  transform: translateX(-6px);
}

.launcher-nav-primary {
  border-left-color: rgba(225, 78, 60, 0.62);
}

.launcher-nav-quiet {
  opacity: 0.62;
}

.launcher-nav-index {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(168, 192, 189, 0.25);
  color: var(--launcher-red-bright);
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 18px;
}

.launcher-nav-button strong,
.launcher-nav-button small {
  display: block;
}

.launcher-nav-button strong {
  font: 400 20px/1.2 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.08em;
}

.launcher-nav-button small {
  margin-top: 4px;
  color: rgba(160, 186, 181, 0.62);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.screen-heading {
  height: 88px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.screen-heading span {
  color: var(--launcher-red-bright);
  font-size: 9px;
}

.screen-heading h3 {
  margin: 4px 0 0;
  font: 400 26px/1.1 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.08em;
}

.launcher-back {
  position: relative;
  min-height: 36px;
  padding: 0 16px 0 28px;
  border: 1px solid var(--launcher-line);
  color: var(--launcher-cyan);
  background: rgba(7, 10, 11, 0.64);
  cursor: pointer;
}

.launcher-back::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-left: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.stage-layout {
  min-height: 0;
  height: calc(100% - 88px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 24px;
}

.stage-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  grid-auto-rows: minmax(92px, 1fr);
  gap: 10px;
  padding: 2px 8px 18px 2px;
}

.stage-card {
  position: relative;
  min-height: 92px;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 2px 12px;
  padding: 15px;
  border: 1px solid rgba(186, 204, 199, 0.2);
  color: rgba(232, 226, 211, 0.78);
  background:
    linear-gradient(145deg, rgba(23, 28, 29, 0.92), rgba(8, 10, 11, 0.86)),
    url("/legacy/texture/kmulogo003.bmp") center / cover;
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.stage-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--launcher-red-bright);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 160ms ease;
}

.stage-card:hover,
.stage-card:focus-visible,
.stage-card.is-selected {
  border-color: var(--launcher-line-bright);
  color: #fff6e7;
  outline: none;
  transform: translateY(-2px);
}

.stage-card.is-selected {
  background:
    linear-gradient(145deg, rgba(105, 35, 28, 0.9), rgba(16, 19, 20, 0.9)),
    url("/legacy/texture/kmulogo003.bmp") center / cover;
}

.stage-card.is-selected::after {
  transform: scaleX(1);
}

.stage-card-index {
  grid-row: 1 / 3;
  align-self: start;
  color: rgba(154, 187, 182, 0.42);
  font: 300 22px/1 "Segoe UI", sans-serif;
}

.stage-card-name {
  font: 400 19px/1.2 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.08em;
}

.stage-card-code {
  color: rgba(154, 187, 182, 0.52);
  font-size: 9px;
  letter-spacing: 0.16em;
}

.stage-selection {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--launcher-line);
  background:
    linear-gradient(180deg, rgba(139, 42, 31, 0.18), transparent 34%),
    var(--launcher-panel-soft);
}

.stage-selection-label {
  color: var(--launcher-red-bright);
  font-size: 9px;
}

.stage-selection strong {
  margin-top: 18px;
  font: 400 clamp(32px, 4vw, 52px)/1.05 "STKaiti", "KaiTi", serif;
}

.stage-selection small {
  margin-top: 10px;
  color: var(--launcher-cyan);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.stage-selection p {
  color: rgba(232, 226, 211, 0.52);
  font-size: 12px;
  line-height: 1.8;
}

.stage-selection .launcher-action {
  margin-top: auto;
}

.launcher-action,
.launcher-secondary,
.launcher-small-button,
.launcher-text-button {
  min-height: 40px;
  padding: 0 18px;
  font: inherit;
  cursor: pointer;
}

.launcher-action {
  border: 1px solid rgba(228, 106, 86, 0.72);
  color: #fff5e7;
  background: linear-gradient(180deg, rgba(173, 54, 43, 0.96), rgba(91, 28, 24, 0.98));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.08);
}

.launcher-action:hover,
.launcher-action:focus-visible {
  border-color: #f0806d;
  background: linear-gradient(180deg, rgba(202, 67, 53, 0.98), rgba(111, 32, 26, 0.98));
  outline: none;
}

.launcher-action:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.launcher-secondary,
.launcher-small-button {
  border: 1px solid var(--launcher-line);
  color: var(--launcher-paper);
  background: rgba(11, 14, 15, 0.86);
}

.launcher-text-button {
  border: 0;
  color: rgba(232, 226, 211, 0.58);
  background: transparent;
}

.network-layout {
  min-height: 0;
  height: calc(100% - 88px);
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(340px, 1.28fr);
  gap: 24px;
}

.network-form,
.network-browser,
.settings-form fieldset {
  border: 1px solid var(--launcher-line);
  background: var(--launcher-panel-soft);
}

.network-form {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 22px;
}

.network-form label,
.settings-form label {
  display: grid;
  gap: 7px;
}

.network-form label > span,
.settings-form label > span {
  color: rgba(160, 190, 184, 0.7);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.network-form input,
.network-form select,
.settings-form select {
  min-height: 40px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid rgba(187, 205, 200, 0.24);
  border-radius: 0;
  color: var(--launcher-paper);
  background: rgba(5, 7, 8, 0.82);
  font: inherit;
}

.network-create-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.network-browser {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.network-browser > header {
  min-height: 62px;
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--launcher-line);
}

.network-browser > header span,
.network-browser > header strong {
  display: block;
}

.network-browser > header span {
  color: var(--launcher-red-bright);
  font-size: 10px;
  letter-spacing: 0.1em;
}

#networkStatus {
  margin-top: 5px;
  color: rgba(232, 226, 211, 0.52);
  font-size: 11px;
  font-weight: 400;
}

#networkStatus[data-tone="ok"] {
  color: #9dccb8;
}

#networkStatus[data-tone="error"] {
  color: #e98979;
}

.room-list {
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.network-empty {
  margin: 0;
  padding: 24px;
  color: rgba(232, 226, 211, 0.42);
  font-size: 12px;
  text-align: center;
}

.room-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid rgba(187, 205, 200, 0.13);
}

.room-list-item strong,
.room-list-item span {
  display: block;
}

.room-list-item strong {
  color: var(--launcher-paper);
  font-size: 14px;
}

.room-list-item span {
  margin-top: 4px;
  color: rgba(157, 187, 181, 0.62);
  font-size: 10px;
}

.launcher-small-button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 11px;
}

.room-panel {
  padding: 16px 18px;
  border-top: 1px solid var(--launcher-line);
  background: rgba(111, 35, 28, 0.16);
}

.room-panel h4 {
  margin: 0 0 10px;
  font: 400 18px/1.2 "STKaiti", "KaiTi", serif;
}

#combatStatus {
  margin: 0 0 10px;
  color: rgba(232, 226, 211, 0.58);
  font-size: 11px;
}

#combatStatus.is-error {
  color: #e98979;
}

.room-panel ul {
  max-height: 110px;
  overflow: auto;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.room-panel li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 5px 0;
  color: rgba(232, 226, 211, 0.7);
  font-size: 11px;
}

.room-panel li strong {
  color: var(--launcher-cyan);
  font-weight: 500;
}

.room-panel > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.launcher-settings-screen {
  min-height: 0;
}

.settings-form {
  height: calc(100% - 88px);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  grid-template-rows: none;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px;
  padding: 2px 10px 18px 2px;
  scrollbar-gutter: stable;
}

.settings-form fieldset {
  min-width: 0;
  margin: 0;
  padding: 18px;
  align-self: start;
}

.settings-form legend {
  padding: 0 9px;
  color: var(--launcher-red-bright);
  font: 400 18px/1.2 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.08em;
}

.settings-form fieldset > label + label {
  margin-top: 14px;
}

.settings-form input[type="range"] {
  width: 100%;
  accent-color: var(--launcher-red);
}

.settings-check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.settings-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--launcher-red);
}

.settings-form output {
  float: right;
  color: var(--launcher-paper);
}

.settings-keys {
  grid-column: 1 / -1;
}

.settings-keys-hint {
  margin: 0 0 12px;
  color: rgba(232, 226, 211, 0.52);
  font-size: 11px;
}

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

.key-binding-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--launcher-line);
  color: var(--launcher-paper);
  background: rgba(11, 14, 15, 0.86);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.key-binding-button:hover,
.key-binding-button:focus-visible {
  border-color: var(--launcher-line-bright);
  outline: none;
}

.key-binding-button kbd {
  padding: 2px 8px;
  border: 1px solid rgba(188, 202, 202, 0.32);
  color: var(--launcher-cyan);
  background: rgba(7, 10, 11, 0.64);
  font: inherit;
  font-size: 11px;
}

.key-binding-button.is-listening {
  border-color: rgba(228, 106, 86, 0.72);
}

.key-binding-button.is-listening kbd {
  border-color: rgba(228, 106, 86, 0.72);
  color: var(--launcher-red-bright);
}

.settings-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.launcher-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--launcher-line);
  color: rgba(151, 184, 181, 0.42);
  font-size: 8px;
}

/* ---------- Lock-on markers (原版 0x4bb640 Lock / Track 屏幕标记) ---------- */

.lock-marker {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 3;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  will-change: transform;
}

.lock-marker-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--red);
  box-shadow: 0 0 10px rgba(155, 46, 53, 0.65), inset 0 0 6px rgba(155, 46, 53, 0.4);
}

.lock-marker-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--red);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.lock-marker--lock .lock-marker-ring {
  animation: lockPulse 1.2s ease-in-out infinite;
}

.lock-marker--track .lock-marker-ring {
  width: 26px;
  height: 26px;
  border-color: var(--gold);
  border-style: dashed;
  box-shadow: none;
  opacity: 0.75;
}

.lock-marker--track .lock-marker-label {
  color: var(--gold);
  opacity: 0.75;
}

@keyframes lockPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.78; }
}

/* ---------- In-game vignette ---------- */

.game-vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.55) 100%);
  transition: opacity 600ms ease;
}

body.network-match .game-vignette {
  opacity: 1;
}

body.menu-open .game-vignette {
  opacity: 0;
}

/* ---------- Combat HUD (bottom immersive) ---------- */

.combat-hud {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  grid-template-columns: minmax(200px, 320px) minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
  padding: 18px 24px 22px;
  background: linear-gradient(0deg, rgba(4, 5, 6, 0.82) 0%, rgba(4, 5, 6, 0.38) 60%, transparent 100%);
  pointer-events: none;
}

body.network-match .combat-hud,
body.solo-match .combat-hud {
  display: grid;
}

/* 单机模式没有权威快照，隐藏网络提示行 */
body.solo-match:not(.network-match) .combat-status,
body.solo-match:not(.network-match) .combat-hud-right {
  display: none;
}

body.menu-open .combat-hud {
  opacity: 0;
  pointer-events: none;
}

.combat-hud-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.combat-health-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.combat-health-track {
  position: relative;
  width: min(300px, 38vw);
  height: 14px;
  overflow: hidden;
  border: 1px solid rgba(226, 104, 83, 0.5);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  box-shadow:
    0 0 12px rgba(180, 59, 48, 0.2),
    inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.combat-health-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #6b1a14, #c0392b 40%, #e74c3c 70%, #ff6b5a);
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
  transition: width 180ms ease-out;
}

/* 低血量时血条闪烁 */
.combat-health-track.is-low span {
  animation: health-pulse 0.8s ease-in-out infinite alternate;
}

@keyframes health-pulse {
  from { opacity: 1; }
  to { opacity: 0.6; }
}

.combat-anger-bar {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.combat-anger-track {
  position: relative;
  width: min(300px, 38vw);
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(94, 156, 211, 0.5);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  box-shadow:
    0 0 10px rgba(58, 116, 180, 0.18),
    inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.combat-anger-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #14406b, #2b76c0 40%, #3c9ce7 70%, #6cc2ff);
  box-shadow: 0 0 8px rgba(76, 156, 231, 0.4);
  transition: width 160ms ease-out;
}

/* 满怒时怒气条泛光提示（可放大绝） */
.combat-anger-track.is-full span {
  background: linear-gradient(90deg, #7a4d10, #c08a2b 40%, #e7b53c 70%, #ffd76c);
  animation: health-pulse 0.7s ease-in-out infinite alternate;
}

.combat-health-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 50%);
  pointer-events: none;
}

.combat-health-info {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.combat-health-info strong {
  color: #f0e6d8;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.combat-health-info small {
  color: rgba(232, 226, 211, 0.45);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.combat-hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 2px;
}

.combat-round-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 18px;
  border: 1px solid rgba(150, 184, 182, 0.2);
  border-radius: 3px;
  background: rgba(8, 10, 11, 0.72);
  backdrop-filter: blur(6px);
}

.combat-round-info span {
  color: rgba(232, 226, 211, 0.7);
  font-size: 10px;
}

.combat-round-info strong {
  color: var(--launcher-cyan);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.combat-round-info small {
  color: rgba(232, 226, 211, 0.4);
  font-size: 9px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combat-status {
  margin: 0;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(232, 226, 211, 0.62);
  font-size: 11px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  text-align: center;
}

.combat-status.is-error {
  color: #ef7766;
}

.combat-hud-right {
  display: flex;
  align-items: flex-end;
  padding-bottom: 4px;
}

.combat-hud-right small {
  color: rgba(150, 184, 182, 0.5);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

/* 单机死亡倒计时 / 关卡结算提示 */
.solo-banner {
  position: fixed;
  z-index: 6;
  left: 50%;
  top: 26%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 34px;
  text-align: center;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(4, 5, 6, 0.72) 0%, rgba(4, 5, 6, 0.42) 100%);
  border-top: 1px solid rgba(198, 168, 106, 0.35);
  border-bottom: 1px solid rgba(198, 168, 106, 0.35);
}

.solo-banner[hidden] {
  display: none;
}

.solo-banner strong {
  color: #e6d3a3;
  font-size: 26px;
  letter-spacing: 6px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.solo-banner.is-defeat strong {
  color: #ef7766;
}

.solo-banner small {
  color: rgba(214, 226, 224, 0.72);
  font-size: 12px;
  letter-spacing: 2px;
}

body.menu-open .solo-banner {
  opacity: 0;
}

/* ---------- Desktop + mobile session controls ---------- */

.game-session-controls {
  position: fixed;
  z-index: 12;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  display: none;
  align-items: center;
  gap: 6px;
}

body:is(.solo-match, .network-match):not(.menu-open) .game-session-controls {
  display: flex;
}

body:is(.solo-match, .network-match):not(.menu-open) .hud-top {
  right: 92px;
}

.game-session-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(226, 213, 180, 0.4);
  border-radius: 4px;
  color: rgba(248, 240, 221, 0.94);
  background: rgba(10, 14, 15, 0.78);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  touch-action: manipulation;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.game-session-control:hover,
.game-session-control:focus-visible,
.game-session-control[aria-pressed="true"] {
  border-color: rgba(230, 184, 95, 0.8);
  background: rgba(62, 52, 33, 0.88);
}

.game-session-control:active {
  transform: translateY(1px);
}

.game-session-control-exit {
  border-color: rgba(230, 105, 87, 0.54);
  background: rgba(74, 25, 22, 0.8);
}

.game-session-control-icon {
  font-size: 15px;
  line-height: 1;
}

/* ---------- Mobile touch controls ---------- */

.mobile-controls {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

body.mobile-controls-enabled:is(.solo-match, .network-match):not(.menu-open) .mobile-controls {
  display: block;
}

.mobile-move-zone,
.mobile-action-zone,
.mobile-action {
  pointer-events: auto;
  touch-action: none;
}

.mobile-stick,
.mobile-stick * {
  touch-action: none;
}

.mobile-move-zone {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(24px, env(safe-area-inset-bottom));
  width: 142px;
  height: 142px;
}

.mobile-stick {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(230, 184, 95, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(230, 184, 95, 0.08) 0 31%, transparent 32%),
    radial-gradient(circle, rgba(7, 10, 10, 0.28) 0 56%, rgba(7, 10, 10, 0.68) 100%);
  box-shadow:
    inset 0 0 26px rgba(0, 0, 0, 0.5),
    0 8px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.mobile-stick-ring {
  position: absolute;
  inset: 32%;
  border: 1px solid rgba(150, 184, 182, 0.3);
  border-radius: 50%;
}

.mobile-stick-command-ring {
  position: absolute;
  inset: 24%;
  border: 1px dashed rgba(230, 184, 95, 0.28);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(230, 184, 95, 0.04);
  pointer-events: none;
}

.mobile-stick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(230, 213, 170, 0.6);
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 241, 204, 0.28), transparent 32%),
    linear-gradient(145deg, rgba(88, 93, 87, 0.94), rgba(24, 29, 28, 0.96));
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transform: translate(-50%, -50%);
  will-change: transform;
}

.mobile-stick-mark {
  position: absolute;
  color: rgba(225, 230, 219, 0.4);
  font-size: 9px;
  line-height: 1;
  transition: color 80ms ease, filter 80ms ease, transform 80ms ease;
}

.mobile-stick-mark-up {
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-stick-mark-down {
  bottom: 9px;
  left: 50%;
  transform: translateX(-50%);
}

.mobile-stick-mark-left {
  top: 50%;
  left: 9px;
  transform: translateY(-50%);
}

.mobile-stick-mark-right {
  top: 50%;
  right: 9px;
  transform: translateY(-50%);
}

.mobile-stick[data-command-direction="forward"] .mobile-stick-mark-up {
  color: #ffe3a2;
  filter: drop-shadow(0 0 5px rgba(230, 184, 95, 0.95));
  transform: translateX(-50%) scale(1.45);
}

.mobile-stick[data-command-direction="backward"] .mobile-stick-mark-down {
  color: #ffe3a2;
  filter: drop-shadow(0 0 5px rgba(230, 184, 95, 0.95));
  transform: translateX(-50%) scale(1.45);
}

.mobile-stick[data-command-direction="left"] .mobile-stick-mark-left {
  color: #ffe3a2;
  filter: drop-shadow(0 0 5px rgba(230, 184, 95, 0.95));
  transform: translateY(-50%) scale(1.45);
}

.mobile-stick[data-command-direction="right"] .mobile-stick-mark-right {
  color: #ffe3a2;
  filter: drop-shadow(0 0 5px rgba(230, 184, 95, 0.95));
  transform: translateY(-50%) scale(1.45);
}

.mobile-stick.is-command-pulse .mobile-stick-command-ring {
  border-color: rgba(255, 227, 162, 0.82);
  box-shadow:
    inset 0 0 22px rgba(230, 184, 95, 0.12),
    0 0 12px rgba(230, 184, 95, 0.2);
}

.mobile-stick-sequence {
  position: absolute;
  left: 50%;
  bottom: -21px;
  min-width: 72px;
  margin: 0;
  padding: 3px 8px;
  border: 1px solid rgba(230, 184, 95, 0.18);
  border-radius: 9px;
  color: rgba(255, 227, 162, 0.92);
  background: rgba(7, 10, 10, 0.62);
  font: 600 12px/1 "Segoe UI Symbol", sans-serif;
  letter-spacing: 0.12em;
  text-align: center;
  opacity: 0;
  transform: translateX(-50%) translateY(3px);
  transition: opacity 100ms ease, transform 100ms ease;
  pointer-events: none;
}

.mobile-stick-sequence.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mobile-action-zone {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 224px;
  height: 248px;
}

.mobile-action {
  position: absolute;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(226, 213, 180, 0.46);
  border-radius: 50%;
  color: rgba(248, 240, 221, 0.94);
  font: 600 20px/1 "STKaiti", "KaiTi", "Microsoft YaHei", sans-serif;
  text-shadow: 0 1px 4px #000;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.16), transparent 31%),
    rgba(13, 17, 18, 0.78);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.34),
    inset 0 0 12px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  -webkit-tap-highlight-color: transparent;
  transition: transform 70ms ease, filter 70ms ease, border-color 70ms ease;
}

.mobile-action.is-pressed {
  transform: scale(0.88);
  filter: brightness(1.35);
  border-color: rgba(255, 241, 204, 0.9);
}

.mobile-action-attack {
  right: 0;
  bottom: 30px;
  width: 76px;
  height: 76px;
  border-color: rgba(230, 105, 87, 0.72);
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.18), transparent 31%),
    rgba(123, 32, 28, 0.82);
  font-size: 28px;
}

.mobile-action-jump {
  right: 76px;
  bottom: 0;
  width: 64px;
  height: 64px;
  border-color: rgba(230, 184, 95, 0.68);
  background: rgba(98, 73, 31, 0.82);
}

.mobile-action-guard {
  right: 82px;
  bottom: 72px;
  width: 62px;
  height: 62px;
  border-color: rgba(105, 181, 159, 0.68);
  background: rgba(29, 87, 75, 0.82);
}

.mobile-action-crouch,
.mobile-action-switch,
.mobile-action-fake,
.mobile-action-lock,
.mobile-action-burst,
.mobile-action-cure {
  width: 48px;
  height: 48px;
  font-size: 16px;
}

.mobile-action-crouch {
  right: 148px;
  bottom: 24px;
}

.mobile-action-switch {
  right: 150px;
  bottom: 82px;
}

.mobile-action-fake {
  right: 150px;
  bottom: 140px;
}

.mobile-action-lock {
  right: 96px;
  bottom: 140px;
  border-color: rgba(150, 184, 182, 0.65);
  background: rgba(36, 74, 72, 0.82);
}

.mobile-action-fake,
.mobile-action-lock {
  font-size: 13px;
}

.mobile-action-burst {
  right: 28px;
  bottom: 118px;
  border-color: rgba(104, 165, 221, 0.65);
  background: rgba(26, 65, 104, 0.82);
}

.mobile-action-cure {
  right: 42px;
  bottom: 196px;
  border-color: rgba(112, 201, 127, 0.72);
  background: rgba(34, 105, 57, 0.84);
}

.mobile-look-hint {
  position: absolute;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  margin: 0;
  transform: translateX(-50%);
  color: rgba(232, 226, 211, 0.48);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-shadow: 0 1px 4px #000;
  animation: mobile-hint-fade 4s ease forwards;
}

body.mobile-controls-enabled:is(.solo-match, .network-match):not(.menu-open) .combat-hud {
  top: max(8px, env(safe-area-inset-top));
  bottom: auto;
  padding: 58px max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(4, 5, 6, 0.72), transparent);
}

body.mobile-controls-enabled:is(.solo-match, .network-match):not(.menu-open) :is(
  .hud-top,
  .side-panel,
  .debug-overlay
) {
  opacity: 0;
  pointer-events: none;
}

@keyframes mobile-hint-fade {
  0%,
  55% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media (max-height: 520px) {
  .mobile-move-zone {
    width: 122px;
    height: 122px;
  }

  .mobile-action-zone {
    transform: scale(0.86);
    transform-origin: right bottom;
  }
}

@media (orientation: portrait) and (max-width: 540px) {
  .mobile-move-zone {
    width: 126px;
    height: 126px;
  }

  .mobile-action-zone {
    width: 210px;
    transform: scale(0.9);
    transform-origin: right bottom;
  }

  .mobile-look-hint {
    bottom: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-action,
  .mobile-look-hint {
    animation: none;
    transition: none;
  }
}

/* 伤害闪烁 overlay */
.game-vignette.is-damaged {
  opacity: 1;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(139, 0, 0, 0.35) 100%);
  transition: opacity 80ms ease;
}

/* 战斗 HUD 响应式 */
@media (max-width: 720px) {
  .combat-hud {
    grid-template-columns: 1fr auto;
    padding: 12px 14px 16px;
  }

  .combat-hud-center {
    grid-column: 1 / -1;
    order: -1;
  }

  .combat-health-track {
    width: min(220px, 50vw);
    height: 10px;
  }

  .combat-round-info {
    padding: 4px 12px;
  }
}

/* 阵营选择 */
.team-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 11px;
  color: rgba(232, 226, 211, 0.7);
}

.team-btn.is-active {
  border-color: var(--launcher-red-bright);
  color: var(--launcher-red-bright);
  background: rgba(226, 104, 83, 0.18);
}

/* 回合比分 */
.round-score {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 10px;
  font-size: 11px;
  color: rgba(232, 226, 211, 0.7);
}

.round-score strong {
  color: var(--launcher-cyan);
  font-size: 12px;
}

/* 规则选项 fieldset */
.network-rules {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--launcher-line);
}

.network-rules legend {
  padding: 0 6px;
  color: var(--launcher-red-bright);
  font-size: 11px;
}

.network-rules label {
  margin-top: 8px;
}

.network-rules input[type="number"] {
  width: 64px;
}

body.menu-open #motionDebugToggle {
  display: none !important;
}

/* 游戏中侧面板自动收缩 */
body.network-match:not(.menu-open) .side-panel {
  opacity: 0.28;
  transition: opacity 300ms ease;
}

body.network-match:not(.menu-open) .side-panel:hover {
  opacity: 1;
}

body.network-match:not(.menu-open) .hud-top {
  opacity: 0;
  pointer-events: none;
}

@keyframes launcher-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 940px) {
  .launcher {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .launcher-brand {
    padding: 28px;
  }

  .launcher-brand h1 {
    font-size: 52px;
  }

  .launcher-main-screen {
    grid-template-columns: 1fr;
    gap: 22px;
    align-content: center;
  }

  .launcher-main-copy {
    display: none;
  }

  .stage-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

}

@media (max-width: 720px) {
  .launcher {
    display: block;
    overflow: auto;
    background: rgba(4, 6, 7, 0.94);
  }

  .launcher-brand {
    min-height: 132px;
    display: block;
    padding: 22px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--launcher-line);
  }

  .launcher-brand h1 {
    display: flex;
    gap: 12px;
    font-size: 42px;
    letter-spacing: 0;
  }

  .launcher-brand h1 span:last-child {
    margin-left: 0;
  }

  .launcher-brand p,
  .launcher-era {
    display: none;
  }

  .launcher-seal {
    left: auto;
    right: 24px;
    bottom: 22px;
  }

  .launcher-shell {
    height: auto;
    min-height: calc(100dvh - 132px);
    padding: 20px 18px 12px;
  }

  .launcher-version,
  .launcher-footer span:last-child {
    display: none;
  }

  .launcher-main-screen {
    min-height: 520px;
  }

  .stage-layout,
  .network-layout {
    height: auto;
    grid-template-columns: 1fr;
  }

  .stage-selection {
    min-height: 260px;
  }

  .stage-grid {
    max-height: 430px;
  }

  .network-form,
  .network-browser {
    min-height: 430px;
  }

  .settings-form {
    height: auto;
    grid-template-columns: 1fr;
  }

  .settings-form fieldset:last-of-type {
    grid-column: auto;
  }
}

@media (max-width: 430px) {
  .launcher-nav-button {
    min-height: 62px;
  }

  .stage-grid {
    grid-template-columns: 1fr;
  }

  .network-create-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .launcher-screen,
  .launcher-nav-button,
  .stage-card,
  #viewport {
    animation: none;
    transition: none;
  }
}

/* ==========================================================================
   Debug console 「暗令台」 + enhanced debug panel
   命令名与原版 Meteor.exe 隐藏控制台字符串对齐（cheat / speed / adddummy …）
   ========================================================================== */

.debug-console {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: clamp(8px, 4vh, 40px) var(--pad) 0;
  pointer-events: none;
}

.debug-console[hidden] {
  display: none;
}

.console-frame {
  pointer-events: auto;
  width: min(760px, 94vw);
  display: flex;
  flex-direction: column;
  max-height: min(58vh, 480px);
  border: 1px solid rgba(230, 184, 95, 0.38);
  border-top: none;
  background:
    linear-gradient(180deg, rgba(20, 15, 10, 0.96), rgba(10, 10, 12, 0.93));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(230, 184, 95, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: console-drop 0.16s ease-out;
}

@keyframes console-drop {
  from {
    transform: translateY(-12px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid rgba(230, 184, 95, 0.2);
  background: rgba(230, 184, 95, 0.05);
}

.console-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.console-title i {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(155, 46, 53, 0.9);
  color: #f0d8ab;
  background: linear-gradient(160deg, rgba(155, 46, 53, 0.85), rgba(80, 22, 24, 0.9));
  font-style: normal;
  font-size: 12px;
  font-family: "STKaiti", "KaiTi", serif;
}

.console-hint {
  color: rgba(173, 182, 173, 0.62);
  font-size: 11px;
  white-space: nowrap;
}

.console-log {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 10px 14px;
  font-family: "Cascadia Mono", "JetBrains Mono", Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
  line-height: 1.65;
}

.console-line {
  color: rgba(244, 239, 228, 0.86);
  word-break: break-all;
  white-space: pre-wrap;
}

.console-line + .console-line {
  margin-top: 1px;
}

.console-line.is-cmd {
  color: var(--gold);
}

.console-line.is-ok {
  color: #7fc9ae;
}

.console-line.is-warn {
  color: #e0b968;
}

.console-line.is-err {
  color: #e2766f;
}

.console-line.is-title {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.console-line.is-muted {
  color: rgba(173, 182, 173, 0.6);
}

.console-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px 14px;
  border-top: 1px solid rgba(230, 184, 95, 0.2);
  background: rgba(8, 9, 10, 0.55);
}

.console-prompt {
  color: var(--gold);
  font-weight: 700;
}

#consoleInput {
  flex: 1;
  min-height: 32px;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: "Cascadia Mono", "JetBrains Mono", Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
}

#consoleInput:focus {
  box-shadow: none;
  outline: none;
}

#consoleInput::placeholder {
  color: rgba(173, 182, 173, 0.42);
}

/* ---------- Debug panel additions ---------- */

.section-hint {
  margin-left: 6px;
  color: rgba(173, 182, 173, 0.5);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.debug-toggle-list {
  display: grid;
  gap: 2px;
  margin-bottom: 10px;
}

.debug-toggle-list .settings-check {
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 3px;
  transition: background 0.12s ease;
  cursor: pointer;
}

.debug-toggle-list .settings-check:hover {
  background: rgba(230, 184, 95, 0.07);
}

.debug-toggle-list .settings-check span {
  color: var(--text);
  font-size: 12px;
  text-transform: none;
}

.debug-toggle-list .settings-check input {
  width: 15px;
  height: 15px;
  min-height: 0;
  accent-color: var(--gold);
}

.cmd-tag {
  justify-self: end;
  padding: 1px 7px;
  border: 1px solid rgba(230, 184, 95, 0.26);
  border-radius: 2px;
  color: rgba(230, 184, 95, 0.78);
  background: rgba(230, 184, 95, 0.06);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
}

.debug-slider {
  margin: 2px 6px 12px;
}

.debug-slider > span {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  font-size: 12px;
  color: var(--text);
}

.debug-slider output {
  margin-left: auto;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.debug-slider input[type="range"] {
  min-height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--gold);
}

.debug-buttons {
  margin: 0 0 10px;
}

.debug-buttons button {
  color: #f4e9cf;
  background: linear-gradient(180deg, rgba(94, 74, 34, 0.85), rgba(48, 38, 20, 0.92));
  font-size: 12px;
}

.console-open-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 12px;
  color: var(--gold);
  background: rgba(230, 184, 95, 0.07);
  border-color: rgba(230, 184, 95, 0.4);
  letter-spacing: 0.06em;
  cursor: pointer;
}

.console-open-btn:hover {
  background: rgba(230, 184, 95, 0.14);
}

kbd {
  padding: 1px 7px;
  border: 1px solid rgba(234, 218, 170, 0.35);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: rgba(8, 9, 10, 0.7);
  color: #f0d8ab;
  font-family: Consolas, monospace;
  font-size: 11px;
}

/* ---------- HUD polish ---------- */

.panel-body,
.console-log,
.debug-overlay-body,
.room-list,
.stage-grid {
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 184, 95, 0.35) transparent;
}

.panel-body::-webkit-scrollbar,
.console-log::-webkit-scrollbar,
.debug-overlay-body::-webkit-scrollbar {
  width: 8px;
}

.panel-body::-webkit-scrollbar-thumb,
.console-log::-webkit-scrollbar-thumb,
.debug-overlay-body::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 6px;
  background: rgba(230, 184, 95, 0.3) padding-box;
}

.panel-body::-webkit-scrollbar-thumb:hover,
.console-log::-webkit-scrollbar-thumb:hover {
  background: rgba(230, 184, 95, 0.5) padding-box;
}

.side-panel .settings-check input,
.panel-body input[type="checkbox"] {
  accent-color: var(--gold);
}

.panel-section summary {
  color: var(--gold);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.panel-section summary:hover {
  color: #f0d8ab;
}

#debugStats {
  font-variant-numeric: tabular-nums;
}

#debugStats dt {
  letter-spacing: 0.03em;
}

#debugStats dd {
  font-family: Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
  font-size: 11px;
}

button,
select,
input {
  transition: border-color 0.14s ease, background-color 0.14s ease, color 0.14s ease;
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 1px solid rgba(230, 184, 95, 0.75);
  outline-offset: 1px;
}

@media (max-width: 720px), (max-height: 560px) {
  .console-frame {
    max-height: 48vh;
  }

  .console-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .console-frame {
    animation: none;
  }
}

/* ==========================================================================
   阵中小憩 — in-game translucent pause menu
   开局后按 Esc 打开的菜单不再遮死画面：战场持续渲染（网络对战继续模拟），
   菜单以半透明水墨覆层浮于其上。
   ========================================================================== */

body.menu-ingame #viewport {
  /* 覆盖 menu-open 的重度压暗：保留清晰战场，只轻微收敛 */
  filter:
    brightness(calc(var(--game-brightness) * 0.82))
    contrast(var(--game-contrast))
    saturate(0.92);
  transform: none;
}

.launcher.is-ingame::before {
  background:
    linear-gradient(90deg, rgba(4, 6, 7, 0.82) 0 18%, rgba(5, 7, 8, 0.34) 46%, rgba(5, 7, 8, 0.55) 100%),
    radial-gradient(circle at 76% 40%, rgba(153, 44, 31, 0.14), transparent 32%);
}

.launcher.is-ingame::after {
  opacity: 0.05;
}

.launcher.is-ingame .launcher-brand {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.5)),
    linear-gradient(145deg, rgba(128, 41, 29, 0.22), transparent 40%);
}

.launcher.is-ingame .launcher-nav-button {
  background: linear-gradient(90deg, rgba(23, 27, 28, 0.66), rgba(10, 12, 13, 0.28));
}

.launcher.is-ingame .network-form .network-section,
.launcher.is-ingame .network-browser,
.launcher.is-ingame .settings-form fieldset,
.launcher.is-ingame .stage-selection {
  background-color: rgba(11, 13, 15, 0.78);
}

/* 开局后「重返战局」置顶并高亮 */
.launcher-nav-resume {
  order: -1;
  border-left-color: rgba(230, 184, 95, 0.66);
}

.launcher-nav-resume .launcher-nav-index {
  border-color: rgba(230, 184, 95, 0.5);
  color: var(--gold);
}

.launcher.is-ingame .launcher-nav-resume strong {
  color: #f5e5c0;
}

/* ==========================================================================
   网络对战 — 「群雄榜」重制
   ========================================================================== */

.network-form {
  border: none;
  background: transparent;
  padding: 2px 6px 18px 2px;
  gap: 16px;
}

.network-section {
  position: relative;
  min-width: 0;
  margin: 0;
  display: grid;
  gap: 13px;
  padding: 18px 18px 20px;
  border: 1px solid var(--launcher-line);
  background:
    linear-gradient(180deg, rgba(139, 42, 31, 0.1), transparent 26%),
    var(--launcher-panel-soft);
  box-shadow: inset 0 0 0 1px rgba(7, 9, 10, 0.55), inset 0 1px 0 rgba(232, 226, 211, 0.05);
}

/* 四角描金 */
.network-section::before,
.network-section::after,
.network-browser::before,
.network-browser::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
  opacity: 0.85;
}

.network-section::before,
.network-browser::before {
  top: -1px;
  left: -1px;
  border-top: 1px solid rgba(230, 184, 95, 0.75);
  border-left: 1px solid rgba(230, 184, 95, 0.75);
}

.network-section::after,
.network-browser::after {
  right: -1px;
  bottom: -1px;
  border-right: 1px solid rgba(230, 184, 95, 0.75);
  border-bottom: 1px solid rgba(230, 184, 95, 0.75);
}

.network-section legend {
  padding: 0 10px;
  margin-left: -4px;
  color: var(--launcher-red-bright);
  font: 400 16px/1.2 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.3em;
}

.network-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.network-form input:hover,
.network-form select:hover {
  border-color: rgba(225, 230, 219, 0.44);
}

.network-form input:focus,
.network-form select:focus {
  border-color: rgba(228, 106, 86, 0.78);
  box-shadow: 0 0 0 2px rgba(180, 59, 48, 0.16), inset 0 0 12px rgba(180, 59, 48, 0.08);
  outline: none;
}

/* 规则细则：内嵌浅框 */
.network-rules {
  border: 1px dashed rgba(188, 202, 202, 0.24);
  background: rgba(5, 7, 8, 0.4);
  padding: 12px 14px 14px;
}

.network-rules-title {
  display: block;
  margin-bottom: 10px;
  color: rgba(160, 190, 184, 0.7);
  font-size: 10px;
  letter-spacing: 0.22em;
}

.network-rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.network-rules-grid input[type="number"] {
  min-height: 34px;
}

.network-rules-grid .settings-check {
  align-self: end;
  grid-template-columns: auto auto;
  justify-content: start;
  gap: 8px;
  min-height: 34px;
  align-items: center;
}

.network-rules-grid .settings-check span {
  color: var(--launcher-paper);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: none;
}

.network-create-row {
  grid-template-columns: 1fr;
  padding-top: 2px;
}

.network-create-note {
  margin: -2px 0 2px;
  color: rgba(230, 218, 188, 0.72);
  font-size: 12px;
  line-height: 1.55;
}

/* —— 群雄榜（房间列表）—— */

.network-browser {
  position: relative;
  background:
    linear-gradient(180deg, rgba(139, 42, 31, 0.08), transparent 22%),
    var(--launcher-panel-soft);
}

.room-password-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 46%, rgba(121, 42, 33, 0.22), transparent 44%),
    rgba(3, 5, 6, 0.82);
  backdrop-filter: blur(8px);
}

.room-password-gate[hidden] {
  display: none;
}

.room-password-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(210, 180, 122, 0.34);
  background:
    linear-gradient(150deg, rgba(116, 37, 30, 0.2), transparent 48%),
    rgba(9, 12, 13, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(5, 7, 8, 0.9),
    0 24px 80px rgba(0, 0, 0, 0.62);
}

.room-password-kicker {
  color: var(--launcher-red-bright);
  font-size: 10px;
  letter-spacing: 0.32em;
}

.room-password-card h4 {
  margin: 0;
  color: var(--launcher-paper);
  font: 400 25px/1.2 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.08em;
}

.room-password-card p {
  margin: 0;
  color: rgba(232, 226, 211, 0.58);
  font-size: 12px;
  line-height: 1.65;
}

.room-password-card label {
  display: grid;
  gap: 7px;
}

.room-password-card label > span {
  color: rgba(160, 190, 184, 0.72);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.room-password-card input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(187, 205, 200, 0.28);
  border-radius: 0;
  color: var(--launcher-paper);
  background: rgba(3, 5, 6, 0.88);
  font: inherit;
}

.room-password-card input:focus {
  border-color: rgba(228, 106, 86, 0.78);
  box-shadow: 0 0 0 2px rgba(180, 59, 48, 0.16);
  outline: none;
}

.room-password-card .room-password-error {
  color: #ef9a89;
}

.room-password-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.network-browser > header {
  justify-content: space-between;
  gap: 14px;
  background: linear-gradient(90deg, rgba(111, 35, 28, 0.3), transparent 70%);
}

.network-browser-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.network-refresh-button {
  min-height: 34px;
  padding: 0 14px;
  color: var(--launcher-cyan);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.browser-seal {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1.5px solid rgba(215, 79, 61, 0.65);
  color: rgba(226, 94, 73, 0.85);
  font: 700 17px/1 "STKaiti", "KaiTi", serif;
  font-style: normal;
  transform: rotate(-5deg);
  opacity: 0.9;
}

.room-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
}

.room-list-item {
  position: relative;
  border: 1px solid rgba(187, 205, 200, 0.14);
  border-left: 2px solid rgba(187, 205, 200, 0.2);
  background: linear-gradient(90deg, rgba(23, 27, 28, 0.6), rgba(10, 12, 13, 0.3));
  padding: 12px 14px;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.room-list-item:hover {
  border-color: rgba(225, 230, 219, 0.38);
  border-left-color: var(--launcher-red-bright);
  background: linear-gradient(90deg, rgba(84, 30, 25, 0.5), rgba(15, 18, 19, 0.55));
  transform: translateX(2px);
}

.room-list-item strong {
  font: 400 16px/1.3 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.06em;
}

.room-list-item .launcher-small-button {
  min-height: 34px;
  min-width: 72px;
  border-color: rgba(228, 106, 86, 0.5);
  color: #f5decd;
  background: rgba(111, 35, 28, 0.3);
}

.room-list-item .launcher-small-button:hover:not(:disabled) {
  border-color: #f0806d;
  background: rgba(173, 54, 43, 0.55);
}

.room-list-item .launcher-small-button:disabled {
  border-color: var(--launcher-line);
  color: rgba(232, 226, 211, 0.4);
  background: transparent;
}

.network-empty {
  padding: 42px 24px;
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 14px;
  letter-spacing: 0.14em;
  line-height: 2.2;
  color: rgba(232, 226, 211, 0.4);
}

.network-empty::before {
  content: "劍 未 出 鞘";
  display: block;
  margin-bottom: 8px;
  color: rgba(215, 79, 61, 0.5);
  font-size: 18px;
  letter-spacing: 0.5em;
}

/* —— 聚义厅（房间面板）—— */

.room-panel {
  background:
    linear-gradient(180deg, rgba(111, 35, 28, 0.24), rgba(111, 35, 28, 0.1)),
    rgba(8, 10, 11, 0.5);
}

.room-panel h4 {
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.08em;
}

.room-panel h4::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--launcher-red-bright);
  transform: rotate(45deg);
  flex: 0 0 auto;
}

.room-panel li {
  border-bottom: 1px dashed rgba(188, 202, 202, 0.14);
}

.room-panel-actions {
  padding-top: 4px;
}

.team-btn {
  min-height: 34px;
  padding: 0 18px;
  border: 1px solid var(--launcher-line);
  color: var(--launcher-paper);
  background: rgba(11, 14, 15, 0.86);
  font: inherit;
  letter-spacing: 0.12em;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.team-btn-meteor:hover,
.team-btn-meteor.is-active {
  border-color: rgba(79, 165, 143, 0.85);
  color: #9fe0c8;
  background: rgba(38, 84, 72, 0.32);
}

.team-btn-butterfly:hover,
.team-btn-butterfly.is-active {
  border-color: rgba(226, 104, 83, 0.85);
  color: #f0937f;
  background: rgba(120, 38, 30, 0.34);
}

.team-btn.is-active {
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
}

#readyButton {
  letter-spacing: 0.14em;
}

/* ==========================================================================
   网络房间等待页 — 大厅 → 房间 → 整备/聊天 → 房主开局
   ========================================================================== */

.network-room-view {
  height: calc(100% - 88px);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--launcher-line);
  background:
    linear-gradient(135deg, rgba(137, 42, 31, 0.12), transparent 38%),
    rgba(7, 9, 10, 0.78);
  box-shadow: inset 0 0 0 1px rgba(7, 9, 10, 0.62);
}

.network-room-view[hidden],
#networkLobbyView[hidden] {
  display: none !important;
}

.network-room-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--launcher-line);
  background: linear-gradient(90deg, rgba(111, 35, 28, 0.34), transparent 72%);
}

.network-room-header h4 {
  margin: 3px 0 0;
  color: var(--launcher-paper);
  font: 400 21px/1.2 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.08em;
}

.network-room-header p {
  margin: 5px 0 0;
  color: rgba(232, 226, 211, 0.52);
  font-size: 11px;
}

.network-room-kicker {
  color: var(--launcher-red-bright);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.network-link-summary {
  display: grid;
  justify-items: end;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.network-link-summary span {
  color: rgba(232, 226, 211, 0.5);
  font-size: 10px;
}

.network-link-summary strong {
  min-width: 148px;
  padding: 6px 10px;
  border: 1px solid rgba(187, 205, 200, 0.2);
  color: rgba(232, 226, 211, 0.64);
  background: rgba(5, 7, 8, 0.55);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

#roomP2pStatus[data-state="direct"] {
  border-color: rgba(89, 190, 145, 0.5);
  color: #9fe0c8;
  background: rgba(37, 95, 72, 0.25);
}

#roomP2pStatus[data-state="failed"],
#roomP2pStatus[data-state="unsupported"] {
  border-color: rgba(226, 104, 83, 0.48);
  color: #f0937f;
}

.network-room-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(500px, 1.75fr) minmax(280px, 0.78fr);
  grid-template-rows: minmax(118px, 0.52fr) minmax(195px, 1fr) minmax(150px, 0.74fr);
  gap: 10px;
  padding: 10px;
}

.network-room-card {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  border: 1px solid rgba(187, 205, 200, 0.16);
  background: rgba(12, 15, 16, 0.67);
}

.network-room-card > header {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(187, 205, 200, 0.13);
  background: rgba(111, 35, 28, 0.12);
}

.network-room-card > header span {
  color: #e7d8bd;
  font: 400 15px/1 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.12em;
}

.network-room-card > header small {
  color: rgba(160, 190, 184, 0.52);
  font-size: 9px;
}

.network-roster-card {
  grid-column: 1;
  grid-row: 1 / 4;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.network-settings-card {
  grid-column: 2;
  grid-row: 2;
}

.network-loadout-card {
  grid-column: 2;
  grid-row: 1;
}

.network-chat-card {
  grid-column: 2;
  grid-row: 3;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.room-showcase {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 68%, rgba(183, 105, 62, 0.2), transparent 43%),
    radial-gradient(circle at 50% 35%, rgba(93, 109, 105, 0.13), transparent 58%),
    linear-gradient(180deg, rgba(16, 22, 23, 0.5), rgba(5, 7, 8, 0.88));
  isolation: isolate;
}

.room-showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.18;
  background:
    radial-gradient(circle at 50% 44%, transparent 0 28%, rgba(202, 159, 100, 0.16) 28.2% 28.5%, transparent 28.8%),
    linear-gradient(90deg, transparent, rgba(151, 178, 174, 0.08), transparent);
  pointer-events: none;
}

.room-showcase-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  filter: drop-shadow(0 8px 7px rgba(0, 0, 0, 0.72));
}

.network-room-roster {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  pointer-events: none;
}

.room-player-label {
  position: absolute;
  z-index: 3;
  width: 104px;
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 0;
  background: none;
  opacity: 0;
  text-align: center;
  transform: translate(-50%, 7px);
  pointer-events: none;
  text-shadow:
    0 1px 2px #030405,
    0 2px 8px rgba(0, 0, 0, 0.98);
}

.room-player-label[data-positioned="true"] {
  opacity: 1;
}

.room-player-name {
  max-width: 100%;
  overflow: hidden;
  color: #f1e8d6;
  font: 500 11px/1.25 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-player-label.is-local .room-player-name {
  color: #f2cf8c;
}

.room-player-label.is-team-meteor:not(.is-local) .room-player-name {
  color: #b5e1d5;
}

.room-player-label.is-team-butterfly:not(.is-local) .room-player-name {
  color: #efb0a3;
}

.room-player-details,
.room-player-model-state {
  max-width: 100%;
  overflow: hidden;
  color: rgba(199, 211, 206, 0.68);
  font: 8px/1.3 Consolas, "SFMono-Regular", monospace;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-player-details.is-ready {
  color: #9fe0c8;
}

.room-player-model-state {
  color: rgba(222, 170, 112, 0.64);
}

.room-player-label[data-model-state="ready"] .room-player-model-state {
  display: none;
}

.room-player-label[data-model-state="error"] .room-player-model-state {
  color: #ef9583;
}

.room-showcase-fallback {
  display: none;
  position: absolute;
  inset: 50% 14px auto;
  z-index: 5;
  margin: 0;
  color: rgba(232, 226, 211, 0.58);
  font-size: 10px;
  text-align: center;
  transform: translateY(-50%);
}

.room-showcase[data-preview="unavailable"] .room-showcase-canvas,
.room-showcase[data-preview="unavailable"] .room-player-model-state {
  display: none;
}

.room-showcase[data-preview="unavailable"] .room-showcase-fallback {
  display: block;
}

.room-showcase[data-preview="unavailable"] .network-room-roster {
  position: relative;
  inset: auto;
  z-index: 6;
  height: 100%;
  display: grid;
  align-content: end;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 48px 12px 12px;
}

.room-showcase[data-preview="unavailable"] .room-player-label {
  position: relative;
  left: auto !important;
  top: auto !important;
  width: auto;
  opacity: 1;
  transform: none;
}

.room-loadout-grid,
.room-settings-form {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.room-loadout-grid {
  grid-template-columns: 1fr 1fr;
}

.room-loadout-grid label,
.room-settings-form label {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.room-loadout-grid label > span,
.room-settings-form label > span,
.team-select > span {
  color: rgba(160, 190, 184, 0.65);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.room-loadout-grid select,
.room-settings-form select,
.room-settings-form input,
.room-chat-form input {
  min-width: 0;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid rgba(187, 205, 200, 0.22);
  border-radius: 0;
  color: var(--launcher-paper);
  background: rgba(5, 7, 8, 0.78);
  font: inherit;
}

.network-loadout-card .team-select {
  padding: 0 10px 8px;
}

.room-loadout-hint {
  margin: auto 10px 8px;
  color: rgba(232, 226, 211, 0.42);
  font-size: 8px;
  line-height: 1.4;
}

.network-settings-card {
  grid-template-rows: auto minmax(0, 1fr);
}

.room-settings-form {
  grid-template-columns: 1fr 1fr;
  overflow: auto;
  align-content: start;
}

.room-settings-form .room-friendly-fire {
  grid-column: 1 / -1;
  grid-template-columns: auto 1fr;
  align-items: center;
}

.room-settings-hint {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: rgba(211, 190, 127, 0.78);
  font-size: 8px;
  line-height: 1.45;
}

.room-settings-form :disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.room-settings-summary {
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.room-settings-summary-state {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-left: 2px solid rgba(89, 190, 145, 0.58);
  color: #9fd4bf;
  background: rgba(28, 84, 64, 0.16);
  font-size: 9px;
  line-height: 1.45;
}

.room-settings-summary[data-configured="false"] .room-settings-summary-state {
  border-left-color: rgba(222, 170, 80, 0.58);
  color: #dfc28a;
  background: rgba(101, 72, 26, 0.16);
}

.room-settings-summary dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 0;
}

.room-settings-summary dl > div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(187, 205, 200, 0.13);
  background: rgba(5, 7, 8, 0.5);
}

.room-settings-summary dt {
  color: rgba(160, 190, 184, 0.52);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.room-settings-summary dd {
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--launcher-paper);
  font: 400 12px/1.25 "STKaiti", "KaiTi", serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-chat-log {
  min-height: 0;
  overflow: auto;
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 184, 95, 0.32) transparent;
}

.room-chat-log li {
  margin: 0 0 5px;
  color: rgba(232, 226, 211, 0.7);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.room-chat-log strong {
  margin-right: 6px;
  color: #cf9484;
  font-weight: 500;
}

.room-chat-log time {
  margin-right: 7px;
  color: rgba(160, 190, 184, 0.4);
  font: 9px/1 Consolas, monospace;
}

.room-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid rgba(187, 205, 200, 0.13);
}

.room-chat-form button {
  min-width: 68px;
}

.network-room-actions {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-top: 1px solid var(--launcher-line);
  background: rgba(5, 7, 8, 0.52);
}

.network-room-ready-hint {
  min-width: 0;
  margin-left: auto;
  color: rgba(232, 226, 211, 0.48);
  font-size: 10px;
  text-align: right;
}

.network-room-actions button {
  min-height: 36px;
  padding: 0 14px;
}

@media (max-width: 980px), (max-height: 700px) {
  .network-room-view {
    height: auto;
    max-height: calc(100dvh - 150px);
    overflow: auto;
  }

  .network-room-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    grid-template-rows: minmax(480px, 62vh) auto minmax(190px, auto);
  }

  .network-roster-card {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .network-loadout-card {
    grid-column: 1;
    grid-row: 2;
  }

  .network-settings-card {
    grid-column: 2;
    grid-row: 2;
    min-height: 260px;
  }

  .network-chat-card {
    grid-column: 1 / -1;
    grid-row: 3;
    min-height: 190px;
  }
}

@media (max-width: 680px) {
  .network-room-header,
  .network-room-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .network-link-summary {
    width: 100%;
    justify-items: stretch;
  }

  .network-room-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(540px, 72vh) auto auto minmax(210px, auto);
  }

  .network-roster-card {
    grid-column: 1;
    grid-row: 1;
  }

  .network-loadout-card {
    grid-column: 1;
    grid-row: 2;
  }

  .network-settings-card {
    grid-column: 1;
    grid-row: 3;
  }

  .network-chat-card {
    grid-column: 1;
    grid-row: 4;
  }

  .network-room-ready-hint {
    width: 100%;
    order: -1;
    margin-left: 0;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .network-room-grid {
    grid-template-rows: minmax(500px, 68vh) auto auto minmax(220px, auto);
  }

  .network-room-roster {
    display: block;
  }

  .room-player-label {
    width: 76px;
  }

  .room-player-name {
    font-size: 9px;
  }

  .room-player-details,
  .room-player-model-state {
    font-size: 7px;
  }

  .room-showcase[data-preview="unavailable"] .network-room-roster {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .room-loadout-grid,
  .room-settings-form {
    grid-template-columns: 1fr;
  }

  .room-settings-form .room-friendly-fire {
    grid-column: 1;
  }
}

/* 二级页面统一释放首页品牌侧栏，让任务、大厅和设置使用完整视口宽度。 */
.launcher.is-secondary-view {
  display: block;
}

.launcher.is-secondary-view .launcher-brand {
  display: none;
}

.launcher.is-secondary-view .launcher-shell {
  width: 100%;
  min-height: 100dvh;
}

/* 已进入房间后进一步切为独立候场页：同时释放启动器上下框架占用。 */
.launcher.is-room-view {
  display: block;
  overflow: hidden;
}

.launcher.is-room-view .launcher-brand,
.launcher.is-room-view .launcher-header,
.launcher.is-room-view .launcher-footer {
  display: none;
}

.launcher.is-room-view .launcher-shell {
  width: 100%;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  padding: clamp(12px, 1.6vw, 24px) clamp(14px, 2.4vw, 38px);
}

.launcher.is-room-view .launcher-network-screen {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
}

.launcher.is-room-view .screen-heading {
  height: 64px;
}

.launcher.is-room-view .network-room-view {
  height: auto;
  max-height: none;
  overflow: hidden;
}

@media (max-width: 980px), (max-height: 700px) {
  .launcher.is-room-view {
    overflow: auto;
  }

  .launcher.is-room-view .launcher-shell {
    height: auto;
    min-height: 100dvh;
  }

  .launcher.is-room-view .launcher-network-screen {
    height: auto;
  }

  .launcher.is-room-view .network-room-view {
    overflow: auto;
  }
}

@media (max-width: 680px) {
  .network-browser > header {
    align-items: flex-start;
  }

  .network-browser-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }

  .browser-seal {
    display: none;
  }
}

/* ==========================================================================
   杂项打磨
   ========================================================================== */

/* 任务选择卡片：编号印章化 */
.stage-card-index {
  font-family: "STKaiti", "KaiTi", serif;
  font-size: 15px;
  color: rgba(215, 96, 76, 0.55);
}

.stage-selection {
  position: relative;
}

.stage-selection::before {
  content: "";
  position: absolute;
  top: -1px;
  left: -1px;
  width: 14px;
  height: 14px;
  border-top: 1px solid rgba(230, 184, 95, 0.75);
  border-left: 1px solid rgba(230, 184, 95, 0.75);
}

.stage-selection::after {
  content: "";
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(230, 184, 95, 0.75);
  border-bottom: 1px solid rgba(230, 184, 95, 0.75);
}

.settings-form fieldset {
  position: relative;
}

.network-form,
.room-panel ul {
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 184, 95, 0.35) transparent;
}

.network-form::-webkit-scrollbar,
.room-panel ul::-webkit-scrollbar {
  width: 8px;
}

.network-form::-webkit-scrollbar-thumb,
.room-panel ul::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 6px;
  background: rgba(230, 184, 95, 0.3) padding-box;
}

@media (max-width: 900px) {
  .network-field-row,
  .network-rules-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   战场入境遮罩 — 覆盖启动器关闭到首帧可交互之间的真实加载事务
   ========================================================================== */

body.is-game-loading {
  overflow: hidden;
  cursor: wait;
}

.game-loading {
  --game-loading-progress: 0%;
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  color: #eee4d1;
  background:
    radial-gradient(circle at 50% 42%, rgba(113, 43, 34, 0.24), transparent 32%),
    radial-gradient(circle at 50% 78%, rgba(53, 76, 72, 0.13), transparent 42%),
    linear-gradient(155deg, #08090a 0%, #030405 58%, #0c0908 100%);
  opacity: 1;
  touch-action: none;
  transition: opacity 360ms ease;
}

.game-loading:focus {
  outline: none;
}

.game-loading[hidden] {
  display: none;
}

.game-loading.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.game-loading::before,
.game-loading::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.game-loading::before {
  inset: 0;
  opacity: 0.2;
  background:
    repeating-linear-gradient(
      112deg,
      transparent 0 72px,
      rgba(229, 208, 168, 0.035) 73px,
      transparent 74px 146px
    );
}

.game-loading::after {
  width: min(74vw, 880px);
  height: min(74vw, 880px);
  border: 1px solid rgba(210, 173, 111, 0.08);
  border-radius: 50%;
  box-shadow:
    0 0 0 14vw rgba(210, 173, 111, 0.018),
    0 0 0 28vw rgba(210, 173, 111, 0.012);
}

.game-loading-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.game-loading-sky i {
  position: absolute;
  top: 18%;
  left: -24%;
  width: clamp(160px, 28vw, 420px);
  height: 1px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(235, 194, 125, 0.82));
  box-shadow: 0 0 10px rgba(229, 128, 88, 0.34);
  transform: rotate(-16deg);
  animation: game-loading-meteor 3.8s ease-in infinite;
}

.game-loading-sky i:nth-child(2) {
  top: 48%;
  left: -34%;
  width: clamp(110px, 20vw, 300px);
  animation-delay: 1.25s;
  animation-duration: 4.6s;
}

.game-loading-sky i:nth-child(3) {
  top: 72%;
  left: -18%;
  width: clamp(90px, 15vw, 220px);
  animation-delay: 2.4s;
  animation-duration: 4.2s;
}

.game-loading-content {
  position: relative;
  z-index: 2;
  width: min(520px, 88vw);
  display: grid;
  justify-items: center;
  text-align: center;
}

.game-loading-emblem {
  position: relative;
  width: clamp(92px, 11vw, 128px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin-bottom: 26px;
}

.game-loading-emblem::before,
.game-loading-emblem::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.game-loading-emblem::before {
  inset: 12%;
  background:
    radial-gradient(circle at 38% 32%, rgba(239, 197, 125, 0.22), transparent 28%),
    rgba(73, 25, 21, 0.42);
  box-shadow:
    inset 0 0 28px rgba(0, 0, 0, 0.72),
    0 0 38px rgba(151, 52, 40, 0.18);
}

.game-loading-emblem::after {
  inset: 27%;
  border: 1px solid rgba(238, 198, 125, 0.28);
}

.game-loading-emblem span {
  position: relative;
  z-index: 3;
  color: #e6c78e;
  font: 400 clamp(32px, 4vw, 45px)/1 "STKaiti", "KaiTi", serif;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.9);
}

.game-loading-orbit {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(213, 172, 107, 0.18);
  border-top-color: rgba(234, 195, 124, 0.92);
  border-right-color: rgba(198, 78, 59, 0.5);
  border-radius: 50%;
  animation: game-loading-orbit 2.2s linear infinite;
}

.game-loading-orbit::after {
  content: "";
  position: absolute;
  top: 8%;
  right: 13%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #edc77e;
  box-shadow: 0 0 12px #dc725b;
}

.game-loading-orbit-inner {
  inset: 18%;
  border-top-color: rgba(100, 174, 155, 0.68);
  border-right-color: rgba(100, 174, 155, 0.08);
  animation-direction: reverse;
  animation-duration: 3.1s;
}

.game-loading-kicker {
  color: rgba(221, 174, 99, 0.72);
  font-size: 9px;
  letter-spacing: 0.42em;
}

.game-loading h2 {
  margin: 10px 0 8px;
  color: #f0e4cf;
  font: 400 clamp(29px, 4.2vw, 42px)/1.15 "STKaiti", "KaiTi", serif;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
}

.game-loading-stage {
  min-height: 20px;
  margin: 0 0 28px;
  color: rgba(178, 202, 194, 0.68);
  font-size: 11px;
  letter-spacing: 0.16em;
}

.game-loading-track {
  position: relative;
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: rgba(216, 223, 216, 0.1);
  box-shadow: 0 1px rgba(255, 255, 255, 0.03);
}

.game-loading-track > span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--game-loading-progress);
  min-width: 5px;
  overflow: hidden;
  background: linear-gradient(90deg, #7c2c25, #d37855 62%, #e9c17e);
  box-shadow: 0 0 14px rgba(219, 113, 81, 0.46);
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.game-loading-track > span::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 42%;
  background: linear-gradient(90deg, transparent, rgba(255, 239, 195, 0.92), transparent);
  transform: translateX(-120%);
  animation: game-loading-shimmer 1.45s ease-in-out infinite;
}

.game-loading-meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: rgba(220, 215, 200, 0.48);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.game-loading-meta output {
  color: rgba(228, 193, 128, 0.7);
  font: 9px/1 Consolas, "SFMono-Regular", monospace;
  font-variant-numeric: tabular-nums;
}

.game-loading.is-error .game-loading-orbit {
  border-top-color: #e36f5d;
  animation-play-state: paused;
}

.game-loading.is-error .game-loading-emblem span,
.game-loading.is-error .game-loading-meta output {
  color: #ef9583;
}

.game-loading.is-error .game-loading-track > span {
  background: #b63d32;
}

@keyframes game-loading-orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes game-loading-meteor {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(-16deg);
  }
  12% {
    opacity: 0.78;
  }
  44%,
  100% {
    opacity: 0;
    transform: translate3d(150vw, 42vh, 0) rotate(-16deg);
  }
}

@keyframes game-loading-shimmer {
  58%,
  100% {
    transform: translateX(280%);
  }
}

@media (max-width: 520px) {
  .game-loading-content {
    width: min(420px, 86vw);
  }

  .game-loading-emblem {
    margin-bottom: 22px;
  }

  .game-loading-stage {
    margin-bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-loading,
  .game-loading-track > span {
    transition-duration: 1ms;
  }

  .game-loading-orbit,
  .game-loading-sky i,
  .game-loading-track > span::after {
    animation: none;
  }
}
