.tst-password-generator {
  --tst-accent: var(--tst-tool-control-secondary, #2563eb);
  --tst-primary: var(--tst-tool-control-primary, #c8f65c);
  --tst-primary-hover: var(--tst-tool-control-primary-hover, #afe33f);
  --tst-on-primary: var(--tst-tool-control-on-primary, #101827);
  --tst-border: #cbd5e1;
  --tst-danger: #b42318;
  --tst-muted: #475569;
  --tst-success: #067647;
  background: #fff;
  border: 1px solid var(--tst-border);
  border-radius: 0.75rem;
  box-shadow: 0 0.25rem 0.75rem rgb(15 23 42 / 8%);
  color: #0f172a;
  max-width: 36rem;
  padding: clamp(1rem, 4vw, 1.5rem);
}

.tst-password-generator,
.tst-password-generator * {
  box-sizing: border-box;
}

.tst-password-generator__title {
  font-size: 1.5rem;
  margin: 0 0 1rem;
}

.tst-password-generator__result {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  margin-top: 0.4rem;
}

.tst-password-generator input[type='text'],
.tst-password-generator input[type='number'] {
  border: 1px solid var(--tst-border);
  border-radius: 0.4rem;
  font: inherit;
  min-height: 2.75rem;
  padding: 0.65rem 0.75rem;
}

.tst-password-generator input[type='text'] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  min-width: 0;
  width: 100%;
}

.tst-password-generator button {
  align-items: center;
  background: var(--tst-accent);
  border: 0;
  border-radius: 0.4rem;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 650;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
}

.tst-password-generator__icon-button {
  font-size: 1.2rem;
  min-width: 2.75rem;
  padding: 0.5rem;
}

.tst-password-generator button:hover {
  background: #1747b6;
}

.tst-password-generator button:focus-visible,
.tst-password-generator input:focus-visible,
.tst-password-generator__help:focus-visible {
  outline: 0.2rem solid var(--tst-tool-control-focus, #8ab1ff);
  outline-offset: 0.15rem;
}

.tst-password-generator__strength {
  background: #e2e8f0;
  border-radius: 999px;
  height: 0.75rem;
  margin: 2.25rem 0 1.5rem;
  position: relative;
}

.tst-password-generator__strength-bar {
  background: var(--tst-danger);
  border-radius: inherit;
  display: block;
  height: 100%;
  transition: width 180ms ease, background-color 180ms ease;
  width: 0;
}

.tst-password-generator__strength[data-strength='medium'] .tst-password-generator__strength-bar {
  background: #b54708;
}

.tst-password-generator__strength[data-strength='strong'] .tst-password-generator__strength-bar {
  background: var(--tst-success);
}

.tst-password-generator__strength-label {
  bottom: 0.9rem;
  color: var(--tst-muted);
  font-size: 0.8rem;
  position: absolute;
  right: 0;
}

.tst-password-generator__length {
  align-items: center;
  display: grid;
  gap: 0.6rem 1rem;
  grid-template-columns: 1fr auto;
  margin-bottom: 1.25rem;
}

.tst-password-generator__length label {
  grid-column: 1 / -1;
}

.tst-password-generator__length input[type='range'] {
  accent-color: var(--tst-accent);
  width: 100%;
}

.tst-password-generator__length input[type='number'] {
  width: 5rem;
}

.tst-password-generator fieldset {
  border: 0;
  margin: 0 0 1rem;
  padding: 0;
}

.tst-password-generator legend,
.tst-password-generator label {
  font-weight: 650;
}

.tst-password-generator__option {
  align-items: center;
  display: flex;
  font-weight: 400 !important;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.tst-password-generator__option input {
  accent-color: var(--tst-accent);
  height: 1.1rem;
  width: 1.1rem;
}

.tst-password-generator__help {
  align-items: center;
  background: var(--tst-accent);
  border-radius: 50%;
  color: #fff;
  cursor: help;
  display: inline-flex;
  font-size: 0.75rem;
  height: 1.15rem;
  justify-content: center;
  width: 1.15rem;
}

.tst-password-generator__custom {
  background: #f8fafc;
  border-radius: 0.5rem !important;
  padding: 0.8rem 1rem !important;
}

.tst-password-generator__custom[hidden] {
  display: none;
}

.tst-password-generator__actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.tst-password-generator__actions button {
  background: var(--tst-primary);
  color: var(--tst-on-primary);
}

.tst-password-generator__actions button:hover {
  background: var(--tst-primary-hover);
}

.tst-password-generator__status {
  color: var(--tst-muted);
  font-size: 0.9rem;
}

.tst-password-generator__requirements {
  margin-top: 1.25rem;
}

.tst-password-generator__requirements p {
  font-weight: 650;
  margin-bottom: 0.5rem;
}

.tst-password-generator__requirements ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tst-password-generator__requirements li {
  margin: 0.3rem 0;
  padding-left: 1.5rem;
  position: relative;
}

.tst-password-generator__requirements li::before {
  content: '○';
  left: 0;
  position: absolute;
}

.tst-password-generator__requirements .is-valid {
  color: var(--tst-success);
}

.tst-password-generator__requirements .is-valid::before {
  content: '✓';
}

.tst-password-generator__requirements .is-invalid {
  color: var(--tst-danger);
}

@media (max-width: 30rem) {
  .tst-password-generator__result {
    grid-template-columns: 1fr 1fr;
  }

  .tst-password-generator__result input {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tst-password-generator__strength-bar {
    transition: none;
  }
}

[data-tst-site-shell][data-theme='dark'] .tst-password-generator {
  --tst-border: #475569;
  --tst-muted: #cbd5e1;
  background: #0f172a;
  color: #f8fafc;
}

[data-tst-site-shell][data-theme='dark'] .tst-password-generator input[type='text'],
[data-tst-site-shell][data-theme='dark'] .tst-password-generator input[type='number'],
[data-tst-site-shell][data-theme='dark'] .tst-password-generator__custom {
  background: #1e293b;
  color: #f8fafc;
}
