:root {
  --bg-1: #0f172a;
  --bg-2: #4338ca;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --teal: #0d9488;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 2rem 1rem;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, var(--bg-2), var(--bg-1));
}

.card {
  position: relative;
  width: 100%;
  max-width: 460px;
  padding: 2rem 1.5rem 1.5rem;
  background: var(--card);
  border-radius: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}

.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;
}

/* Language switch */
.lang-switch { position: absolute; top: .75rem; right: .75rem; display: flex; gap: .25rem; }
.lang-btn {
  padding: .25rem .55rem;
  font: inherit; font-size: .75rem; font-weight: 700;
  color: var(--muted); background: #f3f4f6;
  border: none; border-radius: 8px; cursor: pointer;
}
.lang-btn:hover { background: #e5e7eb; }
.lang-btn.active { color: #fff; background: var(--accent); }

/* Brand */
.brand { text-align: center; }
.brand img { display: block; margin: 0 auto .5rem; border-radius: 14px; box-shadow: 0 6px 16px rgba(79, 70, 229, .35); }
h1 { margin: 0; font-size: 1.75rem; letter-spacing: -.02em; }
.subtitle { margin: .25rem 0 0; color: var(--muted); font-size: .95rem; }

/* Output */
.output { margin-top: 1.5rem; }
.password {
  display: block;
  min-height: 4.25rem;
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.35rem;
  line-height: 1.5;
  text-align: center;
  word-break: break-all;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.ch-digit { color: #2563eb; }
.ch-symbol { color: #ea580c; }

.actions { display: flex; gap: .5rem; margin-top: .75rem; }
.actions button {
  flex: 1;
  padding: .7rem 1rem;
  font: inherit; font-weight: 700;
  border-radius: 12px; cursor: pointer;
  transition: background .15s, transform .1s;
}
.actions button:active { transform: scale(.97); }
button.primary { color: #fff; background: var(--accent); border: 1px solid var(--accent); }
button.primary:hover { background: var(--accent-dark); }
button.secondary { color: var(--accent); background: #eef2ff; border: 1px solid #c7d2fe; }
button.secondary:hover { background: #e0e7ff; }

/* Strength */
.strength { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; min-height: 1.25rem; }
.bars { display: flex; gap: .25rem; flex: 1; }
.bars span { flex: 1; height: 6px; border-radius: 3px; background: var(--border); transition: background .2s; }
.bars span.on.level-0, .bars span.on.level-1 { background: #ef4444; }
.bars span.on.level-2 { background: #f59e0b; }
.bars span.on.level-3 { background: #84cc16; }
.bars span.on.level-4 { background: #10b981; }
.strength-label { min-width: 5.5rem; text-align: right; font-size: .85rem; font-weight: 600; color: var(--muted); }

/* Options */
.options { margin-top: 1.25rem; }
.length-row { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.length-row output { padding: .1rem .6rem; font-variant-numeric: tabular-nums; color: var(--accent); background: #eef2ff; border-radius: 999px; }
input[type="range"] { width: 100%; margin: .6rem 0 1rem; accent-color: var(--accent); }

fieldset { margin: 0; padding: 0; border: 0; display: grid; gap: .5rem; }
.check { display: flex; align-items: center; gap: .6rem; font-size: .95rem; cursor: pointer; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.error { margin: .75rem 0 0; font-size: .9rem; font-weight: 600; color: #dc2626; }

/* About + disclaimer */
.about { margin-top: 1.5rem; font-size: .9rem; }
.about details { border-top: 1px solid var(--border); padding: .6rem 0; }
.about summary { cursor: pointer; font-weight: 600; }
.about p, .about ul { margin: .5rem 0 0; color: var(--muted); line-height: 1.5; }
.about ul { padding-left: 1.1rem; }
.about li + li { margin-top: .4rem; }

.disclaimer {
  margin: .75rem 0 0;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  font-size: .75rem; font-style: italic; line-height: 1.5;
  color: var(--muted);
}

:focus-visible { outline: 3px solid #818cf8; outline-offset: 2px; }
