@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Unbounded:wght@500;600;700;800&display=swap");

:root {
  --ink: #08000d;
  --ink-soft: #13001d;
  --magenta: #e400ff;
  --magenta-hot: #ff38f5;
  --violet: #7812ff;
  --cyan: #72fff1;
  --acid: #dcff68;
  --danger: #ff426d;
  --paper: #f8edff;
  --muted: #b99fc6;
  --panel: rgba(13, 2, 20, 0.66);
  --line: rgba(233, 189, 255, 0.22);
  --font-display: "Unbounded", "Arial Black", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
}

body {
  color: var(--paper);
  font-family: var(--font-mono);
}

button,
kbd,
output {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.game {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 42%, rgba(151, 0, 255, 0.2), transparent 40%),
    #07000b;
}

#gameCanvas,
#monsterCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#gameCanvas {
  z-index: 0;
  image-rendering: auto;
}

#monsterCanvas {
  z-index: 1;
  pointer-events: none;
}

.scene-effects,
.scene-effects > div {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scene-effects {
  z-index: 2;
}

.scene-effects__bloom {
  background:
    radial-gradient(circle at 50% 45%, transparent 0 25%, rgba(104, 0, 167, 0.07) 64%, rgba(0, 0, 0, 0.28) 100%),
    linear-gradient(90deg, rgba(255, 0, 230, 0.03), transparent 35%, transparent 65%, rgba(81, 0, 255, 0.04));
}

.scene-effects__scanlines {
  opacity: 0.14;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(4, 0, 6, 0.38) 4px
  );
}

.scene-effects__grain {
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.scene-effects__vignette {
  box-shadow:
    inset 0 0 12vw rgba(0, 0, 0, 0.72),
    inset 0 0 3vw rgba(45, 0, 53, 0.35);
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms var(--ease-out);
}

.game.is-running .hud,
.game.is-paused .hud,
.game.is-ended .hud {
  opacity: 1;
}

.micro-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1;
}

.brand-lockup {
  position: absolute;
  top: 28px;
  left: 32px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-lockup__sigil {
  position: relative;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  transform: rotate(45deg);
}

.brand-lockup__sigil span {
  position: absolute;
  background: var(--magenta-hot);
  box-shadow: 0 0 10px var(--magenta);
}

.brand-lockup__sigil span:nth-child(1) {
  top: 6px;
  right: 6px;
  width: 10px;
  height: 2px;
}

.brand-lockup__sigil span:nth-child(2) {
  top: 6px;
  right: 6px;
  width: 2px;
  height: 10px;
}

.brand-lockup__sigil span:nth-child(3) {
  bottom: 6px;
  left: 6px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--cyan);
  background: transparent;
  box-shadow: 0 0 8px rgba(114, 255, 241, 0.7);
}

.brand-lockup__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.objective {
  position: absolute;
  top: 28px;
  right: 32px;
  width: 250px;
  padding: 13px 16px 12px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(21, 2, 30, 0.58), rgba(7, 0, 11, 0.1));
  text-align: right;
}

.objective::before {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 6px;
  height: 6px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.objective__title {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.objective__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 0 rgba(114, 255, 241, 0.55);
  animation: signal-pulse 1.8s ease-out infinite;
}

@keyframes signal-pulse {
  70% { box-shadow: 0 0 0 8px rgba(114, 255, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(114, 255, 241, 0); }
}

.objective__signal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.15em;
}

.objective__signal::before {
  content: "";
  position: absolute;
  right: 58px;
  bottom: 15px;
  left: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(114, 255, 241, 0.28));
}

.objective__signal output {
  color: var(--cyan);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.threat-hud {
  --threat-color: var(--cyan);
  position: absolute;
  top: 126px;
  left: 32px;
  display: flex;
  width: 218px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px 10px 9px;
  border-left: 1px solid color-mix(in srgb, var(--threat-color) 58%, transparent);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--threat-color) 10%, transparent), transparent),
    rgba(5, 0, 9, 0.4);
  opacity: 0;
  transform: translateX(-12px);
  transition:
    opacity 260ms ease,
    transform 260ms var(--ease-out),
    border-color 160ms ease;
  pointer-events: none;
}

.threat-hud.is-active {
  opacity: 0.92;
  transform: translateX(0);
}

.threat-hud[data-state="run"] {
  --threat-color: #ffc857;
}

.threat-hud[data-state="attack"] {
  --threat-color: #ff355d;
  animation: threat-impact 320ms steps(2, end) infinite;
}

@keyframes threat-impact {
  50% {
    filter: brightness(1.35);
  }
}

.threat-hud__scanner {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--threat-color) 66%, transparent);
  border-radius: 50%;
  box-shadow:
    inset 0 0 12px color-mix(in srgb, var(--threat-color) 12%, transparent),
    0 0 15px color-mix(in srgb, var(--threat-color) 12%, transparent);
}

.threat-hud__scanner::before,
.threat-hud__scanner::after {
  content: "";
  position: absolute;
  inset: 50% 3px auto;
  height: 1px;
  background: color-mix(in srgb, var(--threat-color) 42%, transparent);
}

.threat-hud__scanner::after {
  inset: 3px auto 3px 50%;
  width: 1px;
  height: auto;
}

.threat-hud__scanner i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--threat-color);
  box-shadow: 0 0 7px var(--threat-color);
}

.threat-hud__scanner i:nth-child(1) {
  transform: translate(-9px, -7px);
}

.threat-hud__scanner i:nth-child(2) {
  transform: translate(5px, 4px);
}

.threat-hud__scanner i:nth-child(3) {
  width: 16px;
  height: 1px;
  border-radius: 0;
  transform-origin: left center;
  animation: scanner-sweep 2.2s linear infinite;
}

@keyframes scanner-sweep {
  to {
    transform: rotate(1turn);
  }
}

.threat-hud__body {
  min-width: 0;
  flex: 1;
}

.threat-hud__body .micro-label {
  margin-bottom: 6px;
  color: color-mix(in srgb, var(--threat-color) 76%, #b5a2bf);
  font-size: 7px;
}

.threat-hud__status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--threat-color);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.threat-hud__status output:last-child {
  color: rgba(228, 213, 235, 0.55);
  font-variant-numeric: tabular-nums;
}

