:root {
  --bg: #050b12;
  --panel: rgba(7, 18, 31, 0.84);
  --panel-strong: #091522;
  --border: #263f5e;
  --text: #eaf1ff;
  --text-dim: #8295b0;
  --amber: #ffb020;
  --cyan: #2ce0ff;
  --green: #50e39a;
  --red: #ff6573;
  --font-display: "Rajdhani", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  -webkit-tap-highlight-color: transparent;
}

button,
input { font: inherit; }

button { color: inherit; }

a {
  color: inherit;
  text-decoration: none;
}

[hidden] { display: none !important; }

.arcade-nav {
  position: relative;
  z-index: 20;
  width: 100%;
  min-height: 76px;
  padding: 0 clamp(18px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(255, 176, 32, 0.25);
  background: rgba(5, 24, 35, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}

.arcade-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  white-space: nowrap;
}

.arcade-brand img {
  display: block;
  width: 78px;
  filter: drop-shadow(0 0 8px rgba(44, 224, 255, 0.25));
}

.arcade-brand strong { color: var(--amber); }

.all-missions {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 176, 32, 0.42);
  border-radius: 3px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.app-stage {
  position: relative;
  min-height: calc(100vh - 76px);
  padding: clamp(24px, 4vw, 54px) clamp(12px, 3vw, 40px) 64px;
  background:
    radial-gradient(circle at 50% 8%, rgba(20, 137, 173, 0.18), transparent 30%),
    linear-gradient(180deg, #061521, #030910 72%);
}

.app-stage::before,
.app-stage::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.app-stage::before {
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(44, 224, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44, 224, 255, 0.08) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 78% 70% at 50% 30%, black 4%, transparent 82%);
}

.app-stage::after {
  background:
    linear-gradient(115deg, transparent 0 49.9%, rgba(255, 176, 32, 0.08) 50%, transparent 50.1%),
    radial-gradient(circle at center, transparent 0 34%, rgba(44, 224, 255, 0.08) 34.2% 34.5%, transparent 34.7%);
}

.app {
  position: relative;
  z-index: 1;
  width: min(1320px, 100%);
  margin: 0 auto;
}

.app-header { text-align: center; }

.mission-id,
.panel-kicker {
  margin: 0;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.57rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.app-header h1 {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  letter-spacing: 0.075em;
  text-transform: uppercase;
  text-shadow: 0 0 22px rgba(44, 224, 255, 0.22);
}

.brand-hair {
  width: clamp(34px, 6vw, 82px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(44, 224, 255, 0.72));
}

.brand-hair:last-child { transform: rotate(180deg); }

.subtitle {
  margin: 8px 0 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.trainer-modes {
  width: min(470px, 100%);
  margin: 28px auto 0;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid #294563;
  border-radius: 5px;
  background: rgba(5, 15, 26, 0.82);
}

.mode-btn {
  min-height: 48px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.mode-btn.active {
  background: linear-gradient(180deg, #ffd06b, var(--amber));
  color: #07111d;
  box-shadow: 0 0 18px rgba(255, 176, 32, 0.28);
}

.failure-banner {
  margin-top: 20px;
  min-height: 58px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 101, 115, 0.48);
  background: linear-gradient(90deg, rgba(255, 101, 115, 0.1), rgba(8, 19, 31, 0.82) 45%);
}

.failure-pulse {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 15px var(--red);
  animation: pulse 1.25s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.38; box-shadow: 0 0 5px var(--red); }
}

.failure-banner small,
.failure-banner strong { display: block; }

.failure-banner small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.46rem;
  letter-spacing: 0.1em;
}

.failure-banner strong {
  margin-top: 2px;
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 0.69rem;
  letter-spacing: 0.08em;
}

.failure-banner .squawk {
  margin-left: auto;
  min-width: 115px;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 176, 32, 0.35);
}

.failure-banner .squawk strong {
  color: var(--amber);
  font-size: 1rem;
}

.workspace {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(350px, 0.92fr);
  gap: 16px;
}

.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.route-panel,
.altitude-panel { padding: 18px; }

.panel-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-topline h2,
.drill-head h2 {
  margin: 3px 0 0;
  font-size: 1.3rem;
}

.system-chip {
  padding: 5px 8px;
  border: 1px solid rgba(255, 176, 32, 0.42);
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.system-chip.cyan {
  border-color: rgba(44, 224, 255, 0.4);
  color: var(--cyan);
}

.vfr-gate {
  margin-top: 14px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(80, 227, 154, 0.28);
  background: rgba(80, 227, 154, 0.05);
}

.vfr-gate small,
.vfr-gate strong { display: block; }

.vfr-gate small {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.45rem;
  letter-spacing: 0.1em;
}

.vfr-gate strong {
  margin-top: 2px;
  font-size: 0.86rem;
}

.vfr-toggle {
  min-width: 126px;
  min-height: 34px;
  padding: 3px 8px;
  display: grid;
  grid-template-columns: 1fr 34px 1fr;
  align-items: center;
  gap: 4px;
  border: 1px solid #2d4863;
  border-radius: 99px;
  background: #071421;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  cursor: pointer;
}

.vfr-toggle i {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 99px;
  background: #263b52;
}

.vfr-toggle i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  content: "";
  transition: transform 0.18s, background 0.18s;
}

.vfr-toggle[aria-pressed="true"] {
  border-color: rgba(80, 227, 154, 0.55);
  color: var(--green);
}

.vfr-toggle[aria-pressed="true"] i::after {
  background: var(--green);
  transform: translateX(14px);
}

.route-map-wrap {
  position: relative;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #294563;
  background: #06101b;
}

#route-map {
  display: block;
  width: 100%;
  min-height: 270px;
}

