/* ==========================================================================
   Daily Spelling — design system
   Warm, friendly kid-education product. Deep teal primary, warm amber
   accent, off-white paper background, generous radii, soft shadows.
   Built on top of Bootstrap 5 (CDN) — targeted overrides only, no build step.
   ========================================================================== */

:root {
  /* Palette */
  --st-primary: #0f766e; /* deep teal */
  --st-primary-dark: #115e59;
  --st-primary-soft: #d5efec; /* soft teal wash */
  --st-primary-softer: #ebf7f5;
  --st-accent: #b45309; /* warm amber (text-safe) */
  --st-accent-soft: #fdf1d7; /* hint / warm wash */
  --st-accent-border: #f4d48c;
  --st-green: #2e7d4f; /* gentle success */
  --st-green-dark: #22613d;
  --st-green-soft: #ddf2e4;
  --st-red: #b23b3b;
  --st-red-soft: #fbe9e7;
  --st-ink: #33302b; /* warm near-black */
  --st-muted: #6f675b; /* warm gray, AA on paper */
  --st-paper: #faf6f0; /* page background */
  --st-card: #ffffff;
  --st-line: #eae3d8; /* hairline borders */
  --st-line-strong: #ddd4c6;

  /* Shape + depth */
  --st-radius-lg: 1.15rem;
  --st-radius: 0.75rem;
  --st-radius-sm: 0.55rem;
  --st-shadow:
    0 1px 2px rgba(51, 48, 43, 0.05), 0 6px 18px rgba(51, 48, 43, 0.07);
  --st-shadow-lg:
    0 2px 4px rgba(51, 48, 43, 0.05), 0 14px 34px rgba(51, 48, 43, 0.1);

  /* Typography */
  --st-font:
    'Nunito', -apple-system, blinkmacsystemfont, 'Segoe UI', roboto,
    'Helvetica Neue', arial, sans-serif;

  /* Remap the Bootstrap tokens we lean on */
  --bs-primary: var(--st-primary);
  --bs-primary-rgb: 15, 118, 110;
  --bs-success: var(--st-green);
  --bs-success-rgb: 46, 125, 79;
  --bs-danger: var(--st-red);
  --bs-danger-rgb: 178, 59, 59;
  --bs-body-font-family: var(--st-font);
  --bs-body-bg: var(--st-paper);
  --bs-body-color: var(--st-ink);
  --bs-border-radius: var(--st-radius);
  --bs-link-color: var(--st-primary);
  --bs-link-hover-color: var(--st-primary-dark);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

body {
  font-family: var(--st-font);
  background-color: var(--st-paper);
  color: var(--st-ink);
  font-size: 1.02rem;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  font-weight: 800;
  color: var(--st-ink);
  letter-spacing: -0.01em;
}

a {
  color: var(--st-primary);
}

a:hover {
  color: var(--st-primary-dark);
}

.text-secondary,
.text-muted {
  color: var(--st-muted) !important;
}

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.45);
  outline-offset: 2px;
}

main.st-main {
  padding-bottom: 4rem;
}

/* --------------------------------------------------------------------------
   Navbar
   -------------------------------------------------------------------------- */

.st-navbar {
  background: var(--st-card);
  border-bottom: 1px solid var(--st-line);
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.st-navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--st-ink);
}

.st-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.7rem;
  background: linear-gradient(135deg, var(--st-primary) 0%, #14958b 100%);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.35);
}

.st-navbar .nav-link {
  color: var(--st-ink);
  font-weight: 700;
  border-radius: var(--st-radius-sm);
  padding: 0.4rem 0.85rem;
}

.st-navbar .nav-link:hover,
.st-navbar .nav-link:focus {
  color: var(--st-primary-dark);
  background: var(--st-primary-softer);
}

.st-navbar .nav-link.active {
  color: var(--st-primary-dark);
  background: var(--st-primary-soft);
}

.st-navbar .dropdown-menu {
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius);
  box-shadow: var(--st-shadow);
  overflow: hidden;
}

.st-navbar .dropdown-item {
  font-weight: 600;
  padding: 0.5rem 1rem;
}

.st-navbar .dropdown-item:hover,
.st-navbar .dropdown-item:focus {
  background: var(--st-primary-softer);
  color: var(--st-primary-dark);
}

.st-navbar .navbar-toggler {
  border-color: var(--st-line-strong);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  font-weight: 700;
  border-radius: var(--st-radius);
  padding: 0.45rem 1.1rem;
}

.btn-lg {
  border-radius: 0.9rem;
  padding: 0.65rem 1.6rem;
}

.btn-sm {
  border-radius: var(--st-radius-sm);
}