.integrity-meter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.integrity-meter i {
  height: 4px;
  background: var(--threat-color);
  box-shadow: 0 0 8px color-mix(in srgb, var(--threat-color) 48%, transparent);
  transform: skewX(-20deg);
  transition:
    background 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease;
}

.integrity-meter i.is-lost {
  background: rgba(164, 132, 177, 0.16);
  box-shadow: none;
  opacity: 0.62;
}

.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  transform: translate(-50%, -50%);
  opacity: 0.8;
}

.crosshair i,
.crosshair b {
  position: absolute;
  display: block;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 5px rgba(228, 0, 255, 0.8);
}

.crosshair i:nth-child(1),
.crosshair i:nth-child(2) {
  top: 20px;
  width: 7px;
  height: 1px;
}

.crosshair i:nth-child(1) { left: 5px; }
.crosshair i:nth-child(2) { right: 5px; }

.crosshair i:nth-child(3),
.crosshair i:nth-child(4) {
  left: 20px;
  width: 1px;
  height: 7px;
}

.crosshair i:nth-child(3) { top: 5px; }
.crosshair i:nth-child(4) { bottom: 5px; }

.crosshair b {
  top: 19px;
  left: 19px;
  width: 3px;
  height: 3px;
  background: var(--magenta-hot);
}

.interaction-hint {
  position: absolute;
  bottom: 20%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 7px 14px 7px 8px;
  border: 1px solid rgba(114, 255, 241, 0.34);
  background:
    linear-gradient(90deg, rgba(16, 43, 43, 0.82), rgba(8, 1, 13, 0.72)),
    var(--panel);
  color: var(--cyan);
  font-size: 9px;
  letter-spacing: 0.12em;
  box-shadow:
    0 0 24px rgba(114, 255, 241, 0.1),
    inset 0 0 18px rgba(114, 255, 241, 0.04);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition:
    opacity 180ms ease,
    transform 240ms var(--ease-out);
}

.interaction-hint::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 12px;
  width: 34px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.interaction-hint.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.interaction-hint kbd {
  min-width: 30px;
  min-height: 30px;
  border-color: rgba(114, 255, 241, 0.58);
  color: var(--cyan);
  box-shadow:
    inset 0 -2px rgba(114, 255, 241, 0.08),
    0 0 12px rgba(114, 255, 241, 0.12);
}

.interaction-hint b {
  color: var(--paper);
}

.map-panel,
.vitals {
  position: absolute;
  bottom: 34px;
  background: linear-gradient(145deg, rgba(22, 3, 30, 0.88), rgba(6, 0, 10, 0.72));
  border: 1px solid var(--line);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  contain: paint;
}

.map-panel {
  left: 32px;
  width: 210px;
  padding: 13px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
}

.map-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 17px;
  width: 1px;
  height: 25px;
  background: var(--line);
  transform: rotate(-45deg);
  transform-origin: top;
}

.panel-heading,
.vitals__header,
.meter__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-heading {
  margin-bottom: 9px;
}

.panel-heading__title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.map-panel__recording {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--danger);
  font-size: 9px;
  letter-spacing: 0.1em;
}

.map-panel__recording::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: rec-blink 1s steps(1) infinite;
}

@keyframes rec-blink {
  50% { opacity: 0.2; }
}

#miniMap {
  display: block;
  width: 182px;
  height: 182px;
  border: 1px solid rgba(236, 195, 255, 0.12);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    rgba(4, 0, 7, 0.52);
  background-size: 10px 10px;
}

.map-panel__note {
  margin: 8px 0 0;
  color: rgba(217, 188, 230, 0.5);
  font-size: 7px;
  letter-spacing: 0.14em;
  text-align: center;
}

.vitals {
  right: 32px;
  width: min(340px, calc(100vw - 64px));
  padding: 16px 17px 18px;
  border-left: 2px solid rgba(228, 0, 255, 0.68);
}

.vitals__header {
  margin-bottom: 17px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(234, 202, 247, 0.12);
}

.vitals__header .micro-label {
  margin: 0;
}