.route-result {
  position: absolute;
  top: 11px;
  left: 11px;
  max-width: min(300px, calc(100% - 22px));
  padding: 8px 10px;
  border: 1px solid rgba(255, 176, 32, 0.5);
  background: rgba(4, 13, 23, 0.92);
  box-shadow: 0 0 22px rgba(255, 176, 32, 0.1);
}

.route-result small,
.route-result strong,
.route-result span { display: block; }

.route-result small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.43rem;
  letter-spacing: 0.1em;
}

.route-result strong {
  margin-top: 3px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.route-result span {
  margin-top: 3px;
  color: #aebbd0;
  font-size: 0.68rem;
}

.route-result.vfr {
  border-color: rgba(80, 227, 154, 0.55);
  box-shadow: 0 0 26px rgba(80, 227, 154, 0.14);
}

.route-result.vfr strong { color: var(--green); }

.route-result.pending {
  border-color: rgba(44, 224, 255, 0.42);
  box-shadow: 0 0 22px rgba(44, 224, 255, 0.08);
}

.route-result.pending strong { color: var(--cyan); }

.priority-stack {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.priority-card {
  min-width: 0;
  min-height: 92px;
  padding: 9px;
  display: grid;
  grid-template-columns: 26px 1fr;
  grid-template-rows: 1fr auto;
  gap: 6px 8px;
  border: 1px solid #29435f;
  background: #091523;
  text-align: left;
  cursor: pointer;
}

.priority-card b {
  grid-row: 1 / 3;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 1.35rem;
}

.priority-card span strong,
.priority-card span small { display: block; }

.priority-card span strong {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.04em;
}

.priority-card span small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 0.58rem;
  line-height: 1.15;
}

.priority-card > i {
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 0.39rem;
  font-style: normal;
  letter-spacing: 0.06em;
}

.priority-card.active {
  border-color: var(--amber);
  background: rgba(255, 176, 32, 0.09);
  box-shadow: 0 0 18px rgba(255, 176, 32, 0.12);
}

.priority-card.unavailable {
  opacity: 0.36;
  filter: grayscale(0.5);
}

.priority-card.unavailable > i {
  color: var(--red);
}

.control-note {
  margin: 9px 0 0;
  color: var(--text-dim);
  font-size: 0.65rem;
  line-height: 1.35;
}

.altitude-display {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #294563;
  background: #06101b;
}

.altitude-panel.standby .altitude-display,
.altitude-panel.standby .altitude-controls,
.altitude-panel.standby .altitude-rule {
  opacity: 0.34;
}

.priority-stack.locked .priority-card,
.altitude-controls input:disabled,
.vfr-toggle:disabled {
  cursor: default;
}

.altitude-tape {
  position: relative;
  min-height: 322px;
  overflow: hidden;
  border-left: 2px solid #4a647e;
  background:
    linear-gradient(90deg, rgba(44, 224, 255, 0.04), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(85, 122, 154, 0.16) 31px 32px);
}

.terrain-profile {
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: 29%;
  pointer-events: none;
}

.terrain-profile::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 42%;
  background: linear-gradient(180deg, rgba(16, 43, 62, 0.08), rgba(16, 43, 62, 0.42));
  content: "";
}

