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

/* ── Tokens + light default ── */
:root {
  --accent: #8eb353; --accent-dim: rgba(142,179,83,.18); --accent-border: rgba(142,179,83,.5); --accent-text: #527020;
  --radius: 12px; --ease: cubic-bezier(.4,0,.2,1); --t: .22s;
  --bg: #f4f2ee; --surface: #fff; --surface-alt: #f0eeea;
  --border: rgba(0,0,0,.09); --border-hi: rgba(0,0,0,.22);
  --text: #111110; --muted: #6a6a6f;
  --shadow: rgba(0,0,0,.12); --color-error: #c0392b; --color-warn: #a05200;
  --logo: #2a2a2a;
}
@media (prefers-color-scheme: dark) { :root {
  --bg: #0e0e0f; --surface: #18181a; --surface-alt: #111113;
  --border: rgba(255,255,255,.08); --border-hi: rgba(255,255,255,.18);
  --text: #f0ede8; --muted: #858589;
  --shadow: rgba(0,0,0,.5); --color-error: #e05252; --color-warn: #e8a44a;
  --logo: #8eb353; --accent-text: #8eb353;
}}
[data-theme="light"] { color-scheme: light;
  --bg: #f4f2ee; --surface: #fff; --surface-alt: #f0eeea;
  --border: rgba(0,0,0,.09); --border-hi: rgba(0,0,0,.22);
  --text: #111110; --muted: #6a6a6f;
  --shadow: rgba(0,0,0,.12); --color-error: #c0392b; --color-warn: #a05200;
  --logo: #2a2a2a;
}
[data-theme="dark"] { color-scheme: dark;
  --bg: #0e0e0f; --surface: #18181a; --surface-alt: #111113;
  --border: rgba(255,255,255,.08); --border-hi: rgba(255,255,255,.18);
  --text: #f0ede8; --muted: #858589;
  --shadow: rgba(0,0,0,.5); --color-error: #e05252; --color-warn: #e8a44a;
  --logo: #8eb353; --accent-text: #8eb353;
}

/* ── Base ── */
body {
  background: var(--bg); color: var(--text); font-family: 'DM Sans', sans-serif;
  min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem 1rem 3rem;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.hidden { display: none !important; }

/* ── Topbar ── */
.topbar {
  width: 100%; max-width: 680px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; padding: 0 4px;
}
.logo { font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--logo); transition: color var(--t); display: flex; align-items: center; gap: 7px; }
.logo svg { display: block; }
.topbar-controls { display: flex; align-items: center; gap: 8px; }

/* ── Theme pill ── */
.theme-switcher {
  position: relative; display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; transition: background var(--t), border-color var(--t);
}
.theme-indicator {
  position: absolute; top: 3px; bottom: 3px; border-radius: 999px;
  background: var(--bg); pointer-events: none;
  transition: transform .28s var(--ease), width .28s var(--ease), background var(--t);
}
.theme-opt {
  position: relative; z-index: 1; display: flex; align-items: center; gap: 5px;
  padding: 5px 11px; border: none; border-radius: 999px; background: none; cursor: pointer;
  font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .05em;
  color: var(--muted); white-space: nowrap; touch-action: manipulation;
  transition: color .22s var(--ease);
}
.theme-opt.active, .theme-opt:hover { color: var(--text); }
.theme-opt-icon { font-size: 11px; line-height: 1; }

/* ── Share button ── */
.share-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); cursor: pointer;
  font-family: 'DM Mono', monospace; font-size: 11px; letter-spacing: .05em;
  color: var(--muted); white-space: nowrap; touch-action: manipulation;
  transition: color .22s var(--ease), border-color .18s, background var(--t);
}
.share-btn:hover { color: var(--text); border-color: var(--border-hi); }
.share-btn-icon { font-size: 11px; line-height: 1; }

/* ── Card ── */
.wrap {
  width: 100%; max-width: 680px;
  background: var(--border); border-radius: 20px; overflow: hidden;
  box-shadow: 0 32px 64px var(--shadow); transition: box-shadow var(--t);
  animation: fadeUp .4s var(--ease) both;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:none; } }
.panel { background: var(--surface); padding: 2rem; transition: background var(--t); }

/* ── Typography ── */
header { margin-bottom: 1.75rem; }
h1 { font-size: 26px; font-weight: 300; line-height: 1.2; }
h1 strong { font-weight: 500; }
.lbl { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; font-family: 'DM Mono', monospace; transition: color var(--t); }
.field { margin-bottom: 1.1rem; }

/* ── Slider ── */
.slider-wrap { display: flex; align-items: center; gap: 10px; }
input[type="range"] { flex: 1; cursor: pointer; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 999px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent); cursor: pointer; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 999px; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: none; cursor: pointer; }
input[type="range"]::-moz-range-progress { background: var(--accent); height: 4px; border-radius: 999px; }