.vitals__header output {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.meter + .meter {
  margin-top: 15px;
}

.meter__meta {
  margin-bottom: 7px;
}

.meter__meta output {
  width: 32px;
  color: var(--paper);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.meter__name {
  flex: 1;
  margin-left: 9px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.meter__icon {
  position: relative;
  width: 13px;
  height: 15px;
  color: var(--acid);
}

.meter__icon--bolt::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  clip-path: polygon(55% 0, 17% 56%, 48% 56%, 32% 100%, 87% 40%, 56% 40%);
  filter: drop-shadow(0 0 5px currentColor);
}

.meter__icon--health {
  color: #ff5b74;
}

.meter__icon--health::before,
.meter__icon--health::after {
  content: "";
  position: absolute;
  background: currentColor;
  box-shadow: 0 0 7px rgba(255, 53, 93, 0.75);
}

.meter__icon--health::before {
  top: 1px;
  left: 5px;
  width: 4px;
  height: 13px;
}

.meter__icon--health::after {
  top: 5px;
  left: 1px;
  width: 12px;
  height: 4px;
}

.meter__icon--drop {
  color: var(--danger);
}

.meter__icon--drop::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  width: 8px;
  height: 11px;
  border: 1px solid currentColor;
  border-radius: 70% 35% 65% 40%;
  transform: rotate(45deg);
  box-shadow: 0 0 5px rgba(255, 66, 109, 0.6);
}

.meter__track {
  position: relative;
  height: 7px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    repeating-linear-gradient(90deg, transparent 0 14px, rgba(0, 0, 0, 0.7) 14px 16px),
    rgba(255, 255, 255, 0.06);
}

.meter__fill {
  position: absolute;
  inset: 0;
  display: block;
  transform: scaleX(1);
  transform-origin: left center;
  will-change: transform;
}

.meter--health .meter__fill {
  background: linear-gradient(90deg, #a80e39, #ff355d 58%, #ff7189);
  box-shadow: 0 0 14px rgba(255, 53, 93, 0.72);
}

.meter--stamina .meter__fill {
  background: linear-gradient(90deg, #7eeb5c, var(--acid));
  box-shadow: 0 0 12px rgba(220, 255, 104, 0.62);
}

.meter--dehydration .meter__fill {
  transform: scaleX(0.08);
  background: linear-gradient(90deg, #ff8e52, var(--danger));
  box-shadow: 0 0 12px rgba(255, 66, 109, 0.55);
}

.meter.is-critical .meter__name,
.meter.is-critical output {
  color: var(--danger);
  animation: critical-flash 0.75s steps(2) infinite;
}

@keyframes critical-flash {
  50% { opacity: 0.42; }
}

.control-hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(223, 205, 231, 0.58);
  font-size: 8px;
  letter-spacing: 0.1em;
  transform: translateX(-50%);
  white-space: nowrap;
}

.control-hint span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.control-hint i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
}

kbd {
  display: inline-flex;
  min-width: 20px;
  min-height: 20px;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-bottom-color: rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  background: rgba(11, 1, 17, 0.65);
  color: var(--paper);
  font-size: 8px;
  line-height: 1;
  box-shadow: inset 0 -2px rgba(255, 255, 255, 0.05);
}

.sound-toggle {
  position: absolute;
  top: 78px;
  left: 32px;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(234, 215, 243, 0.62);
  font-size: 8px;
  letter-spacing: 0.12em;
  cursor: pointer;
  pointer-events: auto;
  transition: color 180ms ease;
}

.sound-toggle:hover {
  color: var(--paper);
}

.sound-toggle svg {
  width: 19px;
  height: 19px;
  overflow: visible;
  fill: currentColor;
}

.sound-toggle svg path.sound-wave {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.5;
}

.sound-toggle[aria-pressed="false"] .sound-wave {
  opacity: 0;
}

.sound-toggle[aria-pressed="false"] svg {
  opacity: 0.5;
}

.announcer {
  position: absolute;
  top: 25%;
  left: 50%;
  width: min(520px, calc(100vw - 40px));
  padding: 10px 16px;
  border-right: 1px solid rgba(114, 255, 241, 0.6);
  border-left: 1px solid rgba(114, 255, 241, 0.6);
  background: linear-gradient(90deg, transparent, rgba(4, 20, 21, 0.74), transparent);
  color: var(--cyan);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition:
    opacity 220ms ease,
    transform 280ms var(--ease-out);
}

.announcer.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(4, 0, 7, 0.92), rgba(11, 0, 17, 0.72) 48%, rgba(4, 0, 7, 0.87)),
    radial-gradient(circle at 50% 45%, rgba(188, 0, 255, 0.28), transparent 43%);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 500ms ease,
    visibility 500ms;
}

.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(217, 141, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 141, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}

.overlay--visible,
.overlay:not([hidden]) {
  opacity: 1;
  visibility: visible;
}

.overlay[hidden] {
  display: none;
}

.intro {
  position: relative;
  width: min(920px, calc(100vw - 40px));
  padding: 22px 30px;
  text-align: center;
}

.intro__index {
  margin: 0 0 18px;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.34em;
}

.intro h1 {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(52px, 7.5vw, 104px);
  font-weight: 800;
  letter-spacing: -0.08em;
  line-height: 0.84;
  text-shadow:
    0 0 12px rgba(228, 0, 255, 0.42),
    0 0 68px rgba(122, 0, 255, 0.33);
}

.intro h1::before {
  content: "LABYRINTH";
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.15);
  transform: translate(5px, -4px);
  z-index: -1;
}

.intro h1 span {
  color: var(--magenta-hot);
}

.intro__lead {
  margin: 17px auto 0;
  color: #d7c4df;
  font-family: var(--font-display);
  font-size: clamp(13px, 1.35vw, 17px);
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.65;
}

.intro__rule {
  position: relative;
  width: min(520px, 85%);
  height: 1px;
  margin: 17px auto 15px;
  background: linear-gradient(90deg, transparent, rgba(239, 214, 255, 0.42), transparent);
}

.intro__rule::after {
  content: "";
  position: absolute;
  top: -2px;
  left: 50%;
  width: 5px;
  height: 5px;
  background: var(--magenta-hot);
  box-shadow: 0 0 12px var(--magenta);
  transform: translateX(-50%) rotate(45deg);
}

.mission-selector {
  width: min(760px, 100%);
  margin: 0 auto 17px;
  padding: 10px;
  border: 1px solid rgba(221, 182, 239, 0.16);
  border-left-color: rgba(228, 0, 255, 0.58);
  background:
    linear-gradient(120deg, rgba(228, 0, 255, 0.075), transparent 42%),
    rgba(7, 0, 11, 0.46);
  box-shadow: inset 0 0 30px rgba(46, 0, 67, 0.18);
  text-align: left;
}

.mission-selector__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
  padding: 0 2px;
  color: rgba(216, 190, 227, 0.52);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.mission-selector__head output {
  color: var(--cyan);
}

.difficulty-tabs,
.level-grid {
  display: grid;
  gap: 6px;
}

.difficulty-tabs {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 7px;
}

.difficulty-tab,
.level-card {
  position: relative;
  border: 1px solid rgba(238, 215, 249, 0.13);
  background: rgba(13, 2, 19, 0.72);
  color: rgba(235, 218, 243, 0.54);
  cursor: pointer;
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.difficulty-tab {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  text-align: left;
}

.difficulty-tab small,
.difficulty-tab b {
  display: block;
}

.difficulty-tab small {
  font-size: 6px;
  letter-spacing: 0.16em;
}

.difficulty-tab b {
  font-size: 8px;
  letter-spacing: 0.13em;
}

.difficulty-tab:hover,
.level-card:hover {
  border-color: rgba(228, 0, 255, 0.52);
  color: var(--paper);
}

.difficulty-tab.is-active {
  border-color: rgba(114, 255, 241, 0.52);
  background: linear-gradient(90deg, rgba(114, 255, 241, 0.12), rgba(20, 2, 29, 0.72));
  color: var(--paper);
  box-shadow: inset 2px 0 0 var(--cyan);
}

.difficulty-tab.is-active small {
  color: var(--cyan);
}

.level-grid {
  grid-template-columns: repeat(3, 1fr);
}

.level-card {
  display: grid;
  min-height: 52px;
  grid-template-columns: 39px 1fr;
  align-items: center;
  padding: 6px 9px 6px 5px;
  text-align: left;
}

.level-card__number {
  color: rgba(226, 99, 255, 0.64);
  font-family: var(--font-display);
  font-size: 19px;
  text-align: center;
}

.level-card__name,
.level-card__meta {
  display: block;
}

.level-card__name {
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 7px;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-card__meta {
  color: rgba(201, 177, 213, 0.44);
  font-size: 6px;
  letter-spacing: 0.08em;
}

.level-card.is-active {
  border-color: rgba(228, 0, 255, 0.72);
  background: linear-gradient(105deg, rgba(228, 0, 255, 0.15), rgba(16, 2, 23, 0.78));
  color: var(--paper);
  box-shadow:
    inset 0 -2px 0 var(--magenta-hot),
    0 0 18px rgba(228, 0, 255, 0.08);
}

.level-card.is-active .level-card__number {
  color: var(--magenta-hot);
  text-shadow: 0 0 12px rgba(228, 0, 255, 0.65);
}

.mission-selector__brief {
  min-height: 9px;
  margin: 8px 2px 0;
  color: rgba(213, 189, 224, 0.47);
  font-size: 6px;
  letter-spacing: 0.13em;
}

.difficulty-tab:focus-visible,
.level-card:focus-visible,
.secondary-button:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 2px;
}

.intro__controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: min(620px, 100%);
  margin: 0 auto 17px;
}