.terrain-profile > span {
  position: absolute;
  right: -2%;
  bottom: 0;
  left: -2%;
  height: 100%;
  transform-origin: bottom;
}

.terrain-back {
  background: rgba(38, 82, 112, 0.12);
  clip-path: polygon(0 76%, 9% 60%, 17% 70%, 27% 40%, 36% 68%, 48% 51%, 58% 75%, 70% 35%, 79% 66%, 89% 52%, 100% 71%, 100% 100%, 0 100%);
}

.terrain-front {
  background:
    linear-gradient(180deg, rgba(6, 16, 27, 0.18), rgba(6, 16, 27, 0.7));
  clip-path: polygon(0 86%, 12% 69%, 23% 80%, 35% 55%, 45% 79%, 57% 65%, 68% 84%, 81% 58%, 91% 76%, 100% 66%, 100% 100%, 0 100%);
  filter: drop-shadow(0 -1px 0 rgba(74, 111, 141, 0.5));
}

.terrain-obstacle {
  position: absolute;
  z-index: 1;
  right: 18%;
  bottom: 18%;
  width: 1px;
  height: 22px;
  background: rgba(255, 176, 32, 0.72);
  box-shadow: 0 0 6px rgba(255, 176, 32, 0.28);
}

.terrain-obstacle::before,
.terrain-obstacle::after {
  position: absolute;
  left: 50%;
  width: 9px;
  height: 1px;
  background: inherit;
  content: "";
  transform: translateX(-50%);
}

.terrain-obstacle::before { top: 6px; }
.terrain-obstacle::after { top: 12px; width: 6px; }

.profile-view-label {
  position: absolute;
  z-index: 2;
  right: 12px;
  bottom: 9px;
  color: rgba(135, 158, 188, 0.62);
  font-family: var(--font-mono);
  font-size: 0.4rem;
  letter-spacing: 0.1em;
}

.altitude-tape::before {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.08em;
  content: "14,000 FT";
}

.altitude-tape::after {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.08em;
  content: "3,000 FT";
}

.altitude-marker {
  position: absolute;
  z-index: 3;
  left: 28px;
  right: 98px;
  height: 2px;
  background: currentColor;
  color: var(--amber);
  box-shadow: 0 0 8px currentColor;
  transition: top 0.18s;
}

.altitude-marker.minimum { color: var(--cyan); }
.altitude-marker.expected { color: var(--green); }

.altitude-marker span,
.altitude-marker strong {
  position: absolute;
  top: -10px;
  background: #06101b;
  font-family: var(--font-mono);
}

.altitude-marker span {
  left: 5px;
  padding: 2px 5px;
  font-size: 0.43rem;
  letter-spacing: 0.07em;
}

.altitude-marker strong {
  right: 5px;
  padding-left: 5px;
  font-size: 0.57rem;
}

.altitude-marker.winner {
  height: 3px;
  box-shadow: 0 0 16px currentColor;
}

.selected-altitude {
  position: absolute;
  z-index: 5;
  right: 8px;
  width: 78px;
  padding: 7px 5px;
  border: 1px solid var(--amber);
  background: rgba(255, 176, 32, 0.1);
  text-align: center;
  transform: translateY(-50%);
  transition: top 0.18s;
}