.btn-primary {
  --bs-btn-bg: var(--st-primary);
  --bs-btn-border-color: var(--st-primary);
  --bs-btn-hover-bg: var(--st-primary-dark);
  --bs-btn-hover-border-color: var(--st-primary-dark);
  --bs-btn-active-bg: var(--st-primary-dark);
  --bs-btn-active-border-color: var(--st-primary-dark);
  --bs-btn-disabled-bg: var(--st-primary);
  --bs-btn-disabled-border-color: var(--st-primary);
  --bs-btn-focus-shadow-rgb: 15, 118, 110;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
}

.btn-outline-primary {
  --bs-btn-color: var(--st-primary);
  --bs-btn-border-color: var(--st-primary);
  --bs-btn-hover-bg: var(--st-primary);
  --bs-btn-hover-border-color: var(--st-primary);
  --bs-btn-active-bg: var(--st-primary);
  --bs-btn-active-border-color: var(--st-primary);
  --bs-btn-focus-shadow-rgb: 15, 118, 110;
}

.btn-success {
  --bs-btn-bg: var(--st-green);
  --bs-btn-border-color: var(--st-green);
  --bs-btn-hover-bg: var(--st-green-dark);
  --bs-btn-hover-border-color: var(--st-green-dark);
  --bs-btn-active-bg: var(--st-green-dark);
  --bs-btn-active-border-color: var(--st-green-dark);
  --bs-btn-focus-shadow-rgb: 46, 125, 79;
}

.btn-danger {
  --bs-btn-bg: var(--st-red);
  --bs-btn-border-color: var(--st-red);
  --bs-btn-hover-bg: #96312f;
  --bs-btn-hover-border-color: #96312f;
  --bs-btn-active-bg: #96312f;
  --bs-btn-active-border-color: #96312f;
}

.btn-outline-danger {
  --bs-btn-color: var(--st-red);
  --bs-btn-border-color: #d9a4a4;
  --bs-btn-hover-bg: var(--st-red);
  --bs-btn-hover-border-color: var(--st-red);
  --bs-btn-active-bg: var(--st-red);
  --bs-btn-active-border-color: var(--st-red);
}

.btn-outline-secondary {
  --bs-btn-color: var(--st-muted);
  --bs-btn-border-color: var(--st-line-strong);
  --bs-btn-hover-bg: #f1ece3;
  --bs-btn-hover-border-color: var(--st-line-strong);
  --bs-btn-hover-color: var(--st-ink);
  --bs-btn-active-bg: #f1ece3;
  --bs-btn-active-border-color: var(--st-line-strong);
  --bs-btn-active-color: var(--st-ink);
}

/* Quiet action links on cards (Word list / Progress / Settings) */
.btn-quiet {
  --bs-btn-color: var(--st-primary);
  --bs-btn-bg: var(--st-primary-softer);
  --bs-btn-border-color: transparent;
  --bs-btn-hover-bg: var(--st-primary-soft);
  --bs-btn-hover-color: var(--st-primary-dark);
  --bs-btn-active-bg: var(--st-primary-soft);
  --bs-btn-active-color: var(--st-primary-dark);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  background: var(--st-card);
}

.card.shadow-sm,
.st-card {
  box-shadow: var(--st-shadow) !important;
}

.card-footer {
  border-top: 1px solid var(--st-line);
  background: transparent;
  border-bottom-left-radius: var(--st-radius-lg) !important;
  border-bottom-right-radius: var(--st-radius-lg) !important;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-control,
.form-select {
  border-radius: var(--st-radius);
  border-color: var(--st-line-strong);
  padding: 0.5rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--st-primary);
  box-shadow: 0 0 0 0.25rem rgba(15, 118, 110, 0.15);
}

