*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Brand palette */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.12);
  --accent-glow: rgba(99, 102, 241, 0.25);

  /* Strength colors */
  --weak: #ef4444;
  --fair: #f59e0b;
  --strong: #10b981;

  /* Surfaces */
  --bg-body: #f0f0f5;
  --bg-card: rgba(255, 255, 255, 0.30);
  --bg-card-border: rgba(255, 255, 255, 0.5);
  --bg-card-solid: #ffffff;
  --bg-output: #1e1b2e;

  /* Text */
  --text-primary: #1a1a2e;
  --text-secondary: #5b5b7b;
  --text-muted: #8888a4;
  --text-on-dark: #e8e6f0;
  --text-on-accent: #ffffff;

  /* Borders & misc */
  --border: rgba(0, 0, 0, 0.06);
  --border-control: rgba(0, 0, 0, 0.10);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-glow: 0 4px 32px var(--accent-glow);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 900px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Dark mode (auto from system preference) ── */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg-body: #0f0e17;
    --bg-card: rgba(30, 28, 46, 0.35);
    --bg-card-border: rgba(255, 255, 255, 0.08);
    --bg-card-solid: #1e1c2e;
    --bg-output: #12101e;
    --text-primary: #ededf4;
    --text-secondary: #a0a0be;
    --text-muted: #6e6e8a;
    --border: rgba(255, 255, 255, 0.06);
    --border-control: rgba(255, 255, 255, 0.10);
    --shadow-card: 0 4px 24px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --accent-light: rgba(99, 102, 241, 0.18);
  }
}

/* ── Dark mode (forced via toggle) ── */
:root.dark {
  --bg-body: #0f0e17;
  --bg-card: rgba(30, 28, 46, 0.35);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-card-solid: #1e1c2e;
  --bg-output: #12101e;
  --text-primary: #ededf4;
  --text-secondary: #a0a0be;
  --text-muted: #6e6e8a;
  --border: rgba(255, 255, 255, 0.06);
  --border-control: rgba(255, 255, 255, 0.10);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --accent-light: rgba(99, 102, 241, 0.18);
}

body {
  font-family: var(--font);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-body);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Wave pattern background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.08), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(236, 72, 153, 0.06), transparent 50%),
    url("../assets/waves.svg") center / cover no-repeat;
  pointer-events: none;
  z-index: 0;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) body::before {
    background:
      radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.12), transparent 60%),
      radial-gradient(ellipse 60% 50% at 80% 80%, rgba(236, 72, 153, 0.08), transparent 50%),
      url("../assets/waves.svg") center / cover no-repeat;
    filter: invert(1) opacity(0.5);
  }
}
.dark body::before {
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(236, 72, 153, 0.08), transparent 50%),
    url("../assets/waves.svg") center / cover no-repeat;
  filter: invert(1) opacity(0.5);
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Header ── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-card);
  backdrop-filter: blur(4px) saturate(1.4);
  -webkit-backdrop-filter: blur(4px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.site-header .container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
}
.site-header .logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.site-header .logo span {
  color: var(--accent);
}
.site-header nav a {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-left: 24px;
  transition: color var(--transition);
}
.site-header nav a:hover { color: var(--text-primary); text-decoration: none; }
.site-header nav {
  display: flex;
  align-items: center;
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
  margin-left: 24px;
}
.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  transition: color var(--transition);
}
.nav-dropdown-btn:hover { color: var(--text-primary); }
.nav-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 240px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  padding: 8px 0;
  z-index: 100;
}
@media (min-width: 641px) {
  .nav-dropdown-menu {
    width: 520px;
    column-count: 2;
    column-gap: 0;
  }
}
.nav-dropdown-menu.open { display: block; }
.nav-category {
  padding: 10px 16px 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  opacity: 0.7;
  break-after: avoid;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.nav-category:first-child {
  border-top: none;
  margin-top: 0;
}
.nav-tool {
  display: block;
  padding: 6px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  margin: 0 !important;
  break-inside: avoid;
}
.nav-tool:hover {
  background: var(--accent-light);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-active {
  color: var(--accent);
  font-weight: 600;
}

/* Theme toggle */
.theme-toggle {
  margin-left: 16px;
  background: none;
  border: 1px solid var(--border-control);
  border-radius: 20px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1;
  transition: all var(--transition);
  display: flex;
  align-items: center;
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Main layout ── */
main {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ── Ad slots ── */
.ad-slot {
  background: var(--bg-card-solid);
  border: 1px dashed var(--border-control);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin: 20px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Hero ── */
.hero {
  text-align: center;
  margin: 12px 0 28px;
}
.hero h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  line-height: 1.15;
}
.hero p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Card (glassmorphic) ── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(3px) saturate(1.3);
  -webkit-backdrop-filter: blur(3px) saturate(1.3);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

/* ── Output area ── */
.output-area {
  position: relative;
  background: var(--bg-output);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
/* Subtle inner glow */
.output-area::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 30% 0%, rgba(99, 102, 241, 0.1), transparent 60%);
  pointer-events: none;
}
.password-display {
  position: relative;
  flex: 1;
  font-family: "JetBrains Mono", "SF Mono", "Fira Code", Consolas, monospace;
  font-size: 1.1rem;
  color: var(--text-on-dark);
  word-break: break-all;
  line-height: 1.6;
  white-space: pre-wrap;
}
.password-display.multiple { font-size: 0.88rem; }
.password-display.placeholder {
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--font);
  font-size: 0.95rem;
}

.btn-copy {
  position: relative;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-on-dark);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}
.btn-copy:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
}
.btn-copy.copied {
  background: var(--strong);
  border-color: var(--strong);
  color: white;
}

