:root {
  color-scheme: dark;
  --bg: #020504;
  --bg-2: #06100d;
  --panel: rgba(2, 12, 10, 0.86);
  --panel-2: rgba(4, 22, 18, 0.72);
  --line: rgba(40, 255, 177, 0.22);
  --line-strong: rgba(102, 255, 209, 0.46);
  --text: #d9fff1;
  --muted: #7ca99b;
  --dim: #44685e;
  --green: #36ff99;
  --green-2: #0bbf69;
  --cyan: #66f8ff;
  --white: #f4fffb;
  --warn: #ffd166;
  --danger: #ff4d6d;
  --shadow: 0 0 24px rgba(18, 255, 164, 0.11);
  --font: "SFMono-Regular", "Cascadia Mono", "Liberation Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 8%, rgba(28, 255, 172, 0.07), transparent 34%),
    linear-gradient(180deg, #020504 0%, #010302 54%, #06110e 100%);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
summary {
  font: inherit;
}

.screen-noise,
.scanlines,
.crt-vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
}

.screen-noise {
  opacity: 0.11;
  background-image:
    repeating-radial-gradient(circle at 17% 32%, rgba(255, 255, 255, 0.2) 0 1px, transparent 1px 3px),
    repeating-radial-gradient(circle at 74% 61%, rgba(54, 255, 153, 0.16) 0 1px, transparent 1px 4px);
  mix-blend-mode: screen;
  animation: noiseShift 1.4s steps(3) infinite;
}

.scanlines {
  opacity: 0.24;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.05) 0,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 4px
  );
}

.crt-vignette {
  z-index: 21;
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.96), inset 0 0 28px rgba(54, 255, 153, 0.06);
  animation: crtFlicker 5.5s infinite;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100vw;
  height: 100vh;
  padding: 14px;
  gap: 12px;
  filter: saturate(0.96);
}

.start-screen,
.intro-screen,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 34%, rgba(54, 255, 153, 0.08), transparent 34%),
    rgba(0, 3, 2, 0.94);
}

.intro-screen {
  z-index: 35;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, rgba(102, 248, 255, 0.06), transparent 31%),
    radial-gradient(circle at 48% 52%, rgba(54, 255, 153, 0.04), transparent 42%),
    #000302;
}

.intro-screen.hidden {
  display: none;
}

.start-screen.hidden,
.modal-backdrop[hidden] {
  display: none;
}

.intro-screen.fade-out {
  animation: introFadeOut 1.1s ease-in both;
}

.intro-mark {
  position: absolute;
  top: 31%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--white);
  font-size: clamp(44px, 11vw, 128px);
  font-weight: 900;
  letter-spacing: 0;
  white-space: nowrap;
  opacity: 0;
  text-shadow: 0 0 26px rgba(102, 248, 255, 0.24), 0 0 12px rgba(54, 255, 153, 0.18);
  animation: introMark 18s linear both;
}

.intro-mark::before,
.intro-mark::after {
  opacity: 0.35;
}

.intro-mark::before {
  transform: translate(2px, -1px);
}

.intro-mark::after {
  transform: translate(-2px, 1px);
}

.intro-mark::selection {
  background: transparent;
}

.intro-mark::after {
  background: linear-gradient(90deg, transparent, var(--cyan), var(--green), var(--white), transparent);
  background-size: 260% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: introSweep 3s ease-in-out 5s 1 both, introGlitchLayer 18s linear both;
}

.intro-terminal {
  position: absolute;
  left: 50%;
  bottom: 18%;
  width: min(620px, calc(100vw - 40px));
  min-height: 132px;
  transform: translateX(-50%);
  border: 1px solid rgba(54, 255, 153, 0.24);
  background: rgba(0, 8, 7, 0.76);
  box-shadow: 0 0 30px rgba(54, 255, 153, 0.09), inset 0 0 28px rgba(102, 248, 255, 0.025);
  padding: 16px;
  color: var(--green);
  font-size: 13px;
  line-height: 1.6;
  opacity: 0;
  animation: introTerminalIn 18s linear both;
}

