:root {
  color-scheme: light dark;
  --surface: #0f172a;
  --surface-soft: rgba(15, 23, 42, 0.72);
  --surface-strong: rgba(15, 23, 42, 0.82);
  --text: #f8fafc;
  --text-muted: rgba(248, 250, 252, 0.72);
  --accent-weak: #38bdf8;
  --accent-strong: #22c55e;
  --danger: #f97316;
  --shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: "Inter", "Segoe UI", "SF Pro Display", "Roboto", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: radial-gradient(circle at top left, #312e81 0%, #111827 45%, #020617 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.32), transparent 55%),
    radial-gradient(circle at 78% 12%, rgba(236, 72, 153, 0.24), transparent 60%),
    radial-gradient(circle at 50% 72%, rgba(34, 197, 94, 0.18), transparent 55%);
  z-index: -1;
  pointer-events: none;
  transform: translateZ(0);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  background: var(--surface-strong);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.skip-link:focus {
  left: 12px;
}

.topbar {
  width: min(1100px, 92vw);
  margin: clamp(2.5rem, 6vw, 4.25rem) auto clamp(1.5rem, 4vw, 2.5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  display: grid;
  gap: clamp(0.5rem, 2vw, 1rem);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-items: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.topbar__eyebrow {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-weak);
}

.topbar__lead {
  margin: 0;
  color: var(--text-muted);
  max-width: 420px;
}

.shell {
  width: min(1100px, 92vw);
  margin: 0 auto clamp(3rem, 8vw, 4.5rem);
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  background: var(--surface-strong);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 3vw, 2.5rem);
  box-shadow: var(--shadow);
  border: 1px solid rgba(148, 163, 184, 0.16);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.card--analysis {
  grid-column: 1 / -1;
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.card__header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card__eyebrow {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-weak);
}

.card__header h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.6rem);
}

.card__hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.checker {
  display: grid;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.58);
  border-radius: var(--radius-md);
  padding: clamp(1rem, 2vw, 1.25rem);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.checker__label {
  font-weight: 600;
}

.checker__field {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.checker__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.checker__link {
  background: none;
  border: none;
  color: var(--accent-weak);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.25rem 0;
}

.checker__link:focus-visible {
  outline: none;
  box-shadow: 0 2px 0 0 var(--accent-weak);
}

.checker__status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.checker__breach {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.checker__input {
  flex: 1 1 auto;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.checker__input::placeholder {
  color: rgba(248, 250, 252, 0.35);
}

.checker__input:focus-visible {
  outline: none;
  border-color: var(--accent-weak);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}

.checker__toggle {
  flex: none;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(56, 189, 248, 0.18);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.checker__toggle:hover,
.checker__toggle[aria-pressed='true'] {
  background: rgba(56, 189, 248, 0.32);
  border-color: rgba(56, 189, 248, 0.55);
}

.checker__toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}

.meter {
  position: relative;
  width: 100%;
  height: 12px;
  background: rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  overflow: hidden;
}

.meter__fill {
  position: absolute;
  inset: 0;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0.05);
  transition: transform var(--transition), background var(--transition);
  background: var(--accent-weak);
}

.meter__fill[data-strength='0'] {
  transform: scaleX(0.05);
  background: rgba(148, 163, 184, 0.35);
}

.meter__fill[data-strength='1'] {
  transform: scaleX(0.25);
  background: var(--danger);
}

.meter__fill[data-strength='2'] {
  transform: scaleX(0.5);
  background: #f59e0b;
}

.meter__fill[data-strength='3'] {
  transform: scaleX(0.75);
  background: #a3e635;
}

.meter__fill[data-strength='4'] {
  transform: scaleX(1);
  background: var(--accent-strong);
}

.attack {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}

.attack__fieldset {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
  display: grid;
  gap: 0.5rem;
}

.attack__fieldset legend {
  padding: 0 0.25rem;
  font-weight: 600;
  color: var(--text-muted);
}

.attack__option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-muted);
}

.attack__option input[type='radio'] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent-weak);
}

.attack__hash {
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  display: grid;
  gap: 0.5rem;
}

.attack__hash label {
  font-weight: 600;
}

.attack__hash select {
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.35);
  padding: 0.65rem 0.75rem;
  color: var(--text);
}

