/* ============================================
   NOIDED.ORG — STAY NOIDED
   Chaotic glitch aesthetic / surveillance HUD
   ============================================ */

:root {
  --black: #000;
  --white: #fff;
  --cyan: #0ff;
  --magenta: #f0f;
  --yellow: #ff0;
  --red: #f00;
  --green: #0f0;
  --grey: #1a1a1a;
  --font-mono: 'Share Tech Mono', monospace;
  --font-display: 'Oswald', sans-serif;
  --cursor-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='28' viewBox='0 0 20 28'%3E%3Cpath d='M10 0 L2 22 L8 17 L10 28 L12 17 L18 22 Z' fill='white' stroke='%23333' stroke-width='0.5' transform='rotate(180 10 14)'/%3E%3Ccircle cx='10' cy='17' r='2.5' fill='none' stroke='rgba(255,255,255,0.35)' stroke-width='0.4'/%3E%3Cpath d='M10 14.8 L11.18 16.42 L10.73 16.75 L10 15.6 L9.27 16.75 L8.82 16.42 Z M8.82 16.42 L8.1 18.1 L8.6 18.25 L9.15 16.95 L9.27 17.85 L9.73 17.85 L9.85 16.95 L10.4 18.25 L10.9 18.1 L10.18 16.42 L10.73 16.75 L11.45 18.1 L11.15 18.55 L10 17.8 L8.85 18.55 L8.55 18.1 L9.27 16.75 L8.82 16.42 Z' fill='rgba(255,255,255,0.2)'/%3E%3C/svg%3E") 10 28, default;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  cursor: var(--cursor-svg);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--black);
  color: var(--white);
  font-family: var(--font-mono);
  cursor: var(--cursor-svg);
}

body.chaos-invert {
  filter: invert(1) hue-rotate(180deg);
}

body.chaos-tear {
  transform: skewX(-2deg) translateX(8px);
}

body.chaos-tear-hard {
  transform: skewX(5deg) translateY(-3px) scaleY(1.01);
}

/* ---- LAYER: THREE.JS BACKGROUND ---- */

#three-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ---- LAYER: NOISE CANVAS ---- */

#noise-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: screen;
}

/* ---- LAYER: SCAN LINES ---- */

#scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.15) 2px,
    rgba(0, 0, 0, 0.15) 4px
  );
}

/* ---- LAYER: SURVEILLANCE HUD ---- */

#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--white);
}

#hud::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: -1;
}

/* CCTV corner brackets */
.hud-corner {
  position: absolute;
  width: 40px;
  height: 40px;
  border-color: rgba(255, 255, 255, 0.7);
  border-style: solid;
}

.hud-tl {
  top: 16px;
  left: 16px;
  border-width: 2px 0 0 2px;
}

.hud-tr {
  top: 16px;
  right: 16px;
  border-width: 2px 2px 0 0;
}

.hud-bl {
  bottom: 66px;
  left: 16px;
  border-width: 0 0 2px 2px;
}

.hud-br {
  bottom: 66px;
  right: 16px;
  border-width: 0 2px 2px 0;
}

/* REC indicator */
.hud-rec {
  position: absolute;
  top: 24px;
  left: 70px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: recBlink 1s step-end infinite;
}

.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  display: inline-block;
  animation: recDotPulse 1s step-end infinite;
}

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

@keyframes recDotPulse {
  0%, 100% { background: var(--red); }
  50% { background: #600; }
}

/* Timestamp */
.hud-timestamp {
  position: absolute;
  top: 46px;
  left: 70px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}

/* Fingerprint readout (right column) */
.hud-fingerprint {
  position: absolute;
  top: 70px;
  right: 20px;
  bottom: 80px;
  font-size: 11px;
  color: var(--white);
  letter-spacing: 0.5px;
  text-align: right;
  line-height: 1.8;
  max-width: 440px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 0, 0.3) transparent;
  padding-right: 4px;
  opacity: 1;
  pointer-events: all;
}

.hud-fingerprint::-webkit-scrollbar {
  display: none;
}

.hud-fingerprint .fp-header {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #ff1a1a;
  letter-spacing: 4px;
  margin-bottom: 4px;
  text-shadow: 0 0 14px rgba(255, 0, 0, 0.7), 0 0 40px rgba(255, 0, 0, 0.3);
  -webkit-text-stroke: 0.5px rgba(255, 255, 0, 0.4);
  padding-bottom: 4px;
  border-bottom: 2px solid rgba(255, 0, 0, 0.4);
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1;
}