.intro-terminal .intro-line {
  min-height: 20px;
  white-space: pre-wrap;
}

.intro-terminal .intro-line.warn {
  color: var(--danger);
  text-shadow: 0 0 12px rgba(255, 77, 109, 0.35);
}

.intro-crawler {
  position: absolute;
  left: 50%;
  bottom: 23%;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.05;
  opacity: 0;
  text-shadow: 0 0 12px rgba(255, 77, 109, 0.38);
}

.intro-crawler.active {
  animation: crawlerMove 2.4s steps(3) both;
}

.intro-crawler.contained {
  animation: crawlerContain 0.7s steps(2) both;
}

.start-terminal,
.mission-modal {
  width: min(720px, 100%);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(2, 16, 13, 0.96), rgba(0, 0, 0, 0.9));
  box-shadow: 0 0 54px rgba(54, 255, 153, 0.16), inset 0 0 44px rgba(54, 255, 153, 0.035);
}

.start-terminal {
  padding: 34px;
}

.start-kicker,
.modal-label {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
}

.start-title {
  margin: 12px 0 10px;
  color: var(--white);
  font-size: clamp(30px, 6vw, 58px);
  line-height: 0.98;
  font-weight: 900;
  text-shadow: 0 0 18px rgba(102, 248, 255, 0.28);
}

.start-copy,
.safety-copy,
.about-text,
.mission-modal p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.safety-copy {
  margin: 14px 0 0;
  color: #a4cfc3;
}

.memory-notice {
  min-height: 22px;
  margin-top: 16px;
  color: var(--cyan);
  font-size: 12px;
}

.deep-protocol-button {
  color: var(--danger);
  border-color: rgba(255, 77, 109, 0.45);
}

.hardcore-button {
  color: var(--warn);
  border-color: rgba(255, 209, 102, 0.48);
}

.start-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.terminal-button,
.icon-button,
.quick-commands button {
  border: 1px solid rgba(54, 255, 153, 0.3);
  background: rgba(0, 0, 0, 0.42);
  color: var(--green);
  min-height: 36px;
  padding: 9px 12px;
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
}

.terminal-button:hover,
.icon-button:hover,
.quick-commands button:hover {
  border-color: var(--line-strong);
  background: rgba(54, 255, 153, 0.09);
  color: var(--white);
}

.terminal-button.primary {
  background: rgba(54, 255, 153, 0.13);
  color: var(--white);
}

.about-text {
  margin-top: 18px;
  padding: 14px;
  border-left: 2px solid rgba(102, 248, 255, 0.55);
  background: rgba(102, 248, 255, 0.035);
}

.status-bar,
.panel,
.terminal-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 0 32px rgba(54, 255, 153, 0.025);
  backdrop-filter: blur(8px);
}

.app-shell::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 18;
  opacity: 0;
  background: radial-gradient(circle at 50% 42%, transparent 0 36%, rgba(255, 77, 109, 0.12) 78%, rgba(255, 77, 109, 0.2));
  transition: opacity 180ms ease;
}

.app-shell.pressure-amber {
  filter: saturate(1.08) contrast(1.03);
}

.app-shell.pressure-red .terminal-panel {
  border-color: rgba(255, 77, 109, 0.62);
  box-shadow: 0 0 34px rgba(255, 77, 109, 0.16), inset 0 0 36px rgba(255, 77, 109, 0.05);
}

.app-shell.pressure-red::after {
  opacity: 0.38;
  animation: redPulse 1.35s ease-in-out infinite;
}

.app-shell.pressure-critical::after,
.app-shell.session-failed::after {
  opacity: 0.72;
  animation: criticalPulse 0.55s steps(2) infinite;
}

.app-shell.pressure-critical .status-bar,
.app-shell.session-failed .status-bar {
  border-color: rgba(255, 77, 109, 0.76);
}

