:root {
  color-scheme: dark;
  font-family: Impact, "Arial Narrow", "Microsoft YaHei", system-ui, sans-serif;
  --red: #f02a23;
  --paper: #e2ded3;
  --muted: #9d9990;
  --panel: rgba(7, 10, 10, 0.78);
  --line: rgba(224, 224, 216, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
}

body {
  color: var(--paper);
  background:
    linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.46)),
    url("/assets/mobile-bg.webp") center / cover fixed,
    #050707;
  overflow-x: hidden;
}

.browser-title-helper {
  position: fixed;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  pointer-events: none;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(76deg, rgba(220, 0, 0, 0.16) 0 1px, transparent 1px 13px),
    radial-gradient(circle at 80% 15%, rgba(220, 0, 0, 0.18), transparent 27%),
    radial-gradient(circle at 92% 84%, rgba(220, 0, 0, 0.22), transparent 24%);
  content: "";
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  touch-action: manipulation;
}

.boot-loading {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background: #000;
  color: #fff;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  opacity: 1;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.boot-loading-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.boot-loading-logo {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  background: url("/assets/portal/logos/logo-ba-loading.png") center / contain no-repeat;
}

.boot-loading-text {
  display: inline-flex;
  align-items: baseline;
  font-size: 18px;
  line-height: 1;
  white-space: nowrap;
}

.boot-loading-text span {
  display: inline-block;
  min-width: 0.28em;
  animation: bootLetterJump 1.35s ease-in-out infinite;
  animation-delay: calc(var(--i) * 0.075s);
}

.boot-loading.hidden {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

@keyframes bootLetterJump {
  0%,
  72%,
  100% {
    transform: translateY(0);
  }

  18% {
    transform: translateY(-5px);
  }
}

.game {
  width: min(100%, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 2px) 12px calc(env(safe-area-inset-bottom) + 14px);
}

.play-panel,
.hud.play-panel,
.timer-wrap.play-panel,
.arena.play-panel,
.skill-dock.play-panel {
  display: none;
}

body.playing .play-panel {
  display: block;
}

body.playing .timer-wrap {
  display: block;
}

body.playing .hud,
body.playing .skill-dock {
  display: grid;
}

body.playing .map-screen {
  display: none;
}

body.playing {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
}

.map-screen {
  display: grid;
  gap: 8px;
}

.map-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.map-actions {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px;
  align-items: end;
  justify-self: end;
}

.map-action,
.back-map {
  min-height: 44px;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(126, 4, 5, 0.95), rgba(16, 6, 6, 0.98));
  color: var(--paper);
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: inset 0 0 22px rgba(255, 255, 255, 0.035), 0 0 18px rgba(240, 42, 35, 0.16);
}

.map-action {
  min-width: 82px;
  padding: 0 12px;
  position: static;
  margin-top: 0;
}

.map-action.secondary {
  min-width: 74px;
  background: linear-gradient(145deg, rgba(28, 31, 29, 0.96), rgba(8, 8, 8, 0.98));
}

.map-panel,
.mission-brief {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5, 8, 8, 0.78);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45), inset 0 0 38px rgba(255, 255, 255, 0.025);
}

.map-panel {
  overflow: hidden;
}

.map-toolbar {
  display: block;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.map-toolbar span {
  color: var(--paper);
  font-size: 1.05rem;
  font-weight: 900;
  text-shadow: 0 2px 0 #000;
}

.mission-map {
  position: relative;
  height: min(118vw, 560px);
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 24%, rgba(89, 255, 17, 0.14), transparent 15%),
    radial-gradient(circle at 72% 40%, rgba(151, 255, 53, 0.08), transparent 17%),
    linear-gradient(135deg, rgba(3, 20, 9, 0.98), rgba(0, 8, 4, 0.99));
  isolation: isolate;
  cursor: grab;
  touch-action: none;
}

.mission-map:active {
  cursor: grabbing;
}

.mission-map-canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 1800px;
  height: 1800px;
  will-change: transform;
}

.mission-map-canvas::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(18deg, transparent 0 13%, rgba(59, 126, 25, 0.2) 13% 15%, transparent 15% 35%, rgba(42, 115, 18, 0.2) 35% 37%, transparent 37% 61%, rgba(72, 134, 28, 0.18) 61% 63%, transparent 63%),
    linear-gradient(96deg, transparent 0 18%, rgba(98, 150, 33, 0.16) 18% 20%, transparent 20% 53%, rgba(72, 136, 23, 0.17) 53% 55%, transparent 55% 78%, rgba(57, 119, 21, 0.14) 78% 80%, transparent 80%),
    repeating-linear-gradient(0deg, rgba(142, 255, 58, 0.03) 0 1px, transparent 1px 34px),
    repeating-linear-gradient(90deg, rgba(142, 255, 58, 0.026) 0 1px, transparent 1px 32px);
  content: "";
}

.mission-map-canvas::after {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 54%, rgba(0, 0, 0, 0.42) 75%),
    repeating-linear-gradient(76deg, rgba(80, 255, 23, 0.08) 0 1px, transparent 1px 13px);
  content: "";
  pointer-events: none;
}

.city-map-details {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.98;
  pointer-events: none;
}

.city-map-details svg {
  display: block;
  width: 100%;
  height: 100%;
}

.city-map-details .map-base {
  fill: #001006;
}

.city-map-details .map-photo {
  opacity: 0.96;
  filter: saturate(1.18) contrast(1.1) brightness(0.86);
}

.city-map-details .blue-point,
.city-map-details .hot-point,
.city-map-details .micro-point {
  animation: map-point-blink 2.6s ease-in-out infinite;
}

.city-map-details .blue-point {
  fill: rgba(119, 255, 35, 0.78);
  filter: drop-shadow(0 0 7px rgba(97, 255, 20, 0.78));
}

.city-map-details .hot-point {
  fill: rgba(184, 255, 60, 0.9);
  filter: drop-shadow(0 0 10px rgba(148, 255, 24, 0.9));
}

.city-map-details .micro-point {
  fill: rgba(96, 255, 20, 0.42);
  filter: drop-shadow(0 0 4px rgba(92, 255, 19, 0.58));
  animation-duration: 3.8s;
}