.intro__controls > div {
  display: grid;
  min-height: 62px;
  grid-template-columns: 70px 1fr;
  align-items: center;
  padding: 0 20px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
}

.intro__controls > div:last-child {
  border-right: 0;
}

.intro__controls p {
  margin: 0;
}

.intro__controls b,
.intro__controls small {
  display: block;
}

.intro__controls b {
  margin-bottom: 5px;
  font-size: 9px;
  letter-spacing: 0.13em;
}

.intro__controls small {
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.08em;
}

.key-cluster {
  display: grid;
  width: 58px;
  gap: 3px;
  justify-content: center;
}

.key-cluster > kbd {
  justify-self: center;
}

.key-cluster span {
  display: flex;
  gap: 3px;
}

.key-cluster kbd {
  width: 17px;
  min-width: 17px;
  height: 17px;
  min-height: 17px;
  padding: 0;
  font-size: 7px;
}

.mouse-mark {
  position: relative;
  width: 27px;
  height: 39px;
  margin-left: 15px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 14px;
}

.mouse-mark::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.mouse-mark i {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 3px;
  height: 7px;
  border-radius: 2px;
  background: var(--magenta-hot);
  box-shadow: 0 0 8px var(--magenta);
  transform: translateX(-50%);
}

.shift-key {
  width: 58px;
  min-height: 25px;
  font-size: 7px;
}

.primary-button {
  position: relative;
  display: inline-flex;
  min-width: 290px;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 23px;
  overflow: hidden;
  border: 1px solid rgba(246, 229, 255, 0.7);
  background: rgba(8, 0, 13, 0.55);
  color: var(--paper);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.17em;
  cursor: pointer;
  transition:
    border-color 220ms ease,
    color 220ms ease,
    box-shadow 220ms ease;
}

.primary-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper);
  transform: translateX(-102%);
  transition: transform 340ms var(--ease-out);
}

.primary-button span,
.primary-button svg {
  position: relative;
  z-index: 1;
}

.primary-button svg {
  width: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}

.primary-button:hover {
  border-color: var(--paper);
  color: var(--ink);
  box-shadow: 0 0 35px rgba(228, 0, 255, 0.25);
}

.primary-button:hover::before {
  transform: translateX(0);
}

.primary-button:active {
  opacity: 0.78;
}

.intro__warning {
  margin: 13px 0 0;
  color: rgba(205, 180, 216, 0.45);
  font-size: 7px;
  letter-spacing: 0.15em;
}

.token-masthead {
  position: absolute;
  top: 28px;
  left: 32px;
  z-index: 2;
  display: flex;
  min-width: 250px;
  align-items: center;
  gap: 11px;
  padding: 8px 12px 8px 9px;
  border: 1px solid rgba(216, 190, 230, 0.16);
  border-left-color: rgba(114, 255, 241, 0.7);
  background:
    linear-gradient(90deg, rgba(114, 255, 241, 0.08), transparent 46%),
    rgba(5, 0, 9, 0.42);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.token-masthead__mark {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border: 1px solid rgba(114, 255, 241, 0.72);
  transform: rotate(45deg);
  box-shadow:
    inset 0 0 12px rgba(114, 255, 241, 0.12),
    0 0 14px rgba(228, 0, 255, 0.12);
}

.token-masthead__mark::before,
.token-masthead__mark::after,
.token-masthead__mark i {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--magenta-hot);
}

.token-masthead__mark::after {
  inset: 9px;
  border: 0;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}

.token-masthead__mark i {
  inset: 3px 10px;
  border: 0;
  background: rgba(255, 255, 255, 0.35);
}

.token-masthead__identity {
  display: grid;
  gap: 2px;
  text-align: left;
}

.token-masthead__identity strong {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.09em;
}

.token-masthead__identity small {
  color: rgba(210, 188, 220, 0.52);
  font-size: 6px;
  letter-spacing: 0.19em;
}

.token-masthead > b {
  margin-left: auto;
  padding-left: 14px;
  border-left: 1px solid rgba(216, 190, 230, 0.14);
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-shadow: 0 0 12px rgba(114, 255, 241, 0.45);
}

.token-panel {
  width: min(640px, 100%);
  margin: 15px auto 0;
}

.token-links {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.token-links a {
  position: relative;
  display: flex;
  min-height: 31px;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid rgba(216, 190, 230, 0.18);
  background: rgba(7, 0, 12, 0.5);
  color: rgba(239, 221, 248, 0.72);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    color 180ms ease,
    background 180ms ease,
    transform 180ms var(--ease-out);
}

.token-links a::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(228, 0, 255, 0.14), rgba(114, 255, 241, 0.09));
  opacity: 0;
  transition: opacity 180ms ease;
}

.token-links a span {
  position: relative;
  color: var(--cyan);
  font-size: 10px;
}

.token-links a:hover,
.token-links a:focus-visible {
  border-color: rgba(114, 255, 241, 0.55);
  color: var(--paper);
  transform: translateY(-2px);
}

.token-links a:hover::before,
.token-links a:focus-visible::before {
  opacity: 1;
}