/* ── Strength meter ── */
.strength-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-bottom: 6px;
  overflow: hidden;
}
.strength-bar .fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s var(--transition), background 0.4s;
  width: 0%;
}
.strength-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.strength-weak { color: var(--weak); }
.strength-weak .fill { background: var(--weak); }
.strength-fair { color: var(--fair); }
.strength-fair .fill { background: var(--fair); }
.strength-strong { color: var(--strong); }
.strength-strong .fill { background: linear-gradient(90deg, var(--strong), #34d399); }

/* ── Slider ── */
.slider-group { margin-bottom: 20px; }
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.slider-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}
.slider-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 12px;
  border-radius: 20px;
  min-width: 40px;
  text-align: center;
}
input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-control);
  border-radius: 3px;
  outline: none;
  transition: background var(--transition);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: transform var(--transition), box-shadow var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 16px var(--accent-glow);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ── Character option checkboxes ── */
.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
@media (max-width: 480px) {
  .controls-grid { grid-template-columns: 1fr; }
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-control);
  background: transparent;
  transition: all var(--transition);
  user-select: none;
}
.form-group label:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text-primary);
}
.form-group label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--text-primary);
}

.form-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Extra options ── */
.extra-options {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 4px;
}
.extra-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.extra-row label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.extra-row input[type="number"] {
  width: 70px;
  padding: 8px 10px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  background: var(--bg-card-solid);
  color: var(--text-primary);
  transition: border-color var(--transition);
}
.extra-row input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.extra-row input[type="text"] {
  flex: 1;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border-control);
  border-radius: var(--radius-sm);
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: 0.85rem;
  background: var(--bg-card-solid);
  color: var(--text-primary);
  transition: border-color var(--transition);
}
.extra-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ── Generate button ── */
.btn-generate {
  width: 100%;
  padding: 15px;
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: all var(--transition);
  box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-generate:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}
.btn-generate:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px var(--accent-glow);
}

/* ── Info / SEO content ── */
.info-section h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.info-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.info-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 20px 0 8px;
}
.info-section p {
  color: var(--text-secondary);
  font-size: 0.925rem;
  margin-bottom: 12px;
}
.info-section ul {
  color: var(--text-secondary);
  font-size: 0.925rem;
  padding-left: 20px;
  margin-bottom: 12px;
}
.info-section li { margin-bottom: 6px; }
.info-section code {
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

/* ── Footer ── */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 24px 20px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.site-footer a {
  color: var(--text-muted);
  margin: 0 12px;
  font-weight: 500;
  transition: color var(--transition);
}
.site-footer a:hover { color: var(--text-primary); text-decoration: none; }

/* ── Mobile header ── */
@media (max-width: 640px) {
  .site-header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 0;
    gap: 4px;
  }
  .site-header .logo {
    font-size: 0.88rem;
    width: 100%;
    text-align: center;
  }
  .site-header nav {
    width: 100%;
    justify-content: center;
    gap: 0;
  }
  .site-header nav a {
    font-size: 0.78rem;
    margin-left: 16px;
  }
  .nav-dropdown { margin-left: 0; }
  .nav-dropdown-btn { font-size: 0.78rem; }
  .nav-dropdown-menu {
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    transform: none;
    width: auto;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
  .hero h1 { font-size: 1.4rem; }
  .hero p { font-size: 0.88rem; }
}

/* ── Accessibility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
