:root {
  --bg-main: #0f1419;
  --bg-panel: #131a21;
  --bg-panel-alt: #0c1116;
  --line: #1f1f1f;
  --line-strong: #2a2a2a;
  --text-main: #d4dde5;
  --text-soft: #9daab5;
  --accent: #b8c9d8;
  --danger: #d3a8a8;
  --success: #b8d3b1;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0;
  scrollbar-color: #4a4a4a #0a1014;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: #0a1014;
}

*::-webkit-scrollbar-thumb {
  background: #4a4a4a;
  border: 1px solid #2a2a2a;
}

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

body {
  background:
    linear-gradient(0deg, rgba(88, 88, 88, 0.06) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(88, 88, 88, 0.06) 1px, transparent 1px) 0 0 / 32px 100%,
    linear-gradient(150deg, #121920 0%, #0b1014 100%);
  color: var(--text-main);
  font-family: "Barlow Condensed", "Segoe UI", Tahoma, sans-serif;
  letter-spacing: 0.02em;
}

body.auth-locked .layout {
  filter: blur(1px) saturate(70%);
  pointer-events: none;
  user-select: none;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 8, 11, 0.85);
  backdrop-filter: blur(3px);
}

.auth-panel {
  width: min(430px, 100%);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #101821 0%, #0a1016 100%);
  padding: 22px 20px 18px;
  border-radius: 14px;
}

.auth-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: #95a4af;
  font-size: 0.78rem;
}

.auth-panel h2 {
  margin: 6px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 1.9rem;
  font-weight: 600;
}

.auth-subtitle {
  margin: 10px 0 0;
  color: #a9b7c3;
  font-size: 0.98rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.auth-tab {
  border: 1px solid #2e2e2e;
  padding: 8px 10px;
  background: #0d1318;
  color: #bcc8d2;
  font-family: "IBM Plex Mono", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
}

.auth-tab.active {
  border-color: #3f3f3f;
  color: #dce7ef;
  background: #121b23;
}

.auth-form {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.auth-form label {
  color: #9fb0bc;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.77rem;
}

.auth-form input {
  border: 1px solid #2d2d2d;
  background: #0b1116;
  color: #d4e0e9;
  padding: 9px 10px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.86rem;
}

.auth-form input:focus {
  outline: none;
  border-color: #4c4c4c;
}

.auth-submit {
  margin-top: 4px;
  border: 1px solid #343434;
  background: linear-gradient(180deg, #1a2530 0%, #10171d 100%);
  color: #d6e3ed;
  padding: 9px 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: "IBM Plex Mono", Consolas, monospace;
  cursor: pointer;
}

.auth-feedback {
  min-height: 1.2em;
  margin: 10px 0 0;
  color: #cfa0a0;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.8rem;
}

.hidden {
  display: none;
}

.backdrop-grid {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(to right, transparent 0, transparent calc(100% - 1px), rgba(70, 70, 70, 0.06) calc(100% - 1px)),
    linear-gradient(to bottom, transparent 0, transparent calc(100% - 1px), rgba(70, 70, 70, 0.06) calc(100% - 1px));
  background-size: 160px 160px;
  pointer-events: none;
  opacity: 0.1;
}

.top-line {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #2b2b2b 30%, #3a3a3a 50%, #2b2b2b 70%, transparent 100%);
  opacity: 0.35;
}

.layout {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 430px);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.briefing {
  border-right: 0;
  padding: 42px 36px 30px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent 22%),
    linear-gradient(135deg, rgba(0, 0, 0, 0.08), transparent 48%);
}

.agency-header h1 {
  margin: 10px 0 0;
  font-size: clamp(1.9rem, 2.9vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.agency-kicker {
  margin: 0;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.85rem;
}

.agency-subtitle {
  max-width: 74ch;
  margin: 16px 0 0;
  font-size: 1.05rem;
  color: #b7c2cc;
}

.mission-status {
  margin-top: 32px;
  border: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.24));
  padding: 14px 16px 18px;
  border-radius: 12px;
}

.progress-label {
  margin: 0 0 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-soft);
}

.progress-track {
  width: 100%;
  height: 12px;
  border: 0;
  background: repeating-linear-gradient(
    90deg,
    #0d1115,
    #0d1115 18px,
    #121a21 18px,
    #121a21 36px
  );
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  width: 33.3333%;
  height: 100%;
  background: linear-gradient(90deg, #6f6f6f, #8a8a8a);
  transition: width 0.3s ease;
  border-radius: 999px;
}

.dossier-card {
  margin-top: 20px;
  border: 0;
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-panel-alt) 100%);
  padding: 24px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
}

.dossier-card.transition-in {
  animation: dossierIn 0.42s cubic-bezier(0.2, 0.6, 0.2, 1);
}

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