.form-label {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Alerts / messages
   -------------------------------------------------------------------------- */

.alert {
  border-radius: var(--st-radius);
  border: 1px solid transparent;
  font-weight: 600;
}

.alert-success {
  background: var(--st-green-soft);
  border-color: #b9e2c6;
  color: var(--st-green-dark);
}

.alert-info {
  background: var(--st-primary-softer);
  border-color: #bfe5e0;
  color: var(--st-primary-dark);
}

.alert-warning {
  background: var(--st-accent-soft);
  border-color: var(--st-accent-border);
  color: #8a4a06;
}

.alert-danger,
.alert-error {
  background: var(--st-red-soft);
  border-color: #eec5c0;
  color: #96312f;
}

/* --------------------------------------------------------------------------
   Status chips (New / Learning / Mastered)
   -------------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.chip-new {
  background: #efe9df;
  color: #635b4e;
}

.chip-learning {
  background: var(--st-primary-soft);
  color: #0b5a54;
}

.chip-mastered {
  background: var(--st-green-soft);
  color: var(--st-green-dark);
}

.chip-streak {
  background: var(--st-accent-soft);
  color: var(--st-accent);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.st-table-card {
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow);
  overflow: hidden;
}

.st-table-card .table {
  margin-bottom: 0;
}

.table {
  --bs-table-hover-bg: #faf7f1;
  color: var(--st-ink);
}

.table thead th {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--st-muted);
  background: #f6f1e9;
  border-bottom: 1px solid var(--st-line);
  padding: 0.65rem 1rem;
}

.table tbody td {
  padding: 0.7rem 1rem;
  border-color: var(--st-line);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

/* Result markers (summary + progress) — color plus text, never color alone */
.result-good {
  color: var(--st-green-dark);
  font-weight: 700;
}

.result-ok {
  color: var(--st-accent);
  font-weight: 700;
}

.result-miss {
  color: var(--st-red);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Landing hero
   -------------------------------------------------------------------------- */

.st-hero {
  text-align: center;
  padding: 4.5rem 1rem 3rem;
}

.st-hero-badge {
  display: inline-block;
  background: var(--st-accent-soft);
  color: var(--st-accent);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.st-hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 800;
  margin-bottom: 1rem;
}

.st-hero h1 .accent {
  color: var(--st-primary);
}

.st-hero .lead {
  max-width: 38rem;
  margin: 0 auto 2rem;
  color: var(--st-muted);
  font-size: 1.15rem;
  font-weight: 600;
}

.st-feature-card {
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow);
  padding: 1.75rem 1.5rem;
  height: 100%;
  text-align: center;
}

.st-feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 1rem;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.st-feature-icon.tint-teal {
  background: var(--st-primary-soft);
}

.st-feature-icon.tint-amber {
  background: var(--st-accent-soft);
}

.st-feature-icon.tint-green {
  background: var(--st-green-soft);
}

.st-feature-card h3 {
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.st-feature-card p {
  color: var(--st-muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Students page
   -------------------------------------------------------------------------- */

.st-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.st-avatar-0 {
  background: linear-gradient(135deg, #0f766e, #16988d);
}

.st-avatar-1 {
  background: linear-gradient(135deg, #b45309, #d97a1f);
}

.st-avatar-2 {
  background: linear-gradient(135deg, #6d5db4, #8a7ad1);
}

.st-avatar-3 {
  background: linear-gradient(135deg, #b34a72, #d0688f);
}

.st-avatar-4 {
  background: linear-gradient(135deg, #2e7d4f, #47a06c);
}

.st-student-card .card-body {
  padding: 1.5rem;
}

.st-student-card .card-footer {
  padding: 0.9rem 1.5rem;
}

/* Onboarding / empty states */
.st-empty {
  max-width: 34rem;
  margin: 3rem auto;
  text-align: center;
}

.st-empty-art {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 1rem;
}

.st-steps {
  list-style: none;
  counter-reset: st-step;
  padding: 0;
  margin: 1.75rem 0;
  text-align: left;
}

.st-steps li {
  counter-increment: st-step;
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.6rem 0;
}

.st-steps li::before {
  content: counter(st-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--st-primary-soft);
  color: var(--st-primary-dark);
  font-weight: 800;
  flex-shrink: 0;
}

.st-steps strong {
  display: block;
}

.st-steps span {
  color: var(--st-muted);
  font-size: 0.95rem;
}

/* Soft callout (e.g. "ready to practice" pointer) */
.st-callout {
  background: var(--st-primary-softer);
  border: 1px solid #bfe5e0;
  border-radius: var(--st-radius-lg);
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.st-callout p {
  margin: 0;
  font-weight: 600;
  color: var(--st-primary-dark);
}

/* --------------------------------------------------------------------------
   Quiz page (kid-facing: big, calm, friendly)
   -------------------------------------------------------------------------- */

.st-quiz-card {
  border: 1px solid var(--st-line);
  border-radius: 1.5rem;
  background: var(--st-card);
  box-shadow: var(--st-shadow-lg);
}

.st-quiz-card .card-body {
  padding: 3rem 2rem;
}

#start-screen h1 {
  font-size: clamp(1.6rem, 4.5vw, 2.3rem);
}

#progress-text {
  font-weight: 700;
  color: var(--st-muted);
  letter-spacing: 0.02em;
}

.progress {
  background-color: #ece5d9;
  border-radius: 999px;
}

.progress-bar {
  background-color: var(--st-primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}

#hear-btn {
  --bs-btn-color: var(--st-primary-dark);
  --bs-btn-bg: var(--st-primary-softer);
  --bs-btn-border-color: var(--st-primary-soft);
  --bs-btn-hover-bg: var(--st-primary-soft);
  --bs-btn-hover-border-color: var(--st-primary-soft);
  --bs-btn-hover-color: var(--st-primary-dark);
  --bs-btn-active-bg: var(--st-primary-soft);
  --bs-btn-active-border-color: var(--st-primary-soft);
  --bs-btn-active-color: var(--st-primary-dark);
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.75rem 1.75rem;
}

#attempt-input {
  border-radius: 1rem;
  border: 2px solid var(--st-line-strong);
  background: #fdfcf9;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.9rem 1rem;
}

#attempt-input:focus {
  border-color: var(--st-primary);
  box-shadow: 0 0 0 0.3rem rgba(15, 118, 110, 0.14);
}

#hint-card {
  background: var(--st-accent-soft) !important;
  border: 1px solid var(--st-accent-border) !important;
  border-radius: var(--st-radius-lg);
}

#hint-card .hint-label {
  color: var(--st-accent) !important;
  font-weight: 800;
  letter-spacing: 0.08em;
}

#hint-card p {
  color: #6b3a06;
}

#hint-card #hint-rule {
  color: #8a5a1f !important;
}

/* The wrong phonogram inside the quoted attempt, e.g. th**ay** */
#hint-card mark {
  background: var(--st-red-soft);
  color: var(--st-red);
  font-weight: 800;
  padding: 0 0.15em;
  border-radius: 0.25em;
}

#correct-msg {
  color: var(--st-green-dark) !important;
  font-weight: 800;
}