.contract-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  width: 100%;
  min-height: 36px;
  margin-top: 5px;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  border: 1px solid rgba(228, 0, 255, 0.3);
  background:
    linear-gradient(90deg, rgba(228, 0, 255, 0.08), transparent 34%),
    rgba(5, 0, 9, 0.62);
  color: var(--paper);
  cursor: pointer;
}

.contract-field > span {
  color: var(--magenta-hot);
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.contract-field code {
  overflow: hidden;
  color: rgba(236, 216, 245, 0.72);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.07em;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-field small {
  color: var(--cyan);
  font-size: 6px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.contract-field.is-empty {
  cursor: default;
  opacity: 0.62;
}

.contract-field.is-copied {
  border-color: rgba(114, 255, 241, 0.68);
  box-shadow: 0 0 18px rgba(114, 255, 241, 0.1);
}

.token-panel--compact {
  margin-top: 24px;
}

.overlay__bracket {
  position: absolute;
  width: 90px;
  height: 90px;
  opacity: 0.36;
}

.overlay__bracket--tl {
  top: 32px;
  left: 32px;
  border-top: 1px solid var(--magenta-hot);
  border-left: 1px solid var(--magenta-hot);
}

.overlay__bracket--br {
  right: 32px;
  bottom: 32px;
  border-right: 1px solid var(--cyan);
  border-bottom: 1px solid var(--cyan);
}

.overlay__coordinate {
  position: absolute;
  right: 44px;
  bottom: 40px;
  margin: 0;
  color: rgba(210, 190, 219, 0.36);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.overlay--compact {
  background: rgba(4, 0, 7, 0.78);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
}

.compact-dialog {
  position: relative;
  width: min(560px, calc(100vw - 40px));
  padding: 48px 48px 44px;
  border-top: 1px solid rgba(228, 0, 255, 0.6);
  border-bottom: 1px solid rgba(114, 255, 241, 0.35);
  background: linear-gradient(135deg, rgba(26, 2, 36, 0.9), rgba(5, 0, 9, 0.84));
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.48);
}

.compact-dialog::before,
.compact-dialog::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
}

.compact-dialog::before {
  top: -4px;
  left: 26px;
  background: var(--magenta-hot);
  box-shadow: 0 0 12px var(--magenta);
}

.compact-dialog::after {
  right: 26px;
  bottom: -4px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}

.compact-dialog h2 {
  margin: 0 0 15px;
  font-family: var(--font-display);
  font-size: clamp(38px, 7vw, 64px);
  letter-spacing: -0.04em;
}

.compact-dialog > p:not(.intro__index) {
  margin: 0 auto 27px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.overlay {
  isolation: isolate;
}

.overlay::before,
.overlay::after {
  z-index: 0;
  pointer-events: none;
}

.overlay::before {
  animation: menu-grid-drift 16s linear infinite;
}

.overlay::after {
  content: "";
  position: absolute;
  inset: -45% 0 auto;
  height: 38%;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(114, 255, 241, 0.025) 38%,
    rgba(114, 255, 241, 0.18) 50%,
    rgba(228, 0, 255, 0.05) 56%,
    transparent
  );
  mix-blend-mode: screen;
  animation: menu-screen-scan 7s linear infinite;
}

.overlay > .intro,
.overlay > .compact-dialog,
.overlay > .token-masthead,
.overlay > .overlay__bracket,
.overlay > .overlay__coordinate {
  z-index: 2;
}

.menu-aperture {
  position: absolute;
  top: 47%;
  left: 50%;
  z-index: 1;
  width: min(72vw, 820px);
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0.29;
  filter: drop-shadow(0 0 28px rgba(228, 0, 255, 0.2));
  transform: translate(-50%, -50%);
}

.menu-aperture::before,
.menu-aperture::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(114, 255, 241, 0.1);
  transform: rotate(45deg);
}

.menu-aperture::after {
  inset: 28%;
  border-color: rgba(228, 0, 255, 0.16);
}

.menu-aperture span {
  position: absolute;
  border: 1px solid rgba(228, 0, 255, 0.22);
  background:
    linear-gradient(90deg, transparent 48%, rgba(114, 255, 241, 0.14) 50%, transparent 52%),
    linear-gradient(transparent 48%, rgba(228, 0, 255, 0.12) 50%, transparent 52%);
  transform: rotate(45deg);
  animation: menu-aperture-breathe 8s ease-in-out infinite;
}

.menu-aperture span:nth-child(1) {
  inset: 2%;
}

.menu-aperture span:nth-child(2) {
  inset: 16%;
  border-color: rgba(114, 255, 241, 0.2);
  animation-delay: -2.6s;
}

.menu-aperture span:nth-child(3) {
  inset: 31%;
  animation-delay: -5.2s;
}

#startScreen .intro {
  z-index: 2;
}

#startScreen .intro::before {
  content: "";
  position: absolute;
  inset: -8px -28px;
  z-index: -1;
  border: 1px solid rgba(225, 183, 243, 0.08);
  background:
    linear-gradient(115deg, rgba(228, 0, 255, 0.07), transparent 28% 74%, rgba(114, 255, 241, 0.05)),
    rgba(4, 0, 8, 0.17);
  box-shadow:
    inset 0 0 70px rgba(85, 0, 126, 0.08),
    0 26px 90px rgba(0, 0, 0, 0.18);
  clip-path: polygon(0 18px, 18px 0, calc(100% - 18px) 0, 100% 18px, 100% calc(100% - 18px), calc(100% - 18px) 100%, 18px 100%, 0 calc(100% - 18px));
  animation: intro-frame-breathe 6s ease-in-out infinite;
}

#startScreen.overlay--visible .intro > * {
  animation: menu-item-arrive 650ms var(--ease-out) backwards;
}

#startScreen.overlay--visible .intro__index {
  animation-delay: 80ms;
}

#startScreen.overlay--visible .intro h1 {
  animation-delay: 140ms;
}

#startScreen.overlay--visible .intro__lead {
  animation-delay: 220ms;
}

#startScreen.overlay--visible .intro__rule {
  animation-delay: 290ms;
}

#startScreen.overlay--visible .mission-selector {
  animation-delay: 350ms;
}