.earth-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.map-grid-lines {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    repeating-linear-gradient(90deg, rgba(240, 42, 35, 0.07) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(0deg, rgba(240, 42, 35, 0.055) 0 1px, transparent 1px 42px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.mission-nodes {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.tactical-hud {
  position: absolute;
  inset: 0;
  z-index: 7;
  overflow: hidden;
  color: rgba(133, 255, 35, 0.86);
  font-family: "Consolas", "Courier New", monospace;
  text-shadow: 0 0 8px rgba(100, 255, 23, 0.7);
  mix-blend-mode: screen;
  pointer-events: none;
}

.tactical-hud::before {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(126, 255, 35, 0.16);
  clip-path: polygon(0 0, 23% 0, 23% 1px, 77% 1px, 77% 0, 100% 0, 100% 24%, calc(100% - 1px) 24%, calc(100% - 1px) 76%, 100% 76%, 100% 100%, 77% 100%, 77% calc(100% - 1px), 23% calc(100% - 1px), 23% 100%, 0 100%, 0 76%, 1px 76%, 1px 24%, 0 24%);
  content: "";
}

.tactical-hud::after {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(132, 255, 42, 0.5), transparent);
  content: "";
}

.hud-frame {
  position: absolute;
  width: 42px;
  height: 42px;
  border-color: rgba(137, 255, 35, 0.55);
  filter: drop-shadow(0 0 8px rgba(98, 255, 18, 0.45));
}

.hud-frame.top-left {
  top: 14px;
  left: 14px;
  border-top: 2px solid;
  border-left: 2px solid;
}

.hud-frame.top-right {
  top: 14px;
  right: 14px;
  border-top: 2px solid;
  border-right: 2px solid;
}

.hud-frame.bottom-left {
  bottom: 14px;
  left: 14px;
  border-bottom: 2px solid;
  border-left: 2px solid;
}

.hud-frame.bottom-right {
  right: 14px;
  bottom: 14px;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.hud-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(33vw, 150px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  animation: hud-breathe 2.4s ease-in-out infinite;
}

.hud-crosshair span {
  position: absolute;
  width: 28%;
  height: 28%;
  border-color: rgba(157, 255, 63, 0.74);
}

.hud-crosshair span:nth-child(1) {
  left: 0;
  top: 0;
  border-top: 2px solid;
  border-left: 2px solid;
}

.hud-crosshair span:nth-child(2) {
  right: 0;
  top: 0;
  border-top: 2px solid;
  border-right: 2px solid;
}

.hud-crosshair span:nth-child(3) {
  right: 0;
  bottom: 0;
  border-right: 2px solid;
  border-bottom: 2px solid;
}

.hud-crosshair span:nth-child(4) {
  left: 0;
  bottom: 0;
  border-bottom: 2px solid;
  border-left: 2px solid;
}

.hud-arc {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(58vw, 260px);
  aspect-ratio: 1;
  border: 2px solid rgba(126, 255, 34, 0.52);
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  animation: hud-spin 7s linear infinite;
}

.hud-arc.arc-b {
  width: min(42vw, 190px);
  opacity: 0.65;
  animation-direction: reverse;
  animation-duration: 5.2s;
}

.hud-readout {
  position: absolute;
  display: grid;
  gap: 2px;
  width: 28%;
  max-width: 128px;
  padding: 5px 7px;
  border-top: 1px solid rgba(135, 255, 35, 0.48);
  background: linear-gradient(90deg, rgba(96, 255, 18, 0.08), transparent);
  font-size: clamp(0.48rem, 1.9vw, 0.68rem);
  line-height: 1.1;
  overflow: hidden;
  white-space: nowrap;
}

.hud-readout.left {
  left: 14px;
  top: 24%;
}

.hud-readout.right {
  right: 20px;
  top: 24%;
  text-align: right;
  background: linear-gradient(270deg, rgba(96, 255, 18, 0.08), transparent);
}

.hud-readout b {
  color: rgba(226, 255, 196, 0.92);
  font-size: 1.1em;
}

.hud-readout .hud-coordinate {
  color: rgba(236, 255, 218, 0.98);
  font-size: 1.35em;
  letter-spacing: 0;
  text-shadow:
    0 0 4px rgba(157, 255, 63, 0.95),
    0 0 12px rgba(97, 255, 20, 0.72);
}

.hud-readout span,
.hud-readout i {
  color: rgba(127, 255, 38, 0.78);
  font-style: normal;
}

.hud-matrix {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 9%;
  overflow: hidden;
  color: rgba(126, 255, 35, 0.72);
  font-size: clamp(0.5rem, 2vw, 0.76rem);
  white-space: nowrap;
  opacity: 0.78;
}

.hud-scanline {
  position: absolute;
  left: 0;
  right: 0;
  height: 62px;
  background: linear-gradient(180deg, transparent, rgba(110, 255, 23, 0.1), transparent);
  animation: hud-scan 3.6s linear infinite;
}

.mission-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  background: rgba(240, 42, 35, 0.88);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 1000;
  box-shadow: 0 0 0 8px rgba(240, 42, 35, 0.08), 0 0 24px rgba(240, 42, 35, 0.82);
  animation: distress-pulse 0.9s ease-in-out infinite alternate;
}

.mission-node.locked {
  background: rgba(82, 82, 78, 0.78);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.34);
  box-shadow: none;
  animation: none;
}

.mission-node.done {
  background: rgba(76, 176, 94, 0.9);
  box-shadow: 0 0 22px rgba(80, 220, 110, 0.48);
  animation: none;
}

.mission-node.active::after {
  position: absolute;
  inset: -12px;
  border: 1px solid rgba(240, 42, 35, 0.5);
  border-radius: inherit;
  content: "";
  animation: distress-ring 1.1s ease-out infinite;
}

.map-intel-spot {
  position: absolute;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin: -9.5px 0 0 -9.5px;
  border: 1px solid rgba(255, 231, 94, 0.9);
  border-radius: 999px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 249, 160, 0.98), rgba(255, 205, 42, 0.82) 45%, rgba(80, 51, 5, 0.92) 78%);
  color: #2a1800;
  cursor: pointer;
  font-size: 0.46rem;
  font-weight: 1000;
  line-height: 1;
  box-shadow: 0 0 0 5px rgba(255, 212, 42, 0.12), 0 0 12px rgba(255, 195, 32, 0.86);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  animation: map-intel-pulse 1.35s ease-in-out infinite alternate;
  touch-action: manipulation;
}

.map-intel-spot span {
  transform: translateY(-1px);
}

.map-intel-spot:hover,
.map-intel-spot:focus-visible {
  border-color: rgba(255, 255, 255, 0.95);
  outline: none;
  box-shadow: 0 0 0 6px rgba(255, 221, 54, 0.16), 0 0 16px rgba(255, 215, 62, 0.96);
}

.map-intel-spot:active {
  transform: scale(0.94);
}

