/* ===== TOP SECRET THEME ===== */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Orbitron:wght@500;700&display=swap');

:root {
  --bg: #050a05;
  --panel: #0a150a;
  --accent: #00ff41;
  --accent-dim: #00aa2a;
  --danger: #ff003c;
  --warning: #ffcc00;
  --text: #c8ffc8;
  --muted: #4a7a4a;
  --glow: 0 0 12px rgba(0, 255, 65, 0.6);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden;
  cursor: default;
}

/* ===== LOADING SCREEN ===== */
#loading-screen {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, #0a1a0a 0%, #000 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.8s ease, visibility 0.8s;
}

#loading-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  position: relative;
  width: min(90vw, 520px);
}

.classified-stamp {
  display: inline-block;
  border: 3px solid var(--danger);
  color: var(--danger);
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 6px;
  padding: 8px 24px;
  transform: rotate(-8deg);
  margin-bottom: 30px;
  text-shadow: 0 0 10px var(--danger);
  animation: pulse-red 2s infinite;
}

.glitch-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent);
  text-shadow: var(--glow);
  position: relative;
  margin-bottom: 40px;
}

.glitch-title::before,
.glitch-title::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch-title::before {
  left: 2px;
  text-shadow: -2px 0 var(--danger);
  clip: rect(24px, 550px, 90px, 0);
  animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

.glitch-title::after {
  left: -2px;
  text-shadow: -2px 0 #00f0ff;
  clip: rect(85px, 550px, 140px, 0);
  animation: glitch-anim 3s infinite linear alternate-reverse;
}

.loading-bar-container {
  width: 100%;
  height: 6px;
  background: #111;
  border: 1px solid var(--accent-dim);
  margin-bottom: 18px;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  box-shadow: var(--glow);
  transition: width 0.3s ease;
}

.loading-status {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 2px;
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 65, 0.03) 2px,
    rgba(0, 255, 65, 0.03) 4px
  );
  pointer-events: none;
}

/* ===== MAIN APP ===== */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(0, 40, 0, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(0, 30, 0, 0.3) 0%, transparent 50%),
    var(--bg);
}

#app.hidden {
  display: none;
}

/* HUD Corners */
.hud-overlay {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  z-index: 50;
}

.corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid var(--accent);
  opacity: 0.7;
}

.corner.tl { top: 0; left: 0; border-right: none; border-bottom: none; }
.corner.tr { top: 0; right: 0; border-left: none; border-bottom: none; }
.corner.bl { bottom: 0; left: 0; border-right: none; border-top: none; }
.corner.br { bottom: 0; right: 0; border-left: none; border-top: none; }

/* Top / Bottom bars */
.top-bar, .bottom-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(0, 20, 0, 0.85);
  border-bottom: 1px solid var(--accent-dim);
  font-size: 0.8rem;
  letter-spacing: 1px;
  z-index: 40;
}

.bottom-bar {
  border-bottom: none;
  border-top: 1px solid var(--accent-dim);
  font-size: 0.7rem;
  color: var(--muted);
}

.logo {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  color: var(--accent);
  text-shadow: var(--glow);
}

.blink {
  animation: blink 1.2s infinite;
  color: var(--danger);
}

.status-indicator {
  color: var(--accent);
}

.clearance {
  color: var(--warning);
  font-weight: 700;
}

/* Main Stage */
.main-stage {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  min-height: 0;
}

.video-container {
  flex: 1;
  position: relative;
  background: #000;
  border: 1px solid var(--accent-dim);
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.15);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  perspective: 1000px;
}

#video, #overlay {
  position: absolute;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

#overlay {
  z-index: 2;
}

.video-frame {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(0, 255, 65, 0.3);
  pointer-events: none;
  z-index: 3;
}

.scan-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 15px var(--accent);
  animation: scan 3.5s linear infinite;
  z-index: 4;
  opacity: 0.7;
}

.access-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-6deg);
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.5rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 4px;
  padding: 12px 30px;
  border: 4px solid;
  z-index: 10;
  text-align: center;
  animation: stamp-in 0.4s ease;
}

.access-banner.granted {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0, 40, 0, 0.85);
  text-shadow: var(--glow);
}

.access-banner.denied {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(40, 0, 0, 0.85);
  text-shadow: 0 0 12px var(--danger);
}

.access-banner.hidden {
  display: none;
}

/* Side Panel */
.side-panel {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.panel-section {
  background: rgba(0, 25, 0, 0.7);
  border: 1px solid var(--accent-dim);
  padding: 14px;
  position: relative;
}

.panel-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  border-top: 2px solid var(--accent);
  border-left: 2px solid var(--accent);
}

.panel-section h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: var(--muted);
}

.data-row span:last-child {
  color: var(--text);
  font-weight: 700;
}

.cyber-btn {
  width: 100%;
  padding: 12px;
  margin-bottom: 8px;
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

.cyber-btn:hover:not(:disabled) {
  background: rgba(0, 255, 65, 0.15);
  box-shadow: var(--glow);
}

.cyber-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.cyber-btn.secondary {
  border-color: var(--danger);
  color: var(--danger);
}

.cyber-btn.secondary:hover:not(:disabled) {
  background: rgba(255, 0, 60, 0.15);
  box-shadow: 0 0 12px rgba(255, 0, 60, 0.5);
}

.panel-section.warning {
  border-color: var(--warning);
}

.panel-section.warning h3 {
  color: var(--warning);
}

.panel-section.warning p {
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--muted);
}

.log-box {
  height: 120px;
  overflow-y: auto;
  font-size: 0.7rem;
  color: var(--muted);
  background: #000;
  padding: 8px;
  border: 1px solid #1a2a1a;
}

.log-box div {
  margin-bottom: 4px;
  border-bottom: 1px solid #0a1a0a;
  padding-bottom: 2px;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse-red {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

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

@keyframes scan {
  0% { top: 0%; }
  100% { top: 100%; }
}

@keyframes glitch-anim {
  0% { clip: rect(32px, 9999px, 58px, 0); }
  20% { clip: rect(12px, 9999px, 90px, 0); }
  40% { clip: rect(70px, 9999px, 20px, 0); }
  60% { clip: rect(5px, 9999px, 110px, 0); }
  80% { clip: rect(45px, 9999px, 30px, 0); }
  100% { clip: rect(85px, 9999px, 70px, 0); }
}

@keyframes stamp-in {
  0% { transform: translate(-50%, -50%) scale(1.8) rotate(-12deg); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(-6deg); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .main-stage {
    flex-direction: column;
  }

  .side-panel {
    width: 100%;
    max-height: 40vh;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .panel-section {
    flex: 1 1 45%;
    min-width: 140px;
  }

  .video-container {
    min-height: 45vh;
  }
}

@media (max-width: 500px) {
  .top-bar, .bottom-bar {
    font-size: 0.65rem;
    padding: 8px 12px;
  }

  .clearance {
    display: none;
  }

  .side-panel {
    max-height: 38vh;
  }

  .panel-section {
    flex: 1 1 100%;
  }
}

/* Hide scrollbars but keep functionality */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: #000;
}
::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
}
