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

html, body {
  height: 100%;
  -webkit-text-size-adjust: 100%;       
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #002e49;
  color: white;
  overflow: hidden;

  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);

  --glow: rgba(231, 228, 228, 0.781);
}

/* =========================
   STATE COLORS
========================= */
body.state-idle { --glow: rgba(2, 112, 116, 0.76); }
body.state-safe { --glow: rgba(0, 255, 42, 0.747); }
body.state-suspicious { --glow: rgba(255, 166, 0, 0.87); }
body.state-critical { --glow: rgba(255, 60, 60, 0.747); }

/* =========================
   BACKGROUND
========================= */
.fx-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.fx-layer::before,
.fx-layer::after {
  content: "";
  position: absolute;
  width: 140%;
  height: 200%;
  left: -20%;
  filter: blur(40px);
  opacity: 0.08;

  background: linear-gradient(
    120deg,
    transparent,
    var(--glow),
    transparent
  );

  animation: rayMove1 10s linear infinite;
}

.fx-layer::after {
  animation: rayMove2 26s linear infinite;
}

.dust {
  position: absolute;
  inset: 0;

  background:
    radial-gradient(var(--glow) 1.5px, transparent 1px);

  background-size: 120px 90px;
  opacity: 0.2;

  animation: dustFloat 5s ease-in-out infinite;
}

/* =========================
   UI
========================= */
.ui-layer {
  position: relative;
  z-index: 10;

  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;

  padding-top: 60px;
}

/* =========================
   LOGO (FINAL LOCKED)
========================= */

.logo {
  width: 120px;
  margin-bottom: 50px;

  position: relative;
  display: block;
  z-index: 1;
}

/* Glow layer (independent from image) */
.logo::after {
  content: "";
  position: absolute;
  inset: -18px;

  border-radius: 50%;

  background: radial-gradient(
    circle,
    var(--glow) 0%,
    transparent 70%
  );

  filter: blur(22px);
  opacity: 0.55;

  z-index: -1;
  pointer-events: none;
}

/* GLASS */
.glass {
  width: 90%;
  max-width: 360px;

  border-radius: 24px;
  padding: 20px;

  display: flex;
  flex-direction: column;
  gap: 14px;

  backdrop-filter: blur(30px);
  background: rgba(255,255,255,0.05);

  box-shadow:
    0 0 35px var(--glow),
    inset 0 1px 0.5px rgba(255,255,255,0.7),
    inset 0 -1px 2px rgba(255,255,255,0.3);
}

/* INPUT */
textarea {
  width: 100%;
  height: 100px;

  border: none;
  border-radius: 14px;
  padding: 12px;

  background: rgba(0,0,0,0.35);
  color: white;

  font-size: 16px;
  outline: none;
}

/* BUTTONS */
.actions {
  display: flex;
  gap: 10px;
}

button {
  flex: 1;
  border-radius: 999px;
  border: none;

  position: relative;
  overflow: hidden;

  padding: 12px;
  color: white;
  cursor: pointer;

  backdrop-filter: blur(20px);
  background: rgba(255,255,255,0.03);

  box-shadow:
    0 4px 12px rgba(0,0,0,0.35),
    inset 0 0 10px var(--glow),
    inset 0 1px 1px rgba(255,255,255,0.6),
    inset 0 -2px 4px rgba(0,0,0,0.4);

  transition: all 0.15s ease;
}

button:active {
  transform: translateY(2px) scale(0.97);
}

.cta {
  font-weight: bold;
  padding: 16px;

  box-shadow:
    0 0 25px var(--glow),
    inset 0 0 12px var(--glow),
    inset 0 1px 1px rgba(255,255,255,0.7);
}

/* =========================
   LOG UI
========================= */

.log-container {
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: 10px;

  z-index: 50;

  display: flex;
  flex-direction: column;
  gap: 8px;

  font-size: 11px;
}

.log-block {
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  padding: 8px;
  backdrop-filter: blur(10px);
}

.log-title {
  font-weight: 600;
  margin-bottom: 4px;
  opacity: 0.8;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 80px;
  overflow-y: auto;
}

.log-item {
  display: grid;
  grid-template-columns: 60px 1fr 1fr;
  gap: 4px;
  opacity: 0.85;
}

.log-list.error .log-item {
  grid-template-columns: 60px 1fr;
  color: #ff6b6b;
}

/* =========================
   LOADER
========================= */

.loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  justify-content: center;
  align-items: center;

  background: rgba(10, 18, 30, 0.6);
  backdrop-filter: blur(20px);
}

.loader-overlay.hidden {
  display: none;
}

.loader {
  display: flex;
}

.loader-bar {
  height: 25px;
  width: 6px;
  margin: 0 3px;
  border-radius: 20px;
  animation: loader 1.2s ease-in-out infinite;
}

.bar-1 {
  background: #07fafa;
}

.bar-2 {
  background: #00ccff9c;
}

.bar-3 {
  background: #0099ff;
}

.bar-4 {
  background: #0066ff;
}

@keyframes loader {
  0% { transform: scaleY(1); }
  50% { transform: scaleY(2); }
  100% { transform: scaleY(1); }
}

/* =========================
   ANIMATIONS
========================= */

@keyframes rayMove1 {
  0% { transform: translateX(-60%) rotate(15deg); }
  100% { transform: translateX(160%) rotate(15deg); }
}

@keyframes rayMove2 {
  0% { transform: translateX(60%) rotate(-12deg); }
  100% { transform: translateX(-160%) rotate(-12deg); }
}

@keyframes dustFloat {
  0% { transform: translate(0,0); }
  50% { transform: translate(-5%, -10%); }
  100% { transform: translate(0,0); }
}