.hud-fingerprint .fp-subheader {
  font-size: 10px;
  color: rgba(255, 255, 0, 0.6);
  letter-spacing: 2.5px;
  margin-bottom: 14px;
  margin-top: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 0, 0.15);
  position: sticky;
  top: 36px;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1;
}

.hud-fingerprint .fp-label {
  color: var(--yellow);
  font-weight: bold;
  margin-right: 6px;
  text-shadow: 0 0 4px rgba(255, 255, 0, 0.2);
}

.hud-fingerprint .fp-section {
  font-size: 10px;
  color: var(--red);
  font-weight: bold;
  letter-spacing: 2px;
  margin-top: 10px;
  margin-bottom: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 0, 0, 0.2);
  text-shadow: 0 0 6px rgba(255, 0, 0, 0.3);
}

/* Noided Level dropdown (top right — z-index above all overlays) */
.noided-level {
  position: fixed;
  top: 20px;
  right: 70px;
  font-size: 11px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: all;
  z-index: 50;
  font-family: var(--font-mono);
  opacity: 0.9;
}

.noided-level-label {
  color: var(--yellow);
  font-weight: bold;
  letter-spacing: 1.5px;
}

#noided-level-select {
  background: rgba(0, 0, 0, 0.7);
  color: var(--cyan);
  border: 1px solid rgba(0, 255, 255, 0.3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 4px 8px;
  cursor: var(--cursor-svg);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  min-width: 110px;
  padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2300ffff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  position: relative;
  z-index: 21;
}

#noided-level-select:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.2);
}

#noided-level-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.3);
}

#noided-level-select option {
  background: #000;
  color: var(--cyan);
  cursor: var(--cursor-svg);
}

/* Sector surveillance panel (bottom left) */
.hud-sector {
  position: absolute;
  bottom: 74px;
  left: 20px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1.5px;
  line-height: 1.9;
  border-left: 2px solid rgba(255, 0, 0, 0.4);
  padding-left: 10px;
}

.sector-label {
  font-weight: bold;
  color: var(--red);
  font-size: 11px;
  letter-spacing: 2.5px;
  margin-bottom: 2px;
  text-shadow: 0 0 8px rgba(255, 0, 0, 0.3);
  animation: recBlink 2s step-end infinite;
}

.sector-val {
  color: var(--white);
}

.sector-red {
  color: var(--red);
  font-weight: bold;
}

.sector-yellow {
  color: var(--yellow);
}

/* ---- SITE NAVIGATION (bottom bar, independent of HUD) ---- */

.site-nav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
}

.site-nav-link {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--yellow);
  letter-spacing: 3px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 6px 14px;
  border: 2px solid rgba(255, 255, 0, 0.4);
  background: rgba(0, 0, 0, 0.6);
  text-shadow: 0 0 10px rgba(255, 255, 0, 0.5), 0 0 30px rgba(255, 255, 0, 0.15);
  transition: all 0.15s ease;
  cursor: var(--cursor-svg);
  pointer-events: all;
}

.site-nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 0, 0.15);
  border-color: var(--yellow);
  text-shadow: 0 0 14px rgba(255, 255, 0, 0.8), 0 0 40px rgba(255, 255, 0, 0.3);
  box-shadow: 0 0 16px rgba(255, 255, 0, 0.25), inset 0 0 12px rgba(255, 255, 0, 0.08);
  transform: scale(1.05);
}

/* ---- LAYER: CENTRAL CONTENT ---- */

#content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

/* GLITCH TEXT — "STAY NOIDED" */

