:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --hero-1: #1e3a8a;
  --hero-2: #2563eb;
  --weak: #dc2626;
  --fair: #f59e0b;
  --strong: #16a34a;
  --very-strong: #0d9488;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #1f2a44;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --hero-1: #0f1d4a;
    --hero-2: #1e40af;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 760px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.15rem; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--primary); color: #fff;
}
.brand-name span { color: var(--primary); font-weight: 600; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--primary); }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2));
  color: #fff;
  text-align: center;
  padding: 64px 0 120px;
}
.hero h1 { margin: 0 0 12px; font-size: clamp(1.9rem, 4.5vw, 2.9rem); line-height: 1.15; letter-spacing: -0.02em; }
.hero .lead { margin: 0 auto; max-width: 620px; font-size: 1.1rem; opacity: .9; }

/* Generator */
.generator-section { margin-top: -80px; padding-bottom: 56px; scroll-margin-top: 140px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.output-card { margin-bottom: 20px; }
.output-row { display: flex; align-items: center; gap: 12px; }
.password-output {
  flex: 1; min-width: 0;
  border: none; outline: none; background: transparent; color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: clamp(1.15rem, 3.5vw, 1.75rem);
  font-weight: 600;
  letter-spacing: .02em;
  text-overflow: ellipsis;
}
.output-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  display: grid; place-items: center; width: 46px; height: 46px;
  border-radius: 10px; border: 1px solid var(--border); background: transparent;
  color: var(--muted); cursor: pointer; transition: all .15s ease;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn:active { transform: scale(.94); }
#regenerate.spin svg { animation: spin .4s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

.strength { margin-top: 18px; }
.strength-bar { height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.strength-bar span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .3s ease, background .3s ease; }
.strength-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: .9rem; }
.strength-label { font-weight: 700; }
.entropy { color: var(--muted); }

.options-card h2 { margin: 0 0 20px; font-size: 1.25rem; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.option-block { border: none; margin: 0; padding: 0; min-width: 0; }
.block-title { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 12px; padding: 0; }

.length-control { display: flex; flex-direction: column; gap: 14px; }
.length-control input[type="number"] {
  width: 90px; padding: 10px 12px; font-size: 1.1rem; font-weight: 600;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text);
}
.length-control input[type="number"]:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
input[type="range"] { width: 100%; accent-color: var(--primary); cursor: pointer; }

.radio, .check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; cursor: pointer; }
.radio input, .check input { margin-top: 5px; width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.radio small, .check small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.check input:disabled + span { opacity: .45; }
.check:has(input:disabled) { cursor: not-allowed; }

.primary-btn {
  display: block; width: 100%; max-width: 320px; margin: 12px auto 0;
  padding: 14px 24px; border: none; border-radius: 999px;
  background: var(--primary); color: #fff; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: background .15s ease, transform .1s ease;
}
.primary-btn:hover { background: var(--primary-dark); }
.primary-btn:active { transform: scale(.98); }

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

/* Tips */
.tips-section { padding: 56px 0; background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); scroll-margin-top: 64px; }
.tips-section h2, .faq-section h2 { text-align: center; margin: 0 0 32px; font-size: 1.7rem; }
.tips-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.tip { padding: 22px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); }
.tip-icon { font-size: 1.6rem; }
.tip h3 { margin: 8px 0 6px; font-size: 1.1rem; }
.tip p { margin: 0; color: var(--muted); font-size: .93rem; }

/* FAQ */
.faq-section { padding: 56px 0; scroll-margin-top: 64px; }
details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0 20px; margin-bottom: 12px;
}
summary { cursor: pointer; font-weight: 600; padding: 16px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--primary); }
details[open] summary::after { content: "−"; }
details p { margin: 0 0 16px; color: var(--muted); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* Footer */
.site-footer { padding: 28px 0; text-align: center; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--border); }
.site-footer p { margin: 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: .95rem; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Responsive */
@media (max-width: 820px) {
  .option-grid { grid-template-columns: 1fr 1fr; }
  .length-block { grid-column: 1 / -1; }
  .length-control { flex-direction: row; align-items: center; }
  .tips-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .nav { display: none; }
  .hero { padding: 44px 0 100px; }
  .card { padding: 18px; }
  .option-grid { grid-template-columns: 1fr; gap: 18px; }
  .tips-grid { grid-template-columns: 1fr; }
  .icon-btn { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
