/* ==========================================================================
   NEON ROGUE · 霓虹荒原
   A local, zero-dependency canvas roguelike.
   ========================================================================== */

:root {
  --bg: #04060b;
  --bg-deep: #020407;
  --ink: #ecfbff;
  --ink-soft: #c5d9df;
  --dim: #718794;
  --dim-2: #4d606b;
  --cyan: #4df6ff;
  --rose: #ff3d88;
  --violet: #a878ff;
  --lime: #b9ff63;
  --amber: #ffc44d;
  --danger: #ff4e60;
  --sector: #4df6ff;
  --sector-rgb: 77, 246, 255;
  --line: rgba(147, 211, 225, .15);
  --line-bright: rgba(172, 234, 244, .32);
  --panel: rgba(7, 12, 19, .78);
  --panel-solid: #080d14;
  --font-display: "Bahnschrift", "DIN Alternate", "Arial Narrow", "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-body: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  background: var(--bg-deep);
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 110%, #0b1320 0%, #05080d 42%, #020408 100%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 4px;
}

::selection {
  background: var(--rose);
  color: #fff;
}

#app {
  position: fixed;
  inset: 0;
  isolation: isolate;
  background: var(--bg-deep);
}

/* --------------------------------------------------------------------------
   Canvas + screen FX
   -------------------------------------------------------------------------- */

#game {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #04060b;
  transition: filter .45s var(--ease-out), transform .45s var(--ease-out);
  touch-action: none;
}

#app.is-playing #game {
  cursor: none;
}

#game.is-blurred {
  filter: blur(3.5px) saturate(.65) brightness(.48);
  transform: scale(1.012);
}

.screen-fx {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.vignette {
  background:
    radial-gradient(ellipse 78% 72% at 50% 48%, transparent 42%, rgba(0, 2, 6, .35) 78%, rgba(0, 2, 6, .8) 100%),
    linear-gradient(180deg, rgba(0, 3, 7, .38), transparent 18%, transparent 82%, rgba(0, 3, 7, .5));
}

.scanlines {
  opacity: .36;
  background: repeating-linear-gradient(
    to bottom,
    rgba(2, 8, 14, .25) 0,
    rgba(2, 8, 14, .25) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  animation: scanDrift 20s linear infinite;
}

.grain {
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  animation: grainShift .8s steps(2) infinite;
}

@keyframes scanDrift {
  to { background-position-y: 260px; }
}

@keyframes grainShift {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 1%); }
  50% { transform: translate(1%, -2%); }
  75% { transform: translate(2%, 2%); }
  100% { transform: translate(-1%, -1%); }
}

/* --------------------------------------------------------------------------
   Shared type + controls
   -------------------------------------------------------------------------- */

.micro-label,
.panel-kicker,
.kicker,
.brand-tag,
.build-tag,
.start-foot,
.manual-head,
.end-code,
.dash-line,
.best-line,
.sector-code,
.wave-progress,
.select-hint,
.upgrade-footer,
.banner-kicker {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .17em;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(199, 239, 247, .24);
  background: rgba(183, 231, 242, .06);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .04em;
  border-radius: 2px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .35);
}

kbd.wide {
  min-width: 48px;
}

.mouse-icon {
  position: relative;
  display: inline-block;
  width: 13px;
  height: 19px;
  border: 1px solid rgba(209, 240, 245, .55);
  border-radius: 7px;
  vertical-align: -4px;
}

.mouse-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 1px;
  height: 5px;
  background: var(--cyan);
  transform: translateX(-50%);
  box-shadow: 0 0 5px rgba(77, 246, 255, .8);
}

.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 20px;
  min-height: 54px;
  padding: 0 21px 0 25px;
  overflow: hidden;
  background: var(--cyan);
  color: #031014;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .12em;
  text-align: left;
  transition: background .25s, color .25s, transform .25s var(--ease-out), box-shadow .25s;
  box-shadow: 0 0 32px rgba(77, 246, 255, .22);
}

.primary-btn::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(0, 19, 24, .22);
  clip-path: inherit;
  pointer-events: none;
}

.primary-btn .btn-label {
  position: relative;
  z-index: 1;
}

.primary-btn kbd {
  position: relative;
  z-index: 1;
  min-width: 42px;
  border-color: rgba(4, 19, 23, .24);
  color: rgba(4, 19, 23, .72);
  background: rgba(3, 20, 24, .09);
  box-shadow: none;
}

.primary-btn:hover {
  background: #eafeff;
  transform: translateY(-2px);
  box-shadow: 0 0 48px rgba(77, 246, 255, .36);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn.compact {
  min-height: 48px;
  font-size: 13px;
}

.secondary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 17px 0 18px;
  border: 1px solid rgba(255, 61, 136, .38);
  background:
    linear-gradient(135deg, rgba(255, 61, 136, .08), rgba(255, 61, 136, .025)),
    rgba(7, 10, 16, .55);
  color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .1em;
  text-align: left;
  transition: border-color .25s, background .25s, transform .25s var(--ease-out), box-shadow .25s;
}

.secondary-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 38%;
  height: 1px;
  background: var(--rose);
  box-shadow: 0 0 13px rgba(255, 61, 136, .7);
}

.secondary-btn .endless-glyph {
  position: relative;
  z-index: 1;
  color: var(--rose);
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1;
  transform: translateY(-1px);
  text-shadow: 0 0 16px rgba(255, 61, 136, .55);
}

.secondary-btn .btn-label {
  position: relative;
  z-index: 1;
  white-space: nowrap;
}

.secondary-btn kbd {
  position: relative;
  z-index: 1;
  min-width: 24px;
  border-color: rgba(255, 61, 136, .28);
  color: var(--rose);
  background: rgba(255, 61, 136, .06);
  box-shadow: none;
}

.secondary-btn:hover {
  border-color: rgba(255, 61, 136, .78);
  background:
    linear-gradient(135deg, rgba(255, 61, 136, .16), rgba(255, 61, 136, .04)),
    rgba(10, 12, 19, .7);
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(255, 61, 136, .16);
}

.secondary-btn:active {
  transform: translateY(0);
}

.btn-shine {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -45%;
  width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: skewX(-18deg);
  animation: buttonShine 5.5s var(--ease-in-out) infinite;
}

@keyframes buttonShine {
  0%, 55% { left: -45%; }
  80%, 100% { left: 130%; }
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: rgba(121, 181, 197, .035);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .11em;
  transition: .22s;
}

.ghost-btn:hover {
  border-color: rgba(77, 246, 255, .45);
  color: var(--ink);
  background: rgba(77, 246, 255, .06);
}

.ghost-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.text-btn {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  transition: color .2s;
}

.text-btn:hover {
  color: var(--cyan);
}

.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  background: #04060b;
  color: var(--ink);
  font-size: 15px;
}

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

.hud {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 1;
  transition: opacity .35s var(--ease-out);
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(16px, 2.4vw, 34px) clamp(18px, 3vw, 44px);
}

.hud-card {
  position: relative;
  width: 260px;
  padding: 13px 15px 12px;
  border: 1px solid var(--line);
  background:
    linear-gradient(120deg, rgba(11, 21, 30, .85), rgba(5, 10, 16, .58)),
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(133, 212, 228, .025) 15px 16px);
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .25);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.hud-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 34%;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 13px rgba(77, 246, 255, .7);
}

.hud-corner {
  position: absolute;
  width: 7px;
  height: 7px;
  border-color: rgba(77, 246, 255, .55);
  border-style: solid;
  pointer-events: none;
}

.hud-corner.tl {
  left: 5px;
  top: 5px;
  border-width: 1px 0 0 1px;
}