/* ── Checkboxes ── */
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; transition: border-color .18s, background .18s;
  user-select: none; margin-bottom: 0;
}
.opt-row:hover { border-color: var(--border-hi); }
.opt-row.checked { border-color: var(--accent-border); background: var(--accent-dim); }
.opt-checkbox {
  width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: border-color .18s, background .18s;
}
.opt-row.checked .opt-checkbox { border-color: var(--accent); background: var(--accent); }
.opt-check-icon { font-size: 10px; color: #0e0e0f; opacity: 0; transition: opacity .15s; line-height: 1; }
.opt-row.checked .opt-check-icon { opacity: 1; }
.opt-label { font-size: 13px; color: var(--text); transition: color var(--t); }

/* ── Exclude field placeholder ── */

input[type="text"], input[type="number"] {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-family: 'DM Mono', monospace;
  font-size: 13px; padding: 10px 13px; outline: none; -webkit-appearance: none;
  transition: border-color .18s, background var(--t), color var(--t);
  letter-spacing: .06em;
}
input[type="number"] { -moz-appearance: textfield; text-align: center; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { display: none; }
input[type="text"]:focus { border-color: var(--accent); }

/* ── Count + icon buttons ── */
.count-btn {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--muted); font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: 'DM Mono', monospace;
  transition: border-color .18s, color .18s, background var(--t);
}
.count-btn:hover { border-color: var(--border-hi); color: var(--text); }
.count-btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

.pw-icon-btn {
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--muted); font-size: 14px; line-height: 1;
  transition: background .18s, border-color .18s, color .18s;
}
.pw-icon-btn:hover { background: var(--border); border-color: var(--border-hi); color: var(--text); }
.pw-copy-btn {
  background: var(--accent); border: 1px solid var(--accent);
  border-radius: 8px; cursor: pointer; padding: 0 10px; height: 32px;
  display: flex; align-items: center; flex-shrink: 0;
  color: #0e0e0f; font-family: 'DM Mono', monospace; font-size: 10px;
  letter-spacing: .07em; text-transform: uppercase;
  transition: opacity .18s;
}
.pw-copy-btn:hover { opacity: .85; }
.pw-output-area {
  background: var(--surface-alt); border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 1.5rem;
  overflow: hidden; transition: background var(--t), border-color var(--t);
}
.pw-output-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border);
  transition: border-color var(--t);
}
.pw-count-inline {
  display: flex; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); overflow: hidden;
  transition: border-color .18s, background var(--t);
}
.pw-count-inline .count-btn {
  width: 30px; height: 30px; border-radius: 0; border: none; background: none; font-size: 16px;
}
.pw-count-inline .count-btn:hover { background: var(--surface-alt); }
.pw-count-inline input[type="number"] {
  width: 32px; padding: 0; text-align: center; font-size: 13px;
  border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  border-radius: 0; background: none; color: var(--text);
  font-family: 'DM Mono', monospace; height: 30px;
  transition: color var(--t), border-color var(--t);
}
.pw-count-inline input[type="number"]:focus { outline: none; }
.pw-refresh-btn {
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); border-radius: 6px;
  transition: color .18s; display: flex; align-items: center; gap: 5px;
}
.pw-refresh-btn:hover { color: var(--accent-text); }
.pw-refresh-icon { font-size: 13px; line-height: 1; display: inline-block; transition: transform .3s var(--ease); }
.pw-refresh-btn:active .pw-refresh-icon { transform: rotate(180deg); }
/* ── Password list ── */
.pw-list { display: flex; flex-direction: column; }
.pw-list-item {
  background: var(--surface); border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.pw-list-item:last-child { border-bottom: none; }
.pw-list-item:hover { background: var(--bg); }
.pw-item-top {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px;
}
.pw-list-text {
  flex: 1; font-family: 'DM Mono', monospace; font-size: 13px;
  color: var(--text); letter-spacing: .04em; word-break: break-all;
  transition: color var(--t);
}
.pw-item-strength {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px 9px;
}
.pw-str-track {
  flex: 1; height: 3px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.pw-str-fill {
  height: 100%; border-radius: 999px; width: 0;
  transition: width .3s var(--ease), background .3s var(--ease);
}
.pw-str-lbl {
  font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .08em;
  color: var(--muted); flex-shrink: 0; min-width: 7ch; text-align: right;
}

/* ── Toast ── */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 20px;
  font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text);
  box-shadow: 0 8px 32px var(--shadow); opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity .2s, transform .2s var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Footer ── */
.footer { width: 100%; max-width: 680px; display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; padding: 0 4px; }
.footer a { font-family: 'DM Mono', monospace; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-decoration: none; transition: color .18s; }
.footer a:hover { color: var(--text); }

/* ── Mobile ── */
@media (max-width: 640px) {
  body { padding: 1rem .75rem 2.5rem; }
  .topbar { flex-wrap: wrap; }
  .topbar-controls { margin-left: auto; }
  .panel { padding: 1.5rem 1.25rem; }
  h1 { font-size: 22px; }
  .theme-opt-label { display: none; }
  .theme-opt.active .theme-opt-label { display: inline; }
  .theme-opt { padding: 6px 10px; }
  .share-btn { padding: 9px 10px; }
  .share-btn-label { display: none; }
  .options-grid { grid-template-columns: 1fr; }
  .pw-icon-btn { width: 44px; height: 44px; }
  .pw-copy-btn { height: 44px; padding: 0 14px; }
}