#reveal-card .fs-4 {
  color: var(--st-ink);
}

#reveal-word {
  color: var(--st-primary-dark);
  letter-spacing: 0.06em;
}

#degraded-sentence {
  font-weight: 600;
  color: var(--st-ink);
}

/* --------------------------------------------------------------------------
   Summary page
   -------------------------------------------------------------------------- */

.st-score-hero {
  text-align: center;
  padding: 2.5rem 1.5rem 2rem;
}

.st-score-ring {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  background: var(--st-card);
  border: 6px solid var(--st-primary-soft);
  box-shadow: var(--st-shadow);
  margin-bottom: 1.25rem;
}

.st-score-ring .score {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--st-primary-dark);
}

.st-score-ring .label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--st-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.st-celebrate {
  background: var(--st-green-soft);
  border: 1px solid #b9e2c6;
  color: var(--st-green-dark);
  border-radius: var(--st-radius-lg);
  padding: 1rem 1.4rem;
  text-align: center;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Progress page
   -------------------------------------------------------------------------- */

.st-stat-card {
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow);
  padding: 1.15rem 0.75rem;
  text-align: center;
  height: 100%;
}

.st-stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.2;
}

.st-stat-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--st-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.st-quiz-row {
  border: 0;
  border-bottom: 1px solid var(--st-line);
}

.st-quiz-row:last-child {
  border-bottom: 0;
}

.st-quiz-row .btn-toggle {
  font-weight: 700;
  color: var(--st-ink);
}

.st-score-pill {
  background: var(--st-primary-soft);
  color: var(--st-primary-dark);
  font-weight: 800;
  border-radius: 999px;
  padding: 0.28rem 0.85rem;
  font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Auth (allauth entrance) pages
   -------------------------------------------------------------------------- */

.st-auth-wrap {
  max-width: 26.5rem;
  margin: 3rem auto 4rem;
  padding: 0 1rem;
}

.st-auth-card {
  background: var(--st-card);
  border: 1px solid var(--st-line);
  border-radius: var(--st-radius-lg);
  box-shadow: var(--st-shadow-lg);
  padding: 2.25rem 2rem;
}

.st-auth-card h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.st-auth-card .btn {
  width: 100%;
  margin-top: 0.5rem;
}

.st-auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.st-auth-brand .st-brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 1rem;
  font-size: 1.5rem;
}

/* --------------------------------------------------------------------------
   Page headers
   -------------------------------------------------------------------------- */

.st-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 2rem 0 1.5rem;
}

.st-page-header h1 {
  margin: 0;
  font-size: 1.65rem;
}

.st-page-header .subtitle {
  color: var(--st-muted);
  font-weight: 600;
  margin: 0.15rem 0 0;
}

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 575.98px) {
  .st-quiz-card .card-body {
    padding: 2rem 1.15rem;
  }

  .st-hero {
    padding-top: 3rem;
  }

  .st-page-header h1 {
    font-size: 1.4rem;
  }

  #attempt-input.fs-2 {
    font-size: 1.6rem !important;
  }
}