.hud-corner.br {
  right: 5px;
  bottom: 5px;
  border-width: 0 1px 1px 0;
}

.micro-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  font-size: 9px;
  line-height: 1;
}

.micro-label b {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: .08em;
  font-weight: 500;
}

.micro-slash {
  color: var(--dim-2);
}

.pulse-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
  animation: dotPulse 2s ease-in-out infinite;
}

@keyframes dotPulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

.meter {
  position: relative;
  height: 9px;
  margin-top: 9px;
  overflow: hidden;
  background: rgba(154, 217, 228, .09);
  border: 1px solid rgba(181, 235, 243, .08);
}

.meter::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(90deg, transparent 0 12px, rgba(3, 9, 13, .65) 12px 13px);
  pointer-events: none;
}

.meter-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #31c7d6, var(--cyan) 58%, #d9ffff);
  box-shadow: 0 0 14px rgba(77, 246, 255, .5);
  transform-origin: left center;
  transition: transform .18s var(--ease-out), background .3s;
}

.meter-scan {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  left: -40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .24), transparent);
  animation: meterScan 4s linear infinite;
}

@keyframes meterScan {
  to { left: 130%; }
}

.meter.is-low .meter-fill {
  background: linear-gradient(90deg, #ff3c4d, #ff8760);
  box-shadow: 0 0 14px rgba(255, 60, 77, .5);
  animation: lowHealth 1s ease-in-out infinite;
}

@keyframes lowHealth {
  50% { filter: brightness(1.55); }
}

.meter.has-overheal:not(.is-low) .meter-fill {
  background: linear-gradient(90deg, #d89a3d, #ffd36a 58%, #fff4c7);
  box-shadow: 0 0 14px rgba(255, 211, 106, .5);
}

.meter.has-overheal::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 1px solid rgba(255, 211, 106, .4);
  pointer-events: none;
}

.shield-meter {
  height: 4px;
  margin-top: 4px;
  border: 0;
  background: rgba(168, 120, 255, .12);
}

.shield-meter .meter-fill {
  background: linear-gradient(90deg, #7b5bff, var(--violet));
  box-shadow: 0 0 12px rgba(168, 120, 255, .45);
}

.shield-meter.is-hidden {
  display: none;
}

.dash-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: var(--dim-2);
  font-size: 8px;
  letter-spacing: .12em;
}

.dash-track {
  flex: 1;
  height: 2px;
  background: rgba(173, 230, 240, .12);
  overflow: hidden;
}

.dash-track i {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--cyan);
  transform-origin: left;
  transition: transform .08s linear, background .2s;
  box-shadow: 0 0 8px rgba(77, 246, 255, .55);
}

.dash-state {
  min-width: 44px;
  color: var(--cyan);
  text-align: right;
  font-size: 8px;
}

.buff-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.buff-bar.is-hidden {
  display: none;
}

.buff-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 16px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--buff-color) 35%, transparent);
  background: color-mix(in srgb, var(--buff-color) 8%, transparent);
  color: var(--buff-color);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .04em;
  white-space: nowrap;
}

.buff-chip i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--buff-color);
  box-shadow: 0 0 6px var(--buff-color);
}

.dash-state.cooling {
  color: var(--dim);
}

.sector-readout {
  min-width: 280px;
  padding-top: 2px;
  text-align: center;
}

.sector-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--sector);
}

.sector-rule i {
  width: clamp(22px, 4vw, 74px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--sector-rgb), .65));
}

.sector-rule i:last-child {
  background: linear-gradient(90deg, rgba(var(--sector-rgb), .65), transparent);
}

.sector-code {
  font-size: 8px;
  letter-spacing: .28em;
  opacity: .9;
}

.sector-name {
  margin: 7px 0 3px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(18px, 1.6vw, 23px);
  font-weight: 500;
  letter-spacing: .26em;
  text-shadow: 0 0 28px rgba(var(--sector-rgb), .24);
}

.sector-sub {
  display: flex;
  justify-content: center;
  gap: 15px;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .16em;
}

.sector-sub span:first-child {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-sub #timer {
  color: var(--dim);
}

.wave-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 9px;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: .13em;
}

.event-hud {
  position: fixed;
  top: 190px;
  left: clamp(18px, 3vw, 44px);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  max-width: 300px;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--event-color, var(--rose)) 35%, transparent);
  border-left: 2px solid var(--event-color, var(--rose));
  background: rgba(3, 8, 11, .78);
  color: var(--event-color, var(--rose));
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .06em;
  line-height: 1.3;
  pointer-events: none;
  backdrop-filter: blur(5px);
}

.remaining-hud {
  position: fixed;
  top: 164px;
  left: clamp(18px, 3vw, 44px);
  z-index: 6;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 61, 136, .26);
  border-left: 2px solid var(--rose);
  background: rgba(3, 8, 11, .78);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .1em;
  pointer-events: none;
  backdrop-filter: blur(5px);
}

.remaining-hud b {
  color: #ffb3c9;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .04em;
}

.remaining-hud em {
  color: var(--dim-2);
  font-size: 6px;
  font-style: normal;
  letter-spacing: .14em;
}

.event-hud.is-hidden {
  display: none;
}

.event-hud-code {
  opacity: .55;
  font-size: 6px;
  letter-spacing: .14em;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .remaining-hud {
    top: 148px;
    left: 21px;
  }

  .event-hud {
    top: 180px;
    left: 21px;
    max-width: calc(100vw - 42px);
  }
}

.event-hud b {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .08em;
  white-space: nowrap;
}

.event-hud em {
  overflow: hidden;
  color: var(--event-color, var(--rose));
  font-size: 7px;
  font-style: normal;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.wave-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wave-dots i {
  display: block;
  width: 13px;
  height: 2px;
  background: rgba(173, 231, 243, .16);
  transition: background .3s, box-shadow .3s;
}

.wave-dots i.done {
  background: rgba(var(--sector-rgb), .44);
}

.wave-dots i.current {
  background: var(--sector);
  box-shadow: 0 0 7px rgba(var(--sector-rgb), .65);
}

.wave-dots i.boss-dot {
  background: rgba(255, 61, 136, .28);
}

.wave-dots i.boss-dot.current {
  background: var(--rose);
  box-shadow: 0 0 8px rgba(255, 61, 136, .7);
}

.top-right {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  min-width: 260px;
  position: relative;
}

.score-box {
  padding-top: 2px;
  text-align: right;
}

.score-box .micro-label {
  justify-content: flex-end;
}

.score-value {
  margin-top: 5px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 600;
  line-height: .9;
  letter-spacing: .035em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(77, 246, 255, .28);
}

.best-line {
  margin-top: 6px;
  color: var(--dim-2);
  font-size: 8px;
  letter-spacing: .12em;
}

.best-line span {
  color: var(--dim);
}

.hud-actions {
  display: flex;
  gap: 6px;
  margin-left: 17px;
}

.square-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  background: rgba(7, 13, 20, .55);
  color: var(--dim);
  backdrop-filter: blur(8px);
  pointer-events: auto;
  transition: .2s;
}

.square-btn:hover {
  color: var(--cyan);
  border-color: rgba(77, 246, 255, .4);
  background: rgba(77, 246, 255, .07);
}

.square-btn span {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
}

.pause-glyph {
  letter-spacing: -2px;
  transform: translateX(-1px);
}

.square-btn.is-muted {
  color: var(--dim-2);
  border-color: rgba(160, 200, 210, .08);
}

