@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&family=Space+Mono:wght@400;700&display=swap');

/* ==========================================================================
   Project Ashoka - CRT Terminal Styles
   Authentic Retro Monospaced CRT Terminal, Scanlines, Flicker & Glow
   ========================================================================== */

:root {
  --term-bg: #030304;
  --term-screen-bg: #07080a;
  --term-green: #33ff66;
  --term-white: #f0f4f8;
  --term-cyan: #38ef7d;
  --term-dim: #5c6773;
  --term-amber: #ffb833;
  --term-glow: rgba(255, 255, 255, 0.7);
  --font-mono: 'Share Tech Mono', 'Space Mono', 'Courier New', monospace;
  --font-pixel: 'VT323', monospace;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--term-bg);
  color: var(--term-white);
  font-family: var(--font-mono);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--term-bg);
  padding: 1rem;
}

/* ==========================================================================
   Outer Layout & Shell
   ========================================================================== */

.terminal-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  position: relative;
}

/* Header toolbar for controls / step switching */
.terminal-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  max-width: 440px;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: rgba(18, 22, 28, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: #8b9bb4;
  z-index: 100;
}

.terminal-toolbar-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #e2e8f0;
  font-weight: bold;
}

.terminal-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #00ff88;
  border-radius: 50%;
  box-shadow: 0 0 8px #00ff88;
  animation: pulse-dot 1.8s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.2); }
}

.terminal-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toolbar-btn {
  background: transparent;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.toolbar-btn.active {
  color: #00ff88;
  border-color: #00ff88;
  background: rgba(0, 255, 136, 0.1);
}

/* ==========================================================================
   CRT Phone Mockup Frame
   ========================================================================== */

.phone-mockup-frame {
  position: relative;
  width: 100%;
  max-width: 390px;
  height: 800px;
  max-height: 90vh;
  background: #000;
  border-radius: 44px;
  padding: 12px;
  box-shadow: 
    0 0 0 2px #262930,
    0 0 0 6px #121417,
    0 24px 60px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(0, 255, 150, 0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Fullscreen mode option */
.phone-mockup-frame.fullscreen-mode {
  max-width: 600px;
  height: 85vh;
  border-radius: 20px;
  padding: 8px;
}

/* Notch & Island */
.phone-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 1.4rem 0.25rem;
  font-size: 0.75rem;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  z-index: 40;
  user-select: none;
}

.phone-island {
  width: 90px;
  height: 24px;
  background: #000;
  border-radius: 20px;
  margin: 0 auto;
}

.phone-status-icons {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
}

/* ==========================================================================
   CRT Screen & Scanlines
   ========================================================================== */

.crt-screen {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  background: #000000;
  border-radius: 34px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.9);
}

.fullscreen-mode .crt-screen {
  border-radius: 14px;
}

/* Scanlines overlay */
.crt-scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.45) 0px,
    rgba(0, 0, 0, 0.45) 1.5px,
    transparent 1.5px,
    transparent 3px
  );
  opacity: 0.85;
}

/* Rolling scanline beam */
.crt-roll-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20%;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 50%,
    rgba(255, 255, 255, 0.08) 95%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 31;
  animation: crtRoll 8s linear infinite;
}

@keyframes crtRoll {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(600%); }
}

/* CRT Vignette curvature shadow */
.crt-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 32;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0) 65%,
    rgba(0, 0, 0, 0.65) 90%,
    rgba(0, 0, 0, 0.95) 100%
  );
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.85);
}

/* CRT Flicker animation */
.crt-flicker-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 33;
  opacity: 0.04;
  background: #ffffff;
  animation: crtFlicker 0.12s infinite;
}

@keyframes crtFlicker {
  0% { opacity: 0.02; }
  25% { opacity: 0.04; }
  50% { opacity: 0.01; }
  75% { opacity: 0.05; }
  100% { opacity: 0.02; }
}

/* Scan fragments / static specks */
.crt-scan-fragments {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, rgba(255,255,255,0.25), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 80px 140px, rgba(255,255,255,0.2), rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 150px 70px, rgba(255,255,255,0.3), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 240px 220px, rgba(255,255,255,0.2), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 190px 340px, rgba(255,255,255,0.25), rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 60px 420px, rgba(255,255,255,0.2), rgba(0,0,0,0)),
    radial-gradient(1px 1px at 280px 480px, rgba(255,255,255,0.3), rgba(0,0,0,0));
  background-size: 320px 520px;
  animation: fragmentsDrift 4s steps(4) infinite;
  opacity: 0.6;
}

@keyframes fragmentsDrift {
  0% { transform: translateY(0); }
  25% { transform: translateY(-4px) translateX(2px); }
  50% { transform: translateY(2px) translateX(-3px); }
  75% { transform: translateY(-2px) translateX(1px); }
  100% { transform: translateY(0); }
}

/* Content stage */
.terminal-screen-content {
  position: relative;
  z-index: 20;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem 2rem;
  color: var(--term-white);
  text-shadow: 0 0 5px var(--term-glow);
  user-select: none;
}

/* ==========================================================================
   Screen 1: Initial Load (Blank Screen + Blinking Cursor)
   ========================================================================== */