.app-shell.pressure-critical .brand,
.app-shell.session-failed .brand {
  color: var(--danger);
  text-shadow: 0 0 20px rgba(255, 77, 109, 0.55);
}

.app-shell.deep-protocol {
  filter: saturate(1.25) contrast(1.08);
}

.app-shell.deep-protocol .brand {
  text-shadow: 0 0 18px rgba(255, 77, 109, 0.32), 0 0 14px rgba(102, 248, 255, 0.26);
}

.app-shell.hardcore-protocol {
  filter: brightness(0.88) contrast(1.14) saturate(1.12);
}

.app-shell.hardcore-protocol .panel,
.app-shell.hardcore-protocol .terminal-panel,
.app-shell.hardcore-protocol .status-bar {
  background: rgba(0, 6, 5, 0.92);
}

.app-shell.system-break::after {
  opacity: 0.86;
  animation: criticalPulse 0.42s steps(2) infinite;
}

.app-shell.distortion-high .terminal-output .line:nth-child(3n) {
  animation: textGlitch 0.9s steps(2) infinite;
}

.app-shell.distortion-high {
  animation: randomFlicker 1.3s steps(2) infinite;
}

.app-shell.distortion-critical {
  animation: blurPulse 0.65s ease-in-out infinite;
}

.status-bar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(230px, 0.85fr) 2.4fr;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.brand {
  color: var(--white);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: 0 0 14px rgba(102, 248, 255, 0.35);
}

.icon-button {
  min-width: 64px;
  min-height: 30px;
  padding: 6px 8px;
  color: var(--cyan);
  font-size: 10px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(86px, 1fr));
  gap: 7px;
  min-width: 0;
}