.combo-badge {
  position: absolute;
  top: 71px;
  right: 0;
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 4px 8px;
  border-right: 1px solid var(--rose);
  background: linear-gradient(90deg, transparent, rgba(255, 61, 136, .09));
  pointer-events: none;
  transition: opacity .2s;
}

.combo-badge span {
  color: var(--rose);
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: .03em;
}

.combo-badge em {
  color: var(--dim);
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 7px;
  letter-spacing: .16em;
}

.boss-hud {
  position: absolute;
  top: 118px;
  left: 50%;
  width: min(740px, 74vw);
  padding: 8px 13px 10px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(5, 9, 13, .72) 15%, rgba(5, 9, 13, .72) 85%, transparent);
  transition: opacity .4s var(--ease-out);
}

.boss-hud.is-hidden {
  display: none;
}

.boss-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .2em;
}

.boss-name b {
  color: var(--amber);
  font-size: 7px;
  font-weight: 500;
  letter-spacing: .18em;
}

.boss-meter {
  position: relative;
  height: 7px;
  background: rgba(255, 78, 96, .1);
  border: 1px solid rgba(255, 78, 96, .16);
  overflow: hidden;
}

.boss-meter span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff3951, #ff7150 60%, #ffc44d);
  box-shadow: 0 0 16px rgba(255, 78, 96, .5);
  transform-origin: left;
  transition: transform .25s var(--ease-out);
}

.boss-meter i {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 8.3%, rgba(3, 5, 8, .55) 8.3% 8.6%);
}

.hud-bottom {
  position: absolute;
  left: clamp(18px, 3vw, 44px);
  right: clamp(18px, 3vw, 44px);
  bottom: clamp(15px, 2.4vw, 28px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 25px;
}

.mods-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  max-width: 48vw;
}

.mod-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 7px 0 5px;
  border: 1px solid var(--line);
  background: rgba(6, 12, 18, .65);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .06em;
  backdrop-filter: blur(7px);
  animation: chipIn .35s var(--ease-out) both;
}

.mod-chip svg {
  width: 14px;
  height: 14px;
  color: var(--chip-color, var(--cyan));
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mod-chip b {
  color: var(--ink-soft);
  font-size: 8px;
  font-weight: 500;
}

.mod-chip .mod-level {
  color: var(--chip-color, var(--cyan));
  font-size: 8px;
  opacity: .85;
}

.mod-chip.mod-more {
  color: var(--dim);
  font-size: 8px;
  letter-spacing: .06em;
  cursor: default;
}

@keyframes chipIn {
  from { opacity: 0; transform: translateY(4px); }
}

.controls-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid rgba(157, 214, 226, .1);
  background: rgba(4, 9, 14, .54);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .07em;
  backdrop-filter: blur(8px);
  transition: opacity .8s;
}

.controls-hint.is-dim {
  opacity: .17;
}

.controls-hint span {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.controls-hint kbd {
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  font-size: 8px;
}

.controls-hint .hint-sep {
  width: 1px;
  height: 11px;
  background: var(--line);
}

.wave-banner {
  position: absolute;
  left: 50%;
  top: 24%;
  width: min(720px, 86vw);
  padding: 16px 25px 18px;
  transform: translate(-50%, -8px);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(4, 9, 15, .8) 18%, rgba(4, 9, 15, .8) 82%, transparent);
  border-top: 1px solid rgba(var(--sector-rgb), .22);
  border-bottom: 1px solid rgba(var(--sector-rgb), .12);
}

.wave-banner.show {
  visibility: visible;
  animation: bannerIn 2.8s var(--ease-out) both;
}

@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, 3px); filter: blur(5px); }
  13%, 74% { opacity: 1; transform: translate(-50%, 0); filter: blur(0); }
  100% { opacity: 0; transform: translate(-50%, -5px); filter: blur(3px); }
}

.banner-line {
  position: absolute;
  left: 50%;
  top: -1px;
  width: 30%;
  height: 1px;
  transform: translateX(-50%);
  background: var(--sector);
  box-shadow: 0 0 18px var(--sector);
}

.banner-kicker {
  color: var(--sector);
  font-size: 9px;
  letter-spacing: .33em;
}

.banner-title {
  margin-top: 7px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(25px, 3.2vw, 42px);
  font-weight: 500;
  letter-spacing: .28em;
  line-height: 1.05;
  text-indent: .28em;
  text-shadow: 0 0 32px rgba(var(--sector-rgb), .24);
}

.banner-sub {
  margin-top: 8px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .16em;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 70px;
  padding: 8px 14px;
  transform: translate(-50%, 5px);
  border: 1px solid var(--line);
  background: rgba(5, 10, 15, .88);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .09em;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, transform .25s, visibility .25s;
  backdrop-filter: blur(10px);
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* --------------------------------------------------------------------------
   Screens + title
   -------------------------------------------------------------------------- */

.screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  opacity: 1;
  visibility: visible;
  transition: opacity .4s var(--ease-out), visibility .4s;
}

.screen.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.start-screen {
  overflow: hidden auto;
  background:
    radial-gradient(ellipse 55% 80% at 18% 45%, rgba(16, 35, 51, .38), transparent 68%),
    linear-gradient(90deg, rgba(3, 6, 11, .91) 0%, rgba(3, 6, 11, .72) 48%, rgba(3, 6, 11, .18) 100%),
    linear-gradient(0deg, rgba(3, 6, 10, .68), transparent 24%);
}

.start-screen::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(transparent 8%, rgba(77, 246, 255, .45) 40%, transparent 92%);
}

.start-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.title-aura {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: .28;
}

.a-cyan {
  width: 44vw;
  height: 44vw;
  left: 5vw;
  top: 27%;
  background: radial-gradient(circle, rgba(56, 218, 235, .5), transparent 68%);
  animation: auraFloat 16s ease-in-out infinite alternate;
}

.a-rose {
  width: 32vw;
  height: 32vw;
  right: 2vw;
  bottom: -9vw;
  background: radial-gradient(circle, rgba(255, 61, 136, .35), transparent 68%);
  animation: auraFloat 20s ease-in-out infinite alternate-reverse;
}

@keyframes auraFloat {
  to { transform: translate3d(3vw, -2vw, 0) scale(1.12); }
}

.start-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 1560px;
  margin: 0 auto;
  padding: clamp(22px, 3vw, 44px) clamp(24px, 5vw, 82px);
}

.start-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--dim-2);
  font-size: 8px;
  letter-spacing: .18em;
}

.start-top-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.event-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 21px;
  padding: 0 9px;
  border: 1px solid rgba(151, 211, 224, .28);
  background: rgba(7, 15, 20, .72);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .1em;
  transition: .2s;
}

.event-toggle i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 5px rgba(173, 231, 243, .28);
  transition: .2s;
}

.event-toggle b {
  color: var(--ink-soft);
  font-size: 7.5px;
  font-weight: 500;
}

.event-toggle:hover {
  border-color: rgba(255, 61, 136, .35);
  color: var(--ink-soft);
}

.event-toggle[aria-pressed="true"] {
  border-color: rgba(255, 61, 136, .48);
  background: rgba(255, 61, 136, .06);
  color: var(--ink);
}

.event-toggle[aria-pressed="true"] i {
  background: var(--rose);
  box-shadow: 0 0 8px var(--rose);
}

.event-toggle[aria-pressed="true"] b {
  color: var(--rose);
}

.brand-tag {
  color: var(--dim);
}

.brand-bracket {
  color: var(--cyan);
  opacity: .7;
}

.build-tag {
  position: relative;
  padding-left: 18px;
}

.build-tag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 10px;
  height: 1px;
  background: var(--dim-2);
}

