:root {
  --page: #efeee8;
  --paper: #fffdf8;
  --ink: #172019;
  --muted: #626d65;
  --line: #d6d8d0;
  --line-strong: #b9beb6;
  --accent: #235b3b;
  --accent-dark: #153f28;
  --accent-soft: #e4eee6;
  --danger: #9a392f;
  --warning: #93600f;
  --good: #2d6288;
  --shadow: 0 22px 60px rgba(34, 43, 36, .09);
  --radius: 18px;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
.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;
}
html { background: var(--page); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 32, 25, .027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 25, .027) 1px, transparent 1px),
    var(--page);
  background-size: 32px 32px;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.site-header {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 17px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line-strong);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 760;
  letter-spacing: -.03em;
  text-decoration: none;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  background: var(--paper);
}
.brand-mark svg { width: 17px; height: 17px; }

.header-actions { display: flex; align-items: center; gap: 22px; }
.privacy-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 700 .69rem/1 var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.privacy-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.source-link { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 720; text-decoration: none; }
.source-link:hover { color: var(--accent); }
.source-arrow { font-size: .9rem; }

main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 52px 0 28px; }
.intro { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 48px; align-items: end; margin-bottom: 27px; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font: 750 .71rem/1.2 var(--mono); letter-spacing: .13em; text-transform: uppercase; }
h1 { max-width: 760px; margin: 0; font-size: clamp(2.5rem, 5vw, 4.9rem); font-weight: 770; letter-spacing: -.067em; line-height: .97; text-wrap: balance; }
.intro-copy { margin: 0 0 4px; color: var(--muted); font-size: .96rem; line-height: 1.66; text-wrap: pretty; }

.privacy-banner {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin: 0 0 16px;
  padding: 15px 18px;
  border: 1px solid #b7c8ba;
  border-radius: 12px;
  color: var(--accent-dark);
  background: rgba(228, 238, 230, .8);
}
.privacy-banner svg { width: 21px; height: 21px; flex: 0 0 auto; margin-top: 1px; }
.privacy-banner div { display: flex; flex-wrap: wrap; gap: 5px 9px; font-size: .78rem; line-height: 1.5; }
.privacy-banner span { color: #53665a; }

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, .82fr) minmax(0, 1.18fr);
  min-height: 590px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.builder { padding: 30px; border-right: 1px solid var(--line); }
.output { padding: 30px; background: #faf9f4; }
.section-kicker { min-height: 20px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.section-kicker h2 { margin: 0; font-size: .8rem; letter-spacing: .09em; text-transform: uppercase; }
.step { color: var(--muted); font: .69rem/1 var(--mono); }
.output-tools { display: flex; align-items: center; gap: 14px; }
.text-button { min-height: 34px; padding: 4px 8px; border: 0; color: var(--muted); background: transparent; font-size: .72rem; font-weight: 700; cursor: pointer; }
.text-button:hover { color: var(--danger); }
.text-button[hidden] { display: none; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--page); }
.tab { min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: .84rem; font-weight: 680; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); background: var(--paper); box-shadow: 0 1px 3px rgba(24, 32, 25, .13); }
.tab:hover { color: var(--ink); }
.controls-panel[hidden] { display: none; }

.field { margin-bottom: 22px; }
.fieldset-reset { padding: 0; margin-right: 0; margin-left: 0; border: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 18px; align-items: end; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 9px; color: var(--ink); font-size: .77rem; font-weight: 720; }
.field-hint { color: var(--muted); font-weight: 520; }
.range-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 46px; gap: 12px; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-value { color: var(--ink); font: 730 1rem/1 var(--mono); text-align: right; }
.number-input, .text-input, select { width: 100%; min-height: 44px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink); background: var(--paper); outline: none; }
.text-input { font-family: var(--mono); font-size: .82rem; }
.text-input::placeholder { color: #8a928c; font-family: var(--sans); }

.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option { min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); cursor: pointer; font-size: .81rem; font-weight: 640; user-select: none; }
.option:hover { border-color: var(--line-strong); }
.option:has(input:checked) { border-color: #91aa98; background: var(--accent-soft); }
.option input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; accent-color: var(--accent); }
.option small { margin-left: 4px; color: var(--muted); font: .67rem/1 var(--mono); }
.option-wide { grid-column: 1 / -1; }
.count-field { margin-top: 22px; }
.wordlist-note { margin: -8px 0 20px; color: var(--muted); font: .68rem/1.5 var(--mono); }

.tab:focus-visible, .option:has(input:focus-visible), button:focus-visible, a:focus-visible,
.number-input:focus, .text-input:focus, select:focus, input[type="range"]:focus-visible {
  outline: 3px solid rgba(35, 91, 59, .23);
  outline-offset: 2px;
}