.glitch {
  font-family: var(--font-display);
  font-size: clamp(3rem, 12vw, 10rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  position: relative;
  color: var(--white);
  will-change: transform;
  animation: glitchJitter 100ms infinite;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

.glitch::before {
  color: var(--cyan);
  z-index: -1;
  animation: glitchCyan 2s infinite linear alternate-reverse;
}

.glitch::after {
  color: var(--magenta);
  z-index: -2;
  animation: glitchMagenta 3s infinite linear alternate-reverse;
}

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

@keyframes glitchCyan {
  0% { clip-path: inset(0 0 85% 0); transform: translate(-4px, -2px); }
  5% { clip-path: inset(40% 0 20% 0); transform: translate(3px, 1px); }
  10% { clip-path: inset(80% 0 0 0); transform: translate(-2px, 3px); }
  15% { clip-path: inset(10% 0 60% 0); transform: translate(4px, -1px); }
  20% { clip-path: inset(50% 0 30% 0); transform: translate(-3px, 2px); }
  25% { clip-path: inset(0 0 70% 0); transform: translate(2px, -3px); }
  30% { clip-path: inset(60% 0 10% 0); transform: translate(-1px, 1px); }
  35% { clip-path: inset(20% 0 50% 0); transform: translate(3px, -2px); }
  40% { clip-path: inset(90% 0 0 0); transform: translate(-4px, 0); }
  45% { clip-path: inset(0 0 40% 0); transform: translate(1px, 3px); }
  50% { clip-path: inset(30% 0 40% 0); transform: translate(-2px, -1px); }
  55% { clip-path: inset(70% 0 10% 0); transform: translate(4px, 2px); }
  60% { clip-path: inset(5% 0 80% 0); transform: translate(-3px, -3px); }
  65% { clip-path: inset(45% 0 25% 0); transform: translate(2px, 1px); }
  70% { clip-path: inset(85% 0 5% 0); transform: translate(-1px, -2px); }
  75% { clip-path: inset(15% 0 55% 0); transform: translate(3px, 3px); }
  80% { clip-path: inset(65% 0 15% 0); transform: translate(-4px, 1px); }
  85% { clip-path: inset(0 0 90% 0); transform: translate(2px, -2px); }
  90% { clip-path: inset(35% 0 35% 0); transform: translate(-2px, 2px); }
  95% { clip-path: inset(75% 0 5% 0); transform: translate(1px, -1px); }
  100% { clip-path: inset(25% 0 65% 0); transform: translate(-3px, 0); }
}

@keyframes glitchMagenta {
  0% { clip-path: inset(65% 0 0 0); transform: translate(3px, 2px); }
  5% { clip-path: inset(0 0 50% 0); transform: translate(-2px, -3px); }
  10% { clip-path: inset(30% 0 40% 0); transform: translate(4px, 1px); }
  15% { clip-path: inset(80% 0 5% 0); transform: translate(-1px, -1px); }
  20% { clip-path: inset(10% 0 70% 0); transform: translate(2px, 3px); }
  25% { clip-path: inset(55% 0 20% 0); transform: translate(-3px, -2px); }
  30% { clip-path: inset(0 0 85% 0); transform: translate(1px, 2px); }
  35% { clip-path: inset(40% 0 30% 0); transform: translate(-4px, -1px); }
  40% { clip-path: inset(75% 0 10% 0); transform: translate(3px, -3px); }
  45% { clip-path: inset(20% 0 60% 0); transform: translate(-2px, 1px); }
  50% { clip-path: inset(50% 0 25% 0); transform: translate(4px, -2px); }
  55% { clip-path: inset(5% 0 75% 0); transform: translate(-1px, 3px); }
  60% { clip-path: inset(90% 0 0 0); transform: translate(2px, -1px); }
  65% { clip-path: inset(15% 0 45% 0); transform: translate(-3px, 2px); }
  70% { clip-path: inset(60% 0 15% 0); transform: translate(1px, -3px); }
  75% { clip-path: inset(35% 0 55% 0); transform: translate(-2px, -2px); }
  80% { clip-path: inset(0 0 35% 0); transform: translate(3px, 1px); }
  85% { clip-path: inset(45% 0 40% 0); transform: translate(-4px, 3px); }
  90% { clip-path: inset(70% 0 5% 0); transform: translate(2px, -1px); }
  95% { clip-path: inset(25% 0 60% 0); transform: translate(-1px, 2px); }
  100% { clip-path: inset(85% 0 10% 0); transform: translate(3px, -2px); }
}

/* Subtitle — typewriter target */
.subtitle {
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 2.5vw, 1.4rem);
  color: var(--green);
  letter-spacing: 2px;
  margin-top: 1rem;
  min-height: 1.8em;
  text-shadow: 0 0 8px var(--green);
}

.subtitle .cursor-blink {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--green);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: cursorBlink 530ms step-end infinite;
}

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

/* Tagline */
.tagline {
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 4px;
  margin-top: 2rem;
  animation: taglinePulse 4s ease-in-out infinite;
}

@keyframes taglinePulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.6; }
}

/* ---- PARANOIA FRAGMENTS ---- */

#paranoia-fragments {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
  overflow: hidden;
}

.paranoia-text {
  position: absolute;
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.2vw, 14px);
  color: var(--cyan);
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  text-shadow: 0 0 6px var(--cyan);
  animation: paranoiaFlash 400ms ease-out forwards;
}

@keyframes paranoiaFlash {
  0% { opacity: 0; transform: scale(1.1); }
  15% { opacity: 0.9; transform: scale(1); }
  80% { opacity: 0.7; }
  100% { opacity: 0; transform: scale(0.98) translateY(-4px); }
}