.start-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, .64fr);
  align-items: center;
  gap: clamp(36px, 6vw, 110px);
  padding: clamp(28px, 5vh, 66px) 0 clamp(20px, 4vh, 44px);
}

.start-copy {
  position: relative;
  max-width: 850px;
  padding-bottom: 2px;
  animation: startCopyIn 1s var(--ease-out) both;
}

@keyframes startCopyIn {
  from { opacity: 0; transform: translateY(18px); }
}

.kicker {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: .25em;
  opacity: 0;
  animation: fadeUp .8s .2s var(--ease-out) forwards;
}

.kicker span {
  width: 26px;
  height: 1px;
  background: var(--rose);
  box-shadow: 0 0 10px rgba(255, 61, 136, .6);
}

.logo {
  display: flex;
  flex-direction: column;
  margin: clamp(20px, 3.4vh, 38px) 0 0;
  font-family: var(--font-display);
  font-size: clamp(66px, 10.4vw, 154px);
  font-weight: 800;
  line-height: .73;
  letter-spacing: -.055em;
  white-space: nowrap;
}

.logo span {
  position: relative;
  display: block;
  width: max-content;
  opacity: 0;
  animation: logoIn 1s .12s var(--ease-out) forwards;
}

.logo-rogue {
  animation-delay: .23s !important;
  margin-left: clamp(34px, 5vw, 82px);
}

.logo-neon {
  z-index: 2;
  color: #eefcff;
  text-shadow:
    0 0 5px rgba(255, 255, 255, .25),
    0 0 40px rgba(77, 246, 255, .16),
    0 20px 60px rgba(0, 0, 0, .6);
}

.logo-neon::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(77, 246, 255, .17);
  transform: translate(6px, 2px);
  clip-path: inset(46% 0 0 0);
  opacity: .55;
}

.logo-rogue {
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 61, 136, .84);
  text-shadow: 0 0 38px rgba(255, 61, 136, .13);
  font-style: italic;
  letter-spacing: -.045em;
}

.logo-rogue::before,
.logo-rogue::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  clip-path: inset(42% 0 42% 0);
  opacity: 0;
  animation: logoGlitch 7s steps(1) 2s infinite;
}

.logo-rogue::before {
  color: var(--cyan);
  transform: translate(-4px, 1px);
  clip-path: inset(18% 0 62% 0);
}

.logo-rogue::after {
  color: var(--rose);
  transform: translate(5px, -2px);
  clip-path: inset(66% 0 8% 0);
}

@keyframes logoIn {
  from { opacity: 0; transform: translateY(28px) scale(.965); filter: blur(9px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes logoGlitch {
  0%, 92%, 100% { opacity: 0; }
  93% { opacity: .9; transform: translate(-7px, 2px); }
  94% { opacity: .5; transform: translate(8px, -3px); }
  95% { opacity: 0; }
  97% { opacity: .65; transform: translate(3px, 1px); }
  98% { opacity: 0; }
}

.cn-title {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-top: clamp(22px, 3vh, 33px);
  opacity: 0;
  animation: fadeUp .9s .4s var(--ease-out) forwards;
}

.cn-title b {
  font-size: clamp(20px, 2.2vw, 29px);
  font-weight: 500;
  letter-spacing: .35em;
  text-indent: -.02em;
  white-space: nowrap;
}

.cn-title span {
  color: var(--rose);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .2em;
  white-space: nowrap;
}

.lede {
  margin: clamp(22px, 3.2vh, 32px) 0 0;
  color: var(--dim);
  font-size: clamp(11px, 1.03vw, 14px);
  line-height: 2;
  letter-spacing: .08em;
  opacity: 0;
  animation: fadeUp .9s .5s var(--ease-out) forwards;
}

.save-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 620px);
  margin-top: 15px;
  padding: 10px 11px 10px 12px;
  border: 1px solid rgba(77, 246, 255, .24);
  background:
    linear-gradient(100deg, rgba(8, 19, 26, .92), rgba(5, 10, 15, .7)),
    repeating-linear-gradient(90deg, transparent 0 19px, rgba(77, 246, 255, .025) 19px 20px);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
  animation: saveReveal .4s var(--ease-out) both;
}

.save-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 31%;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(77, 246, 255, .7);
}

.save-card.is-hidden {
  display: none;
}

@keyframes saveReveal {
  from { opacity: 0; transform: translateY(7px); }
}

.save-beacon {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(77, 246, 255, .32);
  border-radius: 50%;
}

.save-beacon::before,
.save-beacon::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(77, 246, 255, .18);
  border-radius: 50%;
}

.save-beacon::after {
  inset: -4px;
  border-color: rgba(77, 246, 255, .08);
  animation: savePulse 2.4s ease-out infinite;
}

.save-beacon i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 9px var(--cyan);
}

@keyframes savePulse {
  0% { transform: scale(.7); opacity: .7; }
  75%, 100% { transform: scale(1.35); opacity: 0; }
}

.save-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.save-kicker {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 6.5px;
  line-height: 1.2;
  letter-spacing: .16em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.save-kicker em {
  color: var(--dim-2);
  font-style: normal;
}

.save-copy b {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .07em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-meta {
  overflow: hidden;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .04em;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.continue-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 9px;
  min-height: 38px;
  padding: 0 10px 0 13px;
  border: 1px solid rgba(77, 246, 255, .5);
  background: rgba(77, 246, 255, .07);
  color: var(--ink);
  clip-path: polygon(0 0, calc(100% - 7px) 0, 100% 7px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: .1em;
  transition: background .2s, border-color .2s, color .2s;
}

.continue-btn kbd {
  height: 18px;
  min-width: 18px;
  padding: 0 4px;
  border-color: rgba(77, 246, 255, .25);
  color: var(--cyan);
  font-size: 8px;
}

.continue-btn:hover {
  border-color: var(--cyan);
  background: var(--cyan);
  color: #031014;
}

.continue-btn:hover kbd {
  border-color: rgba(4, 19, 23, .24);
  color: rgba(4, 19, 23, .7);
}

.save-delete {
  display: grid;
  place-items: center;
  flex: none;
  width: 25px;
  height: 28px;
  border: 1px solid rgba(151, 211, 224, .14);
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1;
  transition: .2s;
}

.save-delete:hover {
  border-color: rgba(255, 61, 136, .5);
  color: var(--rose);
}

.save-delete.armed {
  width: auto;
  padding: 0 7px;
  border-color: rgba(255, 61, 136, .6);
  color: var(--rose);
  font-size: 7px;
  letter-spacing: .08em;
}

.save-card:not(.is-hidden) + .cta-row {
  margin-top: 17px;
}

.save-card:not(.is-hidden) ~ .mode-hint {
  display: none;
}

@media (max-height: 800px) and (min-width: 761px) {
  .save-card {
    margin-top: 10px;
    padding: 7px 10px;
  }

  .save-card:not(.is-hidden) + .cta-row {
    margin-top: 12px;
  }

  .save-card:not(.is-hidden) ~ .run-specs {
    margin-top: 14px;
  }

  .save-card .continue-btn {
    min-height: 34px;
  }

  .save-card .save-delete {
    height: 34px;
  }
}

.cta-row {
  display: flex;
  align-items: center;
  gap: 27px;
  margin-top: clamp(25px, 4.2vh, 41px);
  opacity: 0;
  animation: fadeUp .9s .62s var(--ease-out) forwards;
}

.cta-buttons {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 9px;
}

.cta-row .primary-btn {
  min-width: 184px;
}

.record {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: none;
  padding-left: 22px;
  border-left: 1px solid var(--line);
  font-family: var(--font-mono);
}

.record > span {
  color: var(--dim-2);
  font-size: 7px;
  letter-spacing: .16em;
}

.record > b {
  color: var(--dim);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: .09em;
  font-variant-numeric: tabular-nums;
}

.record-endless {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 1px;
  color: var(--dim-2);
  font-size: 7.5px;
  letter-spacing: .09em;
  white-space: nowrap;
}

.record-endless b {
  color: rgba(255, 131, 177, .9);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
}

.record-endless .record-wave {
  margin-left: 2px;
  color: var(--dim-2);
}

.record-endless .record-wave b {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
}

.mode-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 620px;
  margin: 13px 0 0;
  color: var(--dim);
  font-size: 9px;
  line-height: 1.8;
  letter-spacing: .045em;
  opacity: 0;
  animation: fadeUp .9s .69s var(--ease-out) forwards;
}

.mode-hint span {
  color: var(--rose);
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 61, 136, .55);
}

.run-specs {
  display: flex;
  gap: clamp(18px, 3.4vw, 42px);
  max-width: 520px;
  margin-top: clamp(18px, 3.4vh, 34px);
  padding-top: 15px;
  border-top: 1px solid var(--line);
  opacity: 0;
  animation: fadeUp .9s .76s var(--ease-out) forwards;
}

.run-specs div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.run-specs b {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: .05em;
}

.run-specs span {
  color: var(--dim-2);
  font-size: 8px;
  letter-spacing: .1em;
  white-space: nowrap;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Field manual ---------- */

.manual {
  position: relative;
  width: min(100%, 390px);
  justify-self: end;
  padding: 17px 17px 16px;
  border: 1px solid var(--line);
  background:
    linear-gradient(155deg, rgba(10, 19, 27, .8), rgba(4, 8, 13, .62)),
    repeating-linear-gradient(0deg, transparent 0 24px, rgba(147, 211, 225, .02) 24px 25px);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
  box-shadow: 0 28px 60px rgba(0, 0, 0, .28);
  backdrop-filter: blur(18px);
  opacity: 0;
  animation: manualIn 1.1s .35s var(--ease-out) forwards;
}

.manual::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 62px;
  height: 1px;
  background: var(--rose);
  box-shadow: 0 0 15px rgba(255, 61, 136, .7);
}

.manual::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 22px;
  height: 22px;
  border-left: 1px solid rgba(77, 246, 255, .5);
  transform: rotate(-45deg) translate(-5px, 11px);
  pointer-events: none;
}

