:root {
  --bg-1: #8ecdf8;
  --bg-2: #d9efff;
  --bg-3: #e4c597;
  --panel: rgba(15, 26, 34, 0.78);
  --panel-strong: rgba(11, 20, 27, 0.9);
  --line: rgba(103, 147, 177, 0.28);
  --line-strong: rgba(164, 204, 228, 0.48);
  --text-main: #eff7ff;
  --text-soft: #bfd0df;
  --panel-texture: url("assets/textures/ceiling-plaster-bright.png?v=20260402b");
  --accent-cyan: #6aa9da;
  --accent-lime: #90b96d;
  --accent-amber: #efc76c;
  --accent-rose: #dd8d6d;
  --danger: #d84d58;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--text-main);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 78% 14%, rgba(255, 220, 123, 0.52), transparent 18%),
    radial-gradient(circle at 18% 24%, rgba(255, 255, 255, 0.36), transparent 24%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 44%, var(--bg-3) 100%);
  overflow-x: hidden;
}

.star-layer,
.scan-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.star-layer {
  opacity: 0.68;
}

.stars-back {
  background-image:
    radial-gradient(circle at 78% 18%, rgba(255, 223, 120, 0.44) 0 72px, transparent 142px),
    radial-gradient(circle at 22% 24%, rgba(255, 255, 255, 0.34) 0 68px, transparent 122px),
    radial-gradient(circle at 62% 30%, rgba(255, 255, 255, 0.24) 0 82px, transparent 146px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 46%);
  background-size: 100% 100%, 460px 460px, 520px 520px, 100% 100%;
  animation: drift-stars 28s linear infinite;
}

.stars-front {
  background-image:
    radial-gradient(circle at 18% 34%, rgba(255, 255, 255, 0.42) 0 48px, transparent 104px),
    radial-gradient(circle at 54% 18%, rgba(255, 255, 255, 0.34) 0 64px, transparent 132px),
    radial-gradient(circle at 74% 32%, rgba(255, 255, 255, 0.28) 0 52px, transparent 114px);
  background-size: 380px 220px, 520px 260px, 420px 240px;
  animation: drift-stars 18s linear infinite reverse;
}

.scan-vignette {
  background:
    radial-gradient(circle at center, transparent 52%, rgba(17, 26, 32, 0.24) 100%),
    linear-gradient(rgba(255, 255, 255, 0.025) 50%, rgba(0, 0, 0, 0.018) 50%);
  background-size: 100% 100%, 100% 4px;
  mix-blend-mode: screen;
  opacity: 0.42;
}

.game-shell {
  width: min(1440px, 96vw);
  margin: 18px auto 28px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(160deg, rgba(18, 28, 35, 0.9), rgba(13, 21, 28, 0.74)),
    var(--panel-texture) center / 320px 320px repeat,
    var(--panel);
  box-shadow:
    0 30px 90px rgba(0, 4, 12, 0.52),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    inset 0 0 48px rgba(86, 232, 255, 0.05);
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.title-wrap {
  flex: 1 1 320px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-cyan);
  letter-spacing: 1.3px;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 800;
}

h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.1rem, 3.8vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

h1 span {
  display: inline-block;
  color: var(--accent-amber);
  text-shadow: 0 0 18px rgba(255, 215, 139, 0.42);
}

.subtitle {
  margin: 0;
  max-width: 780px;
  color: var(--text-soft);
  line-height: 1.6;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.quick-links a,
.mini-link,
.mini-btn,
.overlay-actions button,
.touch-controls button {
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(8, 15, 30, 0.78);
  color: #eef7ff;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-links a,
.mini-link {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.quick-links a:hover,
.mini-link:hover,
.mini-btn:hover,
.overlay-actions button:hover,
.touch-controls button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 215, 139, 0.7);
  box-shadow: 0 0 18px rgba(86, 232, 255, 0.18);
}

.hud {
  flex: 1 1 420px;
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 10px;
}

.hud-item {
  min-height: 74px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(136, 255, 190, 0.2);
  background:
    linear-gradient(180deg, rgba(9, 17, 34, 0.9), rgba(5, 10, 22, 0.88)),
    var(--panel-texture) center / 220px 220px repeat;
  box-shadow: inset 0 0 22px rgba(86, 232, 255, 0.05);
}

.hud-item-wide {
  grid-column: span 2;
}

.hud-item label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hud-item strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.2;
}

.arena-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}

.view-panel {
  min-width: 0;
}

.canvas-frame {
  padding: 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(8, 14, 27, 0.95), rgba(4, 10, 20, 0.94)),
    var(--panel-texture) center / 320px 320px repeat;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    inset 0 0 46px rgba(86, 232, 255, 0.04),
    0 18px 36px rgba(0, 0, 0, 0.28);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  touch-action: none;
}

#gameCanvas {
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(circle at 78% 18%, rgba(255, 219, 110, 0.26), transparent 18%),
    linear-gradient(180deg, #90cbfb, #eef9ff 44%, #d5c29d 45%, #b38459);
  border: 1px solid rgba(136, 255, 190, 0.18);
  box-shadow:
    0 0 26px rgba(96, 163, 208, 0.22),
    inset 0 0 40px rgba(0, 0, 0, 0.45);
}

