/* =============================================================================
   MicroMind — Design Tokens & Base Layout
   -----------------------------------------------------------------------------
   Direction: the phosphor-scanner HUD aesthetic already established by the
   project's own name and concept (a neural/biometric analysis instrument) —
   near-black CRT-dark background, phosphor green as the primary signal color,
   with cyan/amber/violet reserved for distinct signal *categories* (AI,
   caution, secondary emotion) rather than decoration. The signature element
   is the psychological-profile radar chart; every other card stays quiet and
   uniform so the radar reads as the one deliberately elevated moment.
   ========================================================================== */

:root {
  /* ---- color: phosphor-scanner palette ---- */
  --bg-void: #050a07;
  --bg-panel: #0a1410;
  --bg-panel-raised: #0e1c15;
  --bg-modal: #0b1712;
  --line-dim: rgba(0, 255, 65, 0.16);
  --line-bright: rgba(0, 255, 65, 0.4);

  --neon: #00ff41;
  --neon-dim: #4a7a52;
  --cyan: #00d2ff;
  --amber: #ffd700;
  --alert: #ff3e3e;
  --violet: #9d7bff;

  --ink: #d7ffe2;
  --ink-dim: #6b8f75;
  --ink-faint: #3f5a48;

  /* ---- type ---- */
  --font-display: 'Orbitron', 'Noto Sans Bengali', sans-serif;
  --font-body: 'Rajdhani', 'Noto Sans Bengali', sans-serif;
  --font-mono: 'Share Tech Mono', 'Noto Sans Bengali', monospace;

  /* ---- spacing scale ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --sp-6: 32px;

  --radius-sm: 4px;
  --radius-md: 9px;
  --radius-lg: 16px;

  --glow-neon: 0 0 14px rgba(0, 255, 65, 0.28);
  --glow-cyan: 0 0 14px rgba(0, 210, 255, 0.28);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

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

body {
  background: var(--bg-void);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient CRT scanline sweep across the whole app — the one deliberate
   atmosphere effect, kept slow and faint so it never competes for attention. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 255, 65, 0.035) 50%, transparent 100%);
  height: 220px;
  animation: mm-ambient-scan 9s linear infinite;
}

/* Fine scanline texture, very low opacity. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(to bottom, rgba(0, 255, 65, 0.025) 0px, transparent 1px, transparent 3px);
  opacity: 0.5;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--cyan); }

.hidden { display: none !important; }

/* =============================================================================
   BOOT SCREEN
   ========================================================================== */
#boot-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg-void);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-5);
  transition: opacity 0.5s ease;
  padding: var(--sp-5);
  text-align: center;
}
.boot-logo { color: var(--neon); filter: drop-shadow(0 0 10px rgba(0,255,65,0.5)); }
.boot-title {
  font-family: var(--font-display);
  font-size: 22px; letter-spacing: 4px; color: var(--neon);
  text-shadow: 0 0 12px rgba(0,255,65,0.45);
}
.boot-tagline { font-size: 13px; color: var(--ink-dim); letter-spacing: 1px; }
.boot-bar-track {
  width: min(280px, 70vw); height: 3px; background: rgba(0,255,65,0.12);
  border-radius: 2px; overflow: hidden;
}
#bar { height: 100%; width: 0%; background: var(--neon); box-shadow: var(--glow-neon); transition: width 0.3s ease; }
#status-txt { font-family: var(--font-mono); font-size: 12px; color: var(--ink-dim); min-height: 16px; }

/* =============================================================================
   HEADER
   ========================================================================== */
.hud-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: rgba(5, 10, 7, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-dim);
}
.hud-brand { display: flex; align-items: center; gap: var(--sp-2); color: var(--neon); }
.hud-brand-text { font-family: var(--font-display); font-size: 15px; letter-spacing: 2.5px; }
.hud-right { display: flex; align-items: center; gap: var(--sp-4); }
#clock { font-family: var(--font-mono); font-size: 13px; color: var(--ink-dim); letter-spacing: 1px; }
.icon-btn {
  background: transparent; border: 1px solid var(--line-dim); color: var(--ink);
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.icon-btn:hover { border-color: var(--neon); color: var(--neon); box-shadow: var(--glow-neon); }
.icon-btn:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; }

/* =============================================================================
   MAIN LAYOUT
   ========================================================================== */
.main-container {
  position: relative; z-index: 3;
  display: flex; flex-direction: column;
  max-width: 720px; margin: 0 auto;
}

.camera-box { padding: var(--sp-3) var(--sp-4) 0; }
.viewport {
  position: relative; width: 100%; aspect-ratio: 4 / 3;
  background: #000; border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--line-dim);
  box-shadow: 0 0 0 1px rgba(0,255,65,0.05), var(--glow-neon);
}
#video { width: 100%; height: 100%; object-fit: cover; display: block; }
#video.mirror-x { transform: scaleX(-1); }
#overlay-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#overlay-canvas.mirror-x { transform: scaleX(-1); }

.viewport-frame { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.corner { position: absolute; width: 22px; height: 22px; border: 2px solid var(--neon); opacity: 0.85; filter: drop-shadow(0 0 4px rgba(0,255,65,0.6)); }
.corner-tl { top: 8px; left: 8px; border-right: none; border-bottom: none; }
.corner-tr { top: 8px; right: 8px; border-left: none; border-bottom: none; }
.corner-bl { bottom: 8px; left: 8px; border-right: none; border-top: none; }
.corner-br { bottom: 8px; right: 8px; border-left: none; border-top: none; }

#no-face-banner {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(5,10,7,0.85); border: 1px solid var(--line-dim);
  color: var(--ink-dim); font-size: 12px; padding: 6px 12px; border-radius: 20px;
  z-index: 6; text-align: center; max-width: 90%;
}

.cam-controls { display: flex; gap: var(--sp-2); padding: var(--sp-3) 0; }

.scroll-content { padding: 0 var(--sp-4) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); }

.footer-badge {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  color: var(--ink-faint); font-size: 11px; letter-spacing: 1px; padding: var(--sp-3) 0 var(--sp-5);
}

@media (min-width: 760px) {
  .camera-box { padding-top: var(--sp-4); }
}