.profile-aircraft {
  position: absolute;
  z-index: 4;
  right: 92px;
  width: 32px;
  height: 14px;
  color: #dfe9f7;
  filter: drop-shadow(0 0 5px rgba(44, 224, 255, 0.65));
  pointer-events: none;
  transform: translateY(-50%);
  transition: top 0.18s;
}

.profile-aircraft::before {
  position: absolute;
  top: 6px;
  right: 0;
  left: 0;
  height: 2px;
  border-radius: 50% 75% 75% 50%;
  background: currentColor;
  content: "";
}

.profile-aircraft::after {
  position: absolute;
  top: 1px;
  left: 9px;
  width: 15px;
  height: 11px;
  border-right: 2px solid currentColor;
  border-left: 2px solid currentColor;
  content: "";
  transform: skewX(-23deg);
}

.profile-aircraft i {
  position: absolute;
  top: 2px;
  left: 3px;
  width: 6px;
  height: 6px;
  border-left: 2px solid currentColor;
  content: "";
  transform: skewX(24deg);
}

.selected-altitude small,
.selected-altitude strong { display: block; }

.selected-altitude small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.08em;
}

.selected-altitude strong {
  margin-top: 2px;
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.altitude-controls { margin-top: 15px; }

.altitude-controls label {
  display: block;
}

.altitude-controls label + label { margin-top: 13px; }

.altitude-controls label > span {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 7px;
}

.altitude-controls b {
  color: var(--amber);
  font-family: var(--font-mono);
}

.altitude-controls label:nth-child(2) b { color: var(--cyan); }
.altitude-controls label:nth-child(3) b { color: var(--green); }

.altitude-controls strong { font-size: 0.75rem; }

.altitude-controls output,
.altitude-selector output {
  font-family: var(--font-mono);
  font-size: 0.61rem;
  font-weight: 700;
}

input[type="range"] {
  --range-color: var(--amber);
  width: 100%;
  height: 4px;
  margin: 9px 0 0;
  appearance: none;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--range-color) var(--range-progress, 0%), #23364f var(--range-progress, 0%));
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  appearance: none;
  border: 2px solid #07111d;
  border-radius: 50%;
  background: var(--range-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--range-color), transparent 45%);
  cursor: ew-resize;
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border: 2px solid #07111d;
  border-radius: 50%;
  background: var(--range-color);
  cursor: ew-resize;
}

#minimum-input { --range-color: var(--cyan); }
#expected-input { --range-color: var(--green); }

.altitude-rule {
  margin-top: 15px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 176, 32, 0.3);
  background: rgba(255, 176, 32, 0.05);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.43rem;
  text-align: center;
}

.altitude-rule i {
  font-style: normal;
  opacity: 0.55;
}

.altitude-rule strong {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: var(--amber);
  font-size: 0.58rem;
  letter-spacing: 0.09em;
}

.altitude-rule small {
  grid-column: 1 / -1;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.58rem;
  line-height: 1.3;
}

.drill-panel {
  margin-top: 16px;
  padding: 18px;
}

.drill-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.drill-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  border: 1px solid var(--border);
}

.drill-stats span {
  padding: 7px 12px;
  text-align: center;
}

.drill-stats span + span { border-left: 1px solid var(--border); }

.drill-stats small,
.drill-stats strong { display: block; }

.drill-stats small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.42rem;
  letter-spacing: 0.08em;
}

.drill-stats strong {
  margin-top: 2px;
  color: var(--cyan);
  font-family: var(--font-mono);
}

.clearance-strip {
  margin-top: 14px;
  padding: 13px 14px;
  border-left: 3px solid var(--amber);
  background: rgba(255, 176, 32, 0.06);
  color: #b7c4d7;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.7;
}

.clearance-strip strong { color: var(--amber); }

.decision-console {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.route-selector > small,
.altitude-selector small {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.route-selector > div {
  margin-top: 7px;
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 5px;
}

.route-selector button,
.drill-actions button,
#reset-stats {
  min-height: 38px;
  border: 1px solid #2c4967;
  border-radius: 3px;
  background: #091522;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.51rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.route-selector button.selected {
  border-color: var(--amber);
  background: rgba(255, 176, 32, 0.12);
  color: var(--amber);
  box-shadow: 0 0 15px rgba(255, 176, 32, 0.14);
}

.altitude-selector {
  display: block;
}

.altitude-selector > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#answer-altitude { --range-color: var(--cyan); }

.drill-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

#check-answer {
  min-width: 155px;
  border-color: rgba(255, 176, 32, 0.55);
  background: rgba(255, 176, 32, 0.1);
  color: var(--amber);
}