@keyframes manualIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.manual-head {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 9px;
  letter-spacing: .18em;
}

.manual-code {
  color: var(--dim-2);
  font-size: 7px;
}

.radar {
  position: relative;
  height: 194px;
  margin: 13px 0 15px;
  overflow: hidden;
  border: 1px solid rgba(128, 204, 218, .12);
  background:
    radial-gradient(circle at 50% 50%, rgba(49, 128, 142, .13), transparent 57%),
    #050b10;
  isolation: isolate;
}

.radar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(0, 0, 0, .16) 3px 4px);
}

.radar-grid {
  position: absolute;
  inset: 0;
  opacity: .23;
  background-image:
    linear-gradient(rgba(91, 200, 218, .25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 200, 218, .25) 1px, transparent 1px);
  background-size: 26px 26px;
  transform: perspective(240px) rotateX(22deg) scale(1.14);
}

.radar-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid rgba(77, 246, 255, .2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.radar-ring.r1 { width: 88px; height: 88px; opacity: .55; }
.radar-ring.r2 { width: 154px; height: 154px; opacity: .3; }

.radar-sweep {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 156px;
  height: 156px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 78%, rgba(77, 246, 255, .18) 91%, rgba(77, 246, 255, .48) 99.4%, transparent 100%);
  transform: translate(-50%, -50%);
  animation: radarSweep 5s linear infinite;
  mask-image: radial-gradient(circle, transparent 0 20%, #000 21%);
  -webkit-mask-image: radial-gradient(circle, transparent 0 20%, #000 21%);
}

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

.radar-core {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
  transform: translate(-50%, -50%);
}

.radar-blip {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 10px rgba(255, 61, 136, .8);
  animation: blipPulse 2.7s ease-in-out infinite;
}

.radar-blip::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(255, 61, 136, .35);
  border-radius: 50%;
}

.radar-blip.b1 { left: 64%; top: 34%; animation-delay: .2s; }
.radar-blip.b2 { left: 31%; top: 61%; animation-delay: 1.1s; }
.radar-blip.b3 { left: 70%; top: 70%; animation-delay: 1.8s; opacity: .6; }

@keyframes blipPulse {
  0%, 100% { transform: scale(.75); opacity: .45; }
  40% { transform: scale(1); opacity: 1; }
}

.radar-label {
  position: absolute;
  z-index: 4;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: .14em;
}

.radar-label.top {
  left: 12px;
  top: 10px;
}

.radar-label.bottom {
  left: 12px;
  right: 12px;
  bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--dim);
}

.radar-label.bottom span {
  color: var(--rose);
}

.radar-label.bottom b {
  color: var(--ink-soft);
  font-weight: 500;
}

.manual-rows {
  display: flex;
  flex-direction: column;
}

.manual-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 13px;
  min-height: 47px;
  border-top: 1px solid rgba(147, 211, 225, .085);
}

.manual-row .keys {
  display: flex;
  align-items: center;
  gap: 3px;
}

.manual-row .keys kbd {
  min-width: 17px;
  height: 19px;
  padding: 0 3px;
  font-size: 8px;
}

.manual-row .keys kbd.wide {
  min-width: 54px;
  letter-spacing: .02em;
}

.mouse-keys {
  justify-content: center;
  width: 54px;
}

.manual-row > div:last-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.manual-row b {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .09em;
}

.manual-row span {
  color: var(--dim-2);
  font-size: 9px;
  letter-spacing: .06em;
}

.manual-note {
  display: flex;
  gap: 10px;
  margin-top: 11px;
  padding: 10px 11px;
  border-left: 1px solid rgba(255, 196, 77, .45);
  background: rgba(255, 196, 77, .035);
  color: var(--dim);
  font-size: 9px;
  line-height: 1.8;
  letter-spacing: .05em;
}

.note-mark {
  flex: none;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 11px;
}

.start-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--dim-2);
  font-size: 8px;
  letter-spacing: .13em;
}

.foot-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
}

.foot-status i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 8px var(--lime);
  animation: dotPulse 2.3s infinite;
}

/* --------------------------------------------------------------------------
   Modal framework
   -------------------------------------------------------------------------- */

.modal-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden auto;
  padding: clamp(14px, 3vw, 34px);
}

.modal-shroud {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 55% at 50% 50%, rgba(6, 14, 19, .54), rgba(1, 3, 6, .9) 74%),
    linear-gradient(180deg, rgba(2, 5, 8, .65), rgba(2, 4, 7, .93));
  backdrop-filter: blur(7px) saturate(.7);
}

.modal-shroud.death-shroud {
  background:
    radial-gradient(ellipse 58% 60% at 50% 50%, rgba(255, 61, 136, .08), rgba(2, 3, 6, .94) 72%),
    linear-gradient(180deg, rgba(2, 4, 7, .78), rgba(2, 3, 6, .96));
}

.modal-shroud.victory-shroud {
  background:
    radial-gradient(ellipse 58% 60% at 50% 50%, rgba(255, 196, 77, .09), rgba(2, 4, 7, .93) 72%);
}

.panel-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: .2em;
}

.panel-kicker span {
  width: 16px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 9px var(--cyan);
}