/* ---- FLASH OVERLAY ---- */

#flash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  background: var(--white);
  mix-blend-mode: difference;
  transition: opacity 50ms;
}

#flash-overlay.active {
  opacity: 1;
  transition: none;
}

/* ---- WELCOME BACK OVERLAY ---- */

#welcome-back {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 8;
  pointer-events: none;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.85);
  text-align: center;
  font-family: var(--font-mono);
}

#welcome-back.active {
  display: flex;
  animation: wbAppear 500ms ease-out;
}

#welcome-back.fade-out {
  animation: wbFadeOut 2s ease-in forwards;
}

.wb-text {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 3.5rem);
  color: var(--red);
  letter-spacing: 0.1em;
  text-shadow: 0 0 20px rgba(255, 0, 0, 0.6), 0 0 60px rgba(255, 0, 0, 0.3);
  margin-bottom: 1rem;
}

.wb-time {
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 3px;
  margin: 0.3rem 0;
}

.wb-elapsed {
  font-size: clamp(1.2rem, 4vw, 2.5rem);
  color: var(--cyan);
  letter-spacing: 2px;
  text-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
  margin: 0.5rem 0;
}

.wb-count {
  font-size: clamp(0.6rem, 1.2vw, 0.9rem);
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 4px;
  margin-top: 1.5rem;
}

@keyframes wbAppear {
  0% { opacity: 0; }
  30% { opacity: 1; }
  35% { opacity: 0.2; }
  40% { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes wbFadeOut {
  0% { opacity: 1; }
  80% { opacity: 0.8; }
  90% { opacity: 0.1; }
  95% { opacity: 0.5; }
  100% { opacity: 0; }
}

/* ---- CHAOS CLASSES (applied via JS) ---- */

.screen-flash {
  animation: screenFlash 80ms linear;
}

@keyframes screenFlash {
  0% { filter: invert(1) brightness(2); }
  100% { filter: none; }
}

/* ---- REDUCED MOTION ---- */

@media (prefers-reduced-motion: reduce) {
  .glitch,
  .glitch::before,
  .glitch::after {
    animation: none !important;
  }

  .tagline {
    animation: none !important;
    opacity: 0.4;
  }

  .paranoia-text {
    animation-duration: 2s !important;
  }

  #scanlines {
    display: none;
  }

  body.chaos-invert,
  body.chaos-tear,
  body.chaos-tear-hard {
    filter: none !important;
    transform: none !important;
  }

  #flash-overlay {
    display: none;
  }

  #noise-canvas {
    opacity: 0.1;
  }
}


/* Start Here button — white outline CTA */
.start-here-link {
  border-color: rgba(255, 255, 255, 0.85) !important;
  color: var(--white) !important;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 30px rgba(255, 255, 255, 0.15) !important;
  position: relative;
}

.start-here-link:hover {
  border-color: var(--white) !important;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.35), inset 0 0 12px rgba(255, 255, 255, 0.08) !important;
}

/* ---- MOBILE ADJUSTMENTS ---- */

@media (max-width: 600px) {
  .hud-corner {
    width: 24px;
    height: 24px;
  }

  .hud-tl, .hud-tr { top: 8px; }
  .hud-bl, .hud-br { bottom: 8px; }
  .hud-tl, .hud-bl { left: 8px; }
  .hud-tr, .hud-br { right: 8px; }

  .hud-rec { top: 14px; left: 40px; font-size: 11px; }
  .hud-timestamp { top: 32px; left: 40px; font-size: 9px; }
  .hud-fingerprint { top: 50px; right: 10px; bottom: 90px; font-size: 9px; max-width: 55vw; }
  .hud-fingerprint .fp-header { font-size: 18px; letter-spacing: 2px; }
  .hud-fingerprint .fp-subheader { font-size: 8px; margin-bottom: 8px; }
  .hud-sector { bottom: 76px; left: 10px; font-size: 7px; line-height: 1.7; padding-left: 8px; }
  .sector-label { font-size: 8px; }
  .hud-bl, .hud-br { bottom: 70px; }
  .site-nav {
    bottom: 10px;
    gap: 4px;
    max-width: 95vw;
    padding: 6px 4px;
    background: rgba(0, 0, 0, 0.85);
    border-top: 1px solid rgba(255, 255, 0, 0.15);
  }
  .site-nav-link {
    font-size: 10px;
    letter-spacing: 1px;
    padding: 4px 6px;
  }
  .noided-level { top: 12px; right: 40px; font-size: 9px; }
  #noided-level-select { font-size: 9px; padding: 3px 6px; }
}