.feedback {
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  background: #07131f;
}

.feedback strong,
.feedback span { display: block; }

.feedback strong {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.feedback span {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 0.72rem;
}

.feedback.correct {
  border-color: rgba(80, 227, 154, 0.6);
  box-shadow: 0 0 24px rgba(80, 227, 154, 0.12);
}

.feedback.correct strong { color: var(--green); }

.feedback.wrong {
  border-color: rgba(255, 101, 115, 0.6);
  box-shadow: 0 0 24px rgba(255, 101, 115, 0.1);
}

.feedback.wrong strong { color: var(--red); }

.memory-strip {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  background: rgba(6, 16, 27, 0.76);
}

.memory-strip article {
  padding: 14px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
}

.memory-strip article + article { border-left: 1px solid var(--border); }

.memory-strip b {
  color: var(--amber);
  font-family: var(--font-mono);
  font-size: 1rem;
}

.memory-strip strong {
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.57rem;
  letter-spacing: 0.06em;
}

.memory-strip p {
  margin: 4px 0 0;
  color: var(--text-dim);
  font-size: 0.68rem;
  line-height: 1.35;
}

.trainer-footer {
  margin-top: 16px;
  padding: 13px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid rgba(38, 63, 94, 0.75);
}

.trainer-footer p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.65rem;
}

#reset-stats {
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

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

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

  .decision-console { grid-template-columns: 1fr 1fr; }

  .drill-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, 1fr);
  }

  #check-answer { min-width: 0; }
}

@media (max-width: 680px) {
  .arcade-nav {
    min-height: 62px;
    padding: 0 14px;
  }

  .arcade-brand { font-size: 0.62rem; }
  .arcade-brand img { width: 58px; }

  .all-missions {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.48rem;
  }

  .app-stage { padding: 22px 8px 44px; }

  .app-header h1 {
    gap: 8px;
    font-size: 1.2rem;
  }

  .brand-hair { width: 20px; }

  .trainer-modes { margin-top: 20px; }

  .mode-btn {
    min-height: 43px;
    padding: 0 6px;
    font-size: 0.52rem;
  }

  .failure-banner { padding: 9px 10px; }

  .route-panel,
  .altitude-panel,
  .drill-panel { padding: 13px; }

  #route-map { min-height: 245px; }

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

  .priority-card { min-height: 84px; }

  .altitude-tape { min-height: 285px; }

  .profile-view-label {
    right: 8px;
    font-size: 0.36rem;
  }

  .profile-aircraft {
    right: 86px;
    transform: translateY(-50%) scale(0.88);
    transform-origin: right center;
  }

  .drill-head { display: block; }

  .drill-stats {
    margin-top: 10px;
    width: 100%;
  }

  .decision-console { grid-template-columns: 1fr; }

  .drill-actions {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .route-selector > div {
    grid-template-columns: 1.35fr repeat(4, 1fr);
  }

  .memory-strip { grid-template-columns: 1fr; }

  .memory-strip article + article {
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .trainer-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 430px) {
  .failure-banner strong { font-size: 0.58rem; }
  .failure-banner .squawk { min-width: 84px; }

  .vfr-gate {
    align-items: flex-start;
    flex-direction: column;
  }

  .vfr-toggle { width: 100%; }

  .route-result span { font-size: 0.6rem; }

  .priority-card {
    grid-template-columns: 23px 1fr;
    padding: 8px 6px;
  }

  .altitude-rule {
    grid-template-columns: 1fr;
  }

  .altitude-rule i { display: none; }

  .route-selector > div {
    grid-template-columns: repeat(4, 1fr);
  }

  .route-selector button:first-child { grid-column: 1 / -1; }
}

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