.tool-hero h1 {
  max-width: 18ch;
}

.tool-workspace {
  scroll-margin-top: 1rem;
}

.mode-tabs {
  width: min(100%, 540px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0 0 1rem;
  border: 1px solid var(--border-soft);
  border-radius: 17px;
  padding: 0.35rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.mode-tab {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-tab:hover {
  background: var(--surface-quiet);
  color: var(--heading);
}

.mode-tab[aria-selected="true"] {
  background: linear-gradient(135deg, var(--navy), var(--green));
  color: var(--on-brand);
  box-shadow: 0 10px 24px -18px rgba(12, 35, 64, 0.8);
}

.password-grid {
  grid-template-columns: minmax(310px, 0.9fr) minmax(0, 1.1fr);
}

.settings-panel,
.secret-panel {
  min-height: 100%;
}

.length-field {
  margin-bottom: 1.35rem;
}

.length-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.42rem;
}

.length-label-row label {
  margin: 0;
}

.length-label-row output {
  color: var(--green);
  font-size: 0.83rem;
  font-weight: 800;
}

:root[data-theme="dark"] .length-label-row output {
  color: #9ee4c2;
}

.length-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: center;
  gap: 0.75rem;
}

input[type="range"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.length-number {
  min-width: 0;
  text-align: center;
}

.length-warning {
  margin: 0.5rem 0 0;
  border-left: 4px solid var(--focus);
  padding: 0.55rem 0.7rem;
  background: color-mix(in srgb, var(--focus) 9%, var(--surface));
  color: var(--text);
  font-size: 0.8rem;
}

.settings-fieldset {
  margin: 0;
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 1rem;
}

.settings-fieldset legend {
  padding: 0 0.35rem;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.2rem 1rem;
}

.avoid-similar {
  margin-top: 0.55rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.7rem;
}

.option-status {
  margin-top: 0.85rem;
}

.generate-button {
  width: 100%;
  margin-top: 0.25rem;
}

.passphrase-fields {
  gap: 0.3rem;
}

.passphrase-fields > div:first-child {
  margin-bottom: 0.5rem;
}

.result-label {
  margin-bottom: 0.5rem;
}

.secret-output {
  width: 100%;
  min-height: 84px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  background: var(--surface-quiet);
  color: var(--heading);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.025em;
}

.secret-output:focus {
  border-color: var(--green);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent);
}

.secret-output:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.result-actions {
  margin-top: 1rem;
}

.result-actions .button {
  min-width: 104px;
}

.button:disabled,
.button:disabled:hover {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.privacy-card,
.source-note {
  border: 1px solid var(--border-soft);
  border-radius: 17px;
  padding: 1rem;
  background: var(--surface-quiet);
}

.privacy-card {
  margin-top: 1.35rem;
}

.privacy-card h3,
.source-note h3 {
  margin: 0;
  font-size: 1.05rem;
}

.privacy-card p,
.source-note p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.crypto-error,
.noscript-message {
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--border-soft));
  border-radius: 14px;
  padding: 0.8rem;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  color: var(--danger);
  font-weight: 750;
}

.crypto-error {
  margin: 1rem 0 0;
  font-size: 0.85rem;
}

.noscript-message {
  margin: 0 0 1rem;
}

.source-note {
  margin-top: 1rem;
}

.source-note a,
.guide-card a {
  color: var(--green);
  font-weight: 750;
  text-underline-offset: 2px;
}

:root[data-theme="dark"] .source-note a,
:root[data-theme="dark"] .guide-card a {
  color: #9ee4c2;
}

.library-credit {
  width: min(100%, 820px);
  margin: 0.7rem auto 0 !important;
  line-height: 1.6;
}

.library-credit a {
  overflow-wrap: anywhere;
}

.copy-helper {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (max-width: 820px) {
  .password-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .mode-tabs {
    width: 100%;
  }

  .mode-tab {
    padding-inline: 0.45rem;
    font-size: 0.84rem;
  }

  .character-grid {
    grid-template-columns: 1fr;
  }

  .result-actions .button {
    width: 100%;
  }

  .secret-output {
    min-height: 76px;
    font-size: 1rem;
  }
}

@media (max-width: 390px) {
  .length-controls {
    grid-template-columns: minmax(0, 1fr) 78px;
    gap: 0.45rem;
  }

  .mode-tab {
    font-size: 0.78rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode-tab,
  .button {
    transition-duration: 0.01ms !important;
  }
}