.upgrade-panel,
.pause-panel,
.end-panel {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line-bright);
  background:
    linear-gradient(145deg, rgba(10, 19, 26, .94), rgba(4, 8, 12, .93)),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(139, 211, 223, .025) 23px 24px);
  box-shadow: 0 40px 110px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(224, 253, 255, .04);
  animation: panelIn .55s var(--ease-out) both;
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(14px) scale(.988); filter: blur(5px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

.upgrade-panel::before,
.pause-panel::before,
.end-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 86px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 18px rgba(77, 246, 255, .8);
}

.upgrade-panel {
  width: min(1150px, 94vw);
  max-height: 94dvh;
  padding: clamp(23px, 3.2vw, 42px);
  overflow: auto;
  clip-path: polygon(0 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.upgrade-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  margin-top: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.upgrade-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 43px);
  font-weight: 500;
  letter-spacing: .06em;
  line-height: 1.1;
}

.upgrade-heading h2 span {
  color: var(--rose);
  font-style: italic;
}

.upgrade-heading p {
  max-width: 560px;
  margin: 9px 0 0;
  color: var(--dim);
  font-size: 10.5px;
  line-height: 1.8;
  letter-spacing: .07em;
}

.wave-stamp {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  padding-right: 4px;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .13em;
}

.wave-stamp b {
  color: rgba(142, 227, 237, .24);
  font-family: var(--font-display);
  font-size: clamp(44px, 5vw, 66px);
  font-weight: 400;
  line-height: .85;
}

.upgrade-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  margin: 21px 0;
}

.upgrade-card {
  --rarity: var(--cyan);
  --rarity-soft: rgba(77, 246, 255, .08);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 326px;
  padding: 17px 17px 14px;
  overflow: hidden;
  border: 1px solid rgba(146, 205, 218, .16);
  background:
    radial-gradient(circle at 52% 23%, var(--rarity-soft), transparent 49%),
    linear-gradient(160deg, rgba(12, 22, 30, .91), rgba(5, 9, 14, .88));
  color: var(--ink);
  text-align: left;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 0 100%);
  transition: transform .28s var(--ease-out), border-color .25s, background .25s;
  animation: cardIn .55s var(--ease-out) both;
}

.upgrade-card:nth-child(2) { animation-delay: .07s; }
.upgrade-card:nth-child(3) { animation-delay: .14s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(15px); }
}

.upgrade-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--rarity), transparent 66%);
  opacity: .8;
}

.upgrade-card::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 13px;
  height: 13px;
  border-left: 1px solid rgba(201, 244, 249, .4);
  transform: rotate(-45deg) translate(1px, -7px);
}

.upgrade-card:hover,
.upgrade-card:focus-visible {
  transform: translateY(-6px);
  border-color: color-mix(in srgb, var(--rarity) 58%, transparent);
  background:
    radial-gradient(circle at 52% 23%, var(--rarity-soft), transparent 53%),
    linear-gradient(160deg, rgba(15, 29, 38, .96), rgba(6, 11, 16, .92));
  outline: none;
}

.upgrade-card:hover .card-icon {
  transform: translateY(-3px) scale(1.04);
  color: var(--rarity);
}

.upgrade-card.is-selected {
  border-color: var(--rarity);
  animation: cardSelect .35s var(--ease-out) both;
}

@keyframes cardSelect {
  50% { transform: scale(1.02); filter: brightness(1.6); }
}

.upgrade-card[data-rarity="mythic"] {
  border-color: rgba(255, 61, 87, .32);
  box-shadow: inset 0 0 36px rgba(255, 61, 87, .055), 0 0 26px rgba(255, 61, 87, .05);
}

.upgrade-card[data-rarity="mythic"]::before {
  width: 3px;
  box-shadow: 0 0 18px rgba(255, 61, 87, .72);
}

.upgrade-card[data-rarity="mythic"] .rarity-tag {
  text-shadow: 0 0 10px rgba(255, 61, 87, .7);
}

.upgrade-card[data-rarity="mythic"] .card-icon {
  animation: mythicPulse 2.8s ease-in-out infinite;
}

@keyframes mythicPulse {
  50% { filter: drop-shadow(0 0 12px rgba(255, 61, 87, .6)); }
}

@media (prefers-reduced-motion: reduce) {
  .upgrade-card[data-rarity="mythic"] .card-icon {
    animation: none;
  }
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .14em;
}

.rarity-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--rarity);
  font-size: 7px;
  letter-spacing: .16em;
}

.rarity-tag::before {
  content: "";
  width: 4px;
  height: 4px;
  background: var(--rarity);
  transform: rotate(45deg);
  box-shadow: 0 0 8px var(--rarity);
}

.owned-tag {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .06em;
}

.card-icon {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  margin: 24px 0 18px;
  color: var(--ink-soft);
  transition: .3s var(--ease-out);
}

.card-icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--rarity) 35%, transparent));
}

.card-watermark {
  position: absolute;
  z-index: 0;
  right: -23px;
  bottom: 48px;
  width: 186px;
  height: 186px;
  color: var(--rarity);
  opacity: .055;
  pointer-events: none;
  transform: rotate(9deg);
}

.card-watermark svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: .8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-code {
  position: relative;
  z-index: 1;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: .16em;
}

.card-title {
  position: relative;
  z-index: 1;
  margin: 6px 0 8px;
  font-size: clamp(19px, 1.65vw, 24px);
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--ink);
}

.card-desc {
  position: relative;
  z-index: 1;
  flex: 1;
  margin: 0;
  color: #8fa4ae;
  font-size: 11.5px;
  line-height: 1.8;
  letter-spacing: .035em;
}

.card-levels {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 9px 0 2px;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: .12em;
}

.card-levels b {
  margin-left: auto;
  color: var(--rarity);
  font-size: 7px;
  font-weight: 400;
  letter-spacing: .04em;
}

.level-pips {
  display: flex;
  align-items: center;
  gap: 3px;
}

.level-pips i {
  display: block;
  width: 11px;
  height: 2px;
  background: rgba(164, 213, 224, .13);
}

.level-pips i.on {
  background: var(--rarity);
  box-shadow: 0 0 6px color-mix(in srgb, var(--rarity) 45%, transparent);
}

.card-flavor {
  position: relative;
  z-index: 1;
  margin: 9px 0 0;
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.6;
  letter-spacing: .04em;
}

.card-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px solid rgba(151, 218, 230, .1);
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .13em;
}

.card-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  border: 1px solid color-mix(in srgb, var(--rarity) 35%, transparent);
  color: var(--rarity);
  font-size: 8px;
}

.card-install {
  color: var(--dim);
  transition: color .2s;
}

.upgrade-card:hover .card-install {
  color: var(--rarity);
}

.upgrade-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 2px;
  font-size: 8px;
  letter-spacing: .08em;
}

.reroll-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reroll-wrap > span {
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .05em;
}

.upgrade-footer .ghost-btn {
  min-height: 35px;
  font-size: 9px;
}

.select-hint {
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .05em;
}

.select-hint kbd {
  min-width: 18px;
  height: 18px;
  margin: 0 2px;
  font-size: 8px;
}

/* --------------------------------------------------------------------------
   Pause
   -------------------------------------------------------------------------- */

.pause-panel {
  width: min(560px, 92vw);
  padding: clamp(25px, 4vw, 39px);
}

.pause-panel h2 {
  margin: 21px 0 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 500;
  letter-spacing: .13em;
}

.pause-panel > p {
  margin: 8px 0 24px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .06em;
}

.pause-readout {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 1px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  background: var(--line);
}

.pause-readout div {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px;
  background: rgba(4, 9, 13, .9);
}

.pause-readout span {
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .13em;
}

