/* ===== V19 Hologram Interface — Root Variables ===== */
:root {
  --primary:   #00fff7;
  --secondary: #0ea5e9;
  --accent:    #67e8f9;
  --surface:   rgba(0, 10, 20, 0.7);
  --text:      #e0fcff;
  --text-dim:  rgba(224, 252, 255, 0.55);
  --glow:      rgba(0, 255, 247, 0.35);
  --glow-mid:  rgba(0, 255, 247, 0.55);
  --glow-strong: rgba(0, 255, 247, 0.8);
  --border:    rgba(0, 255, 247, 0.2);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #00040a;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 500;
}

/* ===== Three.js Canvas Container (z-index: 0) ===== */
#three-container {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#three-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ===== Scanline Overlay (z-index: 1) ===== */
/*
 * Creates a subtle CRT scanline texture over the 3D scene.
 * repeating-linear-gradient simulates horizontal scan bands.
 */
.scanline-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 0, 0, 0.06) 3px,
    rgba(0, 0, 0, 0.06) 4px
  );
  /* Hologram flicker animation — subtle opacity oscillation */
  animation: holo-flicker 4s ease-in-out infinite;
}

@keyframes holo-flicker {
  0%   { opacity: 0.80; }
  15%  { opacity: 1.00; }
  17%  { opacity: 0.75; }
  20%  { opacity: 1.00; }
  50%  { opacity: 0.85; }
  72%  { opacity: 1.00; }
  74%  { opacity: 0.70; }
  76%  { opacity: 1.00; }
  100% { opacity: 0.80; }
}

/* ===== Interface Overlay — HUD corners (z-index: 2) ===== */
.interface-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* Top-left HUD block */
.hud-box {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.hud-box.top-left {
  top: 20px;
  left: 20px;
  border-left: 2px solid var(--border);
  padding-left: 10px;
}

.hud-box.top-right {
  top: 20px;
  right: 20px;
  border-right: 2px solid var(--border);
  padding-right: 10px;
  text-align: right;
}

.hud-box .accent {
  color: var(--primary);
  font-weight: 700;
  text-shadow: 0 0 8px var(--primary);
}

/* Bottom decorative bar lines */
.hud-bottom-left,
.hud-bottom-right {
  position: absolute;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-bottom-left { left: 20px; }
.hud-bottom-right { right: 20px; align-items: flex-end; }

.bar-line {
  height: 2px;
  width: 80px;
  background: var(--border);
  border-radius: 1px;
}

.bar-line.short { width: 40px; }

/* ===== Center Stage (z-index: 3) ===== */
.center-stage {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

/* ===== Glass Panel — Main CTA card ===== */
/*
 * Glassmorphism: backdrop-filter blur with cyan border glow.
 * Clip-path gives the hexagonal-corner sci-fi look.
 */
.glass-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 48px 36px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow:
    0 0 40px rgba(0, 255, 247, 0.08),
    0 0 80px rgba(0, 255, 247, 0.04),
    inset 0 0 30px rgba(0, 255, 247, 0.04);
  min-width: 280px;
  max-width: 420px;
  width: 100%;
  /* Entrance animation */
  animation: panel-enter 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Decorative corner brackets */
.corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--primary);
  border-style: solid;
  opacity: 0.7;
}

.corner.tl { top: 6px;  left: 6px;  border-width: 2px 0 0 2px; }
.corner.tr { top: 6px;  right: 6px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: 6px; left: 6px;  border-width: 0 0 2px 2px; }
.corner.br { bottom: 6px; right: 6px; border-width: 0 2px 2px 0; }

/* ===== Panel Title ===== */
.panel-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: clamp(18px, 4vw, 26px);
  letter-spacing: 5px;
  text-align: center;
  line-height: 1.3;
  color: var(--primary);
  text-shadow:
    0 0 12px var(--primary),
    0 0 30px var(--glow);
  /* Subtle glow pulse */
  animation: title-pulse 3s ease-in-out infinite alternate;
}

@keyframes title-pulse {
  from { text-shadow: 0 0 12px var(--primary), 0 0 30px var(--glow); }
  to   { text-shadow: 0 0 20px var(--primary), 0 0 50px var(--glow-mid), 0 0 80px var(--glow); }
}

