/* ================================================================
   //PROCESS — OSE Intake Protocol Terminal
   Pure black. Monospace. No mercy.
   ================================================================ */

/* Self-hosted VT323 — no Google Fonts request, no metadata leak */
@font-face {
  font-family: 'VT323';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/vt323.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --black: #000000;
  --green: #1a8a1a;
  --green-dim: #0d4a0d;
  --amber: #b8860b;
  --red: #d42020;
  --white: #c0c0c0;
  --white-bright: #e0e0e0;
  --gray: #444444;
  --font: 'VT323', 'Courier New', monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--black);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  color: var(--green);
}

/* ── CRT Scanlines ─────────────────────────────────────────────── */
.scanlines {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ── Screens ───────────────────────────────────────────────────── */
.screen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  flex-direction: column;
  padding: 40px;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

/* ── Boot Screen ───────────────────────────────────────────────── */
#boot {
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.terminal-block {
  width: 100%;
  max-width: 700px;
}

.boot-line {
  opacity: 0;
  white-space: pre-wrap;
  margin-bottom: 4px;
}

.boot-line.visible {
  opacity: 1;
}

.boot-line.classified {
  color: var(--red);
  font-weight: 700;
}

.boot-line.amber {
  color: var(--amber);
}

.boot-line.dim {
  color: var(--gray);
}

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

#begin-btn {
  display: inline;
  background: none;
  border: none;
  color: var(--green);
  font-family: var(--font);
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  animation: pulse 2s ease-in-out infinite;
}

#begin-btn:hover {
  color: var(--white-bright);
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Conversation Screen ───────────────────────────────────────── */
#conversation {
  align-items: center;
}

.messages-area {
  flex: 1;
  width: 100%;
  max-width: 700px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Hide scrollbar but keep functionality */
.messages-area::-webkit-scrollbar {
  width: 4px;
}
.messages-area::-webkit-scrollbar-track {
  background: transparent;
}
.messages-area::-webkit-scrollbar-thumb {
  background: var(--gray);
  border-radius: 2px;
}

.message {
  margin-bottom: 16px;
}

.message-content {
  color: var(--green);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.message.user .message-content {
  color: var(--white-bright);
}

.message.system .message-content {
  color: var(--amber);
  font-size: 12px;
}

/* Blinking cursor at end of typing */
.typing-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background: var(--green);
  vertical-align: middle;
  margin-left: 2px;
  animation: blink 800ms step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Input Area ────────────────────────────────────────────────── */
.input-area {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 16px;
  flex-shrink: 0;
  width: 100%;
  max-width: 700px;
}

.input-area.hidden {
  display: none;
}

.prompt-char {
  color: var(--green);
  font-weight: 700;
  font-size: inherit;
  line-height: 1;
  flex-shrink: 0;
}

#user-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--white-bright);
  font-family: var(--font);
  font-size: inherit;
  line-height: 1;
  resize: none;
  padding: 0;
  caret-color: var(--green);
  overflow-y: auto;
  max-height: 120px;
}

#user-input::placeholder {
  color: var(--gray);
}


/* ── Result Screen ─────────────────────────────────────────────── */
#result {
  justify-content: center;
  align-items: center;
  text-align: center;
}

#result .terminal-block {
  max-width: 600px;
}

.result-line {
  opacity: 0;
  margin-bottom: 6px;
}

.result-line.visible {
  opacity: 1;
}

.result-line.cleared {
  color: var(--green);
  font-weight: 700;
  font-size: 18px;
}

.result-line.denied {
  color: var(--red);
  font-weight: 700;
}

.result-line.token {
  color: var(--amber);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 2px;
  margin: 16px 0;
  user-select: all;
}

.result-line.url {
  color: var(--white-bright);
  font-size: 13px;
}

.result-line.url a {
  color: var(--white-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-line.url a:hover {
  color: var(--green);
}

.result-line.warning {
  color: var(--red);
  font-size: 12px;
}

.result-line.welcome {
  color: var(--green-dim);
  font-size: 13px;
  margin-top: 24px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .screen {
    padding: 16px;
  }

  #boot {
    padding: 16px;
  }

  html, body {
    font-size: 16px;
  }

  .result-line.token {
    font-size: 14px;
    letter-spacing: 1px;
    word-break: break-all;
  }

  .result-line.url {
    font-size: 12px;
    word-break: break-all;
  }
}

/* ── Fade transitions ──────────────────────────────────────────── */
.fade-out {
  animation: fadeOut 1s ease forwards;
}

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