.pause-readout b {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pause-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
}

.pause-actions .primary-btn {
  justify-content: space-between;
}

.pause-actions .ghost-btn {
  min-height: 48px;
}

.ghost-btn.accent-save {
  border-color: rgba(77, 246, 255, .32);
  background: rgba(77, 246, 255, .045);
  color: var(--cyan);
}

.ghost-btn.accent-save:hover {
  border-color: rgba(77, 246, 255, .62);
  background: rgba(77, 246, 255, .1);
  color: var(--ink);
}

.pause-save-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 2px 0;
  border-top: 1px solid rgba(147, 211, 225, .08);
}

.pause-save-line .text-btn {
  color: var(--cyan);
  white-space: nowrap;
}

.pause-save-line > span {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: .03em;
}

.pause-save-line > span.is-saved {
  color: var(--lime);
}

.pause-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.pause-foot > span {
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: .04em;
}

/* --------------------------------------------------------------------------
   End screens
   -------------------------------------------------------------------------- */

.end-panel {
  width: min(690px, 94vw);
  padding: clamp(25px, 4vw, 41px);
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 15px 100%, 0 calc(100% - 15px));
}

.end-panel::before {
  width: 110px;
  background: var(--rose);
  box-shadow: 0 0 20px rgba(255, 61, 136, .8);
}

.end-code {
  color: var(--rose);
  font-size: 8px;
  letter-spacing: .18em;
}

.end-code span {
  color: var(--dim-2);
}

.end-mode-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 2px 7px;
  border: 1px solid rgba(255, 61, 136, .42);
  color: var(--rose) !important;
  background: rgba(255, 61, 136, .05);
  font-family: var(--font-mono);
  font-size: 7px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: .16em;
  vertical-align: 1px;
}

.end-mode-tag.is-hidden {
  display: none;
}

.glitch-title {
  position: relative;
  margin: 20px 0 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(44px, 6.4vw, 72px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: .12em;
  text-indent: -.03em;
  text-shadow: 0 0 35px rgba(255, 61, 136, .17);
}

.glitch-title::before,
.glitch-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .75;
}

.glitch-title::before {
  color: var(--cyan);
  transform: translate(-2px, 1px);
  clip-path: inset(41% 0 40% 0);
  animation: glitchA 4.5s steps(1) infinite;
}

.glitch-title::after {
  color: var(--rose);
  transform: translate(2px, -1px);
  clip-path: inset(12% 0 72% 0);
  animation: glitchB 5.3s steps(1) infinite;
}

@keyframes glitchA {
  0%, 88%, 100% { opacity: 0; }
  89% { opacity: .8; transform: translate(-5px, 2px); }
  90% { opacity: 0; }
  93% { opacity: .55; transform: translate(3px, -1px); }
}

@keyframes glitchB {
  0%, 89%, 100% { opacity: 0; }
  90% { opacity: .7; transform: translate(4px, 1px); }
  91% { opacity: 0; }
  96% { opacity: .4; transform: translate(-2px, -2px); }
}

.end-copy {
  margin: 0;
  color: var(--dim);
  font-size: 11px;
  line-height: 2;
  letter-spacing: .07em;
}

.end-score {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 25px 0 21px;
  padding: 13px 0 15px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.end-score span {
  color: var(--dim-2);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .14em;
}

.end-score b {
  margin-left: auto;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 45px);
  font-weight: 500;
  line-height: .8;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}

.end-score em {
  margin-left: 6px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 7px;
  letter-spacing: .12em;
  animation: dotPulse 1.8s infinite;
}

.run-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.run-stats div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 13px;
  background: rgba(4, 9, 13, .9);
}

.run-stats span {
  color: var(--dim-2);
  font-size: 8px;
  letter-spacing: .08em;
}

.run-stats b {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .04em;
}

.end-mods {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 27px;
  margin: 13px 0 21px;
}

.end-mods .mod-chip {
  height: 24px;
  font-size: 7px;
}

.end-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.save-load-btn {
  border-color: rgba(77, 246, 255, .3);
  color: var(--cyan);
}

.save-load-btn.is-hidden {
  display: none;
}

.victory-panel .end-code {
  color: var(--amber);
}

.victory-panel::before {
  background: var(--amber);
  box-shadow: 0 0 22px rgba(255, 196, 77, .75);
}

.victory-title {
  margin: 20px 0 8px;
  color: #fff9e9;
  font-family: var(--font-display);
  font-size: clamp(44px, 6.4vw, 72px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: .14em;
  text-indent: -.03em;
  text-shadow: 0 0 46px rgba(255, 196, 77, .22);
}

.victory-panel .end-copy {
  color: #b8a78b;
}

.victory-panel .end-score b,
.victory-panel .run-stats b {
  color: #fff2d4;
}

/* --------------------------------------------------------------------------
   Rotate / fallback note
   -------------------------------------------------------------------------- */

.rotate-note {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: 12px;
  display: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(3, 7, 11, .88);
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: .05em;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .start-main {
    grid-template-columns: minmax(0, 1fr) minmax(320px, .62fr);
    gap: 42px;
  }

  .manual {
    max-width: 350px;
  }

  .run-specs {
    gap: 22px;
  }

  .hud-top {
    gap: 16px;
  }

  .hud-card {
    width: 228px;
  }

  .top-right {
    min-width: 215px;
  }

  .score-value {
    font-size: 27px;
  }

  .upgrade-card {
    min-height: 310px;
  }
}

@media (max-width: 980px) {
  .start-screen {
    background:
      radial-gradient(ellipse 80% 70% at 22% 45%, rgba(16, 35, 51, .38), transparent 68%),
      linear-gradient(90deg, rgba(3, 6, 11, .92), rgba(3, 6, 11, .57));
  }

  .start-main {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 35px;
    padding-top: 25px;
  }

  .manual {
    display: none;
  }

  .start-copy {
    max-width: 760px;
  }

  .logo {
    font-size: clamp(68px, 15vw, 130px);
  }

  .start-foot {
    margin-top: 15px;
  }

  .sector-readout {
    min-width: 230px;
  }

  .hud-top {
    flex-wrap: wrap;
  }

  .top-right {
    min-width: 0;
  }

  .hud-bottom {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 10px;
  }

  .controls-hint {
    align-self: flex-end;
  }

  .mods-list {
    max-width: 100%;
  }

  .upgrade-cards {
    grid-template-columns: 1fr;
  }

  .upgrade-card {
    min-height: 0;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) auto;
    grid-template-rows: auto auto 1fr auto;
    column-gap: 14px;
    padding: 14px 16px;
    align-items: start;
  }

  .card-watermark,
  .card-levels {
    display: none;
  }

  .upgrade-card::before {
    width: 100%;
    height: 2px;
    bottom: auto;
    background: linear-gradient(90deg, var(--rarity), transparent 45%);
  }

  .card-top {
    grid-column: 2;
    grid-row: 1;
    padding-top: 2px;
  }

  .card-icon {
    grid-column: 1;
    grid-row: 1 / span 4;
    width: 64px;
    height: 64px;
    margin: 24px 0 0;
  }

  .card-code {
    grid-column: 2;
    grid-row: 2;
    margin-top: 8px;
  }

  .card-title {
    grid-column: 2;
    grid-row: 3;
    margin: 2px 0 3px;
  }

  .card-desc {
    grid-column: 2;
    grid-row: 4;
  }

  .card-flavor {
    display: none;
  }

  .card-foot {
    grid-column: 3;
    grid-row: 1 / span 4;
    align-self: center;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
  }

  .upgrade-heading {
    align-items: center;
  }

  .upgrade-panel {
    overflow: auto;
  }
}