.dossier-index {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dossier-card h2 {
  margin: 10px 0 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: clamp(1.3rem, 1.9vw, 2rem);
  font-weight: 600;
}

.dossier-card > p {
  margin: 12px 0 0;
  color: #c0c9d0;
  max-width: 70ch;
  font-size: 1rem;
}

.dossier-artifact {
  margin-top: 20px;
  overflow: hidden;
  min-height: 0;
}

.artifact-block {
  border: 0;
  background: #0c1116;
  padding: 14px;
  border-radius: 12px;
}

.artifact-label {
  margin: 0 0 8px;
  color: #9aa7b2;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.77rem;
}

.cipher-content,
.morse-content {
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #d5dce2;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.intel-note {
  margin-top: 20px;
  border-top: 0;
  padding-top: 14px;
  flex-shrink: 0;
}

.intel-note h3 {
  margin: 0;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.intel-note p {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.terminal {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  background: linear-gradient(180deg, #101720 0%, #0a1015 100%);
  border-radius: 14px 0 0 14px;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 0;
  padding: 16px 18px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 14px 0 0 0;
}

.terminal-header p {
  margin: 0;
  color: #cfd9e2;
  font-size: 0.83rem;
}

.terminal-mode {
  color: #c2d2dd;
  font-size: 0.74rem;
  border: 0;
  padding: 4px 8px;
}

.terminal-output {
  flex: 1;
  overflow: auto;
  padding: 14px 14px 0;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.6;
}

.terminal-line {
  margin: 0 0 9px;
  color: #d3dde4;
}

.terminal-line.meta {
  color: #a2b1be;
}

.terminal-line.error {
  color: var(--danger);
}

.terminal-line.success {
  color: var(--success);
}

.terminal-form {
  border-top: 0;
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #0a1014;
  border-radius: 0 0 0 14px;
}

.prompt {
  font-family: "IBM Plex Mono", Consolas, monospace;
  color: #a8bac8;
  font-size: 0.86rem;
}

#terminal-input {
  flex: 1;
  border: 0;
  border-bottom: 1px solid #2f2f2f;
  background: transparent;
  padding: 8px 4px;
  color: #dde5ec;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

#terminal-input:focus {
  outline: none;
  border-bottom-color: #555555;
}

.stego-frame {
  border: 0;
  padding: 8px;
  background: #080d11;
}

.corrupted-frame {
  border-color: #303030;
}

.corrupted-image-wrap {
  position: relative;
  overflow: hidden;
  border: 0;
  background: #05090d;
  border-radius: 10px;
}

.corrupted-image {
  display: block;
  width: 100%;
  height: auto;
  filter: contrast(125%) saturate(80%);
}

.corrupted-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(14, 23, 31, 0.26) 0,
      rgba(14, 23, 31, 0.26) 2px,
      rgba(2, 5, 8, 0.06) 2px,
      rgba(2, 5, 8, 0.06) 5px
    );
  mix-blend-mode: overlay;
  animation: corruptedFlicker 1.8s steps(2) infinite;
}

.corrupted-hint {
  margin: 8px 0 0;
  color: #9eacb8;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.82rem;
}

.final-reward-block .cipher-content {
  margin-bottom: 12px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.dossier-card.final-mode .dossier-artifact {
  overflow: hidden;
}

.dossier-card.final-mode .final-reward-block {
  display: block;
}

.final-reward-media {
  border: 0;
  display: block;
  background: #070d12;
  padding: 0;
  margin-top: 10px;
  max-width: 560px;
  border-radius: 12px;
  overflow: hidden;
}

.final-reward-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.final-reward-note {
  margin: 8px 0 0;
  color: #b0c0cb;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.8rem;
  grid-column: 1 / -1;
}

@keyframes corruptedFlicker {
  0% {
    opacity: 0.35;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 0.42;
  }
}

.stego-stage {
  position: relative;
}

#stego-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  image-rendering: pixelated;
  border-radius: 10px;
}

.xray-banner {
  margin-top: 10px;
  border: 0;
  padding: 6px 8px;
  font-family: "IBM Plex Mono", Consolas, monospace;
  font-size: 0.78rem;
  color: #a4b4c1;
}

.xray-lens {
  position: absolute;
  width: 180px;
  height: 180px;
  border: 2px solid #5a5a5a;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -50%);
  box-shadow: inset 0 0 0 1px rgba(3, 7, 10, 0.8);
}

.xray-lens-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

body.xray-enabled .xray-lens {
  display: block;
}

body.xray-enabled .xray-banner {
  color: #d8e6f1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1060px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 44vh;
    height: 100vh;
  }

  .briefing {
    border-right: 0;
    border-bottom: 0;
    padding: 18px 14px 14px;
  }

  .terminal {
    min-height: 0;
    height: auto;
    border-radius: 0;
  }

  .terminal-header,
  .terminal-form {
    border-radius: 0;
  }

  .agency-header h1 {
    font-size: clamp(1.4rem, 4.8vw, 2rem);
  }

  .mission-status {
    margin-top: 14px;
    padding: 10px 12px 12px;
  }

  .dossier-card {
    margin-top: 12px;
    padding: 14px;
  }

  .dossier-card h2 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
  }

  .dossier-card > p {
    font-size: 0.92rem;
    margin-top: 8px;
  }

  .dossier-card.final-mode .final-reward-block {
    grid-template-columns: 1fr;
  }

  .final-reward-image {
    width: min(100%, 220px);
  }

  .artifact-block {
    padding: 10px;
  }

  .intel-note {
    margin-top: 10px;
    padding-top: 8px;
  }
}