.status-grid span {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid rgba(54, 255, 153, 0.13);
  background: rgba(0, 0, 0, 0.23);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-grid strong {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(54, 255, 153, 0.22);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(360px, 2.1fr) minmax(240px, 0.86fr);
  gap: 12px;
}

.panel,
.terminal-panel {
  min-height: 0;
  overflow: hidden;
}

details {
  height: 100%;
}

.analysis-panel details {
  overflow-y: auto;
}

summary {
  position: sticky;
  top: 0;
  z-index: 2;
  cursor: default;
  list-style: none;
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(54, 255, 153, 0.08), rgba(102, 248, 255, 0.035));
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

summary::-webkit-details-marker {
  display: none;
}

.mission-list {
  display: grid;
  gap: 8px;
  padding: 11px;
  overflow-y: auto;
  max-height: calc(100vh - 112px);
}

.mission-item {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 11px;
  border: 1px solid rgba(54, 255, 153, 0.13);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.mission-item:hover,
.mission-item.active {
  border-color: var(--line-strong);
  background: rgba(54, 255, 153, 0.07);
}

.mission-item.locked {
  cursor: not-allowed;
  opacity: 0.42;
}

.mission-code {
  color: var(--green);
  font-size: 10px;
}

.mission-name {
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
}

.mission-meta {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 10px;
}

.mission-desc {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.terminal-panel {
  display: grid;
  grid-template-rows: 1fr auto auto;
}

.terminal-output {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  text-shadow: 0 0 12px rgba(54, 255, 153, 0.08);
}

.line {
  min-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line.command {
  color: var(--white);
}

.line.system {
  color: var(--green);
}

.line.info {
  color: var(--cyan);
}

.line.muted {
  color: var(--muted);
}

.line.warn {
  color: var(--warn);
}

.line.danger {
  color: var(--danger);
  text-shadow: 0 0 14px rgba(255, 77, 109, 0.28);
}

.line.xp {
  color: var(--green);
  text-shadow: 0 0 14px rgba(54, 255, 153, 0.42);
  animation: xpFloat 0.9s ease-out both;
}

.line.feedback {
  color: var(--cyan);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 6px;
}

.result-actions button {
  border: 1px solid rgba(54, 255, 153, 0.28);
  background: rgba(0, 0, 0, 0.36);
  color: var(--green);
  min-height: 32px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-actions button:hover {
  border-color: var(--line-strong);
  color: var(--white);
}

.terminal-input-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 9px 14px;
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.prompt {
  color: var(--green);
  font-size: 13px;
  white-space: nowrap;
}

.terminal-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--white);
  caret-color: transparent;
  font-size: 13px;
}

.cursor {
  width: 8px;
  height: 17px;
  background: var(--green);
  box-shadow: 0 0 12px rgba(54, 255, 153, 0.8);
  animation: blink 1s steps(2, start) infinite;
}

.app-shell.pressure-red .cursor,
.app-shell.pressure-critical .cursor {
  animation-duration: 0.45s;
}

.quick-commands {
  display: none;
  border-top: 1px solid rgba(54, 255, 153, 0.16);
  background: rgba(0, 0, 0, 0.24);
  padding: 8px;
}

.quick-commands[hidden] {
  display: none !important;
}

.quick-toggle {
  width: 100%;
  margin-bottom: 7px;
}

.quick-command-buttons {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.quick-commands.collapsed .quick-command-buttons {
  display: none;
}

.quick-commands.collapsed .quick-toggle {
  margin-bottom: 0;
}

.analysis-block {
  padding: 12px 13px 3px;
}

.analysis-block h2 {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 11px;
  text-transform: uppercase;
}

.data-list,
.process-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.data-list li,
.process-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid rgba(54, 255, 153, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font-size: 10px;
}

.data-list strong,
.process-list strong {
  color: var(--green);
  font-weight: 700;
}

.data-list li.unlocked {
  border-color: rgba(54, 255, 153, 0.36);
  background: rgba(54, 255, 153, 0.07);
}

.metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 12px 13px;
}

.metrics div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 8px;
  border-left: 2px solid rgba(102, 248, 255, 0.38);
  background: rgba(102, 248, 255, 0.035);
}

.metrics span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.metrics strong {
  color: var(--white);
  font-size: 11px;
  text-align: right;
}

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

.telemetry-grid div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(54, 255, 153, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.telemetry-grid span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.telemetry-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-size: 12px;
}

.telemetry-grid .hot strong {
  color: var(--danger);
  text-shadow: 0 0 12px rgba(255, 77, 109, 0.35);
}

.upgrade-list {
  display: grid;
  gap: 7px;
}

.upgrade-item {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid rgba(54, 255, 153, 0.12);
  background: rgba(0, 0, 0, 0.2);
}

.upgrade-item header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
}

.upgrade-item p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.upgrade-item button {
  width: 100%;
  border: 1px solid rgba(102, 248, 255, 0.25);
  background: rgba(102, 248, 255, 0.04);
  color: var(--cyan);
  min-height: 30px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.upgrade-item button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.upgrade-item button.can-buy {
  animation: buyPulse 2.4s ease-in-out infinite;
}

#traceRisk.pulsing {
  animation: tracePulse 0.8s ease-in-out infinite;
}

#comboValue.combo-hot {
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(102, 248, 255, 0.62);
}

#creditsValue.credits-glow {
  color: var(--green);
  animation: creditGlow 0.9s ease-out both;
}