#startScreen.overlay--visible .intro__controls {
  animation-delay: 430ms;
}

#startScreen.overlay--visible .primary-button {
  animation-delay: 500ms;
}

#startScreen.overlay--visible .intro__warning {
  animation-delay: 560ms;
}

#startScreen.overlay--visible .token-panel {
  animation-delay: 620ms;
}

#startScreen .intro h1 {
  filter: drop-shadow(0 0 20px rgba(228, 0, 255, 0.2));
}

#startScreen .intro h1::after {
  content: "LABYRINTH";
  position: absolute;
  inset: 0;
  color: var(--cyan);
  opacity: 0;
  pointer-events: none;
  text-shadow: 5px 0 0 rgba(228, 0, 255, 0.8);
  clip-path: inset(42% 0 43%);
  animation: menu-title-glitch 6.5s steps(1, end) 1.4s infinite;
}

.mission-selector {
  position: relative;
  overflow: hidden;
  border-color: rgba(221, 182, 239, 0.22);
  box-shadow:
    inset 0 0 34px rgba(46, 0, 67, 0.24),
    0 16px 48px rgba(0, 0, 0, 0.16);
}

.mission-selector::before {
  content: "";
  position: absolute;
  top: 0;
  left: -35%;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  box-shadow: 0 0 10px rgba(114, 255, 241, 0.7);
  animation: selector-rail 4.8s ease-in-out infinite;
}

.mission-selector::after {
  content: "";
  position: absolute;
  inset: -100% -25%;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 44%, rgba(228, 0, 255, 0.06) 50%, transparent 56%);
  transform: translateX(-40%);
  animation: selector-sweep 6.2s ease-in-out infinite;
}

.difficulty-tab,
.level-card {
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    transform 180ms var(--ease-out);
}

.difficulty-tab:hover,
.level-card:hover {
  transform: translateY(-2px);
}

.level-card.is-active {
  animation: selected-cell-pulse 2.8s ease-in-out infinite;
}

.primary-button {
  background:
    linear-gradient(100deg, rgba(228, 0, 255, 0.07), transparent 36%, rgba(114, 255, 241, 0.05)),
    rgba(8, 0, 13, 0.68);
  box-shadow:
    inset 0 0 22px rgba(228, 0, 255, 0.035),
    0 12px 32px rgba(0, 0, 0, 0.18);
}

.primary-button::after {
  content: "";
  position: absolute;
  top: -70%;
  bottom: -70%;
  left: -34%;
  width: 23%;
  z-index: 0;
  background: linear-gradient(90deg, transparent, rgba(114, 255, 241, 0.42), transparent);
  transform: skewX(-18deg);
  transition: left 560ms var(--ease-out);
}

.primary-button:hover::after {
  left: 112%;
}

.token-masthead {
  box-shadow:
    inset 0 0 24px rgba(114, 255, 241, 0.035),
    0 18px 50px rgba(0, 0, 0, 0.2);
}

.token-masthead::after {
  content: "";
  position: absolute;
  right: 9px;
  bottom: -1px;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan));
  opacity: 0.7;
}

.token-masthead__mark {
  border: 0;
  background: url("assets/labyrinth-favicon.png") center / cover no-repeat;
  box-shadow: 0 0 16px rgba(228, 0, 255, 0.25);
  transform: none;
  animation: masthead-sigil 3.4s ease-in-out infinite;
}

.token-masthead__mark::before,
.token-masthead__mark::after,
.token-masthead__mark i {
  display: none;
}

.overlay__bracket {
  animation: overlay-corner-pulse 3.8s ease-in-out infinite;
}

.overlay__bracket--br {
  animation-delay: -1.9s;
}

#pauseScreen {
  background:
    radial-gradient(circle at 50% 47%, rgba(228, 0, 255, 0.13), transparent 38%),
    linear-gradient(115deg, rgba(3, 0, 6, 0.96), rgba(15, 0, 22, 0.76) 50%, rgba(3, 0, 6, 0.94));
}

#pauseScreen::before {
  opacity: 0.85;
  background:
    repeating-linear-gradient(115deg, transparent 0 66px, rgba(228, 0, 255, 0.028) 67px 68px),
    linear-gradient(rgba(114, 255, 241, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(114, 255, 241, 0.025) 1px, transparent 1px);
  background-size: auto, 54px 54px, 54px 54px;
  mask-image: radial-gradient(circle at center, black, transparent 76%);
}

#pauseScreen::after {
  height: 24%;
  background: linear-gradient(to bottom, transparent, rgba(255, 56, 245, 0.2), transparent);
  animation-duration: 4.4s;
}

.pause-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: min(70vw, 700px);
  aspect-ratio: 1;
  border: 1px solid rgba(228, 0, 255, 0.13);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.62;
  transform: translate(-50%, -50%);
  animation: pause-reticle-turn 24s linear infinite;
}

.pause-reticle::before,
.pause-reticle::after {
  content: "";
  position: absolute;
  border-radius: inherit;
}

.pause-reticle::before {
  inset: 9%;
  border: 1px dashed rgba(114, 255, 241, 0.14);
}

.pause-reticle::after {
  inset: 25%;
  border: 1px solid rgba(228, 0, 255, 0.14);
  box-shadow:
    0 -1px 0 rgba(114, 255, 241, 0.55),
    inset 0 0 55px rgba(228, 0, 255, 0.05);
}

.pause-reticle span,
.pause-reticle i {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  background: linear-gradient(90deg, transparent, rgba(114, 255, 241, 0.22), transparent);
  transform: translate(-50%, -50%);
}

.pause-reticle span {
  width: 112%;
  height: 1px;
}

.pause-reticle i {
  width: 1px;
  height: 112%;
  background: linear-gradient(transparent, rgba(228, 0, 255, 0.2), transparent);
}

#pauseScreen .compact-dialog {
  z-index: 2;
  width: min(600px, calc(100vw - 40px));
  overflow: hidden;
  border: 1px solid rgba(226, 193, 241, 0.12);
  border-top-color: rgba(228, 0, 255, 0.72);
  border-bottom-color: rgba(114, 255, 241, 0.48);
  background:
    repeating-linear-gradient(to bottom, transparent 0 5px, rgba(255, 255, 255, 0.012) 6px),
    linear-gradient(135deg, rgba(31, 2, 43, 0.94), rgba(5, 0, 9, 0.9));
  box-shadow:
    0 0 0 7px rgba(9, 0, 14, 0.35),
    0 0 0 8px rgba(228, 0, 255, 0.055),
    0 38px 110px rgba(0, 0, 0, 0.62),
    inset 0 0 70px rgba(91, 0, 130, 0.12);
}