.reticle-label {
  margin: 12px 2px 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.touch-controls {
  display: none;
  gap: 14px;
  margin-top: 14px;
}

.touch-pad {
  flex: 1;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(6, 11, 22, 0.92), rgba(4, 8, 18, 0.92)),
    var(--panel-texture) center / 220px 220px repeat;
}

.touch-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.touch-controls button {
  flex: 1;
  min-height: 48px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.touch-controls .fire-btn {
  border-color: rgba(255, 143, 181, 0.6);
  background: linear-gradient(180deg, rgba(62, 12, 26, 0.9), rgba(30, 6, 16, 0.96));
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-block {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(9, 17, 33, 0.92), rgba(6, 11, 22, 0.92)),
    var(--panel-texture) center / 240px 240px repeat;
  box-shadow: inset 0 0 26px rgba(86, 232, 255, 0.04);
}

.panel-block h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-amber);
}

.panel-block p {
  margin: 0 0 10px;
  color: var(--text-soft);
  line-height: 1.55;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head span,
#sector-label {
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.status-line {
  min-height: 48px;
}

.meter {
  margin-top: 12px;
}

.meter-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: #d9ecff;
  font-size: 0.84rem;
}

.meter-track {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.meter-fill {
  height: 100%;
  width: 100%;
  border-radius: inherit;
  transition: width 0.16s ease;
}

.health-track .meter-fill {
  background: linear-gradient(90deg, #ff6f83, #ffca8b);
}

.ammo-track .meter-fill {
  background: linear-gradient(90deg, #56e8ff, #88ffbe);
}

.objective-line {
  margin-top: 12px;
}

#radarCanvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 16px;
  background:
    radial-gradient(circle at center, rgba(196, 220, 171, 0.22), rgba(242, 246, 236, 0.96));
  border: 1px solid rgba(157, 187, 139, 0.32);
}

.weapon-list,
.unlock-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.weapon-chip,
.unlock-chip {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(4, 10, 20, 0.72);
}

.weapon-chip.is-active {
  border-color: rgba(255, 215, 139, 0.56);
  box-shadow: 0 0 18px rgba(255, 215, 139, 0.16);
}

.weapon-chip-header,
.unlock-chip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.weapon-chip strong,
.unlock-chip strong {
  font-size: 0.94rem;
}

.weapon-chip span,
.unlock-chip span {
  color: var(--text-soft);
  font-size: 0.78rem;
}

.weapon-chip p,
.unlock-chip p {
  margin: 0;
  font-size: 0.8rem;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: #d9ecff;
}

.inline-controls {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(86, 232, 255, 0.42);
  background: rgba(5, 10, 20, 0.92);
  color: #eef7ff;
}

.mini-btn {
  min-height: 42px;
  padding: 8px 14px;
  white-space: nowrap;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  margin-right: 4px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid rgba(86, 232, 255, 0.32);
  background: rgba(86, 232, 255, 0.08);
  color: #eef7ff;
  font-size: 0.76rem;
  font-weight: 800;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 7, 14, 0.72);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.panel {
  width: min(94vw, 620px);
  padding: 28px;
  border-radius: 24px;
  border: 1px solid rgba(255, 215, 139, 0.42);
  background:
    linear-gradient(180deg, rgba(8, 14, 29, 0.96), rgba(4, 9, 18, 0.96)),
    var(--panel-texture) center / 260px 260px repeat;
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.35),
    inset 0 0 40px rgba(86, 232, 255, 0.05);
}

.panel h2 {
  margin: 0 0 14px;
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.panel p {
  margin: 0 0 12px;
  color: var(--text-soft);
  line-height: 1.65;
}

.overlay-badge {
  margin: 0 0 8px;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 0.78rem;
  font-weight: 900;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.overlay-actions button {
  padding: 12px 16px;
  font-size: 0.95rem;
}

.overlay-actions button:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.overlay-actions .secondary {
  border-color: rgba(255, 255, 255, 0.16);
}

.loading-track {
  height: 14px;
  margin-top: 14px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.loading-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #56e8ff, #88ffbe, #ffd78b);
  transition: width 0.16s ease;
}

.hidden {
  display: none;
}

@keyframes drift-stars {
  0% {
    transform: translate3d(0, 0, 0);
  }

  100% {
    transform: translate3d(-24px, 18px, 0);
  }
}

@media (max-width: 1180px) {
  .arena-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .game-shell {
    width: min(100vw, 100%);
    margin: 0;
    border-radius: 0;
    padding: 14px;
  }

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

  .hud-item-wide {
    grid-column: span 1;
  }

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

  .touch-controls {
    display: flex;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .game-shell {
    padding: 10px;
  }

  .canvas-frame,
  .panel-block,
  .panel {
    border-radius: 16px;
  }

  .topbar {
    gap: 14px;
  }

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

  .touch-row {
    flex-wrap: wrap;
  }

  .touch-row button {
    min-width: calc(50% - 5px);
  }
}