.mission-brief {
  position: relative;
  min-height: 78px;
  border-color: rgba(240, 42, 35, 0.82);
  padding: 9px 12px;
  overflow: hidden;
  box-shadow: 0 0 18px rgba(240, 42, 35, 0.16), inset 0 0 38px rgba(255, 255, 255, 0.025);
}

.mission-brief::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(3, 4, 4, 0.78) 0%, rgba(3, 4, 4, 0.34) 48%, rgba(3, 4, 4, 0.08) 100%),
    var(--brief-bg, url("/assets/brief-laser.webp")) center 42% / cover;
  content: "";
  opacity: 0.96;
  filter: saturate(1.22) contrast(1.14) brightness(1.08);
  transform: scaleX(-1) scale(1.08);
}

.mission-brief::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    repeating-linear-gradient(76deg, rgba(240, 42, 35, 0.08) 0 1px, transparent 1px 12px),
    radial-gradient(circle at 82% 50%, rgba(240, 42, 35, 0.18), transparent 34%);
  content: "";
  pointer-events: none;
}

.mission-brief h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 4px;
  color: var(--red);
  font-size: 1.05rem;
  font-style: italic;
  text-shadow: 2px 2px 0 #000, 0 0 14px rgba(240, 42, 35, 0.42);
}

.mission-brief p {
  position: relative;
  z-index: 1;
  max-width: 82%;
  margin: 0;
  color: var(--paper);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.28;
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.72);
}

.mission-dialogue-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.mission-dialogue-overlay.visible {
  display: flex;
}

.mission-dialogue-panel {
  width: min(100%, 1140px);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mission-dialogue-head {
  display: none;
}

.mission-dialogue-head span {
  color: #9de75a;
  font-size: 0.86rem;
  font-style: italic;
  text-shadow: 0 0 12px rgba(157, 231, 90, 0.52);
}

.mission-dialogue-head h2 {
  margin: 0;
  color: var(--red);
  font-size: 1.36rem;
  font-style: italic;
  line-height: 1;
  text-shadow: 2px 2px 0 #000, 0 0 18px rgba(240, 42, 35, 0.48);
}

.mission-dialogue-card {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid rgba(240, 42, 35, 0.76);
  border-radius: 10px;
  background:
    radial-gradient(circle at 18% 32%, rgba(240, 42, 35, 0.16), transparent 32%),
    rgba(3, 5, 5, 0.92);
  box-shadow: inset 0 0 28px rgba(255, 255, 255, 0.04), 0 0 32px rgba(240, 42, 35, 0.22);
}

.mission-dialogue-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  filter: saturate(1.45) contrast(1.12) brightness(1.28);
  transform: scale(1.01);
}

.mission-dialogue-card::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.08) 42%, rgba(0, 0, 0, 0.66) 78%, rgba(0, 0, 0, 0.86)),
    linear-gradient(0deg, rgba(0, 0, 0, 0.64), transparent 54%),
    repeating-linear-gradient(76deg, rgba(240, 42, 35, 0.045) 0 1px, transparent 1px 12px);
  content: "";
}

.mission-dialogue-card.system,
.mission-dialogue-card.alien {
  border-color: rgba(157, 231, 90, 0.72);
  background:
    radial-gradient(circle at 50% 50%, rgba(157, 231, 90, 0.12), transparent 42%),
    repeating-linear-gradient(0deg, rgba(157, 231, 90, 0.07) 0 1px, transparent 1px 22px),
    rgba(2, 8, 4, 0.94);
}

.mission-dialogue-card.alien {
  border-color: rgba(240, 42, 35, 0.85);
  background:
    radial-gradient(circle at 70% 30%, rgba(240, 42, 35, 0.22), transparent 38%),
    repeating-linear-gradient(90deg, rgba(240, 42, 35, 0.08) 0 1px, transparent 1px 18px),
    rgba(8, 2, 3, 0.95);
}

.mission-dialogue-card.system img,
.mission-dialogue-card.alien img {
  display: none;
}

.mission-dialogue-copy {
  position: absolute;
  inset: auto 16px 14px 16px;
  z-index: 1;
  display: grid;
  gap: 7px;
  max-width: min(92%, 690px);
  max-height: calc(100% - 28px);
  overflow-y: auto;
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(0, 0, 0, 0.86);
  -webkit-overflow-scrolling: touch;
}

.mission-dialogue-copy span {
  color: #72b8ff;
  font-size: 1.02rem;
  font-style: italic;
  font-weight: 900;
  text-shadow: 0 2px 0 #000, 0 0 14px rgba(114, 184, 255, 0.72);
}

.mission-dialogue-card.alien .mission-dialogue-copy span,
.mission-dialogue-card.mimic .mission-dialogue-copy span {
  color: var(--red);
}

.mission-dialogue-copy p {
  margin: 0;
  color: var(--paper);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1.38;
}

.mission-dialogue-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.mission-dialogue-actions button {
  border: 1px solid rgba(240, 42, 35, 0.78);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(3, 4, 4, 0.76);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 900;
  text-shadow: 0 2px 0 #000;
}

.mission-dialogue-actions button:first-child {
  color: #cfff91;
  border-color: rgba(157, 231, 90, 0.68);
}

@media (max-width: 520px) {
  .mission-dialogue-overlay {
    padding: 8px;
  }

  .mission-dialogue-panel {
    width: calc(100vw - 16px);
  }

  .mission-dialogue-card {
    aspect-ratio: 16 / 7;
  }

  .mission-dialogue-copy {
    inset: auto 12px 12px 12px;
    max-width: calc(100% - 24px);
  }

  .mission-dialogue-copy p {
    font-size: 0.92rem;
    line-height: 1.28;
  }

  .mission-dialogue-actions {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}

.hud {
  display: grid;
  grid-template-columns: minmax(112px, 0.76fr) minmax(178px, 1fr);
  gap: 7px;
  align-items: end;
}

.brand p {
  margin: 0 0 4px;
  font-size: clamp(0.78rem, 3.2vw, 1rem);
  letter-spacing: 0;
}

.brand h1 {
  display: grid;
  width: min-content;
  margin: 0;
  color: var(--red);
  font-size: clamp(3.8rem, 18vw, 6.5rem);
  font-style: italic;
  line-height: 0.72;
  letter-spacing: 0;
  text-shadow: 2px 2px 0 #000, 5px 5px 0 rgba(0, 0, 0, 0.74);
}

.brand h1 span {
  font-size: 0.43em;
}

.brand h1 strong {
  font: inherit;
}

.brand em {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 12px 4px;
  background: var(--red);
  color: #050505;
  font-size: clamp(1rem, 4.8vw, 1.5rem);
  font-style: italic;
  font-weight: 1000;
  line-height: 1;
}

body.playing .hud {
  gap: 7px;
}

body.playing .brand p,
.map-screen .brand p {
  margin-bottom: 2px;
  font-size: clamp(0.66rem, 2.8vw, 0.88rem);
}

body.playing .brand h1,
.map-screen .brand h1 {
  font-size: clamp(2.45rem, 13vw, 5.1rem);
  line-height: 0.68;
}

body.playing .brand em,
.map-screen .brand em {
  margin-top: 3px;
  padding: 2px 8px 3px;
  font-size: clamp(0.72rem, 3.25vw, 1.15rem);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  min-width: 0;
}

.stats span {
  display: grid;
  place-items: center;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.035);
}