#pauseScreen:not([hidden]) .compact-dialog {
  animation: pause-dialog-arrive 620ms var(--ease-out) both;
}

#pauseScreen .compact-dialog::before,
#pauseScreen .compact-dialog::after {
  animation: pause-node-pulse 1.5s ease-in-out infinite;
}

#pauseScreen .compact-dialog .intro__index {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

#pauseScreen .compact-dialog .intro__index::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--danger);
  box-shadow: 0 0 14px rgba(255, 66, 109, 0.9);
  animation: pause-status-blink 1.15s steps(1, end) infinite;
}

#pauseScreen .compact-dialog h2 {
  position: relative;
  display: inline-block;
  color: var(--paper);
  text-shadow:
    -3px 0 18px rgba(228, 0, 255, 0.28),
    3px 0 18px rgba(114, 255, 241, 0.16);
}

#pauseScreen .compact-dialog h2::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -64px;
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--magenta-hot));
  box-shadow: 0 0 10px rgba(228, 0, 255, 0.5);
}

#pauseScreen .compact-dialog h2::after {
  content: "PAUSED";
  position: absolute;
  inset: 0;
  color: var(--cyan);
  opacity: 0;
  pointer-events: none;
  clip-path: inset(58% 0 20%);
  animation: pause-title-glitch 4.8s steps(1, end) 1s infinite;
}

#pauseScreen .compact-dialog > p:not(.intro__index) {
  position: relative;
  max-width: 340px;
}

#pauseScreen .compact-dialog > p:not(.intro__index)::after {
  content: "";
  display: block;
  width: 46px;
  height: 1px;
  margin: 15px auto -8px;
  background: linear-gradient(90deg, transparent, rgba(114, 255, 241, 0.7), transparent);
}

#pauseScreen .token-panel--compact {
  padding-top: 14px;
  border-top: 1px solid rgba(225, 191, 239, 0.08);
}

#startScreen .intro {
  width: min(1040px, calc(100vw - 40px));
}

#startScreen .intro__index,
#pauseScreen .intro__index {
  font-size: 13px;
}

#startScreen .intro__lead {
  font-size: clamp(16px, 1.5vw, 20px);
  line-height: 1.55;
}

#startScreen .mission-selector {
  width: min(820px, 100%);
}

#startScreen .mission-selector__head {
  font-size: 12px;
}

#startScreen .difficulty-tab {
  min-height: 42px;
}

#startScreen .difficulty-tab small {
  font-size: 11px;
}

#startScreen .difficulty-tab b {
  font-size: 13px;
}

#startScreen .level-card {
  min-height: 60px;
  grid-template-columns: 46px 1fr;
}

#startScreen .level-card__number {
  font-size: 22px;
}

#startScreen .level-card__name {
  font-size: 12px;
}

#startScreen .level-card__meta {
  font-size: 11px;
}

#startScreen .mission-selector__brief {
  min-height: 12px;
  font-size: 11px;
  line-height: 1.45;
}

#startScreen .intro__controls {
  width: min(700px, 100%);
}

#startScreen .intro__controls > div {
  min-height: 68px;
}

#startScreen .intro__controls b {
  font-size: 13px;
}

#startScreen .intro__controls small {
  font-size: 11px;
}

#startScreen .key-cluster kbd,
#startScreen .shift-key {
  font-size: 10px;
}

#startScreen .primary-button,
#pauseScreen .primary-button {
  min-height: 60px;
  font-size: 14px;
}

#startScreen .intro__warning {
  font-size: 11px;
  line-height: 1.5;
}

#startScreen .token-masthead,
#pauseScreen .token-masthead {
  min-width: 290px;
}

#startScreen .token-masthead__identity strong,
#pauseScreen .token-masthead__identity strong {
  font-size: 13px;
}

#startScreen .token-masthead__identity small,
#pauseScreen .token-masthead__identity small {
  font-size: 10px;
}

#startScreen .token-masthead > b,
#pauseScreen .token-masthead > b {
  font-size: 15px;
}

#startScreen .token-links a,
#pauseScreen .token-links a {
  min-height: 38px;
  font-size: 11px;
}

#startScreen .token-links a span,
#pauseScreen .token-links a span {
  font-size: 13px;
}

#startScreen .contract-field,
#pauseScreen .contract-field {
  min-height: 42px;
}

#startScreen .contract-field > span,
#pauseScreen .contract-field > span {
  font-size: 12px;
}

#startScreen .contract-field code,
#pauseScreen .contract-field code {
  font-size: 12px;
}

#startScreen .contract-field small,
#pauseScreen .contract-field small {
  font-size: 10px;
}

#startScreen .overlay__coordinate {
  font-size: 10px;
}

#pauseScreen .compact-dialog {
  width: min(680px, calc(100vw - 40px));
}

#pauseScreen .compact-dialog > p:not(.intro__index) {
  max-width: 430px;
  font-size: 16px;
  line-height: 1.6;
}

@keyframes menu-grid-drift {
  to {
    background-position: 64px 64px, 64px 64px;
  }
}

@keyframes menu-screen-scan {
  0% {
    transform: translateY(-30vh);
  }
  100% {
    transform: translateY(180vh);
  }
}

@keyframes menu-aperture-breathe {
  0%,
  100% {
    opacity: 0.38;
    transform: rotate(45deg) scale(0.94);
  }
  50% {
    opacity: 0.92;
    transform: rotate(45deg) scale(1.025);
  }
}

@keyframes intro-frame-breathe {
  0%,
  100% {
    border-color: rgba(225, 183, 243, 0.06);
  }
  50% {
    border-color: rgba(114, 255, 241, 0.14);
  }
}

