* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Courier New', Courier, monospace, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #030d03;
  color: #00ff66;
}

/* CRT Screen Effect */
#crt-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: radial-gradient(circle, rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
  z-index: 99;
}

#scanline {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.3));
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 100;
  opacity: 0.6;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(3, 13, 3, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal-content {
  border: 2px solid #00ff66;
  background: #061806;
  padding: 25px;
  text-align: center;
  max-width: 420px;
  box-shadow: 0 0 20px #00ff66;
  border-radius: 8px;
}

.hud-glitch-title {
  font-size: 28px;
  font-weight: bold;
  letter-spacing: 4px;
  color: #00ff66;
  text-shadow: 0 0 10px #00ff66;
  margin-bottom: 5px;
}

.sub-title {
  font-size: 11px;
  letter-spacing: 2px;
  color: #88ffaa;
  margin-bottom: 15px;
}

.disclaimer-box {
  border: 1px dashed #ff3333;
  color: #ff6666;
  font-size: 10px;
  padding: 10px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.desc {
  font-size: 13px;
  margin-bottom: 20px;
  color: #ccffdd;
}

.hud-btn {
  background: #003311;
  border: 1px solid #00ff66;
  color: #00ff66;
  padding: 12px 24px;
  font-weight: bold;
  font-size: 14px;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 0 10px #00ff66;
  transition: all 0.2s;
}

.hud-btn:active {
  background: #00ff66;
  color: #000;
}

/* App Layout */
#app-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

#webcam {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scaleX(1); /* dynamically flipped for selfie */
}

#output-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* HUD Top Bar */
#hud-header {
  position: absolute;
  top: env(safe-area-inset-top, 10px);
  left: 10px; right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(3, 15, 3, 0.7);
  border: 1px solid rgba(0, 255, 102, 0.4);
  padding: 8px 12px;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background-color: #00ff66;
  border-radius: 50%;
  box-shadow: 0 0 8px #00ff66;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

.title {
  font-weight: bold;
  letter-spacing: 2px;
  font-size: 16px;
}

.ver {
  font-size: 9px;
  color: #66cc88;
  border: 1px solid #66cc88;
  padding: 1px 4px;
  border-radius: 3px;
}

.hud-icon-btn {
  background: rgba(0, 50, 20, 0.8);
  border: 1px solid #00ff66;
  color: #00ff66;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* HUD Telemetry */
#hud-telemetry {
  position: absolute;
  top: 65px; right: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
  width: 160px;
}

.hud-card {
  background: rgba(3, 15, 3, 0.75);
  border: 1px solid rgba(0, 255, 102, 0.3);
  padding: 6px 8px;
  border-radius: 4px;
  backdrop-filter: blur(2px);
}

.card-label {
  font-size: 9px;
  color: #88ffaa;
  letter-spacing: 1px;
}

.card-value {
  font-size: 14px;
  font-weight: bold;
  margin: 2px 0;
}

.status-glow {
  color: #00ff66;
  text-shadow: 0 0 5px #00ff66;
}

.meter-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 40, 0, 0.8);
  border: 1px solid #005522;
  border-radius: 3px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  background: #00ff66;
  box-shadow: 0 0 6px #00ff66;
  transition: width 0.3s ease;
}

.meter-fill.alert {
  background: #ff3333;
  box-shadow: 0 0 6px #ff3333;
}

/* Center Entity Alert */
#entity-alert {
  position: absolute;
  top: 70px;
  left: 10px;
  background: rgba(200, 0, 0, 0.85);
  color: #fff;
  border: 2px solid #ff3333;
  padding: 8px 16px;
  font-weight: bold;
  letter-spacing: 2px;
  font-size: 14px;
  border-radius: 4px;
  box-shadow: 0 0 15px #ff0000;
  animation: blink 0.6s infinite alternate;
  z-index: 25;
}

@keyframes blink {
  from { opacity: 1; }
  to { opacity: 0.4; }
}

/* Protection Cross Overlay */
#protection-overlay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  pointer-events: none;
  transition: opacity 0.5s ease-in-out;
}

.cross-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#cross-img {
  width: 220px;
  height: auto;
  opacity: 0.75;
  filter: drop-shadow(0 0 15px #00ff66) drop-shadow(0 0 30px #ffffff);
  animation: holyPulse 2s infinite alternate;
}

@keyframes holyPulse {
  0% { transform: scale(0.96); filter: drop-shadow(0 0 10px #00ff66); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 25px #ffffff) drop-shadow(0 0 15px #00ff66); }
}

.protection-text {
  margin-top: 15px;
  font-size: 18px;
  font-weight: bold;
  color: #ffffff;
  letter-spacing: 3px;
  text-shadow: 0 0 10px #00ff66, 0 0 20px #00ff66;
}

.latin-sub {
  font-size: 10px;
  color: #88ffaa;
  letter-spacing: 1px;
  margin-top: 4px;
}

.hidden {
  display: none !important;
}

/* Bottom Footer Radar & Event Log */
#hud-footer {
  position: absolute;
  bottom: env(safe-area-inset-bottom, 10px);
  left: 10px; right: 10px;
  height: 90px;
  background: rgba(3, 15, 3, 0.8);
  border: 1px solid rgba(0, 255, 102, 0.4);
  border-radius: 6px;
  display: flex;
  padding: 6px;
  gap: 10px;
  backdrop-filter: blur(4px);
  z-index: 10;
}

.radar-box {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 1px solid #00ff66;
  background: radial-gradient(circle, rgba(0,50,0,0.6) 0%, rgba(0,20,0,0.9) 100%);
  overflow: hidden;
  flex-shrink: 0;
}

.radar-sweep {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: conic-gradient(from 0deg, rgba(0, 255, 102, 0.4) 0deg, transparent 60deg, transparent 360deg);
  border-radius: 50%;
  animation: rotateRadar 2.5s linear infinite;
}

@keyframes rotateRadar {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

#radar-blips {
  position: absolute;
  width: 100%; height: 100%;
}

.blip {
  position: absolute;
  width: 6px; height: 6px;
  background: #ff3333;
  border-radius: 50%;
  box-shadow: 0 0 6px #ff3333;
}

.log-box {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.log-title {
  font-size: 9px;
  color: #88ffaa;
  border-bottom: 1px solid rgba(0,255,102,0.3);
  padding-bottom: 2px;
  margin-bottom: 4px;
}

#log-entries {
  font-size: 10px;
  color: #00ff66;
  overflow-y: auto;
  display: flex;
  flex-direction: column-reverse;
  gap: 3px;
}

#log-entries div {
  line-height: 1.2;
}
