@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&display=swap');

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
}

/* ══════════════════════════════════════════════════════════════
   CUSTOM CURSOR — ethereal ring + dot
   ══════════════════════════════════════════════════════════════ */

.cursor-active {
  cursor: none !important;
}

.cursor-active * {
  cursor: none !important;
}

#cursor-dot {
  position: fixed;
  top: 0; left: 0;
  width: 5px; height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  pointer-events: none;
  z-index: 99999;
  will-change: transform;
  mix-blend-mode: difference;
  transition: width 0.2s ease, height 0.2s ease, margin 0.2s ease, opacity 0.3s ease;
}

#cursor-ring {
  position: fixed;
  top: 0; left: 0;
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  pointer-events: none;
  z-index: 99998;
  will-change: transform;
  mix-blend-mode: difference;
  transition: width 0.35s cubic-bezier(0.23,1,0.32,1),
              height 0.35s cubic-bezier(0.23,1,0.32,1),
              margin 0.35s cubic-bezier(0.23,1,0.32,1),
              border-color 0.3s ease,
              opacity 0.3s ease;
}

#cursor-glow {
  position: fixed;
  top: 0; left: 0;
  width: 80px; height: 80px;
  margin: -40px 0 0 -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 99997;
  will-change: transform;
  mix-blend-mode: screen;
  transition: opacity 0.4s ease;
}

/* ══════════════════════════════════════════════════════════════
   SHARED PHASE STYLES
   ══════════════════════════════════════════════════════════════ */

.phase {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.phase.fade-out {
  opacity: 0;
  transition: opacity 0.6s ease-out;
  pointer-events: none;
}

/* Typing cursor */
.typing::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: rgba(255, 255, 255, 0.85);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.6s step-end infinite;
}

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

/* ══════════════════════════════════════════════════════════════
   PHASE 1: TITLE CARD
   ══════════════════════════════════════════════════════════════ */

.title-type {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.08em;
}

/* ══════════════════════════════════════════════════════════════
   PHASE 2: CINEMATIC TEXT
   ══════════════════════════════════════════════════════════════ */

#cinema-text {
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#cinema-text::-webkit-scrollbar {
  display: none;
}

.intro-line {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  letter-spacing: 0.01em;
  margin: 0;
  padding: 0.15em 0;
}

/* ══════════════════════════════════════════════════════════════
   PHASE 3: SIGNAL COLLECTION (raw grid, no chrome)
   ══════════════════════════════════════════════════════════════ */

#phase-signals {
  align-items: flex-start;
  padding: 2rem;
}

#signal-grid {
  width: 80%;
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1px;
  overflow: hidden;
}

.sig-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.015);
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.3s ease;
  min-height: 28px;
  gap: 0.75rem;
  overflow: hidden;
  min-width: 0;
}

.sig-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.sig-row.updated {
  background: rgba(255, 255, 255, 0.04);
}

.sig-key {
  color: rgba(255, 255, 255, 0.4);
  text-transform: lowercase;
  white-space: nowrap;
}

.sig-val {
  color: rgba(255, 255, 255, 0.85);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-left: 1rem;
}

/* ══════════════════════════════════════════════════════════════
   PHASE 4: PROCESSING
   ══════════════════════════════════════════════════════════════ */

#processing-wrap {
  width: 90%;
  max-width: 640px;
  text-align: center;
}

#processing-msg {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: clamp(0.7rem, 1.5vw, 0.85rem);
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.7;
  letter-spacing: 0.02em;
  margin-bottom: 2rem;
}

#processing-feed {
  text-align: left;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.feed-line {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  padding: 0.2rem 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-line.visible {
  opacity: 1;
  transform: translateY(0);
}

.feed-line.fading {
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}



/* ══════════════════════════════════════════════════════════════
   INFO OVERLAY (press 'i')
   ══════════════════════════════════════════════════════════════ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 1;
  transition: opacity 0.6s ease-out;
  overflow-y: auto;
  padding: 2rem;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-inner {
  max-width: 640px;
  width: 100%;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.02em;
}

.overlay-inner h1 {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.25rem;
}

.overlay-inner .subtitle {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.25);
  margin-bottom: 2rem;
}

.overlay-inner .fade-note {
  margin-top: 2rem;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.15);
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#env-data {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.15rem 2rem;
}

#env-data .env-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

#env-data .env-key {
  color: rgba(255, 255, 255, 0.3);
}

#env-data .env-val {
  color: rgba(255, 255, 255, 0.7);
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   PERSISTENT FOOTER
   ══════════════════════════════════════════════════════════════ */

#site-footer {
  position: fixed;
  bottom: 1rem;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 150;
  pointer-events: auto;
}

#site-footer a {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: 10px;
  color: rgba(235, 130, 130, 0.7);
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: color 0.3s ease;
}

#site-footer a:hover {
  color: rgba(245, 160, 160, 0.9);
}


/* ══════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  #signal-grid {
    grid-template-columns: 1fr;
    width: 95%;
  }
  #env-data {
    grid-template-columns: 1fr;
  }
}