@keyframes menu-item-arrive {
  from {
    opacity: 0;
    transform: translateY(16px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes menu-title-glitch {
  0%,
  88%,
  100% {
    opacity: 0;
    transform: translate(0);
  }
  89% {
    opacity: 0.62;
    transform: translate(-7px, 1px);
  }
  90% {
    opacity: 0.3;
    transform: translate(6px, -1px);
  }
  91% {
    opacity: 0;
  }
}

@keyframes selector-rail {
  0%,
  18% {
    left: -35%;
  }
  72%,
  100% {
    left: 104%;
  }
}

@keyframes selector-sweep {
  0%,
  35% {
    transform: translateX(-40%);
  }
  78%,
  100% {
    transform: translateX(40%);
  }
}

@keyframes selected-cell-pulse {
  0%,
  100% {
    box-shadow:
      inset 0 -2px 0 var(--magenta-hot),
      0 0 18px rgba(228, 0, 255, 0.08);
  }
  50% {
    box-shadow:
      inset 0 -2px 0 var(--magenta-hot),
      0 0 28px rgba(228, 0, 255, 0.18);
  }
}

@keyframes masthead-sigil {
  0%,
  100% {
    filter: brightness(0.92);
    transform: scale(0.96);
  }
  50% {
    filter: brightness(1.18);
    transform: scale(1.04);
  }
}

@keyframes overlay-corner-pulse {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.68;
  }
}

@keyframes pause-reticle-turn {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes pause-dialog-arrive {
  from {
    opacity: 0;
    filter: blur(7px);
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: scale(1) translateY(0);
  }
}

@keyframes pause-node-pulse {
  0%,
  100% {
    opacity: 0.48;
  }
  50% {
    opacity: 1;
  }
}

@keyframes pause-status-blink {
  0%,
  62% {
    opacity: 1;
  }
  63%,
  100% {
    opacity: 0.25;
  }
}

@keyframes pause-title-glitch {
  0%,
  90%,
  100% {
    opacity: 0;
    transform: translate(0);
  }
  91% {
    opacity: 0.55;
    transform: translate(5px, 0);
  }
  92% {
    opacity: 0.22;
    transform: translate(-4px, 1px);
  }
  93% {
    opacity: 0;
  }
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: min(330px, 100%);
  margin: 0 auto 30px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-grid > div {
  padding: 15px;
}

.result-grid > div + div {
  border-left: 1px solid var(--line);
}

.result-grid span,
.result-grid output {
  display: block;
}

.result-grid span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.14em;
}

.result-grid output {
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 19px;
}

.end-actions {
  display: grid;
  width: min(330px, 100%);
  margin: 0 auto;
  gap: 10px;
}

.end-actions .primary-button {
  width: 100%;
}

.secondary-button {
  min-height: 36px;
  border: 1px solid rgba(216, 192, 227, 0.2);
  background: rgba(7, 0, 11, 0.4);
  color: rgba(226, 208, 234, 0.62);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition:
    color 160ms ease,
    border-color 160ms ease;
}

.secondary-button:hover {
  border-color: rgba(114, 255, 241, 0.55);
  color: var(--cyan);
}

.orientation-notice {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  padding: 30px;
  background: var(--ink);
  text-align: center;
}

.orientation-notice p {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 20px;
}

.orientation-notice span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .brand-lockup {
    top: 18px;
    left: 18px;
  }

  .objective {
    top: 18px;
    right: 18px;
    width: 210px;
  }

  .threat-hud {
    top: 122px;
    left: 18px;
    transform: scale(0.9) translateX(-12px);
    transform-origin: top left;
  }

  .threat-hud.is-active {
    transform: scale(0.9) translateX(0);
  }

  .map-panel {
    bottom: 18px;
    left: 18px;
    width: 174px;
  }

  #miniMap {
    width: 146px;
    height: 146px;
  }

  .vitals {
    right: 18px;
    bottom: 18px;
    width: 280px;
  }

  .control-hint {
    display: none;
  }

  .intro__controls {
    width: min(620px, 100%);
  }

  .intro__controls > div {
    padding-inline: 10px;
  }

  .token-masthead {
    top: 18px;
    left: 18px;
    transform: scale(0.9);
    transform-origin: top left;
  }
}

@media (max-width: 560px) {
  .intro {
    padding-inline: 8px;
  }

  .intro h1 {
    font-size: clamp(32px, 10vw, 44px);
  }

  .intro__lead br {
    display: none;
  }

  .intro__lead {
    max-width: 300px;
    font-size: 12px;
  }

  .mission-selector {
    padding: 8px;
  }

  .difficulty-tab {
    justify-content: center;
    padding-inline: 5px;
  }

  .difficulty-tab small {
    display: none;
  }

  .level-card {
    display: block;
    min-height: 47px;
    padding: 7px 5px;
    text-align: center;
  }

  .level-card__number {
    font-size: 15px;
  }

  .level-card__name {
    margin-top: 2px;
    font-size: 6px;
  }

  .level-card__meta,
  .mission-selector__brief {
    display: none;
  }

  .intro__controls {
    display: none;
  }

  .token-links {
    grid-template-columns: repeat(2, 1fr);
  }

  .token-masthead {
    min-width: 220px;
  }

  .menu-aperture {
    width: 112vw;
    opacity: 0.2;
  }

  .pause-reticle {
    width: 118vw;
  }

  #pauseScreen .compact-dialog {
    padding: 38px 20px 30px;
  }

  #pauseScreen .compact-dialog h2::before {
    display: none;
  }

  .primary-button {
    width: 100%;
    min-width: 0;
  }

  .overlay__coordinate,
  .overlay__bracket {
    display: none;
  }
}

@media (hover: none) and (pointer: coarse) {
  .orientation-notice {
    display: grid;
  }
}

@media (max-height: 720px) {
  .intro {
    transform: scale(0.9);
  }

  #pauseScreen .compact-dialog {
    padding-top: 34px;
    padding-bottom: 30px;
  }

  #pauseScreen .token-panel--compact {
    margin-top: 18px;
  }

  .map-panel,
  .vitals {
    bottom: 18px;
  }

  .map-panel {
    transform: scale(0.86);
    transform-origin: bottom left;
  }

  .vitals {
    transform: scale(0.9);
    transform-origin: bottom right;
  }
}

@media (max-height: 640px) {
  #startScreen {
    place-items: start center;
  }

  #startScreen .intro {
    transform: scale(0.78);
    transform-origin: top center;
  }
}

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

  .scene-effects__grain {
    transform: none;
  }
}
