@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

  /* ── Tokens ── */
  :root {
    --bg: #f5f4f0;
    --bg2: #eceae4;
    --card: #fdfcfa;
    --card2: #f7f5f0;
    --border: #e0ddd6;
    --border2: #ccc9c0;
    --text: #1c1b18;
    --text2: #4a4840;
    --muted: #908d85;
    --accent: #1c1b18;
    --green: #246b3e;
    --green-bg: #eaf5ee;
    --green-border: rgba(36,107,62,.18);
    --orange: #b85500;
    --orange-bg: #fdf0e6;
    --orange-border: rgba(184,85,0,.18);
    --red: #b5291e;
    --red-bg: #fcecea;
    --red-border: rgba(181,41,30,.18);
    --blue: #1752a3;
    --blue-bg: #eef2fb;
    --blue-border: rgba(23,82,163,.15);
    --radius: 14px;
    --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 20px rgba(0,0,0,.06);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --transition: .18s ease;
  }

  [data-theme="dark"] {
    --bg: #131210;
    --bg2: #1c1a17;
    --card: #1e1c19;
    --card2: #252320;
    --border: #2e2c28;
    --border2: #3d3a34;
    --text: #f0ede6;
    --text2: #b8b4aa;
    --muted: #6b6760;
    --accent: #f0ede6;
    --green: #4caf7a;
    --green-bg: #142b1e;
    --green-border: rgba(76,175,122,.2);
    --orange: #e07840;
    --orange-bg: #261700;
    --orange-border: rgba(224,120,64,.2);
    --red: #e05555;
    --red-bg: #250f0f;
    --red-border: rgba(224,85,85,.2);
    --blue: #6b9fe8;
    --blue-bg: #101828;
    --blue-border: rgba(107,159,232,.2);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 20px rgba(0,0,0,.25);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.2);
  }

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

  html { color-scheme: light; }
  [data-theme="dark"] { color-scheme: dark; }

  body {
    background: var(--bg);
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 44px 20px 80px;
    transition: background var(--transition), color var(--transition);
  }

  .wrap { width: 100%; max-width: 540px; }

  /* ── Nav ── */
  nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
  }

  .nav-logo {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    color: var(--text);
    letter-spacing: -.3px;
  }

  .nav-logo em { font-style: italic; color: var(--muted); }

  .theme-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 6px 12px 6px 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text2);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
  }

  .theme-btn:hover { border-color: var(--border2); color: var(--text); }

  .theme-icon { font-size: 14px; }

  /* ── Header ── */
  .page-header { margin-bottom: 28px; }

  .page-header h1 {
    font-family: 'Instrument Serif', serif;
    font-size: 34px;
    font-weight: 400;
    letter-spacing: -.5px;
    line-height: 1.1;
    color: var(--text);
  }

  .page-header h1 em { font-style: italic; color: var(--muted); }

  .page-header p {
    font-size: 14px;
    color: var(--muted);
    margin-top: 6px;
  }

  /* ── Card ── */
  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-bottom: 14px;
    transition: background var(--transition), border-color var(--transition);
  }

  .section-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 14px;
  }

  /* ── Input ── */
  .input-row {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg2);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  }

  .input-row:focus-within {
    border-color: var(--text);
    background: var(--card);
    box-shadow: 0 0 0 3px rgba(28,27,24,.07);
  }

  [data-theme="dark"] .input-row:focus-within {
    box-shadow: 0 0 0 3px rgba(240,237,230,.07);
  }

  #pwInput {
    flex: 1; border: none; background: transparent;
    font-family: 'DM Mono', monospace;
    font-size: 15px; padding: 13px 14px;
    color: var(--text); outline: none;
    min-width: 0; letter-spacing: 1.5px;
  }

  #pwInput::placeholder {
    color: var(--muted); font-family: 'DM Sans', sans-serif;
    font-size: 14px; letter-spacing: 0;
  }

  .toggle-btn {
    background: none; border: none; padding: 13px 13px;
    cursor: pointer; color: var(--muted);
    font-size: 15px; transition: color var(--transition);
  }
  .toggle-btn:hover { color: var(--text); }

  /* ── Strength bar ── */
  .strength-wrap { margin-top: 14px; }

  .strength-top {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 7px;
  }

  .strength-lbl { font-size: 12px; font-weight: 500; color: var(--muted); }
  .strength-val { font-size: 12px; font-weight: 600; transition: color var(--transition); }

  .bar-track {
    height: 3px; background: var(--border2);
    border-radius: 99px; overflow: hidden;
  }

  .bar-fill {
    height: 100%; border-radius: 99px; width: 0;
    transition: width .7s cubic-bezier(.34,1.2,.64,1), background-color .4s;
  }

  /* ── Stats ── */
  .stats-row {
    display: grid; grid-template-columns: repeat(3,1fr); gap: 8px;
  }

  .stat-pill {
    background: var(--card2); border: 1px solid var(--border);
    border-radius: 10px; padding: 12px 10px; text-align: center;
    transition: all var(--transition);
  }

  .stat-num {
    font-family: 'DM Mono', monospace; font-size: 18px;
    font-weight: 500; line-height: 1; margin-bottom: 3px;
  }

  .stat-lbl { font-size: 11px; color: var(--muted); }

  /* ── HIBP ── */
  .hibp-row {
    display: flex; align-items: flex-start;
    gap: 12px; padding: 13px 14px;
    border-radius: 10px; border: 1px solid transparent;
    transition: all var(--transition);
  }

  .hibp-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
  .hibp-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
  .hibp-sub { font-size: 12px; color: var(--muted); line-height: 1.45; }

  /* ── Checks ── */
  .checks-list { display: grid; gap: 5px; }

  .check-row {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 11px; border-radius: 8px;
    font-size: 13px; font-weight: 500;
  }

  .check-row.pass { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
  .check-row.fail { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
  .check-row.warn { background: var(--orange-bg); color: var(--orange); border: 1px solid var(--orange-border); }
  .check-icon { font-size: 13px; flex-shrink: 0; }

  /* ── Tips ── */
  .tips-list { display: grid; gap: 7px; }

  .tip-item {
    display: flex; gap: 11px; align-items: flex-start;
    padding: 12px 13px;
    background: var(--blue-bg); border-radius: 10px;
    border: 1px solid var(--blue-border);
  }

  .tip-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
  .tip-text { font-size: 13px; color: var(--blue); line-height: 1.5; }
  .tip-text strong { font-weight: 600; display: block; margin-bottom: 1px; }

  /* ── Generator ── */
  .gen-controls { display: grid; gap: 14px; margin-bottom: 16px; }

  /* Mode tabs */
  .mode-tabs {
    display: flex; gap: 6px;
    background: var(--card2); border: 1px solid var(--border);
    border-radius: 10px; padding: 4px;
  }

  .mode-tab {
    flex: 1; background: none; border: none;
    padding: 7px 10px; border-radius: 7px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px; font-weight: 500;
    color: var(--muted); cursor: pointer;
    transition: all var(--transition);
  }

  .mode-tab.active {
    background: var(--card); color: var(--text);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
  }

  /* Sliders + toggles */
  .control-row {
    display: flex; align-items: center;
    justify-content: space-between; gap: 12px;
  }

  .control-lbl {
    font-size: 12px; font-weight: 500;
    color: var(--text2); flex-shrink: 0; min-width: 100px;
  }

  .control-lbl span {
    font-family: 'DM Mono', monospace;
    color: var(--muted); font-size: 11px; margin-left: 4px;
  }

  input[type="range"] {
    flex: 1; -webkit-appearance: none; appearance: none;
    height: 3px; background: var(--border2);
    border-radius: 99px; outline: none; cursor: pointer;
    transition: background var(--transition);
  }

  input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--text); cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    transition: transform .1s;
  }

  input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.2); }

  /* Toggle switch */
  .toggle-wrap { display: flex; align-items: center; gap: 8px; }

  .toggle-switch {
    position: relative; width: 32px; height: 18px; cursor: pointer;
  }

  .toggle-switch input { opacity: 0; width: 0; height: 0; }

  .toggle-track {
    position: absolute; inset: 0;
    background: var(--border2); border-radius: 99px;
    transition: background .2s;
  }

  .toggle-switch input:checked + .toggle-track { background: var(--text); }

  .toggle-knob {
    position: absolute; top: 2px; left: 2px;
    width: 14px; height: 14px; background: white;
    border-radius: 50%; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
  }

  .toggle-switch input:checked ~ .toggle-knob { transform: translateX(14px); }

  .toggle-lbl { font-size: 12px; font-weight: 500; color: var(--text2); }

  /* Suggestions */
  .sug-list { display: grid; gap: 7px; }

  .sug-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 13px;
    background: var(--card2); border: 1px solid var(--border);
    border-radius: 10px; cursor: pointer;
    transition: all var(--transition);
    position: relative;
  }

  .sug-item:hover {
    border-color: var(--border2); background: var(--card);
    box-shadow: var(--shadow-sm); transform: translateY(-1px);
  }

  .sug-item:active { transform: translateY(0); }

  .sug-pw {
    font-family: 'DM Mono', monospace; font-size: 13px;
    color: var(--text); flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    letter-spacing: .5px;
  }

  .sug-badge {
    font-size: 10px; font-weight: 600; padding: 2px 7px;
    border-radius: 99px; background: var(--bg2);
    color: var(--muted); border: 1px solid var(--border);
    flex-shrink: 0;
  }

  .sug-copy-icon {
    font-size: 12px; color: var(--muted);
    flex-shrink: 0; opacity: 0; transition: opacity .15s;
  }
  .sug-item:hover .sug-copy-icon { opacity: 1; }

  .regen-btn {
    width: 100%; background: none;
    border: 1.5px dashed var(--border2);
    border-radius: 10px; padding: 10px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px; font-weight: 500; color: var(--muted);
    cursor: pointer; transition: all var(--transition);
    margin-top: 8px;
  }
  .regen-btn:hover { border-color: var(--text); color: var(--text); background: var(--card2); }

  /* ── Placeholder ── */
  .placeholder {
    text-align: center; padding: 40px 0;
    color: var(--muted); font-size: 13px; line-height: 1.6;
  }
  .placeholder-icon { font-size: 28px; display: block; margin-bottom: 10px; opacity: .35; }

  /* ── Fade in ── */
  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .fade-in { animation: fadeUp .3s ease forwards; }

  /* ── Toast ── */
  .toast {
    position: fixed; bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: var(--text); color: var(--bg);
    font-size: 12px; font-weight: 500; padding: 9px 18px;
    border-radius: 99px;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1);
    z-index: 99; white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
  }
  .toast.show { transform: translateX(-50%) translateY(0); }

  /* ── Divider ── */
  .divider { height: 1px; background: var(--border); margin: 4px 0 14px; }
