:root {
  --otp-hero-bg: linear-gradient(135deg, rgba(30, 64, 175, 0.14), rgba(16, 185, 129, 0.12));
  --otp-card-border: rgba(15, 23, 42, 0.08);
  --otp-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.08);
}

[data-bs-theme="dark"] {
  --otp-hero-bg: linear-gradient(135deg, rgba(96, 165, 250, 0.18), rgba(45, 212, 191, 0.12));
  --otp-card-border: rgba(148, 163, 184, 0.18);
  --otp-shadow: 0 1rem 2rem rgba(2, 6, 23, 0.45);
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 28%),
    radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.08), transparent 24%),
    var(--bs-body-bg);
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  padding: 1rem 0 0;
}

.navbar {
  padding: 0;
}

.brand-logo {
  width: 96px;
  height: auto;
}

.brand-copy {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  color: var(--bs-body-color);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  color: var(--bs-secondary-color);
  font-size: 0.85rem;
}

.theme-toggle {
  min-width: 7rem;
}

.theme-toggle [class^="theme-toggle-"] {
  display: none;
}

.theme-toggle[data-theme-state="auto"] .theme-toggle-auto,
.theme-toggle[data-theme-state="light"] .theme-toggle-light,
.theme-toggle[data-theme-state="dark"] .theme-toggle-dark {
  display: inline;
}

.hero-card,
.otp-card,
.state-card {
  border: 1px solid var(--otp-card-border);
  border-radius: 1.5rem;
  background-color: color-mix(in srgb, var(--bs-body-bg) 92%, white 8%);
  box-shadow: var(--otp-shadow);
}

.hero-card {
  margin-top: 1.5rem;
  padding: 2rem;
  background-image: var(--otp-hero-bg);
}

.hero-eyebrow {
  display: inline-flex;
  margin-bottom: 1rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background-color: rgba(255, 255, 255, 0.4);
}

[data-bs-theme="dark"] .hero-eyebrow {
  background-color: rgba(15, 23, 42, 0.35);
}

.otp-card {
  overflow: hidden;
}

.stacked-sections {
  display: grid;
  gap: 1.5rem;
  margin-top: 1rem;
}

.password-page {
  margin-top: 1.5rem;
}

.otp-card .badge {
  color: var(--bs-body-color);
}

.password-output,
.font-monospace-input {
  font-family: Consolas, "Courier New", monospace;
}

.length-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.length-buttons .btn {
  min-width: 3rem;
}

.empty-state {
  padding: 2rem 0;
}

.state-card {
  padding: 2rem;
}

.state-card {
  max-width: 42rem;
  margin: 2rem auto 0;
}

.password-preview {
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
}

.footer {
  margin-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem var(--bs-body-bg), 0 0 0 0.25rem rgba(13, 110, 253, 0.35);
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-flex;
}

@media (max-width: 767.98px) {
  .hero-card,
  .state-card {
    padding: 1.5rem;
  }

  .app-header {
    padding-top: 0.75rem;
  }

  .navbar > .container-xl {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .navbar-brand {
    gap: 0.5rem !important;
    margin-right: 0.5rem;
  }

  .otp-card .card-body {
    padding: 1.5rem !important;
  }

  .stacked-sections {
    gap: 1rem;
  }

  .footer {
    margin-top: 1rem;
    padding-bottom: 1rem;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .brand-subtitle {
    font-size: 0.76rem;
  }

  .theme-toggle {
    min-width: 0;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.2;
    flex-shrink: 0;
  }
}