.generate-button { width: 100%; min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; margin-top: 4px; border: 1px solid var(--accent-dark); border-radius: 10px; color: #fff; background: var(--accent); font-weight: 750; cursor: pointer; transition: background 150ms ease, transform 150ms ease; }
.generate-button:hover { background: var(--accent-dark); }
.generate-button:active { transform: translateY(1px); }
.generate-button:disabled { cursor: wait; opacity: .7; }
.generate-button svg { width: 17px; height: 17px; }
.error-message { margin: 14px 0 0; padding: 10px 12px; border-left: 3px solid var(--danger); color: #782b24; background: #f8e9e6; font-size: .81rem; line-height: 1.45; }
.error-message[hidden] { display: none; }

.empty-state { min-height: 445px; display: grid; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 16px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent); background: var(--paper); }
.empty-icon svg { width: 23px; height: 23px; }
.empty-state strong { color: var(--ink); font-size: .94rem; }
.empty-state p { max-width: 300px; margin: 8px 0 0; font-size: .81rem; line-height: 1.55; }
.results { display: grid; gap: 14px; }
.results-heading { margin: 0 0 2px; color: var(--muted); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.result-item { position: relative; padding: 17px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--paper); box-shadow: 0 5px 16px rgba(34, 43, 36, .05); animation: reveal 180ms ease both; }
.result-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.result-number { color: var(--muted); font: .69rem/1 var(--mono); }
.badge { padding: 4px 8px; border-radius: 999px; font-size: .64rem; font-weight: 780; letter-spacing: .06em; text-transform: uppercase; }
.badge-strong { color: var(--accent-dark); background: var(--accent-soft); }
.badge-good { color: #275576; background: #e5eef5; }
.badge-fair { color: #79500f; background: #f5ecd9; }
.badge-weak { color: #833127; background: #f8e9e6; }
.password-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.password-value { min-width: 0; overflow-wrap: anywhere; color: var(--ink); font: clamp(.9rem, 2vw, 1.07rem)/1.5 var(--mono); }
.copy-button { min-width: 78px; min-height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink); background: var(--paper); font-size: .74rem; font-weight: 720; cursor: pointer; }
.copy-button:hover { border-color: var(--accent); color: var(--accent); }
.copy-button.copied { color: var(--accent-dark); background: var(--accent-soft); }
.result-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 13px; color: var(--muted); font: .66rem/1 var(--mono); }
.strength-track { width: 92px; display: flex; gap: 3px; }
.strength-segment { height: 3px; flex: 1; border-radius: 3px; background: var(--line); }
.strength-segment.is-on.strength-strong { background: var(--accent); }
.strength-segment.is-on.strength-good { background: var(--good); }
.strength-segment.is-on.strength-fair { background: var(--warning); }
.strength-segment.is-on.strength-weak { background: var(--danger); }
.footnote { display: flex; align-items: flex-start; gap: 9px; margin: 18px 0 0; color: var(--muted); font-size: .71rem; line-height: 1.5; }
.footnote svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }

footer { width: min(1120px, calc(100% - 40px)); display: flex; justify-content: space-between; gap: 20px; margin: 0 auto; padding: 0 0 36px; color: var(--muted); font-size: .7rem; line-height: 1.5; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 820px) {
  .intro { grid-template-columns: 1fr; gap: 20px; }
  .intro-copy { max-width: 620px; }
  .workspace { grid-template-columns: 1fr; }
  .builder { border-right: 0; border-bottom: 1px solid var(--line); }
  .empty-state { min-height: 280px; }
}

@media (max-width: 560px) {
  .site-header, main, footer { width: min(100% - 24px, 1120px); }
  .site-header { padding-top: 14px; }
  .header-actions { gap: 12px; }
  .privacy-status { font-size: 0; }
  .privacy-status::after { content: "Local"; font-size: .67rem; }
  .source-link { font-size: 0; }
  .source-link::before { content: "Source"; font-size: .76rem; }
  main { padding-top: 34px; }
  h1 { font-size: clamp(2.45rem, 14vw, 3.6rem); }
  .privacy-banner div { display: block; }
  .privacy-banner span { display: block; margin-top: 3px; }
  .builder, .output { padding: 22px 18px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .option-grid { grid-template-columns: 1fr; }
  .option-wide { grid-column: auto; }
  .password-line { grid-template-columns: 1fr; }
  .copy-button { justify-self: start; min-width: 90px; min-height: 44px; }
  footer { flex-direction: column; gap: 5px; }
}

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