/* ============================================
   BLACKOUT — INDEX.CSS  v2.0
   Monotone / CRT / retro-futuristic
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&display=swap');

/* ─── TOKENS ─────────────────────────────────── */
:root {
  --bg:          #000;
  --panel:       #050505;
  --border:      #1a1a1a;
  --border-hi:   #3a3a3a;
  --text:        #c8c8c8;
  --text-dim:    #555;
  --text-mute:   #2a2a2a;
  --accent:      #fff;
  --font-mono:   'Share Tech Mono', 'Courier New', monospace;
  --font-vt:     'VT323', 'Courier New', monospace;
  --scan-opacity: 0.1;
  --prox-distort: 1;
  --v-offset:    0px;
  --shake-x:     0px;
  --shake-y:     0px;
}

/* ─── RESET ──────────────────────────────────── */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}
html { height: 100%; }

/* ─── BODY ───────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  filter: url(#wavyFilter) grayscale(100%);
  transform: translateY(var(--v-offset)) translate(var(--shake-x), var(--shake-y));
  transition: transform 0.05s linear;
}

/* ─── SVG FILTER ─────────────────────────────── */
.svg-filters {
  position: absolute;
  width: 0; height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ─── NOISE CANVAS ───────────────────────────── */
#noiseCanvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9990;
  opacity: 0.025;
  mix-blend-mode: screen;
}

/* ─── SCANLINES ──────────────────────────────── */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent, transparent 3px,
    rgba(0,0,0,var(--scan-opacity)) 3px, rgba(0,0,0,var(--scan-opacity)) 4px
  );
  pointer-events: none;
  z-index: 9991;
  background-size: 100% 4px;
}

/* ─── VIGNETTE ───────────────────────────────── */
body::after {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0,0,0,0.88) 100%);
  pointer-events: none;
  z-index: 9989;
  animation: globalFlicker 8s ease-in-out infinite;
}

/* ─── SCREEN TEAR CANVAS ─────────────────────── */
#tearCanvas {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9995;
  display: none;
  mix-blend-mode: exclusion;
}

/* ─── TERMINAL LOG LAYER ─────────────────────── */
#terminalLogLayer {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9985;
  overflow: hidden;
}

.term-log {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.18);
  letter-spacing: 0.12em;
  white-space: nowrap;
  pointer-events: none;
  animation: termFade 6s ease-out forwards;
}

.term-log.glitch-word {
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  animation: termGlitch 1.8s ease-out forwards;
}

.term-log.xrfxrc-flash {
  color: rgba(255,255,255,0.9);
  font-size: 16px;
  font-family: var(--font-vt);
  letter-spacing: 0.3em;
  animation: xrfxrcFlash 2.2s ease-out forwards;
}

@keyframes termFade {
  0%   { opacity: 0; transform: translateY(0); }
  10%  { opacity: 1; }
  80%  { opacity: 0.18; }
  100% { opacity: 0; transform: translateY(-20px); }
}

@keyframes termGlitch {
  0%   { opacity: 0; transform: skewX(-8deg); }
  8%   { opacity: 1; transform: skewX(2deg); }
  20%  { opacity: 0.7; }
  40%  { opacity: 1; transform: skewX(-1deg); }
  80%  { opacity: 0.4; }
  100% { opacity: 0; transform: skewX(0deg); }
}

@keyframes xrfxrcFlash {
  0%   { opacity: 0; transform: scale(0.95) translateX(-4px); }
  5%   { opacity: 1; }
  15%  { opacity: 0.2; }
  20%  { opacity: 0.9; }
  50%  { opacity: 0.6; }
  100% { opacity: 0; transform: scale(1.02); }
}

/* ─── CRT CORNERS ────────────────────────────── */
.corner {
  position: fixed;
  width: 20px; height: 20px;
  border-color: var(--border-hi);
  border-style: solid;
  z-index: 9996;
  pointer-events: none;
}
.corner-tl { top: 12px; left: 12px; border-width: 1px 0 0 1px; }
.corner-tr { top: 12px; right: 12px; border-width: 1px 1px 0 0; }
.corner-bl { bottom: 12px; left: 12px; border-width: 0 0 1px 1px; }
.corner-br { bottom: 12px; right: 12px; border-width: 0 1px 1px 0; }

/* ─── HEADER ─────────────────────────────────── */
.site-header {
  width: 100%;
  max-width: 680px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 0;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-bottom: 40px;
}
.header-tag { color: var(--text-dim); }
.header-center-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 0 18px;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
}

.blink-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: blinkAnim 1.2s step-end infinite;
  box-shadow: 0 0 8px rgba(255,255,255,0.6);
}

