:root {
  /* Warm, encouraging brand green — doubles as the "correct answer" color throughout the app
     (Duolingo-style: the color that celebrates a right answer is the same one that invites you
     to keep going), so praise and progress always read as one consistent, positive signal. */
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #dcfce7;
  /* Errors/incorrect states get their own color family, decoupled from brand — a wrong answer
     should never render in the same green used for encouragement. */
  --danger: #dc2626;
  --danger-dark: #991b1b;
  --danger-light: #fef2f2;
  --bg: #faf9f5;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #18181b;
  --muted: #6b7280;
  --green: #16a34a;
  --green-light: #dcfce7;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --teal: #008080;
  --teal-light: #f0fdfa;
  --purple: #7c3aed;
  --purple-light: #f5f0ff;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --radius: 14px;
  --sidebar-bg: #12141c;
  --sidebar-text: #9aa1b5;
  --sidebar-active-bg: #ffffff;
  --sidebar-active-text: #14161f;
  --sidebar-hover-bg: #1e212c;
  --sidebar-border: #23252f;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { text-decoration: none; color: inherit; }

/* Disciplined type scale — every heading level has one fixed size everywhere in the app,
   so headings read as a consistent hierarchy instead of ad-hoc browser defaults. */
h1, h2, h3, h4 { margin: 0 0 10px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0 0 10px; line-height: 1.6; }
strong { font-weight: 700; }
.card h3:first-child, .card h2:first-child { margin-top: 0; }

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

/* Sidebar — dark, matching the original app's branding */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { font-weight: 800; font-size: 16px; padding: 0 10px 4px; color: #fff; display: flex; align-items: center; gap: 8px; }
.sidebar-sub { font-size: 11px; color: var(--sidebar-text); padding: 0 10px 18px; font-weight: 600; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 600; color: var(--sidebar-text);
}
.nav-link:hover { background: var(--sidebar-hover-bg); color: #fff; }
.nav-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.nav-icon { width: 20px; text-align: center; }
.nav-divider { height: 1px; background: var(--sidebar-border); margin: 10px 4px; }

/* Expandable sidebar submenu (e.g. Knowledge Resources -> Numbers & More / Pronouns / 7 Cases) */
.nav-submenu summary { cursor: pointer; list-style: none; }
.nav-submenu summary::-webkit-details-marker { display: none; }
.nav-submenu-chevron { margin-left: auto; font-size: 11px; transition: transform .15s; }
.nav-submenu[open] .nav-submenu-chevron { transform: rotate(180deg); }
.nav-submenu-list { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px 14px; }
.nav-sublink { font-size: 13px; font-weight: 500; padding: 8px 12px; }
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px 0; margin-top: 10px; border-top: 1px solid var(--sidebar-border);
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }
.logout-link { font-size: 18px; color: var(--sidebar-text); }
.logout-link:hover { color: #fff; }

/* Main content */
.main-content { flex: 1; min-width: 0; padding: 28px 32px 90px; max-width: 1400px; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.flash-success { background: var(--green-light); color: #166534; }
.flash-error { background: var(--danger-light); color: var(--danger-dark); }
.flash-info { background: var(--blue-light); color: #1e40af; }

.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.page-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-num { font-size: 26px; font-weight: 800; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 14px;
  border: 2px solid transparent; cursor: pointer; background: var(--text); color: #fff;
}
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); }
.btn-outline { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: #dc2626; }
.btn-block { width: 100%; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=file], textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--border);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; }
.form-group { margin-bottom: 14px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > * { flex: 1; min-width: 160px; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #dcfce7, #fef3c7); padding: 20px; }
.auth-card { background: #fff; border-radius: 18px; padding: 36px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.08); }
.auth-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-switch { text-align: center; font-size: 13px; margin-top: 16px; color: var(--muted); }
.auth-switch a { color: var(--primary); font-weight: 700; }
.google-signin-btn { gap: 10px; margin-bottom: 16px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; color: var(--muted); font-size: 12px; font-weight: 600; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Tabs */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tab-btn {
  padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 700;
  border: 2px solid var(--border); background: var(--card); color: var(--muted); cursor: pointer;
}
.tab-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

.filter-scroll-row {
  display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto;
  padding-bottom: 4px; scrollbar-width: thin;
}
.filter-scroll-row .tab-btn { flex-shrink: 0; white-space: nowrap; }
.filter-scroll-row::-webkit-scrollbar { height: 6px; }
.filter-scroll-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; border: 1px solid; }
.badge-green { background: var(--green-light); color: #166534; border-color: #bbf7d0; }
.badge-blue { background: var(--blue-light); color: #1e40af; border-color: #bfdbfe; }
.badge-amber { background: var(--amber-light); color: #92400e; border-color: #fde68a; }
.badge-red { background: var(--danger-light); color: var(--danger-dark); border-color: #fecaca; }
.badge-purple { background: var(--purple-light); color: var(--purple); border-color: #ddd6fe; }
.badge-teal { background: var(--teal-light); color: var(--teal); border-color: #99f6e4; }

/* Plain colored word-type label (top-right of vocab cards) — text only, no pill background */
.type-label { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.type-label.verb { color: var(--green); }
.type-label.noun { color: var(--purple); }
.type-label.adjective { color: var(--blue); }
.type-label.adverb { color: var(--teal); }
.type-label.pronoun { color: var(--amber); }
.type-label.preposition { color: #db2777; }
.type-label.conjunction { color: var(--green); }
.type-label.other { color: var(--muted); }

/* Speaker / pronounce icon button */
.speak-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary-light); color: var(--primary); font-size: 11px; flex-shrink: 0;
}
.speak-btn:hover { background: var(--primary); color: #fff; }

/* Vocab / verb entry card */
.vocab-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.vocab-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.vocab-pair { display: grid; grid-template-columns: 260px 1fr; align-items: center; column-gap: 16px; row-gap: 6px; flex: 1; min-width: 0; }
.vocab-pair-side { min-width: 0; }
.vocab-pair-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vocab-pair-arrow { color: var(--muted); font-size: 16px; margin: 0 4px; flex-shrink: 0; }
.vocab-word { font-size: 17px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
.vocab-word.pf-word, .vocab-word.antonym-word { color: #15803d; }
.vocab-translation { color: var(--muted); font-size: 13px; font-style: italic; }
.gender-mark { font-size: 13px; color: var(--muted); }
.aspect-tag { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 1px 6px; border-radius: 5px; margin-right: 5px; }
.aspect-tag.impf { background: var(--blue-light); color: #1e40af; }
.aspect-tag.pf { background: var(--green-light); color: #166534; }
.rozkaz-line { font-size: 12px; font-weight: 700; margin-top: 4px; }
.rozkaz-label { color: var(--muted); font-weight: 800; margin-right: 2px; }
.rozkaz-line .impf-form { color: #1e40af; }
.rozkaz-line .pf-form { color: #166534; }
.vocab-tags { display: flex; gap: 4px; flex-shrink: 0; }

/* Lists */
.list-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg); }

/* Flashcard */
.flashcard {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 50px 30px; text-align: center; min-height: 220px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer;
  user-select: none;
}
.flashcard-word { font-size: 30px; font-weight: 800; margin-bottom: 8px; }
.flashcard-hint { color: var(--muted); font-size: 13px; }

/* Quiz */
.quiz-question { font-size: 18px; font-weight: 700; margin-bottom: 18px; }
.quiz-option {
  display: block; width: 100%; text-align: left; padding: 13px 16px; margin-bottom: 8px;
  border-radius: 12px; border: 2px solid var(--border); background: var(--card); font-size: 14px; font-weight: 600; cursor: pointer;
}
.quiz-option:hover { border-color: #d1d5db; }
.quiz-option.selected { border-color: var(--blue); background: var(--blue-light); }
.quiz-option.correct { border-color: var(--green); background: var(--green-light); }
.quiz-option.incorrect { border-color: var(--danger); background: var(--danger-light); }

.progress-bar-track { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress-bar-fill { height: 100%; background: var(--primary); }

/* Chips / gap fill */
.gap-blank { display: inline-block; min-width: 90px; border-bottom: 2px solid var(--muted); text-align: center; font-weight: 700; }
.reading-text { line-height: 1.9; font-size: 15px; }

/* Misc */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.flex { display: flex; } .flex-wrap { flex-wrap: wrap; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.chip { display: inline-block; padding: 4px 11px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 12px; font-weight: 600; margin: 2px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.mistake-box { background: var(--danger-light); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.good-box { background: var(--green-light); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.loading-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.15); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Pin / bookmark toggle on vocab cards */
.pin-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; border: none; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 13px; flex-shrink: 0; opacity: .55;
}
.pin-btn:hover { opacity: 1; }
.pin-btn.active { opacity: 1; color: var(--amber); }

/* B1 tag toggle on vocab cards */
.b1-btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 22px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--border); cursor: pointer;
  background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; flex-shrink: 0; opacity: .6;
}
.b1-btn:hover { opacity: 1; }
.b1-btn.active { opacity: 1; background: var(--blue-light); color: #1e40af; border-color: #1e40af; }

/* Smart "add a word" bar — single input, AI fills in the rest */
.smart-add-bar { display: flex; gap: 8px; }
.smart-add-bar input[type=text] { flex: 1; }
.smart-add-status { margin-top: 10px; font-size: 13px; border-radius: 10px; padding: 10px 12px; display: none; }
.smart-add-status.show { display: block; }
.smart-add-status.status-error { background: var(--danger-light); color: var(--danger-dark); }
.smart-add-status.status-exists { background: var(--amber-light); color: #92400e; }
.smart-add-status.status-loading { background: var(--bg); color: var(--muted); }
.smart-add-status.status-success { background: var(--green-light); color: #166534; }
.smart-add-status a { text-decoration: underline; font-weight: 700; }

/* Duplicate-entry warning banner on the Słownik page */
.duplicate-banner { background: var(--amber-light); border: 1px solid #fde68a; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.duplicate-banner summary { cursor: pointer; font-weight: 700; color: #92400e; font-size: 13px; }
.duplicate-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid #fde68a; font-size: 13px; }
.duplicate-group:first-of-type { border-top: none; }
.duplicate-group-label { font-weight: 700; margin-bottom: 4px; }
.duplicate-group-reason { color: #92400e; font-weight: 500; font-size: 12px; margin-bottom: 4px; }
.duplicate-entry-link { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; }
.entry-badge-dup { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.entry-badge-known { background: var(--green-light); color: #166534; border-color: #bbf7d0; }

/* Entry detail modal (verb & word cards open here instead of navigating away) */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(15,15,20,.55);
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100; overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal-box { background: var(--card); border-radius: 20px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-header-title { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.modal-header-sub { color: var(--muted); font-size: 13px; font-style: italic; margin-top: 2px; }
.modal-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
}
.modal-close-btn { background: var(--bg); color: var(--text); }
.modal-delete-btn { background: var(--danger-light); color: var(--danger-dark); }
.modal-body { padding: 14px 22px 22px; }
.modal-loading { padding: 40px; text-align: center; color: var(--muted); }

/* Ebook Library ("Read to Speak") */
.ebook-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ebook-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; align-items: flex-start; gap: 12px; }
.ebook-icon-box {
  width: 44px; height: 52px; border-radius: 10px; background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.ebook-card-body { flex: 1; min-width: 0; }
.ebook-card-title { font-weight: 800; font-size: 14px; margin-bottom: 2px; }
.ebook-card-desc {
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ebook-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ebook-upload-divider { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.ebook-upload-divider hr { flex: 1; border: none; border-top: 1px solid var(--border); }
.ebook-upload-divider span { font-size: 10px; font-weight: 800; letter-spacing: .05em; color: var(--muted); }
.ebook-file-drop {
  display: flex; align-items: center; gap: 10px; border: 2px dashed var(--border); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; font-size: 13px;
}
.ebook-file-drop:hover { border-color: var(--primary); }

.ebook-reader-overlay { padding: 0; align-items: stretch; }
.ebook-reader-box {
  background: var(--card); width: 100%; height: 100%; display: flex; flex-direction: column;
}
.ebook-reader-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ebook-reader-iframe { flex: 1; border: 0; width: 100%; }

.usage-guide-box { background: var(--amber-light); border: 1px solid #fde68a; border-radius: 12px; padding: 12px 14px; margin: 14px 0; font-size: 13px; color: #78350f; }

/* Reusable "📌 B1 Tips" callout — used on Cases, Home, etc. */
.b1-tips-box { background: var(--amber-light); border: 1px solid #fde68a; border-radius: 14px; padding: 14px 16px; margin: 14px 0; }
.b1-tips-title { font-size: 11px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: #92400e; margin-bottom: 8px; }
.b1-tips-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.b1-tips-list li { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: #78350f; line-height: 1.5; }
.b1-tips-list li::before { content: '→'; color: var(--amber); font-weight: 800; flex-shrink: 0; }

/* Case / grammar "hero" intro card — color-tinted explanation block */
.case-hero-card { border-radius: 16px; padding: 18px 20px; border: 2px solid; margin-bottom: 14px; }
.case-hero-top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.case-hero-badge { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.case-hero-title { font-size: 20px; font-weight: 800; margin: 0; }
.case-hero-question { font-size: 12px; font-weight: 800; font-family: ui-monospace, monospace; }
.case-hero-tagline { font-size: 13px; font-weight: 700; margin-top: 2px; }
.case-hero-details summary { cursor: pointer; list-style: none; }
.case-hero-details summary::-webkit-details-marker { display: none; }
.case-hero-expand-hint { text-align: right; }
.case-hero-details[open] .case-hero-expand-hint::before { content: '▾ '; }
.case-hero-details:not([open]) .case-hero-expand-hint::before { content: '▸ '; }
.case-hero-details-body { margin-top: 12px; }
.case-hero-details-body .pguide-box { border-width: 1px; }
.case-hero-explanation { font-size: 13.5px; line-height: 1.6; }

/* Readiness ring (Progress page) */
.readiness-ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.readiness-ring-center { position: absolute; text-align: center; }
.readiness-ring-pct { font-size: 26px; font-weight: 900; }
.readiness-ring-label { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.readiness-badge { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.readiness-badge-ready { background: var(--green-light); color: #166534; }
.readiness-badge-progress { background: var(--blue-light); color: #1e40af; }
.readiness-badge-needswork { background: #ffedd5; color: #9a3412; }

/* Score breakdown skill bars */
.skill-bar-row { margin-bottom: 16px; }
.skill-bar-row:last-child { margin-bottom: 0; }
.skill-bar-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.skill-bar-name { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.skill-bar-pct { font-size: 13px; font-weight: 800; }
.skill-bar-desc { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.skill-bar-track { height: 10px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.skill-bar-fill { height: 100%; border-radius: 999px; }

/* Compact case quick-reference used on Pronouns */
.case-ref-box { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 16px; }
.case-ref-item { border-radius: 10px; padding: 8px 10px; border: 1px solid; font-size: 12px; }
.case-ref-item-top { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.case-ref-item-abbr { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 999px; color: #fff; }
.case-ref-item-q { font-family: ui-monospace, monospace; font-size: 11px; font-weight: 700; }
.case-ref-item-tip { color: var(--muted); font-size: 11px; }

/* Pronoun / vocab "B1 Student Guide" — collapsible when-to-use card (native <details>) */
.pguide-box { border-radius: 16px; border: 1px solid; overflow: hidden; margin-bottom: 16px; }
.pguide-box summary { cursor: pointer; list-style: none; padding: 14px 16px; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.pguide-box summary::-webkit-details-marker { display: none; }
.pguide-summary-left { display: flex; align-items: center; gap: 12px; }
.pguide-icon { font-size: 20px; }
.pguide-title { font-weight: 800; font-size: 14px; }
.pguide-summary-text { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pguide-chevron { flex-shrink: 0; }
.pguide-body { padding: 0 16px 16px; border-top: 1px solid; }
.pguide-when-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 8px; }
.pguide-rule-box { background: rgba(255,255,255,.7); border: 1px solid; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.pguide-rule-title { font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.pguide-rule-example { font-family: ui-monospace, monospace; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.pguide-rule-note { font-size: 11px; color: var(--muted); font-style: italic; }
.pguide-tip-box { background: rgba(255,255,255,.85); border: 1px solid; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 12.5px; }
.pguide-mistake-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 10px 12px; }
.pguide-mistake-title { font-size: 10px; font-weight: 800; text-transform: uppercase; color: #dc2626; margin-bottom: 4px; }
.pguide-mistake-text { font-size: 12.5px; color: #b91c1c; }

/* Pronoun picker + per-case example detail panel */
.pronoun-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pronoun-chip {
  padding: 7px 14px; border-radius: 10px; border: 2px solid var(--border); background: var(--card);
  text-decoration: none; font-size: 13px; font-weight: 700; color: var(--text);
}
.pronoun-chip .pronoun-chip-en { font-weight: 500; color: var(--muted); font-size: 11px; margin-left: 4px; }
.pronoun-chip.active { color: #fff; border-color: transparent; }
.pronoun-detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.pronoun-detail-item { border-radius: 12px; padding: 10px 12px; border: 1px solid; }
.pronoun-detail-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.pronoun-detail-form { font-family: ui-monospace, monospace; font-weight: 800; font-size: 14px; }
.pronoun-detail-example { font-size: 12px; margin-top: 4px; }
.pronoun-detail-example-en { font-size: 11px; color: var(--muted); font-style: italic; }

/* Lesson reader — TOC sidebar + content pane */
.lesson-reader { display: flex; gap: 20px; align-items: flex-start; margin-top: 8px; }
.lesson-toc { width: 260px; flex-shrink: 0; max-height: 78vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--card); padding: 10px; position: sticky; top: 12px; }
.lesson-toc-unit-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 10px 8px 4px; }
.lesson-toc-item { display: flex; align-items: center; gap: 4px; border-radius: 8px; font-size: 12.5px; }
.lesson-toc-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 700; }
.lesson-toc-check { border: none; background: none; cursor: pointer; font-size: 14px; line-height: 1; padding: 6px 2px 6px 6px; flex-shrink: 0; }
.lesson-toc-item-link { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex: 1; min-width: 0; padding: 6px 8px 6px 2px; border-radius: 8px; text-decoration: none; color: inherit; }
.lesson-toc-item-link:hover { background: var(--bg); }
.lesson-toc-item-page { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.lesson-content-pane { flex: 1; min-width: 0; }
.lesson-content-pane .card { max-height: 78vh; overflow-y: auto; }
.lesson-content-pane .card h3, .lesson-content-pane .card h4, .lesson-content-pane .card h5 { color: #008080; }
.lesson-content-pane .card table th { background: #008080; color: #fff; }
.lesson-content-pane .card ol { padding-left: 22px; margin: 10px 0; }
.lesson-content-pane .card ol li { margin-bottom: 8px; }
.lesson-content-pane .card ol ul { margin: 6px 0; }
.lesson-note-box { background: #f0fdfa; border: 1px solid #99f6e4; border-left: 4px solid #008080; border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.lesson-note-title { font-weight: 800; font-size: 12px; color: #008080; margin-bottom: 4px; }
.lesson-note-box p { margin: 0; }
.lesson-dialogue-line { padding: 4px 0; }
.lesson-blank { display: inline-block; min-width: 46px; padding: 1px 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); text-align: center; background: var(--bg); }
.lesson-blank-widget { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.lesson-blank-input { width: 110px; padding: 2px 8px; border: 1px solid #008080; border-radius: 6px; font-size: inherit; font-family: inherit; }
.lesson-blank-input.is-wrong { border-color: var(--danger); background: var(--danger-light); }
.lesson-blank-check { border: none; background: #008080; color: #fff; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1; flex-shrink: 0; }
.lesson-blank-check:disabled { opacity: .5; cursor: default; }
.lesson-blank-feedback { font-size: 11px; font-weight: 700; }
.lesson-blank-feedback.wrong { color: var(--danger-dark); }
.lesson-blank-feedback.revealed { color: var(--amber); }
.lesson-blank-solved { display: inline-block; padding: 1px 10px; border-radius: 6px; background: var(--green-light); color: #166534; font-weight: 700; }
.lesson-mc-widget { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; vertical-align: middle; margin: 4px 0; }
.lesson-mc-options { display: flex; flex-wrap: wrap; gap: 6px; }
.lesson-mc-option { border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 4px 12px; font-size: inherit; font-family: inherit; cursor: pointer; }
.lesson-mc-option:hover:not(:disabled) { border-color: #008080; }
.lesson-mc-option:disabled { cursor: default; opacity: .6; }
.lesson-mc-option.is-correct { border-color: #166534; background: var(--green-light); color: #166534; opacity: 1; font-weight: 700; }
.lesson-mc-option.is-picked-wrong { border-color: var(--danger); background: var(--danger-light); }
.lesson-match-widget { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.lesson-match-select { padding: 2px 6px; border: 1px solid #008080; border-radius: 6px; font-size: inherit; font-family: inherit; max-width: 260px; }
.lesson-match-select.is-wrong { border-color: var(--danger); background: var(--danger-light); }
.lesson-order-widget { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; vertical-align: middle; margin: 4px 0; }
.lesson-order-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lesson-order-chip { border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 4px 12px; font-size: inherit; font-family: inherit; cursor: pointer; position: relative; }
.lesson-order-chip:hover:not(:disabled) { border-color: #008080; }
.lesson-order-chip:disabled { cursor: default; opacity: .6; }
.lesson-order-chip.is-picked { border-color: #008080; background: #f0fdfa; }
.lesson-order-chip .chip-rank { display: inline-block; min-width: 15px; height: 15px; line-height: 15px; border-radius: 50%; background: #008080; color: #fff; font-size: 10px; font-weight: 700; text-align: center; margin-right: 5px; }
.lesson-order-reset { border: 1px solid var(--border); background: var(--bg); border-radius: 50%; width: 22px; height: 22px; cursor: pointer; font-size: 12px; line-height: 1; }
@media (max-width: 860px) {
  .lesson-reader { flex-direction: column; }
  /* Content first, unit navigation below — a learner opening a lesson on a phone should see the
     actual lesson immediately, not scroll through a table of contents first. */
  .lesson-content-pane { order: 1; }
  .lesson-toc { order: 2; width: 100%; max-height: 240px; position: static; }
}
.usage-guide-box-title { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: #92400e; margin-bottom: 4px; }

.aspect-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 14px 0; }
.aspect-card { border-radius: 14px; padding: 14px 16px; border: 1px solid; }
.aspect-card.impf { background: var(--blue-light); border-color: #bfdbfe; }
.aspect-card.pf { background: var(--green-light); border-color: #bbf7d0; }
.aspect-card-eyebrow { font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.aspect-card.impf .aspect-card-eyebrow { color: #1e40af; }
.aspect-card.pf .aspect-card-eyebrow { color: #166534; }
.aspect-card-word { font-size: 18px; font-weight: 800; margin: 2px 0 8px; }
.aspect-check-list { list-style: none; padding: 0; margin: 0 0 10px; font-size: 13px; }
.aspect-check-list li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.aspect-check-list .yes { color: #166534; font-weight: 800; }
.aspect-check-list .no { color: var(--danger-dark); font-weight: 800; }
.aspect-card-rozkaz { font-size: 11px; border-top: 1px solid rgba(0,0,0,.08); padding-top: 8px; }
.aspect-card-rozkaz-label { font-weight: 800; text-transform: uppercase; letter-spacing: .03em; opacity: .7; margin-bottom: 3px; }

.when-to-use-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 13px; }
.when-to-use-arrow { flex-shrink: 0; }

.imperative-usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 12px 0; }
.imperative-usage-card-title { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.imperative-usage-card.impf .imperative-usage-card-title { color: #1e40af; }
.imperative-usage-card.pf .imperative-usage-card-title { color: #166534; }
.imperative-example-box { border-radius: 10px; padding: 9px 11px; font-size: 13px; margin-top: 6px; }
.imperative-usage-card.impf .imperative-example-box { background: var(--blue-light); }
.imperative-usage-card.pf .imperative-example-box { background: var(--green-light); }

.tense-avail-grid td, .tense-avail-grid th { text-align: center; }
.tense-avail-grid td:first-child, .tense-avail-grid th:first-child { text-align: left; }
.tense-avail-yes { color: #166534; font-weight: 800; }
.tense-avail-no { color: var(--danger-dark); font-weight: 800; }

.notes-accordion { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.notes-accordion summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.notes-accordion textarea { margin-top: 10px; min-height: 80px; }

/* Personal Notes widget — multi-note list scoped to a storage_key, embeddable on any page */
.pnotes-box { border: 2px solid; border-radius: 16px; overflow: hidden; margin: 14px 0; }
.pnotes-header { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: none; border: none; cursor: pointer; font: inherit; text-align: left; }
.pnotes-header-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.pnotes-count { font-size: 10px; font-weight: 800; padding: 1px 7px; border-radius: 999px; }
.pnotes-body { border-top: 1px solid; padding: 12px 16px 16px; display: none; }
.pnotes-body.open { display: block; }
.pnotes-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pnotes-item { background: rgba(255,255,255,.6); border: 1px solid; border-radius: 12px; padding: 8px 10px; display: flex; align-items: flex-start; gap: 8px; }
.pnotes-item-text { flex: 1; font-size: 13px; white-space: pre-wrap; }
.pnotes-item-del { background: none; border: none; cursor: pointer; opacity: .4; font-size: 13px; flex-shrink: 0; }
.pnotes-item-del:hover { opacity: 1; }
.pnotes-empty { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.pnotes-add-row textarea { width: 100%; border-radius: 12px; font-size: 13px; resize: vertical; min-height: 56px; }
.pnotes-add-row { display: flex; flex-direction: column; gap: 6px; }
.pnotes-add-btn { align-self: flex-end; }

/* Generic colored info box (adverb-form / related-verb / degrees-of-comparison boxes on word cards) */
.info-box { border-radius: 12px; padding: 12px 14px; margin: 12px 0; border: 1px solid; }
.info-box-title { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px; }
.info-box-teal { background: var(--teal-light); border-color: #99f6e4; }
.info-box-teal .info-box-title { color: var(--teal); }
.info-box-blue { background: var(--blue-light); border-color: #bfdbfe; }
.info-box-blue .info-box-title { color: #1e40af; }
.info-box-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.info-box-col-label { font-size: 11px; font-weight: 700; opacity: .75; margin-bottom: 2px; }
.info-box-col-word { font-size: 16px; font-weight: 800; }
.info-box-col-translation { font-size: 12px; opacity: .8; }

/* Antonym / gender-pair line under a word title */
.antonym-line { font-size: 13px; color: var(--muted); margin-top: 2px; }
.antonym-line strong { color: var(--primary-dark); }

/* Declension section (7-case adjective/noun tables), reusing the app's case color palette */
.decl-toggle { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.decl-toggle button { padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; border: 2px solid; background: var(--card); cursor: pointer; }
.case-section { border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; border: 1px solid; }
.case-section-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.case-section-abbr { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; color: #fff; }
.case-section-name { font-weight: 800; font-size: 14px; }
.case-section-desc { font-size: 11px; opacity: .75; margin-left: auto; text-align: right; }
.case-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; font-size: 13px; margin-bottom: 8px; }
.case-form-grid-label { font-size: 10px; text-transform: uppercase; opacity: .6; font-weight: 700; }
.case-form-grid-value { font-weight: 700; }
.case-example-box { border-radius: 8px; padding: 8px 10px; font-size: 13px; background: rgba(255,255,255,.6); }

/* Degrees of comparison (adverbs) */
.comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; text-align: center; margin-bottom: 12px; }
.comparison-grid-label { font-size: 10px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; opacity: .7; }
.comparison-grid-word { font-size: 16px; font-weight: 800; margin: 2px 0; }
.comparison-grid-translation { font-size: 11px; opacity: .75; }
.comparison-conjunction-row { margin-top: 8px; padding: 8px 0; border-top: 1px solid rgba(0,0,0,.08); font-size: 13px; }
.comparison-conjunction-tag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .03em; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.7); margin-bottom: 4px; }
.comparison-line { font-size: 13px; font-weight: 700; margin-top: 6px; color: #166534; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Case reference page */
.case-pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.case-pill {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 14px; border-radius: 12px; border: 2px solid; background: var(--card);
  font-size: 11px; font-weight: 700; text-decoration: none; min-width: 66px;
}
.case-pill-abbr { font-size: 12px; letter-spacing: .03em; }
.case-pill-pl { font-size: 10px; font-weight: 600; opacity: .85; }
.case-banner { border: 1px solid; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.case-banner-top { display: flex; align-items: center; gap: 14px; }
.case-avatar { width: 42px; height: 42px; border-radius: 12px; color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.case-section-banner { color: #fff; font-weight: 800; font-size: 13px; padding: 10px 16px; border-radius: 10px; letter-spacing: .02em; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.case-section-sub { font-weight: 500; opacity: .85; font-size: 11px; flex-shrink: 0; }

/* 7 Cases grammar reference table (render_grammar_table() in others.php) — gender columns ×
   examples/adjective-endings/noun-endings rows. overflow-x lets it scroll on its own on narrow
   screens instead of widening the whole page. */
.grammar-ref-box { border: 1px solid; border-radius: var(--radius); overflow-x: auto; margin-bottom: 14px; }
.grammar-ref-table { width: max-content; min-width: 100%; border-collapse: collapse; font-size: 13px; }
.grammar-ref-table th, .grammar-ref-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; text-align: left; }
.grammar-ref-table tr:last-child th, .grammar-ref-table tr:last-child td { border-bottom: none; }
.grt-row-label { font-weight: 700; font-size: 12px; color: var(--muted); white-space: nowrap; }
.grt-gender-head { font-size: 12px; font-weight: 800; background: rgba(0,0,0,.03); white-space: nowrap; }
.grt-question { display: block; font-size: 10px; font-weight: 600; letter-spacing: .02em; opacity: .55; margin-top: 2px; }
.grt-cell { min-width: 150px; }
.grt-examples { font-style: italic; line-height: 1.6; }
.grt-endings { font-size: 15px; font-weight: 800; margin-bottom: 2px; }
.grt-example-words { font-size: 12px; color: var(--muted); }

/* Bottom nav (mobile) */
.bottom-nav { display: none; }
.mobile-more-toggle-input { display: none; }
.mobile-more-overlay { display: none; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main-content { padding: 18px 16px 90px; max-width: 100%; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--card);
    border-top: 1px solid var(--border); justify-content: space-around; padding: 8px 4px;
    z-index: 20;
  }
  .bottom-nav-link, .mobile-more-trigger { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--muted); gap: 2px; font-weight: 700; cursor: pointer; }
  .bottom-nav-link.active { color: var(--primary); }

  /* "More" full-screen drawer — pure-CSS checkbox toggle, surfaces every nav item that
     doesn't fit in the 4-icon bottom bar (Curriculum, Knowledge Resources, Speaking, Past
     National Exam, Notes, Settings, Admin Panel, Logout — all unreachable otherwise). */
  .mobile-more-toggle-input:checked + .mobile-more-overlay {
    display: flex; position: fixed; inset: 0; background: var(--card); z-index: 30;
    flex-direction: column;
  }
  .mobile-more-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
  .mobile-more-title { font-weight: 800; font-size: 16px; }
  .mobile-more-close { font-size: 16px; cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg); }
  .mobile-more-list { padding: 8px 12px 24px; overflow-y: auto; flex: 1; }
  .mobile-more-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--text); }
  .mobile-more-link.active { background: var(--primary-light); color: var(--primary-dark); }
  .mobile-more-sublink { padding-left: 34px; font-size: 13px; font-weight: 500; color: var(--muted); }
  .mobile-more-group-label { display: flex; align-items: center; gap: 12px; padding: 12px 14px 4px; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
  .mobile-more-divider { height: 1px; background: var(--border); margin: 8px 4px; }

  /* Wide reference/declension tables scroll horizontally instead of pushing the page sideways. */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Guided curriculum: Continue Learning, stages, units, sessions ──────────────────────── */
.continue-learning-card {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 10%, white), color-mix(in srgb, var(--teal) 8%, white));
  border: 1px solid color-mix(in srgb, var(--primary) 25%, white);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.continue-learning-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--primary-dark); margin-bottom: 6px; }
.continue-learning-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.continue-learning-title { font-size: 19px; font-weight: 800; margin: 2px 0 2px; }

.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.stage-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.stage-card-top { display: flex; align-items: center; justify-content: space-between; }
.stage-can-do { margin: 4px 0 0; }
.stage-can-do li { font-size: 12.5px; }
.stage-units-toggle { margin-top: 10px; }
.stage-units-toggle summary { cursor: pointer; }
.stage-units-list { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.stage-unit-row { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 8px; font-size: 13px; text-decoration: none; color: inherit; }
.stage-unit-row:hover { background: var(--bg); }

.unit-checkpoint-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--amber-light); border: 1px solid color-mix(in srgb, var(--amber) 30%, white); border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-weight: 700; font-size: 13.5px; }

.session-list { display: flex; flex-direction: column; gap: 6px; }
.session-list-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; text-decoration: none; color: inherit; }
.session-list-item:hover { border-color: var(--primary); }
.session-list-icon { font-size: 18px; flex-shrink: 0; }
.session-list-title { font-weight: 700; }

.lesson-crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.lesson-crumb a { color: var(--muted); text-decoration: underline; }

.lesson-objective-banner { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 14px; }
.lesson-objective-icon { font-size: 28px; flex-shrink: 0; }
.lesson-objective-time { flex-shrink: 0; font-weight: 700; font-size: 13px; color: var(--muted); background: var(--bg); border-radius: 20px; padding: 6px 12px; }

.lesson-next-step-card { display: flex; flex-direction: column; gap: 2px; background: var(--primary-light); border-radius: 12px; padding: 12px 14px; margin-top: 14px; }
.lesson-next-step-card a { font-weight: 700; color: var(--primary-dark); }

/* ── Mastery states (Stage 4) ─────────────────────────────────────────────────────────── */
.mastery-legend { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.mastery-chip { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; background: var(--bg); }
.mastery-new { color: var(--muted); }
.mastery-learning { color: #92400e; background: var(--amber-light); }
.mastery-needs-review { color: #9a3412; background: #ffedd5; }
.mastery-mastered { color: var(--primary-dark); background: var(--primary-light); }
.stage-progress-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.stage-progress-row:last-child { border-bottom: none; }

.session-mastery-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }

/* ── Knowledge Resources cross-tab search ────────────────────────────────────────────────── */
.kr-search-wrap { position: relative; margin-bottom: 14px; }
.kr-search-input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit; background: var(--card); }
.kr-search-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.kr-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; }
.kr-search-result { display: block; padding: 10px 14px; text-decoration: none; color: inherit; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.kr-search-result:last-child { border-bottom: none; }
.kr-search-result:hover { background: var(--bg); }
.kr-search-empty { padding: 12px 14px; font-size: 13px; color: var(--muted); }

/* ── Speaking self-assessment rubric (Stage 6) ───────────────────────────────────────────── */
.rubric-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rubric-row:last-child { border-bottom: none; }
.rubric-label { font-size: 13.5px; font-weight: 600; }
.rubric-stars { display: flex; gap: 2px; }
.rubric-star { border: none; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: #f59e0b; padding: 2px; }
.rubric-star:focus-visible { outline: 2px solid var(--primary); border-radius: 4px; }

/* ── Listen & Repeat / Shadowing (Stage 6) ───────────────────────────────────────────────── */
.listen-repeat-box { background: var(--blue-light); border: 1px solid #bfdbfe; border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.listen-repeat-title { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.listen-repeat-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.transcript-hidden { filter: blur(6px); user-select: none; transition: filter .2s; }

@media (max-width: 640px) {
  .continue-learning-main { flex-direction: column; align-items: flex-start; }
  .continue-learning-main .btn { width: 100%; text-align: center; }
  .lesson-objective-banner { flex-wrap: wrap; }
  .lesson-nav-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .lesson-nav-row .flex { justify-content: space-between; }

  /* Fixed 260px pair column is too wide for phone screens — stack instead. */
  .vocab-pair { grid-template-columns: 1fr; }
}