.stats b {
  color: var(--red);
  font-size: 1.48rem;
  line-height: 1;
}

.stats small {
  color: var(--paper);
  font-size: 0.8rem;
}

.timer-wrap {
  margin: 10px 0;
}

.timer-meta {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 76px;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--paper);
  font-size: 0.94rem;
  font-weight: 900;
  text-shadow: 0 2px 0 #000;
}

.timer-meta span {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

#timerLabel {
  text-align: left;
  text-overflow: ellipsis;
}

#speedLabel {
  text-align: right;
}

.timer-track {
  width: 100%;
  height: 17px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: #111;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.85);
}

.timer-bar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #55d56b, #d2dc5d 38%, #ff8a3b 64%, #d30a2c);
  transition: width 80ms linear;
}

.hero-skill {
  position: fixed;
  left: 50%;
  top: var(--hero-skill-top, max(env(safe-area-inset-top), 10px));
  z-index: 80;
  display: grid;
  align-items: end;
  width: min(calc(100vw - 32px), 620px);
  height: var(--hero-skill-height, clamp(128px, 22vh, 176px));
  opacity: 0;
  overflow: hidden;
  border: 2px solid rgba(240, 42, 35, 0.72);
  border-radius: 10px;
  background: rgba(4, 5, 5, 0.62);
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.35),
    0 0 42px rgba(240, 42, 35, 0.32),
    inset 0 0 28px rgba(255, 255, 255, 0.04);
  pointer-events: none;
  transform: translate(-50%, -10px) scale(0.72);
  transform-origin: top center;
  transition: opacity 40ms linear;
}

.hero-skill.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.hero-skill img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  transform: scale(1.04);
  filter: saturate(1.8) contrast(1.24) brightness(1.22);
}

.hero-skill::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.28) 52%, rgba(0, 0, 0, 0.58));
  content: "";
}

.hero-skill div {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: end;
  gap: 2px;
  padding: 12px 14px;
  text-align: right;
  text-shadow: 0 2px 0 #000;
}

.hero-skill span {
  color: #9de75a;
  font-size: 1.1rem;
  font-style: italic;
}

.hero-skill strong {
  color: var(--paper);
  font-size: clamp(1.35rem, 6vw, 2rem);
  font-style: italic;
  line-height: 0.95;
}

.hero-skill small {
  color: var(--red);
  font-size: 0.9rem;
}

.hero-skill.flash img {
  animation: hero-skill-image-pop 240ms cubic-bezier(0.1, 1.35, 0.25, 1);
}

.hero-skill.flash {
  animation: hero-skill-card-pop 240ms cubic-bezier(0.1, 1.35, 0.25, 1);
}

.arena {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background:
    radial-gradient(circle at 35% 0, rgba(255, 255, 255, 0.055), transparent 38%),
    rgba(5, 8, 8, 0.82);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45), inset 0 0 38px rgba(255, 255, 255, 0.025);
}

.back-map {
  position: static;
  min-height: 36px;
  padding: 0 8px;
  font-size: 0.8rem;
}

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 6px;
  aspect-ratio: 7 / 8;
  touch-action: none;
}

.tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background:
    url("/assets/tile-metal-frame.png") center / cover no-repeat,
    linear-gradient(145deg, rgba(18, 20, 20, 0.98), rgba(4, 5, 5, 0.98));
  color: #d7d4cb;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.22rem, 6.4vw, 2.08rem);
  font-weight: 900;
  line-height: 1;
  text-shadow:
    0 2px 1px #000,
    0 -1px 0 rgba(255, 255, 255, 0.42),
    0 0 10px rgba(238, 236, 224, 0.22);
  box-shadow:
    0 2px 5px rgba(0, 0, 0, 0.65),
    inset 0 0 10px rgba(255, 255, 255, 0.03);
  touch-action: none;
  user-select: none;
}

.tile::before {
  position: absolute;
  inset: 8%;
  border-radius: 6px;
  background:
    radial-gradient(circle at 36% 24%, rgba(255, 255, 255, 0.1), transparent 28%),
    radial-gradient(circle at center, transparent 44%, rgba(0, 0, 0, 0.22));
  content: "";
  pointer-events: none;
}

.tile::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 24% 76%, rgba(0, 0, 0, 0.4));
  content: "";
  mix-blend-mode: screen;
  opacity: 0.42;
  pointer-events: none;
}

.tile.empty {
  visibility: hidden;
}

.tile.blocker {
  visibility: visible;
  opacity: 0.92;
  background:
    radial-gradient(circle at 50% 46%, rgba(125, 255, 38, 0.12), transparent 36%),
    linear-gradient(145deg, rgba(10, 18, 12, 0.98), rgba(0, 7, 3, 0.98));
  border-color: rgba(102, 255, 28, 0.24);
  box-shadow:
    inset 0 0 22px rgba(78, 255, 23, 0.12),
    0 0 12px rgba(78, 255, 23, 0.08);
  cursor: not-allowed;
}

.tile.blocker::before {
  border-color: rgba(116, 255, 36, 0.18);
  background:
    repeating-linear-gradient(45deg, rgba(113, 255, 34, 0.16) 0 1px, transparent 1px 9px),
    rgba(0, 0, 0, 0.22);
}

.tile.blocker::after {
  opacity: 0.2;
}

.tile.red-icon {
  color: #ff5a3f;
  text-shadow:
    0 2px 1px #000,
    0 0 10px rgba(255, 56, 30, 0.82),
    0 0 22px rgba(255, 118, 53, 0.64);
}

.tile.selected {
  background:
    radial-gradient(circle at center, rgba(240, 42, 35, 0.28), transparent 43%),
    url("/assets/tile-metal-frame.png") center / cover no-repeat,
    linear-gradient(145deg, rgba(33, 10, 10, 0.98), rgba(8, 9, 9, 0.98));
  transform: scale(0.98);
  box-shadow:
    0 0 16px rgba(240, 42, 35, 0.55),
    0 2px 5px rgba(0, 0, 0, 0.65),
    inset 0 0 14px rgba(240, 42, 35, 0.28);
}

