:root {
  --pcb-green: #39ff14;
  --pcb-green-rgb: 0 255 136;
  --pcb-green-soft: rgba(57, 255, 20, 0.22);
  --pcb-bg: var(--vault-bg);
  --pcb-text: var(--vault-text-body);
  --z-content: 0;
  --z-header: 40;
  --z-modal-backdrop: 90;
  --z-modal: 100;
  --z-toast: 200;
}
body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background-color: var(--pcb-bg);
  color: var(--pcb-text);
  min-height: 100vh;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    opacity 0.3s ease-in;
}
.font-heading {
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.trace-grid {
  background-image:
    linear-gradient(90deg, rgba(57, 255, 20, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(57, 255, 20, 0.06) 1px, transparent 1px);
  background-size:
    48px 48px,
    border-box;
  mask-image: radial-gradient(
    ellipse 80% 70% at 50% 30%,
    black 10%,
    transparent 75%
  );
}
.glow-border {
  box-shadow:
    0 0 0 1px rgba(57, 255, 20, 0.45),
    0 0 20px rgba(57, 255, 20, 0.25),
    inset 0 0 24px rgba(57, 255, 20, 0.04);
}
.glow-border-strong:hover {
  box-shadow:
    0 0 0 1px rgba(57, 255, 20, 0.75),
    0 0 32px rgba(57, 255, 20, 0.35),
    inset 0 0 28px rgba(57, 255, 20, 0.08);
}
.icon-green {
  color: var(--pcb-green);
  filter: drop-shadow(0 0 6px rgba(57, 255, 20, 0.55));
}
.pad-ring {
  box-shadow:
    0 0 0 2px rgba(57, 255, 20, 0.25),
    0 0 12px rgba(57, 255, 20, 0.15);
}
input[type="range"].slider-green::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  background: #39ff14;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.8);
  cursor: pointer;
}
input[type="range"].slider-green::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  background: #39ff14;
  border: none;
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.8);
  cursor: pointer;
}
details summary::-webkit-details-marker {
  display: none;
}

/* PCB Grid Background */
.bg-grid {
  background-image:
    linear-gradient(var(--trace) 1px, transparent 1px),
    linear-gradient(90px, var(--trace) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ANIMATIONS */
@keyframes rain {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateY(60px);
    opacity: 0;
  }
}

@keyframes split-thumb {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(120px, -50px) scale(0.5);
    opacity: 0;
  }
}

@keyframes archive-sink {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateY(120px);
    opacity: 0;
  }
}

@keyframes pulse-shield {
  0%,
  100% {
    box-shadow: 0 0 5px var(--neon);
    border-color: var(--neon);
  }
  50% {
    box-shadow: 0 0 20px var(--neon);
    border-color: #fff;
  }
}

.animate-rain {
  animation: rain 3s infinite linear;
}
.animate-thumb {
  animation: split-thumb 2s infinite ease-out;
}
.animate-sink {
  animation: archive-sink 4s infinite cubic-bezier(0.4, 0, 1, 1);
}
.shield-active {
  animation: pulse-shield 2s infinite;
}

/* Custom Scrollbar for the text side */
.custom-scroll::-webkit-scrollbar {
  width: 4px;
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: var(--trace);
  border-radius: 10px;
}

/* Використовуй класи Tailwind з префіксами тем */
.white-pcb .glass-card {
  background: var(--pcb-card);
  border-color: var(--pcb-border);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-fade-in-up {
  animation: fade-in-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-bounce-slow {
  animation: bounce 3s infinite;
}
.shadow-glow-vault-sm {
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}
input,
textarea,
select {
  background-color: var(--input-bg) !important;
  color: var(--input-text) !important;
  border: 1px solid var(--input-border) !important;

  /* Додаткові покращення для гарного вигляду */
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}

/* Стиль при фокусі, щоб підкреслити активність */
input:focus,
textarea:focus,
select:focus {
  border-color: var(--pcb-green) !important;
  outline: none;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.1);
}

/* Це змусить автозаповнення підлаштовуватися під тему */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  /* Текст беремо зі змінної теми */

  -webkit-text-fill-color: var(--input-text) !important;

  /* Фон (через тінь) теж беремо зі змінної теми */
  box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--input-bg) inset !important;

  /* Плавний перехід, щоб колір не стрибав при зміні теми */
  transition: background-color 5000s ease-in-out 0s;
  caret-color: var(--input-text);
}

@keyframes flow-bg {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.circuit-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  width: 100vw;
  height: 100dvh;
  transition: all 0.5s ease;

  /* Світла тема: зелений WhatsApp */
  color: rgb(var(--vault-accent-rgb));
  opacity: 0.4; /* Робимо лінії ледь помітними на білому */
  mix-blend-mode: multiply;
}

.dark .circuit-layer {
  /* Темна тема: неоновий зелений */
  color: rgb(var(--vault-accent-rgb));
  opacity: 0.25;
  mix-blend-mode: screen;
}

/* Додай це в самий низ CSS */
#app-shell,
#main-content-wrapper,
main,
.content-wrapper {
  position: relative;
  z-index: var(--z-content);
}
header {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  z-index: var(--z-header);
  will-change: backdrop-filter;
}
.cloak {
  opacity: 0;
}
#main-wrapper {
  position: relative;
  z-index: var(--z-content);
}

#modal-layer {
  z-index: var(--z-modal-backdrop);
}

#modal-layer #error-modal,
#modal-layer #confirm-modal {
  z-index: var(--z-modal);
}

#cookie-banner,
#verification-toast {
  z-index: var(--z-toast);
}

body.modal-open #app-shell {
  filter: blur(4px) brightness(0.78);
  pointer-events: none;
  user-select: none;
}

body.modal-open header {
  pointer-events: none;
}
