:root {
  color-scheme: dark;
  --terminal-bg: #080a09;
  --terminal-panel: rgba(12, 15, 13, .86);
  --terminal-text: #a9afaa;
  --terminal-muted: #626863;
  --terminal-line: #292e2a;
  --terminal-active: #c4cbc5;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--terminal-text);
  background:
    radial-gradient(circle at 50% 46%, rgba(103, 117, 105, .035), transparent 38%),
    var(--terminal-bg);
  font-family: "Courier New", Courier, monospace;
}

body::before,
body::after {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  opacity: .18;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, rgba(220, 230, 222, .018) 3px, rgba(220, 230, 222, .018) 4px);
}

body::after {
  opacity: .2;
  background-image:
    radial-gradient(circle at 11% 31%, rgba(255, 255, 255, .1) 0 .45px, transparent .7px),
    radial-gradient(circle at 71% 67%, rgba(255, 255, 255, .08) 0 .4px, transparent .7px),
    radial-gradient(circle at 43% 83%, rgba(255, 255, 255, .07) 0 .35px, transparent .7px);
  background-size: 37px 41px, 53px 47px, 43px 59px;
}

.terminalFrame {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(24px, 4vw, 54px) clamp(22px, 5vw, 72px) clamp(20px, 3vw, 38px);
  opacity: 1;
  transition: opacity .28s ease;
}

.terminalFrame.isTransitioning { opacity: 0; }

.terminalHeader,
.terminalFooter {
  display: flex;
  justify-content: space-between;
  width: 100%;
  color: var(--terminal-muted);
  font-size: 9px;
  letter-spacing: .18em;
}

.terminalVerifiedFrame { animation: terminalReveal .48s ease both; }

.terminalVerifiedPanel { width: min(100%, 520px); }

.terminalVerifiedPanel h1 {
  margin-bottom: 32px;
  font-size: clamp(17px, 3vw, 22px);
  line-height: 1.45;
}

.verificationComplete {
  margin: 0;
  padding: 14px 0;
  border-top: 1px solid var(--terminal-line);
  border-bottom: 1px solid var(--terminal-line);
  color: #858c86;
  font-size: 9px;
  letter-spacing: .16em;
}

.investigatorRecord { margin: 34px 0; }

.investigatorRecord div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(41, 46, 42, .72);
  font-size: 10px;
  letter-spacing: .1em;
}

.investigatorRecord dt { color: #686e69; }
.investigatorRecord dd { margin: 0; color: #b2b9b3; }

.investigatorWelcome {
  margin: 42px 0 24px;
  color: var(--terminal-active);
  font-size: 12px;
  letter-spacing: .16em;
}

.terminalContinue { justify-self: auto; margin: 0; }

.assignmentStatus {
  min-height: 1.5em;
  margin: 24px 0 0;
  color: #777d78;
  font-size: 10px;
  letter-spacing: .15em;
  animation: terminalFade .24s ease both;
}

.terminalHeader {
  align-items: flex-start;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--terminal-line);
}

.terminalHeader p,
.terminalFooter span { margin: 0; }

.terminalMeta {
  display: grid;
  justify-items: end;
  gap: 8px;
  text-align: right;
}

.terminalMeta time {
  display: grid;
  gap: 4px;
  min-width: 9ch;
  color: #777d78;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

.terminalMeta time span { display: block; }

.terminal {
  display: grid;
  place-items: center;
  padding: clamp(54px, 8vh, 92px) 20px;
}

.terminalPanel {
  width: min(100%, 430px);
  padding: clamp(34px, 5vw, 52px);
  border: 1px solid var(--terminal-line);
  background: var(--terminal-panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .22);
}

.terminalIndex {
  margin: 0 0 15px;
  color: var(--terminal-muted);
  font-size: 9px;
  letter-spacing: .2em;
}

h1 {
  margin: 0 0 48px;
  color: var(--terminal-active);
  font-size: clamp(17px, 3vw, 21px);
  font-weight: 400;
  letter-spacing: .17em;
}

form { display: grid; gap: 12px; transition: opacity .24s ease; }

label {
  color: #777d78;
  font-size: 10px;
  letter-spacing: .17em;
}

input,
button { font: inherit; }

.terminalInputWrap { position: relative; }

.terminalInputWrap::after {
  position: absolute;
  right: 13px;
  bottom: 13px;
  width: 1px;
  height: 16px;
  content: "";
  background: #9ba29c;
  opacity: 0;
}

.terminalInputWrap:focus-within::after {
  opacity: .55;
  animation: terminalCursor 1.05s steps(1, end) infinite;
}

input {
  width: 100%;
  height: 46px;
  padding: 9px 34px 9px 12px;
  border: 1px solid #353b36;
  border-radius: 0;
  outline: none;
  caret-color: #adb4ae;
  color: #d0d5d1;
  background: #090b0a;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

input:focus {
  border-color: #626a63;
  background: #0b0e0c;
  box-shadow: 0 0 14px rgba(158, 174, 161, .055);
}

button {
  justify-self: end;
  min-height: 34px;
  margin-top: 9px;
  padding: 0;
  border: 0;
  color: #747a75;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  letter-spacing: .17em;
}

button span { margin-left: 5px; color: #545954; }

button:hover,
button:focus-visible { color: #b5bcb6; outline: none; }

button:disabled { cursor: wait; opacity: .42; }

.terminalStatus {
  display: grid;
  align-content: start;
  min-height: 45px;
  margin-top: 31px;
  color: #858b86;
  font-size: 10px;
  letter-spacing: .15em;
  line-height: 1.8;
}

.terminalStatus p { margin: 0; animation: terminalFade .24s ease both; }
.terminalStatus small { color: #656b66; font: inherit; letter-spacing: .1em; }

.terminalStatus[data-state="verifying"] p::after {
  display: inline-block;
  width: 3px;
  height: 3px;
  margin-left: 8px;
  border-radius: 50%;
  content: "";
  vertical-align: 2px;
  background: currentColor;
  animation: terminalIndicator .75s ease-in-out infinite;
}

.terminalStatus[data-result="granted"] { color: #bdc5be; }
.terminalStatus[data-result="denied"] { color: #959b96; }

.terminalFrame.isVerifying form { opacity: .52; }

.terminalFooter {
  padding-top: 18px;
  border-top: 1px solid var(--terminal-line);
  opacity: .7;
}

@keyframes terminalCursor { 50% { opacity: 0; } }
@keyframes terminalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes terminalReveal { from { opacity: 0; } to { opacity: 1; } }
@keyframes terminalIndicator { 50% { opacity: .2; } }

@media (max-width: 560px) {
  .terminalFrame { padding: 20px 16px; }
  .terminal { padding: 44px 0; }
  .terminalPanel { padding: 34px 24px; }
  .terminalHeader { padding-bottom: 15px; }
  .terminalFooter { font-size: 8px; }
}

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