:root {
  --neon-green: #34d399; /* emerald-400 */
  --neon-green-strong: #10b981; /* emerald-500 */
  --indigo: #6366f1; /* indigo-500 */
  --bg-deep: #0b1020; /* deep navy */
}

body {
  font-family: 'Inter', sans-serif;
  color: #e5e7eb;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(1200px 600px at -10% -10%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, rgba(16, 185, 129, 0.15), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: auto, auto, 24px 24px, 24px 24px;
  background-position: 0 0, 0 0, 0 0, 0 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

.fade-in {
  animation: fadeIn 1s ease-out;
}

.scale-in {
  animation: scaleIn 0.5s ease-out;
}

.slide-in {
  animation: slideIn 0.5s ease-out;
}

.pulse {
  animation: pulse 0.3s ease-in-out;
}

.hover-scale:hover {
  transform: scale(1.05);
  transition: transform 0.2s ease-in-out;
}

.title {
  font-size: 50px;
  line-height: 1.1;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  letter-spacing: 0.5px;
  color: var(--neon-green);
  text-shadow:
    0 0 8px rgba(52, 211, 153, 0.6),
    0 0 16px rgba(52, 211, 153, 0.35),
    0 0 28px rgba(99, 102, 241, 0.25);
}

.social-icon {
  width: 24px;
  height: 24px;
}

/* Avatar positioning for portrait images */
.avatar {
  object-position: 50% 20%; /* bias towards face area */
}

/* Tighter crop for shoulder-to-head framing using wrapper + scaled img */
.avatar-inset {
  object-position: 50% 18%;
  transform: scale(1.3);
  transform-origin: center 20%;
}

/* New, clean avatar framing approach: wrapper + inner image */
.avatar-frame {
  overflow: hidden;
  border-radius: 9999px;
}
.avatar-crop {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transform: scale(1.38) translateY(11%);
  transform-origin: 50% 50%;
}

/* Glassmorphism card */
.glass-card {
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 0.75rem;
  backdrop-filter: blur(12px) saturate(110%);
  -webkit-backdrop-filter: blur(12px) saturate(110%);
  box-shadow:
    0 10px 30px rgba(16, 185, 129, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Avatar subtle neon glow */
.avatar-glow {
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.35)) drop-shadow(0 0 14px rgba(99, 102, 241, 0.25));
}

/* Neon button */
.btn-neon {
  background-image: linear-gradient(135deg, var(--neon-green-strong), var(--indigo));
  box-shadow:
    0 8px 20px rgba(16, 185, 129, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-neon:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 25px rgba(16, 185, 129, 0.35),
    0 0 20px rgba(99, 102, 241, 0.25),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  filter: saturate(1.1);
}
.btn-neon:active { transform: translateY(0); }

/* Neon link glow */
.link-neon {
  color: #a5b4fc; /* indigo-300 */
  transition: color 0.2s ease, text-shadow 0.2s ease, transform 0.15s ease;
}
.link-neon:hover {
  color: var(--neon-green);
  text-shadow:
    0 0 6px rgba(52, 211, 153, 0.6),
    0 0 16px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

/* Toggle switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  width: 38px;
  height: 22px;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.25);
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: radial-gradient(circle at 30% 30%, #fff, #d1fae5);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
  transition: transform 0.2s ease;
}
.switch input:checked + .switch-track {
  background: linear-gradient(135deg, var(--neon-green-strong), var(--indigo));
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 10px rgba(16,185,129,0.35);
}
.switch input:checked + .switch-track::after {
  transform: translateX(16px);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Temporary visibility aid */
.debug-highlight {
  outline: 2px solid #fbbf24; /* amber-400 */
  box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.35), 0 0 16px rgba(251, 191, 36, 0.55);
  border-radius: 10px;
}

/* Panels / sections */
.surface-muted {
  background: rgba(148, 163, 184, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 0.75rem;
}

/* Optional scanlines for hacker vibe */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 2px,
    transparent 4px
  );
}

/*reactive glow using CSS variables set by JS */
.interactive-radius { position: relative; isolation: isolate; }
.interactive-radius::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    180px 160px at var(--mx, 50%) var(--my, 50%),
    rgba(16, 185, 129, 0.24),
    rgba(99, 102, 241, 0.18) 30%,
    transparent 60%
  );
  opacity: var(--glow-opacity, 0);
  transition: opacity 0.2s ease;
}

/* 3D tilt base */
.tilt-3d {
  will-change: transform, filter;
  transform-style: preserve-3d;
  transform-origin: center;
  transition: transform 0.15s ease, filter 0.2s ease;
}

/* Input neon caret + focus */
.input-neon {
  caret-color: var(--neon-green);
}
.input-neon:focus {
  box-shadow:
    0 0 0 2px rgba(99, 102, 241, 0.35),
    0 0 18px rgba(16, 185, 129, 0.25);
}

/* Toast styles */
@keyframes slideUpFade {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
  to { transform: translateY(8px); opacity: 0; }
}
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #eafffb;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  z-index: 50;
  font-size: 0.9rem;
  letter-spacing: 0.3px;
  animation: slideUpFade 180ms ease both, fadeOut 220ms ease 2600ms forwards;
}

/* Matrix canvas layering */
#matrixCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.28;
  pointer-events: none;
  display: none;
}