.event-status {
  min-height: 38px;
  padding: 9px 8px;
  border: 1px solid rgba(255, 209, 102, 0.18);
  background: rgba(255, 209, 102, 0.035);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.event-status.active {
  color: var(--warn);
  border-color: rgba(255, 209, 102, 0.48);
  box-shadow: inset 0 0 20px rgba(255, 209, 102, 0.035);
  animation: eventBlink 0.8s steps(2) infinite;
}

.app-shell.pressure-critical .event-status.active,
.app-shell.session-failed .event-status.active {
  color: var(--danger);
  border-color: rgba(255, 77, 109, 0.78);
  animation: eventCritical 0.45s steps(2) infinite;
}

.mission-modal {
  padding: 24px;
}

.mission-modal h2 {
  margin: 10px 0 14px;
  color: var(--white);
  font-size: 28px;
  line-height: 1.1;
}

.briefing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.briefing-grid span,
.briefing-commands {
  border: 1px solid rgba(54, 255, 153, 0.14);
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  color: var(--muted);
  font-size: 10px;
}

.briefing-grid strong {
  display: block;
  margin-top: 5px;
  color: var(--green);
  font-size: 13px;
}

.briefing-commands {
  display: grid;
  gap: 8px;
}

.briefing-commands span {
  color: var(--cyan);
  font-size: 10px;
  font-weight: 800;
}

.briefing-commands code {
  color: var(--green);
  white-space: pre-wrap;
}

.progress {
  color: var(--green);
}

.glitch {
  position: relative;
}

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

.glitch::before {
  color: var(--cyan);
  transform: translateX(1px);
}

.glitch::after {
  color: var(--danger);
  transform: translateX(-1px);
}

.glitch.active::before,
.glitch.active::after,
.glitch.booting::before,
.glitch.booting::after,
.glitch:hover::before,
.glitch:hover::after {
  opacity: 0.7;
  animation: glitchSlice 0.55s steps(2) both;
}

.glitch.booting::before,
.glitch.booting::after {
  animation: bootGlitch 1.2s steps(2) infinite;
}

.shake {
  animation: screenShake 0.24s linear both;
}

.freeze {
  animation: freezeFrame 1.5s steps(2) both;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@keyframes crtFlicker {
  0%, 100% {
    opacity: 0.98;
  }
  43% {
    opacity: 0.94;
  }
  44% {
    opacity: 0.88;
  }
  45% {
    opacity: 0.97;
  }
}

@keyframes noiseShift {
  0% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(1px, -1px, 0);
  }
  100% {
    transform: translate3d(-1px, 1px, 0);
  }
}

@keyframes glitchSlice {
  0% {
    clip-path: inset(10% 0 74% 0);
  }
  35% {
    clip-path: inset(52% 0 28% 0);
  }
  70% {
    clip-path: inset(22% 0 54% 0);
  }
  100% {
    clip-path: inset(0 0 0 0);
    opacity: 0;
  }
}

@keyframes screenShake {
  0%, 100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(3px, -2px);
  }
  40% {
    transform: translate(-3px, 1px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(-1px, -2px);
  }
}

@keyframes tracePulse {
  50% {
    color: var(--danger);
    text-shadow: 0 0 18px rgba(255, 77, 109, 0.82);
  }
}

@keyframes eventBlink {
  50% {
    border-color: rgba(255, 77, 109, 0.7);
    color: var(--danger);
  }
}

@keyframes textGlitch {
  50% {
    transform: translateX(1px);
    color: var(--cyan);
  }
}

@keyframes randomFlicker {
  48% {
    opacity: 0.97;
  }
  50% {
    opacity: 0.9;
  }
  52% {
    opacity: 1;
  }
}

@keyframes blurPulse {
  50% {
    filter: blur(1px) saturate(1.35);
  }
}

@keyframes xpFloat {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes eventCritical {
  50% {
    background: rgba(255, 77, 109, 0.13);
    box-shadow: 0 0 22px rgba(255, 77, 109, 0.18);
  }
}

@keyframes creditGlow {
  35% {
    text-shadow: 0 0 16px rgba(54, 255, 153, 0.75);
  }
}

@keyframes buyPulse {
  50% {
    border-color: rgba(54, 255, 153, 0.45);
    box-shadow: inset 0 0 14px rgba(54, 255, 153, 0.035);
  }
}

@keyframes redPulse {
  50% {
    opacity: 0.58;
  }
}

@keyframes criticalPulse {
  50% {
    opacity: 0.28;
  }
}

@keyframes freezeFrame {
  0%, 100% {
    filter: none;
  }
  25% {
    filter: contrast(1.8) saturate(0.4);
    transform: translateX(1px);
  }
  55% {
    filter: contrast(2.4) brightness(0.7);
    transform: translateX(-1px);
  }
}

@keyframes introMark {
  0%, 10% {
    opacity: 0;
    filter: blur(2px);
  }
  13%, 27% {
    opacity: 1;
    filter: blur(0);
  }
  29% {
    transform: translate(calc(-50% + 3px), -50%);
  }
  31% {
    transform: translate(calc(-50% - 2px), -50%);
  }
  34%, 76% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  82% {
    opacity: 0.72;
    filter: contrast(1.8);
  }
  88%, 94% {
    opacity: 1;
    filter: none;
  }
  100% {
    opacity: 0;
  }
}

@keyframes introSweep {
  0% {
    background-position: 160% 0;
    opacity: 0;
  }
  18%, 82% {
    opacity: 0.9;
  }
  100% {
    background-position: -80% 0;
    opacity: 0;
  }
}

@keyframes introGlitchLayer {
  0%, 26%, 60%, 100% {
    clip-path: inset(0 0 0 0);
  }
  28% {
    clip-path: inset(10% 0 72% 0);
  }
  31% {
    clip-path: inset(64% 0 18% 0);
  }
  78% {
    clip-path: inset(26% 0 52% 0);
  }
  82% {
    clip-path: inset(74% 0 8% 0);
  }
}

@keyframes introTerminalIn {
  0%, 42% {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  46%, 84% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

@keyframes crawlerMove {
  0% {
    opacity: 0;
    transform: translate(-60px, 0);
  }
  18% {
    opacity: 1;
  }
  40% {
    transform: translate(-22px, -8px);
  }
  68% {
    transform: translate(30px, 2px);
  }
  100% {
    opacity: 1;
    transform: translate(62px, -4px);
  }
}

@keyframes crawlerContain {
  0% {
    opacity: 1;
    transform: translate(62px, -4px) scale(1);
  }
  60% {
    opacity: 0.75;
    transform: translate(62px, -4px) scale(0.82);
    filter: contrast(2);
  }
  100% {
    opacity: 0;
    transform: translate(62px, -4px) scale(0.35);
  }
}

@keyframes introFadeOut {
  to {
    opacity: 0;
  }
}

@keyframes bootGlitch {
  0% {
    clip-path: inset(2% 0 76% 0);
    transform: translateX(2px);
  }
  22% {
    clip-path: inset(44% 0 38% 0);
    transform: translateX(-3px);
  }
  48% {
    clip-path: inset(80% 0 4% 0);
    transform: translateX(1px);
  }
  70% {
    clip-path: inset(18% 0 62% 0);
    transform: translateX(-1px);
  }
  100% {
    clip-path: inset(0 0 0 0);
    transform: translateX(0);
  }
}

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

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
  }

  .status-bar,
  .workspace {
    grid-template-columns: 1fr;
  }

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

  .workspace {
    grid-template-areas:
      "terminal"
      "missions"
      "analysis";
  }

  .mission-panel {
    grid-area: missions;
  }

  .terminal-panel {
    grid-area: terminal;
    min-height: 66vh;
  }

  .quick-commands {
    display: block;
  }

  .analysis-panel {
    grid-area: analysis;
  }

  .mission-list {
    max-height: none;
  }

  .panel details:not([open]) {
    height: auto;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 8px;
    gap: 8px;
  }

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

  .terminal-output,
  .terminal-input,
  .prompt {
    font-size: 12px;
  }

  .terminal-input-row {
    grid-template-columns: 1fr auto;
  }

  .prompt {
    grid-column: 1 / -1;
  }

  .quick-command-buttons,
  .briefing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .quick-commands button,
  .upgrade-item button {
    min-height: 40px;
  }

  .start-terminal,
  .mission-modal {
    padding: 20px;
  }
}