.tile.hint {
  animation: pulse 0.75s ease-in-out infinite alternate;
}

.tile.starlight-hint {
  color: #fff6c2;
  background:
    radial-gradient(circle at center, rgba(255, 220, 82, 0.54), transparent 48%),
    url("/assets/tile-metal-frame.png") center / cover no-repeat,
    linear-gradient(145deg, rgba(50, 36, 8, 0.98), rgba(8, 7, 4, 0.98));
  text-shadow:
    0 2px 1px #000,
    0 0 12px rgba(255, 238, 151, 0.98),
    0 0 26px rgba(255, 199, 45, 0.92);
  box-shadow:
    0 0 0 3px rgba(255, 218, 76, 0.9),
    0 0 22px rgba(255, 199, 45, 0.95),
    0 0 46px rgba(255, 230, 128, 0.55),
    inset 0 0 18px rgba(255, 226, 96, 0.4);
  animation: starlight-trace-pulse 0.58s ease-in-out infinite alternate;
}

.tile.starlight-hint::after {
  opacity: 0.9;
  background:
    radial-gradient(circle at center, rgba(255, 255, 210, 0.62), transparent 34%),
    linear-gradient(135deg, rgba(255, 244, 170, 0.5), transparent 28% 72%, rgba(255, 177, 34, 0.42));
}

.tile.detonating {
  background:
    radial-gradient(circle at center, rgba(255, 226, 106, 0.54), transparent 45%),
    url("/assets/tile-metal-frame.png") center / cover no-repeat,
    #5c141a;
  animation: detonate-tile 140ms ease-out forwards;
}

.skill-dock {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-top: 12px;
}