@media (max-width: 760px) {
  .start-inner {
    padding: 18px 21px 22px;
  }

  .start-top {
    font-size: 7px;
  }

  .build-tag {
    display: none;
  }

  .start-main {
    padding: 26px 0 20px;
  }

  .logo {
    font-size: clamp(56px, 18vw, 105px);
  }

  .logo-rogue {
    margin-left: 25px;
  }

  .cn-title {
    flex-wrap: wrap;
    gap: 8px 15px;
    margin-top: 24px;
  }

  .cn-title b {
    font-size: 20px;
  }

  .lede {
    font-size: 11px;
    line-height: 1.9;
  }

  .save-card {
    flex-wrap: wrap;
    gap: 9px;
    padding: 9px;
  }

  .save-copy {
    flex: 1 1 210px;
  }

  .save-kicker {
    font-size: 6px;
  }

  .save-meta {
    font-size: 7px;
  }

  .continue-btn {
    flex: 1 1 auto;
    min-height: 36px;
  }

  .save-delete {
    height: 36px;
  }

  .cta-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 26px;
  }

  .cta-buttons {
    width: 100%;
    gap: 8px;
  }

  .cta-buttons .primary-btn {
    min-width: 0;
    padding-left: 19px;
    padding-right: 15px;
    gap: 12px;
  }

  .cta-buttons .secondary-btn {
    padding: 0 13px 0 14px;
    gap: 8px;
  }

  .mode-hint {
    margin-top: 12px;
    font-size: 8px;
    line-height: 1.8;
  }

  .record {
    padding-left: 0;
    border: 0;
  }

  .record-endless {
    font-size: 7px;
  }

  .run-specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 20px;
    padding-top: 13px;
  }

  .run-specs div {
    justify-content: flex-start;
    border-bottom: 1px solid rgba(147, 211, 225, .07);
    padding-bottom: 6px;
  }

  .start-inner {
    padding-bottom: 64px;
  }

  .start-foot {
    font-size: 6px;
    line-height: 1.7;
  }

  .foot-status {
    display: none;
  }

  .hud-top {
    padding: 13px 14px;
    gap: 7px;
    align-items: flex-start;
  }

  .hud-card {
    width: 180px;
    padding: 10px 11px;
  }

  .micro-label {
    font-size: 6px;
    letter-spacing: .09em;
  }

  .micro-label b {
    font-size: 8px;
  }

  .meter {
    height: 7px;
    margin-top: 7px;
  }

  .dash-line {
    margin-top: 7px;
    font-size: 6px;
  }

  .dash-state {
    min-width: 35px;
    font-size: 6px;
  }

  .sector-readout {
    position: absolute;
    top: 67px;
    left: 50%;
    min-width: 0;
    width: auto;
    transform: translateX(-50%);
    padding-top: 0;
  }

  .sector-rule,
  .sector-sub,
  .wave-progress {
    display: none;
  }

  .sector-name {
    margin: 0;
    font-size: 13px;
    letter-spacing: .2em;
    opacity: .75;
  }

  .top-right {
    flex: 1;
    min-width: 0;
    align-items: flex-start;
  }

  .score-value {
    font-size: 23px;
  }

  .best-line {
    font-size: 6px;
  }

  .hud-actions {
    margin-left: 10px;
  }

  .square-btn {
    width: 28px;
    height: 28px;
  }

  .combo-badge {
    top: 59px;
    right: 0;
  }

  .boss-hud {
    top: 100px;
    width: 90vw;
  }

  .boss-name {
    font-size: 7px;
  }

  .hud-bottom {
    left: 14px;
    right: 14px;
    bottom: 12px;
  }

  .controls-hint {
    display: none;
  }

  .mods-list {
    gap: 4px;
  }

  .mod-chip {
    height: 23px;
    padding: 0 5px;
    font-size: 7px;
  }

  .mod-chip span {
    display: none;
  }

  .toast {
    bottom: 55px;
    font-size: 8px;
  }

  .wave-banner {
    top: 20%;
    width: 92vw;
    padding: 12px 16px;
  }

  .banner-title {
    font-size: 25px;
  }

  .upgrade-panel {
    padding: 18px 15px;
    width: 96vw;
    max-height: 92dvh;
  }

  .panel-kicker {
    font-size: 7px;
  }

  .upgrade-heading {
    margin-top: 14px;
    padding-bottom: 14px;
    gap: 12px;
  }

  .upgrade-heading h2 {
    font-size: 27px;
  }

  .upgrade-heading p {
    font-size: 9px;
  }

  .wave-stamp b {
    font-size: 36px;
  }

  .upgrade-cards {
    gap: 8px;
    margin: 13px 0;
  }

  .upgrade-card {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    column-gap: 11px;
    padding: 11px 12px;
  }

  .card-icon {
    width: 46px;
    height: 46px;
    margin-top: 22px;
  }

  .card-title {
    font-size: 17px;
  }

  .card-desc {
    font-size: 9px;
    line-height: 1.6;
  }

  .card-code {
    display: none;
  }

  .card-flavor {
    display: none;
  }

  .card-foot {
    gap: 4px;
  }

  .upgrade-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .reroll-wrap {
    flex-wrap: wrap;
    gap: 7px;
  }

  .pause-panel,
  .end-panel {
    padding: 22px 18px;
  }

  .pause-readout {
    grid-template-columns: 1fr 1fr;
  }

  .pause-readout div:first-child {
    grid-column: 1 / -1;
  }

  .pause-actions {
    grid-template-columns: 1fr 1fr;
  }

  .pause-actions .primary-btn {
    grid-column: 1 / -1;
  }

  .pause-save-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .pause-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .run-stats {
    grid-template-columns: 1fr 1fr;
  }

  .end-score {
    flex-wrap: wrap;
  }

  .end-score b {
    font-size: 34px;
  }

  .end-score em {
    margin-left: 0;
  }

  .end-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .end-actions .primary-btn {
    justify-content: space-between;
  }

  .end-panel {
    max-height: 92dvh;
    overflow: auto;
  }

  .rotate-note {
    display: block;
  }
}

@media (max-height: 700px) and (min-width: 981px) {
  .start-inner {
    padding-top: 22px;
    padding-bottom: 18px;
  }

  .start-main {
    padding-top: 22px;
    padding-bottom: 15px;
  }

  .logo {
    font-size: clamp(72px, 11vh, 112px);
    margin-top: 20px;
  }

  .cn-title {
    margin-top: 22px;
  }

  .lede {
    margin-top: 16px;
    line-height: 1.75;
  }

  .cta-row {
    margin-top: 20px;
  }

  .run-specs {
    margin-top: 22px;
  }

  .radar {
    height: 145px;
  }

  .manual-row {
    min-height: 41px;
  }

  .manual-note {
    display: none;
  }

  .upgrade-panel {
    padding-top: 23px;
    padding-bottom: 20px;
  }

  .upgrade-heading {
    margin-top: 10px;
    padding-bottom: 13px;
  }

  .upgrade-heading h2 {
    font-size: 31px;
  }

  .upgrade-cards {
    margin: 13px 0;
  }

  .upgrade-card {
    min-height: 287px;
    padding-top: 13px;
  }

  .card-icon {
    width: 45px;
    height: 45px;
    margin: 17px 0 12px;
  }
}

@media (pointer: coarse) {
  .rotate-note {
    display: block;
  }

  .controls-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  .scanlines,
  .grain {
    animation: none;
  }

  .logo span,
  .kicker,
  .cn-title,
  .lede,
  .cta-row,
  .run-specs,
  .manual {
    opacity: 1;
  }
}