.attack__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.attack__formula {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.stats {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 0;
}

.stat {
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.stat dt {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.stat dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.stat__note {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.insights {
  display: grid;
  gap: clamp(1rem, 3vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.insights article {
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.insights h3 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 1rem;
}

.patterns,
.detectors {
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 1rem 1.25rem;
}

.patterns h2,
.detectors h2 {
  margin-top: 0;
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.detectors__list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.detector {
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid transparent;
  display: grid;
  gap: 0.35rem;
}

.detector[data-state='alert'] {
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.2) inset;
}

.detector[data-state='ok'] {
  border-color: rgba(74, 222, 128, 0.35);
}

.detector__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.detector__name {
  font-weight: 600;
}

.detector__status {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.detector[data-state='alert'] .detector__status {
  color: #f97316;
}

.detector[data-state='ok'] .detector__status {
  color: var(--accent-strong);
}

.detector__details {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.5rem;
}

.list li {
  color: var(--text-muted);
}

.list__empty {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
}

.generator {
  display: grid;
  gap: 1rem;
}

.workshop {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.generator__row {
  display: grid;
  gap: 0.75rem;
}

.generator__row label,
.generator__row legend {
  font-weight: 600;
}

.generator__control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.generator__control input[type='range'] {
  flex: 1 1 auto;
  accent-color: var(--accent-weak);
}

.generator__control output {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.generator fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.generator__row label {
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
}

.generator__row input[type='checkbox'] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent-weak);
}

.generator__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.button {
  background: rgba(56, 189, 248, 0.18);
  color: var(--text);
  border-color: rgba(56, 189, 248, 0.4);
}

.button:hover {
  transform: translateY(-1px);
  background: rgba(56, 189, 248, 0.28);
}

.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}

.button--ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.35);
}

.button--ghost:hover {
  background: rgba(148, 163, 184, 0.18);
}

.generator__output {
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  min-height: 3.25rem;
  display: flex;
  align-items: center;
}

.generator__password {
  margin: 0;
  font-family: "Fira Code", "SFMono-Regular", "Menlo", monospace;
  font-size: 1.05rem;
  word-break: break-all;
}

.generator__password[data-empty='true'] {
  color: var(--text-muted);
}

.passphrase {
  display: grid;
  gap: 0.85rem;
  background: rgba(15, 23, 42, 0.45);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 1rem 1.25rem;
}

.passphrase__hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.passphrase__row {
  display: grid;
  gap: 0.5rem;
}

.passphrase__control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.passphrase__control input[type='range'] {
  flex: 1 1 auto;
  accent-color: var(--accent-weak);
}

.passphrase__control output {
  font-weight: 600;
}

.passphrase__option {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-muted);
}

.passphrase__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.passphrase__output {
  margin: 0;
  font-family: "Fira Code", "SFMono-Regular", "Menlo", monospace;
  font-size: 1.05rem;
  word-break: break-word;
  color: var(--text);
}

.passphrase__output[data-empty='true'] {
  color: var(--text-muted);
}

.passphrase__entropy {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.history__item {
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.16);
  display: grid;
  gap: 0.35rem;
}

.history__item--empty {
  color: var(--text-muted);
  text-align: center;
}

.history__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: baseline;
}

.history__password {
  font-family: "Fira Code", "SFMono-Regular", "Menlo", monospace;
  font-weight: 600;
}

.history__meta {
  display: flex;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.card--guides ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.5rem;
  color: var(--text-muted);
}

.footer {
  width: min(1100px, 92vw);
  margin: 0 auto clamp(2rem, 5vw, 3rem);
  color: var(--text-muted);
  text-align: center;
  font-size: 0.95rem;
}

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 999;
}

.modal[hidden] {
  display: none;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
}

.modal__content {
  position: relative;
  max-width: min(520px, 90vw);
  background: rgba(15, 23, 42, 0.95);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: clamp(1.5rem, 3vw, 2rem);
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
}

.modal__content h2 {
  margin: 0;
}

.modal__content p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

@media (max-width: 720px) {
  .topbar {
    text-align: left;
  }

  .card--analysis {
    grid-template-columns: 1fr;
  }

  .generator__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .button {
    width: 100%;
  }

  .checker__actions {
    flex-direction: column;
    align-items: flex-start;
  }
}