/* ===== Status Text ===== */
.status-text {
  font-family: 'Rajdhani', sans-serif;
  font-size: clamp(13px, 3vw, 16px);
  font-weight: 500;
  letter-spacing: 4px;
  color: var(--text-dim);
  text-align: center;
  text-transform: uppercase;
  min-height: 24px;
  transition: color 0.4s ease, text-shadow 0.4s ease;
}

/* Processing state — blink + cyan color */
.status-text.processing {
  color: var(--primary);
  text-shadow: 0 0 10px var(--primary);
  animation: status-blink 0.7s steps(1) infinite;
}

/* Success state — steady bright glow */
.status-text.success {
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent), 0 0 30px var(--glow);
  animation: none;
}

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}

/* ===== Activate Button ===== */
/*
 * Minimum touch target: 48px height (exceeds 44px requirement).
 * Skewed clip-path for sci-fi angular look.
 */
.activate-btn {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(13px, 3vw, 15px);
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary);
  background: transparent;
  border: 1px solid var(--primary);
  padding: 14px 40px;
  min-height: 48px;
  min-width: 160px;
  cursor: pointer;
  clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.2s ease;
  text-shadow: 0 0 8px var(--primary);
  box-shadow:
    0 0 16px rgba(0, 255, 247, 0.2),
    inset 0 0 10px rgba(0, 255, 247, 0.05);
  position: relative;
  overflow: hidden;
}

/* Sweep shimmer on hover */
.activate-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    120deg,
    transparent 30%,
    rgba(0, 255, 247, 0.12) 50%,
    transparent 70%
  );
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.activate-btn:hover::before {
  transform: translateX(100%);
}

.activate-btn:hover {
  background: rgba(0, 255, 247, 0.08);
  box-shadow:
    0 0 28px rgba(0, 255, 247, 0.45),
    inset 0 0 14px rgba(0, 255, 247, 0.08);
  transform: scale(1.03);
}

.activate-btn:active {
  transform: scale(0.97);
}

.activate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

/* ===== Connecting state overlay on panel ===== */
/*
 * When processing: panel border glows brighter, box-shadow intensifies.
 */
.glass-panel.connecting {
  border-color: rgba(0, 255, 247, 0.45);
  box-shadow:
    0 0 60px rgba(0, 255, 247, 0.15),
    0 0 120px rgba(0, 255, 247, 0.06),
    inset 0 0 40px rgba(0, 255, 247, 0.07);
}

/* ===== Success state on panel ===== */
.glass-panel.success {
  border-color: rgba(0, 255, 247, 0.6);
  box-shadow:
    0 0 80px rgba(0, 255, 247, 0.2),
    0 0 160px rgba(0, 255, 247, 0.08),
    inset 0 0 50px rgba(0, 255, 247, 0.1);
  animation: panel-success-flash 0.4s ease;
}

@keyframes panel-success-flash {
  0%   { box-shadow: 0 0 80px rgba(0, 255, 247, 0.5), inset 0 0 60px rgba(0, 255, 247, 0.3); }
  100% { box-shadow: 0 0 80px rgba(0, 255, 247, 0.2), inset 0 0 50px rgba(0, 255, 247, 0.1); }
}

/* ===== Responsive — mobile-first ===== */
@media (max-width: 480px) {
  .hud-box { font-size: 10px; letter-spacing: 1px; }
  .hud-box.top-left  { top: 12px; left: 12px; }
  .hud-box.top-right { top: 12px; right: 12px; }

  .glass-panel { padding: 32px 28px 28px; }

  .bar-line       { width: 50px; }
  .bar-line.short { width: 25px; }
}

@media (max-width: 360px) {
  .hud-box { display: none; }
  .glass-panel { padding: 28px 20px 24px; gap: 16px; }
}

/* ===== Reduced Motion ===== */
/*
 * Disables all animations for users who prefer less motion.
 * Three.js scene is controlled in JS via prefers-reduced-motion check.
 */
@media (prefers-reduced-motion: reduce) {
  .scanline-overlay,
  .panel-title,
  .glass-panel,
  .status-text,
  .glass-panel.success { animation: none !important; }

  .activate-btn:hover  { transform: none; }
  .activate-btn:active { transform: none; }
  .activate-btn::before { display: none; }
}