/* ─── MAIN WORKSPACE ─────────────────────────── */
#main-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 680px;
  padding: 0 24px 80px;
  z-index: 15;
  position: relative;
}

/* ─── NEON TITLE ─────────────────────────────── */
h1#glitchHeader {
  font-family: var(--font-vt);
  font-size: 86px;
  letter-spacing: 12px;
  margin: 0 0 4px;
  cursor: pointer;
  color: var(--accent);
  line-height: 1;
  transition: text-shadow 0.05s;
  min-height: 90px;
  text-align: center;
}

.neon-on {
  text-shadow:
    3px 0 2px rgba(255,0,0,0.7),
    -3px 0 2px rgba(0,255,255,0.7),
    0 0 12px rgba(255,255,255,0.5),
    0 0 35px rgba(255,255,255,0.18),
    0 0 70px rgba(255,255,255,0.06);
}
.neon-off  { opacity: 0; text-shadow: none; }
.neon-buzz {
  opacity: 0.55;
  animation: buzzHum 0.05s infinite alternate;
  text-shadow: 1px 0 0px rgba(255,0,0,0.3), -1px 0 0px rgba(0,255,255,0.3), 0 0 6px rgba(255,255,255,0.12);
}
.violent-flicker {
  animation: flickerVibrate 0.08s infinite alternate;
  text-shadow: 3px 0 2px rgba(255,0,0,0.95), -3px 0 2px rgba(0,255,255,0.95), 0 0 22px rgba(255,60,60,0.5);
}

@keyframes buzzHum {
  from { opacity: 0.5; transform: translateX(0px); }
  to   { opacity: 0.62; transform: translateX(0.7px); }
}
@keyframes flickerVibrate {
  0%   { transform: translate(2px, 0px);  opacity: 1;   }
  20%  { opacity: 0.1; }
  40%  { transform: translate(-2px, 1px); opacity: 0.9; }
  60%  { opacity: 0.3; }
  80%  { transform: translate(0px, -1px); opacity: 1;   }
  100% { transform: translate(2px, 1px);  opacity: 0.2; }
}

/* ─── SUBLINE ─────────────────────────────────── */
.wide {
  font-size: 11px;
  letter-spacing: 8px;
  color: var(--text-dim);
  margin: 0 0 32px;
  text-align: center;
}

/* ─── GLOBE ──────────────────────────────────── */
.globe-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.globe-ring {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 220px; height: 220px;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 50%;
  pointer-events: none;
  transition: all 0.4s ease;
}
.globe-wrap:hover .globe-ring {
  width: 230px; height: 230px;
  border-color: rgba(255,255,255,0.12);
  box-shadow: 0 0 30px rgba(255,255,255,0.04) inset;
}

.GLOBE {
  display: block;
  width: 180px; height: 180px;
  filter: grayscale(1) contrast(1.4);
  cursor: crosshair;
  z-index: 5;
  position: relative;
}

.globe-label {
  font-size: 9px;
  color: var(--text-mute);
  letter-spacing: 0.3em;
  margin-top: 10px;
  transition: color 0.3s;
}
.globe-wrap:hover .globe-label { color: var(--text-dim); }

/* ─── COUNTDOWN ──────────────────────────────── */
.est-text {
  font-size: 9px;
  color: #2a2a2a;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}
.countdown-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 48px;
}
.countdown-label { font-size: 11px; color: var(--text-mute); letter-spacing: 0.1em; }
.demo {
  font-family: var(--font-vt);
  font-size: 32px;
  color: var(--text-dim);
  letter-spacing: 4px;
}

/* ─── CHECKPOINT SECTION ─────────────────────── */
.checkpoint-section {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel);
  margin-bottom: 32px;
  position: relative;
}

.checkpoint-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.checkpoint-title {
  font-size: 10px;
  color: var(--text);
  letter-spacing: 0.2em;
}
.checkpoint-sub {
  font-size: 9px;
  color: var(--text-mute);
  letter-spacing: 0.1em;
}

.checkpoint-input-wrap {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.cp-prompt {
  color: var(--text-dim);
  font-size: 14px;
  flex-shrink: 0;
}

.checkpoint-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  caret-color: var(--accent);
}
.checkpoint-input::placeholder { color: var(--text-mute); }

.checkpoint-input-wrap button,
.answer-row button,
section.answer-section button {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.12s;
  flex-shrink: 0;
  min-height: 34px;
}
.checkpoint-input-wrap button:hover,
.answer-row button:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.checkpoint-error {
  font-size: 9px;
  color: #444;
  letter-spacing: 0.15em;
  padding: 0 18px;
  min-height: 20px;
  line-height: 20px;
}