#app { position: relative; z-index: 1; }

/* Help button + tooltip */
#helpContainer { pointer-events: none; }
#helpBtn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
}
.help-tooltip {
  position: absolute;
  top: 48px;
  left: 0;
  width: min(92vw, 320px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #e5e7eb;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  z-index: 40;
}
.help-tooltip::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 12px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid rgba(99, 102, 241, 0.35);
}
.help-tooltip::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 12px;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid rgba(15, 23, 42, 0.95);
}
.help-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #a5b4fc;
  margin-bottom: 6px;
}
.help-list {
  margin: 0;
  padding-left: 16px;
}
.help-list li {
  margin: 4px 0;
  font-size: 0.85rem;
  line-height: 1.25rem;
}
.help-note {
  margin-top: 8px;
  font-size: 0.8rem;
  color: #93c5fd;
}
.hidden { display: none !important; }

/* Screen reader only content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Global custom scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 185, 129, 0.6) rgba(148, 163, 184, 0.2);
}
*::-webkit-scrollbar {
  width: 8px;
}
*::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.1);
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.6), rgba(99, 102, 241, 0.6));
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.3);
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.8), rgba(99, 102, 241, 0.8));
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

/* Output section for long passwords */
#outputSection {
  max-height: 200px;
  overflow-y: auto;
  word-break: break-all;
}
#outputText {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
  word-break: break-all;
  white-space: pre-wrap;
}

/* Password strength indicator */
.strength-bar {
  width: 12px;
  height: 4px;
  border-radius: 2px;
  background: rgba(148, 163, 184, 0.3);
  transition: background 0.3s ease;
}
.strength-bar.active {
  background: var(--neon-green-strong);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}
.strength-bar.weak { background: #ef4444; }
.strength-bar.fair { background: #f59e0b; }
.strength-bar.good { background: #10b981; }
.strength-bar.strong { background: var(--neon-green-strong); }

/* Loading spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid var(--neon-green);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Generation process animation */
.process-step {
  font-size: 0.75rem;
  color: rgba(148, 163, 184, 0.6);
  transition: all 0.3s ease;
  padding: 2px 0;
}
.process-step.active {
  color: var(--neon-green);
  text-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
  transform: translateX(4px);
}
.process-step.completed {
  color: #10b981;
}


/* Themed range slider (length meter) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 24px; /* room for thumb */
  background: transparent;
  --range-pct: 100%;
}
input[type="range"]:focus { outline: none; }

/* WebKit track */
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background:
    linear-gradient(90deg, var(--neon-green-strong), var(--indigo)) 0 0 / var(--range-pct) 100% no-repeat,
    rgba(148, 163, 184, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 9999px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.25);
}
/* WebKit thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px; /* centers on 6px track */
  border-radius: 9999px;
  background: radial-gradient(circle at 30% 30%, #eafffb, #a7f3d0);
  border: 1px solid rgba(16, 185, 129, 0.6);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.35),
    0 0 10px rgba(16, 185, 129, 0.35),
    0 0 0 1px rgba(255,255,255,0.06) inset;
  cursor: pointer;
}

/* Firefox track */
input[type="range"]::-moz-range-track {
  height: 6px;
  background: rgba(148, 163, 184, 0.22);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 9999px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.25);
}
/* Firefox filled progress */
input[type="range"]::-moz-range-progress {
  height: 6px;
  background-image: linear-gradient(90deg, var(--neon-green-strong), var(--indigo));
  border-radius: 9999px;
}
/* Firefox thumb */
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: radial-gradient(circle at 30% 30%, #eafffb, #a7f3d0);
  border: 1px solid rgba(16, 185, 129, 0.6);
  box-shadow:
    0 2px 6px rgba(0,0,0,0.35),
    0 0 10px rgba(16, 185, 129, 0.35),
    0 0 0 1px rgba(255,255,255,0.06) inset;
  cursor: pointer;
}

/* Focus glow */
input[type="range"]:focus-visible::-webkit-slider-runnable-track {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}
input[type="range"]:focus-visible::-moz-range-track {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Brand icon tint */
.social-icon {
  filter: invert(76%) sepia(12%) saturate(1290%) hue-rotate(201deg) brightness(96%) contrast(94%);
  transition: filter 0.2s ease, transform 0.15s ease;
}
.link-neon:hover .social-icon {
  filter: invert(79%) sepia(30%) saturate(803%) hue-rotate(92deg) brightness(105%) contrast(105%) drop-shadow(0 0 8px rgba(16,185,129,0.45));
  transform: translateY(-1px) scale(1.05);
}

/* Soft grain/noise overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255,255,255,0.02) 0.5px, transparent 1px),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.02) 0.5px, transparent 1px),
    radial-gradient(circle at 30% 80%, rgba(255,255,255,0.02) 0.5px, transparent 1px),
    radial-gradient(circle at 60% 60%, rgba(255,255,255,0.02) 0.5px, transparent 1px);
  background-size: 120px 120px, 160px 160px, 140px 140px, 200px 200px;
  mix-blend-mode: overlay;
  opacity: 0.5;
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  .fade-in, .scale-in, .slide-in, .pulse { animation: none !important; }
  .hover-scale, .btn-neon, .tilt-3d, .interactive-radius::after { transition: none !important; }
}