.skill {
  display: grid;
  gap: 5px;
  justify-items: center;
  min-height: 90px;
  padding: 7px 3px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(7, 10, 10, 0.86);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.skill:disabled {
  cursor: not-allowed;
  filter: grayscale(0.92);
  opacity: 0.42;
}

.skill:not(:disabled):active {
  transform: scale(0.96);
}

.skill.power-bump {
  animation: skill-shake 300ms ease-out;
}

.skill img {
  width: min(12vw, 54px);
  height: min(12vw, 54px);
  border-radius: 9px;
  object-fit: cover;
}

.skill span {
  color: var(--paper);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 0 #000;
  white-space: nowrap;
}

.skill b.count-bump {
  display: inline-block;
  animation: skill-count-pop 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 390px) {
  .map-header {
    grid-template-columns: 1fr;
  }

  .map-actions {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .map-action {
    min-width: 0;
    padding: 0 6px;
    font-size: 0.78rem;
  }

  .hud-readout {
    width: 88px;
    padding: 4px 5px;
    font-size: 0.44rem;
  }

  .hud-readout.left {
    left: 8px;
  }

  .hud-readout.right {
    right: 8px;
    display: grid;
  }

  body.playing .brand h1,
  .map-screen .brand h1 {
    font-size: clamp(2.25rem, 12.4vw, 4.2rem);
  }

  body.playing .brand em,
  .map-screen .brand em {
    font-size: 0.68rem;
  }

  .mission-brief {
    min-height: 76px;
    padding: 8px 10px;
  }

  .mission-brief p {
    max-width: 88%;
    font-size: 0.76rem;
  }

  body.playing .stats span {
    min-height: 44px;
  }

  body.playing .timer-wrap {
    margin: 6px 0;
  }

  .skill-dock {
    gap: 5px;
  }

  .skill {
    min-height: 78px;
  }

  .skill img {
    width: 42px;
    height: 42px;
  }

  .skill span {
    font-size: 0.7rem;
  }

  .profile-card {
    flex-basis: min(82vw, 286px);
  }
}

@media (max-width: 520px) {
  .hud-readout.right {
    right: 6px;
    display: grid;
    width: 84px;
    max-width: 26%;
    padding: 4px 5px;
    font-size: 0.42rem;
  }
}

.skill b {
  color: #fff;
  font-size: 1.12em;
}

.ranking-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.ranking-modal.visible {
  display: grid;
}

.ranking {
  position: relative;
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 16px 18px;
  background:
    radial-gradient(circle at 88% 10%, rgba(240, 42, 35, 0.14), transparent 34%),
    rgba(5, 8, 8, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), inset 0 0 34px rgba(255, 255, 255, 0.035);
}

.ranking-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(240, 42, 35, 0.62);
  border-radius: 7px;
  background: rgba(10, 10, 10, 0.82);
  color: var(--paper);
  font-size: 1.35rem;
  line-height: 1;
}

.ranking h2 {
  margin: 0 42px 12px 0;
  color: var(--red);
  font-size: 1.45rem;
  font-style: italic;
}

.ranking ol {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.82rem;
}

.ranking li b {
  display: inline-block;
  color: var(--paper);
  font-size: 1rem;
}

.ranking li small {
  display: block;
  margin-left: 31px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

.ranking li span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 7px;
  border: 1px solid rgba(240, 42, 35, 0.36);
  border-radius: 6px;
  color: var(--red);
  font-size: 0.84rem;
  font-weight: 1000;
}

.war-room {
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(620px, calc(100vw - 24px));
  max-width: 620px;
  height: min(760px, calc(100dvh - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  overflow: hidden;
}

.war-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 42px 12px 0;
}

.war-tabs button {
  min-height: 36px;
  border: 1px solid rgba(240, 42, 35, 0.5);
  border-radius: 7px;
  background: rgba(8, 8, 8, 0.72);
  color: var(--muted);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.94rem;
  font-weight: 1000;
}

.war-tabs button.active {
  border-color: var(--red);
  color: var(--paper);
  background:
    linear-gradient(90deg, rgba(240, 42, 35, 0.26), transparent 78%),
    rgba(22, 8, 8, 0.86);
  box-shadow: inset 0 0 18px rgba(240, 42, 35, 0.12), 0 0 16px rgba(240, 42, 35, 0.14);
}

.war-panel {
  display: none;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
  scrollbar-color: rgba(240, 42, 35, 0.62) rgba(255, 255, 255, 0.08);
}

.war-panel.active {
  display: block;
}

.war-panel h3 {
  margin: 13px 0 8px;
  color: var(--paper);
  font-size: 1.06rem;
  font-style: italic;
}

.war-intel-count {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin-bottom: 9px;
  border: 1px solid rgba(157, 231, 90, 0.42);
  border-radius: 7px;
  padding: 7px 9px;
  color: #d9ff9f;
  background:
    linear-gradient(90deg, rgba(157, 231, 90, 0.12), transparent 72%),
    rgba(24, 46, 15, 0.42);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 1000;
}

.war-summary {
  box-sizing: border-box;
  display: grid;
  gap: 4px;
  width: 100%;
  margin: 0 0 12px;
  border: 1px solid rgba(157, 231, 90, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background:
    linear-gradient(90deg, rgba(157, 231, 90, 0.12), transparent 72%),
    rgba(8, 10, 10, 0.78);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

.war-summary span {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 1000;
}

.war-summary strong {
  color: var(--paper);
  font-size: 1.06rem;
}

.war-summary small {
  color: #d9ff9f;
  font-size: 0.8rem;
  font-weight: 800;
}

.ranking-reward-note {
  margin: 0 0 12px;
  border: 1px solid rgba(240, 42, 35, 0.34);
  border-radius: 8px;
  padding: 9px 10px;
  color: #d9ff9f;
  background:
    linear-gradient(90deg, rgba(240, 42, 35, 0.18), transparent 78%),
    rgba(12, 8, 8, 0.78);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.42;
}

.profile-modal {
  position: fixed;
  inset: 0;
  z-index: 62;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
}

.profile-modal.visible {
  display: grid;
}

.profile-panel {
  --profile-info-width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  position: relative;
  width: min(620px, calc(100vw - 24px));
  max-width: 620px;
  height: min(760px, calc(100dvh - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 16px 18px;
  background:
    radial-gradient(circle at 88% 10%, rgba(240, 42, 35, 0.14), transparent 34%),
    rgba(5, 8, 8, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), inset 0 0 34px rgba(255, 255, 255, 0.035);
}

.profile-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 12px;
  align-items: baseline;
  margin: 0 52px 12px 0;
}

.profile-head span {
  color: var(--red);
  font-size: 1.45rem;
  font-style: italic;
  font-weight: 1000;
  line-height: 1.15;
}

.archive-code-title {
  min-height: auto;
  width: auto;
  max-width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--red);
  background: transparent;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 1.45rem;
  font-style: italic;
  font-weight: 1000;
  line-height: 1.15;
  text-shadow: 0 2px 0 #000;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.archive-code-title:focus-visible {
  outline: 2px solid rgba(255, 47, 59, 0.72);
  outline-offset: 4px;
}

.profile-head-actions {
  display: grid;
  grid-column: 1 / -1;
  justify-items: stretch;
  gap: 10px;
  width: 100%;
  margin-top: 2px;
}

#intelCount,
.player-id-card {
  border: 1px solid rgba(240, 42, 35, 0.54);
  border-radius: 7px;
  padding: 5px 8px;
  color: #ffd0d0;
  background:
    linear-gradient(90deg, rgba(240, 42, 35, 0.18), transparent 72%),
    rgba(20, 8, 8, 0.6);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.88rem;
}

#intelCount {
  display: block;
  border-color: rgba(157, 231, 90, 0.42);
  color: #d9ff9f;
  background:
    linear-gradient(90deg, rgba(157, 231, 90, 0.12), transparent 72%),
    rgba(24, 46, 15, 0.42);
  font-weight: 1000;
}

.player-id-card {
  display: grid;
  gap: 7px;
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 8px 10px;
}

.player-id-card strong {
  display: inline-block;
  overflow: hidden;
  color: var(--paper);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  transform-origin: left center;
}

.player-id-card div[hidden] {
  display: none;
}

.player-id-card.cloud-protected {
  border-color: rgba(157, 231, 90, 0.52);
  background:
    linear-gradient(90deg, rgba(157, 231, 90, 0.16), transparent 72%),
    rgba(16, 44, 18, 0.54);
}

.player-id-card.cloud-protected strong {
  color: #d9ff9f;
  text-shadow: 0 0 10px rgba(157, 231, 90, 0.34);
}

.player-id-card.subscription-prompt {
  cursor: pointer;
}

.player-id-card.subscription-prompt strong {
  color: #ffd0d0;
  text-shadow: 0 0 12px rgba(240, 42, 35, 0.34);
}

.player-id-card.subscription-prompt:focus-visible {
  outline: 2px solid rgba(255, 47, 59, 0.72);
  outline-offset: 3px;
}

.player-id-card strong.copied {
  animation: player-id-copy-pop 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.player-id-card.guest > strong {
  display: none;
}

.player-id-card.guest div {
  grid-template-columns: 1fr;
}

.player-id-card.guest button {
  min-height: 46px;
}

.player-id-card.copied {
  animation: player-id-card-copy-flash 420ms ease-out;
}

.player-id-card div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.player-id-card button,
.player-restore button {
  min-height: 32px;
  border: 1px solid rgba(240, 42, 35, 0.48);
  border-radius: 5px;
  background: rgba(10, 10, 10, 0.78);
  color: var(--paper);
  font-size: 0.84rem;
  font-weight: 900;
}

.player-restore {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
  margin: 0;
}

.player-restore[hidden] {
  display: none;
}

.player-restore input {
  min-width: 0;
  min-height: 32px;
  border: 1px solid rgba(157, 231, 90, 0.32);
  border-radius: 6px;
  padding: 0 8px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--paper);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.player-restore small {
  grid-column: 1 / -1;
  min-height: 16px;
  color: #d9ff9f;
  font-size: 0.76rem;
  font-weight: 800;
}

.ranking li.mine b {
  color: #58a6ff;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.45);
}

.my-best-ranking {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  align-items: center;
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 12px;
  color: var(--paper);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 900;
}

.my-best-ranking b {
  color: #58a6ff;
  font-size: 1.08rem;
  text-shadow: 0 0 10px rgba(88, 166, 255, 0.45);
}

.my-best-ranking small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

.profile-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  width: var(--profile-info-width);
  margin: 0 0 12px;
}

.profile-summary {
  box-sizing: border-box;
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(157, 231, 90, 0.28);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background:
    linear-gradient(90deg, rgba(157, 231, 90, 0.12), transparent 72%),
    rgba(8, 10, 10, 0.78);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.45;
}

.profile-war-link {
  min-width: 94px;
  border: 1px solid rgba(240, 42, 35, 0.58);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--paper);
  background:
    linear-gradient(90deg, rgba(240, 42, 35, 0.28), transparent 72%),
    rgba(18, 8, 8, 0.84);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 1000;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: var(--profile-info-width);
  margin: 0 0 14px;
  padding-right: 3px;
  scrollbar-color: rgba(240, 42, 35, 0.62) rgba(255, 255, 255, 0.08);
}

.profile-stat {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid rgba(240, 42, 35, 0.28);
  border-radius: 7px;
  padding: 8px 9px;
  background: rgba(8, 10, 10, 0.74);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
}

.profile-stat small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.profile-stat strong {
  overflow: hidden;
  color: var(--paper);
  font-size: 0.98rem;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .war-room {
    padding: 14px 12px 16px;
  }

  .war-tabs {
    margin-right: 42px;
  }

  .profile-panel {
    --profile-info-width: 100%;
    padding: 14px 12px 16px;
  }

  .profile-head {
    grid-template-columns: auto minmax(0, 1fr);
    margin-right: 42px;
  }

  .profile-head span {
    font-size: 1.35rem;
  }

  .archive-code-title {
    font-size: 1.35rem;
  }

  .profile-overview,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .profile-war-link {
    min-height: 38px;
  }

  .player-restore {
    grid-template-columns: 1fr;
  }
}

.profile-summary span {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 1000;
  letter-spacing: 0;
}

.profile-summary strong {
  color: var(--paper);
  font-size: 1.06rem;
  line-height: 1.12;
}

.profile-summary small {
  color: #d9ff9f;
  font-size: 0.8rem;
  font-weight: 800;
}

.profile-panel h2 {
  margin: 13px 0 8px;
  color: var(--paper);
  font-size: 1.06rem;
  font-style: italic;
}

.profile-grid {
  display: flex;
  gap: 8px;
  margin: 0 -2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 2px 2px 10px;
  scroll-padding-left: 2px;
  scroll-snap-type: x mandatory;
  scrollbar-color: rgba(240, 42, 35, 0.62) rgba(255, 255, 255, 0.08);
  cursor: grab;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.profile-grid.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.profile-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  flex: 0 0 min(78vw, 286px);
  gap: 9px;
  min-height: 104px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 10, 10, 0.88);
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  touch-action: pan-x;
}

.profile-card.selected {
  border-color: var(--red);
  box-shadow: 0 0 18px rgba(240, 42, 35, 0.28), inset 0 0 20px rgba(240, 42, 35, 0.1);
}

.profile-card.locked {
  filter: grayscale(0.92);
  opacity: 0.54;
}

.profile-card img {
  width: 58px;
  height: 58px;
  border-radius: 7px;
  object-fit: cover;
}

.profile-card-media {
  display: grid;
  gap: 5px;
  align-content: start;
  justify-items: center;
}

.profile-train-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 22px;
  padding: 1px 4px;
  border-radius: 4px;
  color: #78e960;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  text-shadow: 0 0 8px rgba(120, 233, 96, 0.82), 0 2px 0 #000;
  touch-action: manipulation;
}