/* Checkpoint entries */
.checkpoint-list {
  max-height: 220px;
  overflow-y: auto;
}
.checkpoint-list::-webkit-scrollbar { width: 3px; }
.checkpoint-list::-webkit-scrollbar-thumb { background: var(--border); }

.checkpoint-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  transition: background 0.1s;
  position: relative;
  overflow: hidden;
}
.checkpoint-entry:hover { background: rgba(255,255,255,0.015); }
.checkpoint-entry:last-child { border-bottom: none; }

.cp-status-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--border-hi);
  flex-shrink: 0;
}
.checkpoint-entry.verified .cp-status-dot {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(255,255,255,0.5);
}

.cp-serial {
  flex: 1;
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
  color: var(--text);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-serial a {
  color: inherit;
  text-decoration: none;
  transition: color 0.1s;
}
.cp-serial a:hover { color: var(--accent); }

.cp-date {
  font-size: 8px;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.cp-remove {
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  transition: color 0.1s;
  flex-shrink: 0;
}
.cp-remove:hover { color: #666; }

.checkpoint-empty {
  padding: 20px 18px;
  font-size: 9px;
  color: var(--text-mute);
  letter-spacing: 0.15em;
  text-align: center;
}

/* ─── ANSWER SECTION ─────────────────────────── */
.answer-section {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel);
  margin-bottom: 24px;
}

.answer-label {
  padding: 10px 18px;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  border-bottom: 1px solid var(--border);
}

.answer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.search-prompt {
  color: var(--text-dim);
  font-size: 14px;
  flex-shrink: 0;
}

#answerInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  caret-color: var(--accent);
}
#answerInput::placeholder { color: var(--text-mute); font-size: 12px; }

.response-msg {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  padding: 8px 18px 12px;
  min-height: 32px;
}

/* ─── SITE FOOTER ─────────────────────────────── */
.site-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.purge-btn {
  background: none;
  border: 1px solid #181818;
  color: #222;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.purge-btn:hover { border-color: #444; color: #555; background: none; }

/* ─── MODAL ──────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-box {
  background: #060606;
  border: 1px solid var(--border-hi);
  padding: 32px 36px;
  position: relative;
  max-width: 360px;
  width: 90%;
}

.modal-corner {
  position: absolute;
  width: 10px; height: 10px;
  border-color: var(--border-hi);
  border-style: solid;
  pointer-events: none;
}
.mc-tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.mc-tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.mc-bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.mc-br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.modal-title {
  font-size: 12px;
  letter-spacing: 0.25em;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-body {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.8;
  letter-spacing: 0.08em;
  margin-bottom: 24px;
}
.modal-actions { display: flex; gap: 12px; }
.modal-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  cursor: pointer;
  transition: all 0.12s;
}
.modal-cancel  { border: 1px solid var(--border-hi); color: var(--text-dim); }
.modal-cancel:hover  { background: var(--border-hi); color: var(--text); }
.modal-confirm { border: 1px solid #2a2a2a; color: #333; }
.modal-confirm:hover { border-color: #555; color: #666; background: rgba(255,255,255,0.02); }

/* ─── SCREEN TEAR ANIMATION ──────────────────── */
.screen-tear {
  animation: tearSnap 0.25s steps(4) 1;
}
@keyframes tearSnap {
  0%   { --v-offset: -45px; }
  25%  { --v-offset:  20px; }
  50%  { --v-offset: -25px; }
  75%  { --v-offset:  12px; }
  100% { --v-offset:   0px; }
}

/* ─── AMBIENT GLITCH ─────────────────────────── */
.ambient-glitch {
  animation: ambientSnap 0.15s steps(2) 1;
}
@keyframes ambientSnap {
  0%   { --v-offset: -18px; }
  50%  { --v-offset:   9px; }
  100% { --v-offset:   0px; }
}

/* ─── GLOBAL ANIMATIONS ──────────────────────── */
@keyframes globalFlicker {
  0%, 96%, 100% { opacity: 1; }
  97%            { opacity: 0.94; }
  98%            { opacity: 1; }
  99%            { opacity: 0.96; }
}

@keyframes blinkAnim {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ─── SCROLLBAR ──────────────────────────────── */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 600px) {
  h1#glitchHeader { font-size: 60px; letter-spacing: 8px; }
  .demo { font-size: 24px; }
  #main-workspace { padding: 0 14px 80px; }
  .checkpoint-header { flex-direction: column; gap: 4px; }
}