.screen-initial {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.terminal-cursor {
  display: inline-block;
  width: 18px;
  height: 3px;
  background-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
  animation: cursorBlink 1.05s infinite steps(1);
}

.terminal-cursor.vertical {
  width: 10px;
  height: 16px;
}

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

.screen-hint {
  position: absolute;
  bottom: 2rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
  transition: opacity 0.3s ease;
}

/* ==========================================================================
   Screen 2: Searching for Signal...
   ========================================================================== */

.screen-searching {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
  gap: 1.25rem;
  cursor: pointer;
}

.searching-readout {
  font-size: 1.05rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

/* Progress bar container */
.searching-progress-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 260px;
}

.segmented-progress-bar {
  display: flex;
  gap: 3px;
  width: 100%;
  justify-content: center;
}

.progress-segment {
  flex: 1;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 1px;
  transition: all 0.15s ease;
}

.progress-segment.filled {
  background-color: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.85);
}

.progress-pct-readout {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.15em;
  font-family: var(--font-mono);
}

/* Glitch scan bars drifting */
.scan-line-fragment {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

/* ==========================================================================
   Screen 3: Signal Detected (Forming Data)
   ========================================================================== */

.screen-detected {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 0.5rem 0;
}

.detected-header {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detected-title {
  font-size: 1.15rem;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

.detected-sub {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.7);
}

/* Forming Face / Abstract Shape Container */
.detected-visual-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 0.75rem 0;
  overflow: hidden;
}

.detected-face-frame {
  position: relative;
  width: 180px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detected-face-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: contrast(160%) brightness(110%);
  animation: glitch-jitter 2.4s infinite;
  mask-image: radial-gradient(circle, black 65%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle, black 65%, transparent 100%);
}

/* Vertical analysing laser scan */
.analysing-laser {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff, 0 0 20px rgba(255, 255, 255, 0.8);
  animation: laserScan 2.2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes laserScan {
  0% { top: 5%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 95%; opacity: 0; }
}

@keyframes glitch-jitter {
  0%, 94%, 100% { transform: translate(0, 0); }
  95% { transform: translate(-2px, 1px); }
  96% { transform: translate(2px, -1px); filter: contrast(220%) invert(0.1); }
  97% { transform: translate(-1px, -2px); }
  98% { transform: translate(1px, 2px); }
  99% { transform: translate(0, 0); }
}

/* Bottom data readout */
.detected-telemetry {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: #e2e8f0;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.5rem 0.25rem;
}

.telemetry-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.telemetry-label {
  color: #818cf8;
  color: rgba(255, 255, 255, 0.6);
  min-width: 95px;
}

.telemetry-value {
  color: #ffffff;
  font-weight: 500;
}

.telemetry-value.live {
  color: #00ff88;
  text-shadow: 0 0 6px rgba(0, 255, 136, 0.6);
}

/* ==========================================================================
   Screen 4: Title Reveal (Tap to Enter)
   ========================================================================== */

.screen-reveal {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 0.5rem 0 1rem;
}

.reveal-visual-box {
  position: relative;
  width: 180px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
}

.reveal-face-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: contrast(180%) brightness(115%);
  mask-image: radial-gradient(circle, black 75%, transparent 100%);
  -webkit-mask-image: radial-gradient(circle, black 75%, transparent 100%);
  animation: breathingGlow 3.5s ease-in-out infinite alternate;
}

@keyframes breathingGlow {
  0% { filter: contrast(170%) brightness(105%) drop-shadow(0 0 4px rgba(255,255,255,0.4)); }
  100% { filter: contrast(190%) brightness(125%) drop-shadow(0 0 12px rgba(255,255,255,0.7)); }
}

/* Main typography */
.reveal-brand-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.reveal-main-title {
  font-size: 2.1rem;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.9), 0 0 24px rgba(255, 255, 255, 0.5);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.reveal-sub-title {
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
  margin-top: 0.3rem;
}

.reveal-tag {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
}

/* Tap to Enter button */
.reveal-enter-btn {
  width: 100%;
  max-width: 250px;
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 0.85rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  outline: none;
  border-radius: 2px;
  transition: all 0.2s ease-in-out;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.reveal-enter-btn:hover,
.reveal-enter-btn:focus-visible {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.85);
  transform: translateY(-1px);
}

.reveal-enter-btn:active {
  transform: translateY(1px);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

/* Flash transition animation when entering */
.crt-flash-active {
  animation: crtEnterFlash 0.6s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes crtEnterFlash {
  0% { filter: brightness(1) invert(0); }
  30% { filter: brightness(3.5) invert(0.8); }
  60% { filter: brightness(2) contrast(200%); }
  100% { filter: brightness(1); }
}

/* ==========================================================================
   Navigation Footbar & Presentation Controls
   ========================================================================== */

.step-nav-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.4rem 0.8rem;
  background: rgba(15, 17, 21, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

.step-nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.step-nav-dot.active {
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
  transform: scale(1.3);
}

.step-nav-dot:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .crt-scanlines,
  .crt-roll-line,
  .crt-flicker-layer,
  .crt-scan-fragments,
  .analysing-laser,
  .reveal-face-img,
  .detected-face-img {
    animation: none !important;
  }
}