.profile-train-link:active {
  color: #d9ff9f;
  transform: translateY(1px);
}

.profile-card strong,
.profile-card small,
.profile-card span,
.profile-card b {
  min-width: 0;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
}

.profile-card strong {
  display: block;
  color: var(--paper);
  font-size: 0.98rem;
  line-height: 1.16;
}

.profile-card > span:not(.profile-card-media),
.profile-card-copy span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.32;
}

.profile-card small {
  display: inline-block;
  margin-top: 6px;
  color: #d9ff9f;
  font-size: 0.78rem;
  font-weight: 900;
}

.profile-card b {
  display: inline-block;
  margin-top: 6px;
  color: var(--red);
  font-size: 0.78rem;
}

.profile-grid.modules .profile-card {
  grid-template-columns: 1fr;
  flex-basis: min(72vw, 248px);
  min-height: 86px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  border-radius: 10px;
  background: rgba(2, 3, 3, 0.83);
  backdrop-filter: blur(4px);
}

.overlay.visible {
  display: grid;
}

.upgrade-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: none;
  align-items: center;
  justify-items: center;
  padding: 14px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 36%, rgba(240, 42, 35, 0.18), transparent 32%),
    rgba(2, 3, 3, 0.88);
  backdrop-filter: blur(4px);
}

.upgrade-overlay.visible {
  display: grid;
}

.upgrade-modal {
  width: min(100%, 390px);
  border: 1px solid rgba(240, 42, 35, 0.78);
  border-radius: 10px;
  padding: 10px;
  background: rgba(5, 7, 7, 0.96);
  box-shadow: 0 0 34px rgba(240, 42, 35, 0.22), inset 0 0 40px rgba(255, 255, 255, 0.035);
  text-align: center;
  animation: upgrade-card-pop 180ms ease-out both;
}

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

.upgrade-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 8px;
  min-height: 220px;
  padding: 13px 9px 12px;
  border: 1px solid rgba(240, 42, 35, 0.64);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(240, 42, 35, 0.18), rgba(8, 10, 10, 0.94) 43%),
    rgba(5, 8, 8, 0.95);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.upgrade-card:active {
  transform: translateY(1px) scale(0.98);
  filter: brightness(1.3);
}

.upgrade-card img {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  object-fit: cover;
  box-shadow: 0 0 18px rgba(240, 42, 35, 0.24);
}

.upgrade-card strong {
  color: var(--paper);
  font-size: 1.02rem;
  line-height: 1.05;
  text-shadow: 0 2px 0 #000;
}

.upgrade-card span {
  color: var(--muted);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.38;
}

.upgrade-card b {
  color: var(--red);
  font-size: 1.36rem;
  line-height: 1;
}

.upgrade-card small {
  color: #f4ead8;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  text-shadow: 0 2px 0 #000;
}

.modal {
  width: min(360px, 100%);
  border: 1px solid rgba(240, 42, 35, 0.65);
  border-radius: 10px;
  padding: 20px;
  background: rgba(6, 8, 8, 0.96);
  text-align: center;
}

.modal h2 {
  margin: 0;
  color: var(--red);
  font-family: Impact, "Arial Black", "Arial Narrow", sans-serif;
  font-size: clamp(3rem, 15vw, 5.7rem);
  font-style: italic;
  font-weight: 1000;
  line-height: 0.82;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow:
    2px 2px 0 #000,
    5px 5px 0 rgba(0, 0, 0, 0.72);
}

.modal p {
  margin: 10px 0 18px;
  color: var(--paper);
  font-family: "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.55;
}

.modal button {
  min-height: 52px;
  width: 100%;
  border: 1px solid var(--red);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(126, 4, 5, 0.95), rgba(16, 6, 6, 0.98));
  color: var(--paper);
  font-size: 1.05rem;
  font-weight: 900;
}

.lightning,
.laser-line {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}

.lightning {
  height: 7px;
  border-radius: 999px;
  background: #fff4bf;
  box-shadow: 0 0 8px #fff7a8, 0 0 18px #e8bc44, 0 0 28px #42c7ff;
  transform-origin: 0 50%;
  animation: lightning-flash 260ms ease-out forwards;
}

.laser-line {
  top: 0;
  bottom: 0;
  width: 9px;
  margin-left: -4.5px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 12px #fff, 0 0 28px var(--red), 0 0 48px var(--red);
  animation: laser-fire 380ms ease-out forwards;
}

.laser-line.horizontal {
  left: 0;
  right: 0;
  top: auto;
  bottom: auto;
  width: auto;
  height: 9px;
  margin: -4.5px 0 0;
}

.burst,
.spark {
  position: absolute;
  z-index: 5;
  pointer-events: none;
}

.burst {
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid #ffd86b;
  border-radius: 999px;
  box-shadow: 0 0 18px #ffd86b, 0 0 34px var(--red), 0 0 58px rgba(255, 255, 255, 0.4);
  animation: burst-pop 520ms ease-out forwards;
}

.spark {
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 999px;
  background: #ffd86b;
  box-shadow: 0 0 12px var(--red), 0 0 20px #fff;
  animation: spark-fly 520ms ease-out forwards;
}

@keyframes pulse {
  to {
    border-color: var(--red);
    box-shadow: 0 0 22px rgba(240, 42, 35, 0.55);
  }
}

@keyframes starlight-trace-pulse {
  to {
    transform: scale(1.04);
    box-shadow:
      0 0 0 4px rgba(255, 239, 135, 1),
      0 0 34px rgba(255, 207, 55, 1),
      0 0 68px rgba(255, 241, 167, 0.78),
      inset 0 0 24px rgba(255, 236, 123, 0.58);
    filter: brightness(1.42) saturate(1.3);
  }
}

@keyframes distress-pulse {
  to {
    transform: scale(1.12);
    filter: brightness(1.35);
  }
}

@keyframes distress-ring {
  to {
    opacity: 0;
    transform: scale(1.72);
  }
}

@keyframes map-intel-pulse {
  to {
    transform: scale(1.1);
    filter: brightness(1.22) saturate(1.2);
  }
}

@keyframes skill-shake {
  0% {
    transform: translateX(0) rotate(0deg);
  }

  25% {
    transform: translateX(-1.5px) rotate(-1.2deg);
  }

  50% {
    transform: translateX(1.8px) rotate(1.2deg);
  }

  75% {
    transform: translateX(-1px) rotate(-0.7deg);
  }

  100% {
    transform: translateX(0) rotate(0deg);
  }
}

@keyframes skill-count-pop {
  0% {
    transform: translateY(0) scale(1);
    color: #ffffff;
    text-shadow: 0 0 0 rgba(255, 88, 48, 0);
  }

  35% {
    transform: translateY(-4px) scale(1.22);
    color: #fff3d4;
    text-shadow: 0 0 14px rgba(255, 88, 48, 0.82);
  }

  100% {
    transform: translateY(0) scale(1);
    color: #ffffff;
    text-shadow: 0 0 0 rgba(255, 88, 48, 0);
  }
}

@keyframes player-id-copy-pop {
  0% {
    color: var(--paper);
    transform: scale(1);
  }

  42% {
    color: #d9ff9f;
    text-shadow: 0 0 12px rgba(157, 231, 90, 0.78);
    transform: scale(1.12);
  }

  100% {
    color: var(--paper);
    transform: scale(1);
  }
}

@keyframes player-id-card-copy-flash {
  0% {
    box-shadow: inset 0 0 0 rgba(157, 231, 90, 0), 0 0 0 rgba(157, 231, 90, 0);
  }

  45% {
    box-shadow: inset 0 0 22px rgba(157, 231, 90, 0.24), 0 0 18px rgba(157, 231, 90, 0.42);
  }

  100% {
    box-shadow: inset 0 0 0 rgba(157, 231, 90, 0), 0 0 0 rgba(157, 231, 90, 0);
  }
}

@keyframes map-point-blink {
  0%,
  100% {
    opacity: 0.32;
  }

  50% {
    opacity: 1;
  }
}

@keyframes hud-breathe {
  50% {
    opacity: 0.58;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes hud-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes hud-scan {
  from {
    top: -70px;
  }

  to {
    top: 100%;
  }
}

@keyframes upgrade-card-pop {
  0% {
    opacity: 0;
    transform: scale(0.9);
    filter: brightness(1.8);
  }

  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes hero-skill-card-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.72) rotate(-1deg);
    filter: brightness(2.2);
  }
  58% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.04) rotate(0deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
    filter: brightness(1);
  }
}

@keyframes hero-skill-image-pop {
  0% {
    opacity: 0.2;
    transform: scale(1.2);
    filter: saturate(2) contrast(1.34) brightness(1.55);
  }
  100% {
    opacity: 1;
    transform: scale(1.04);
    filter: saturate(1.8) contrast(1.24) brightness(1.22);
  }
}

@keyframes lightning-flash {
  0% {
    opacity: 0;
    filter: brightness(1.8);
  }
  20%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    filter: brightness(2.4);
  }
}

@keyframes laser-fire {
  0% {
    opacity: 0;
    transform: scaleY(0);
  }
  24%,
  72% {
    opacity: 1;
    transform: scaleY(1);
  }
  100% {
    opacity: 0;
    transform: scaleY(1.05);
  }
}

@keyframes detonate-tile {
  50% {
    transform: scale(1.08);
    filter: brightness(1.9);
  }
  100% {
    transform: scale(0.78);
    filter: brightness(2.2);
    opacity: 0.2;
  }
}

@keyframes burst-pop {
  to {
    opacity: 0;
    transform: scale(7.2);
  }
}

@keyframes spark-fly {
  to {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0.35);
  }
}

@media (min-width: 760px) {
  .game {
    width: min(100% - 40px, 960px);
  }

  .hud.play-panel,
  .timer-wrap.play-panel,
  .arena.play-panel,
  .skill-dock.play-panel {
    width: 100%;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
  }

  .hud.play-panel {
    grid-template-columns: minmax(250px, 0.86fr) minmax(0, 1fr);
    align-items: end;
  }

  .hud.play-panel .brand h1 {
    font-size: clamp(3.1rem, 7.3vw, 4.7rem);
  }

  .hud.play-panel .brand em {
    font-size: clamp(0.78rem, 1.7vw, 1rem);
  }

  .ranking {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
  }
}
