/* =====================================================================
   English Academy — design layer on top of Bootstrap 5.3
   ===================================================================== */
:root {
  --ea-primary: #2b59c3;
  --ea-primary-rgb: 43, 89, 195;
  --ea-accent: #f2a541;
  --ea-teal: #1fa595;
  --ea-radius: 14px;
  --ea-sidebar-w: 248px;
  --bs-primary: var(--ea-primary);
  --bs-primary-rgb: var(--ea-primary-rgb);
  --bs-link-color: var(--ea-primary);
  --bs-link-color-rgb: var(--ea-primary-rgb);
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --bs-border-radius: 10px;
  --bs-border-radius-lg: var(--ea-radius);
}
[data-bs-theme="light"] { --bs-body-bg: #f5f7fb; --ea-surface: #ffffff; --ea-muted-surface: #eef2fa; }
[data-bs-theme="dark"]  { --bs-body-bg: #0f1420; --ea-surface: #171e2d; --ea-muted-surface: #1e2738;
  --ea-primary: #6f95f0; --ea-primary-rgb: 111, 149, 240; --bs-card-bg: var(--ea-surface); }

body { -webkit-font-smoothing: antialiased; }
.btn-primary { --bs-btn-bg: var(--ea-primary); --bs-btn-border-color: var(--ea-primary);
  --bs-btn-hover-bg: #2249a6; --bs-btn-hover-border-color: #2249a6; --bs-btn-active-bg: #1d3f90; --bs-btn-disabled-bg: var(--ea-primary); }
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1420; --bs-btn-hover-color: #0f1420; --bs-btn-hover-bg: #8aa9f4; --bs-btn-hover-border-color: #8aa9f4; }
.btn-outline-primary { --bs-btn-color: var(--ea-primary); --bs-btn-border-color: var(--ea-primary); --bs-btn-hover-bg: var(--ea-primary); --bs-btn-hover-border-color: var(--ea-primary); }
.card { --bs-card-border-color: var(--bs-border-color-translucent); --bs-card-border-radius: var(--ea-radius); background: var(--ea-surface); }
.card-header { background: transparent; padding: .9rem 1.25rem; font-weight: 600; }
.form-control:focus, .form-select:focus { border-color: rgba(var(--ea-primary-rgb), .6); box-shadow: 0 0 0 .2rem rgba(var(--ea-primary-rgb), .18); }
.btn-icon { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; color: var(--bs-body-color); }
.btn-icon:hover { background: var(--ea-muted-surface); }
.skip-link { position: absolute; left: 1rem; top: 1rem; z-index: 2000; background: var(--ea-surface); padding: .5rem 1rem; border-radius: 8px; }

/* ---- Brand */
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--ea-primary), var(--ea-teal)); color: #fff; font-weight: 800; letter-spacing: -.5px; }
.brand-name { font-weight: 800; color: var(--bs-emphasis-color); letter-spacing: -.3px; }

/* ---- App shell */
.app-shell { min-height: 100vh; }
.sidebar { background: var(--ea-surface); border-right: 1px solid var(--bs-border-color-translucent); display: flex; flex-direction: column; }
@media (min-width: 992px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--ea-sidebar-w); visibility: visible !important; transform: none !important; }
  .main-wrap { margin-left: var(--ea-sidebar-w); }
}
.sidebar-brand { display: flex; align-items: center; padding: 1.1rem 1.25rem; }
.sidebar-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--bs-secondary-color); padding: .5rem 1.5rem; }
.sidebar-nav { padding: .25rem .75rem; gap: 2px; }
.sidebar-nav .nav-link { display: flex; align-items: center; gap: .75rem; color: var(--bs-body-color); border-radius: 10px; padding: .6rem .8rem; font-weight: 500; }
.sidebar-nav .nav-link i { font-size: 1.1rem; opacity: .8; }
.sidebar-nav .nav-link:hover { background: var(--ea-muted-surface); }
.sidebar-nav .nav-link.active { background: rgba(var(--ea-primary-rgb), .12); color: var(--ea-primary); font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 1rem 1.25rem; }
.topbar { position: sticky; top: 0; z-index: 1010; display: flex; align-items: center; gap: .75rem; padding: .7rem 1.5rem;
  background: color-mix(in srgb, var(--bs-body-bg) 85%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--bs-border-color-translucent); }
.topbar-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; padding: .25rem .5rem; border-radius: 999px; }
.btn-user:hover { background: var(--ea-muted-surface); }
.content { padding: 1.5rem; max-width: 1400px; }
@media (max-width: 575.98px) { .content { padding: 1rem; } .topbar { padding: .6rem 1rem; } }

/* ---- Avatars */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.avatar-initials { display: inline-grid; place-items: center; width: var(--s); height: var(--s); font-size: calc(var(--s) * .38);
  font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--ea-primary), var(--ea-teal)); }

/* ---- Dashboard */
.welcome { background: linear-gradient(120deg, #2b59c3 0%, #3c6fd8 45%, #1fa595 120%); border-radius: 18px; overflow: hidden; position: relative; }
.welcome::after { content: "Aa"; position: absolute; right: 12%; top: -30px; font-size: 180px; font-weight: 800; color: rgba(255,255,255,.07); pointer-events: none; }
.target-ring { --p: 0; width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; position: relative; z-index: 1;
  background: conic-gradient(var(--ea-accent) calc(var(--p) * 1%), rgba(255,255,255,.18) 0); }
.target-ring > div { width: 88px; height: 88px; border-radius: 50%; background: #2a55b8; display: grid; place-content: center; text-align: center; color: #fff; }
.target-ring strong { font-size: 1.5rem; line-height: 1; }
.target-ring span { font-size: .72rem; opacity: .8; }
.stat-card .card-body { padding: 1.1rem 1.25rem; }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: rgba(var(--ea-primary-rgb), .1); color: var(--ea-primary); font-size: 1.1rem; margin-bottom: .6rem; }
.stat-label { font-size: .8rem; color: var(--bs-secondary-color); font-weight: 500; }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.5px; color: var(--bs-emphasis-color); }
.stat-sub { font-size: .75rem; color: var(--bs-secondary-color); }
.skill-tile { border: 1px solid var(--bs-border-color-translucent); border-radius: 12px; padding: .85rem 1rem; height: 100%; }
.skill-tile i { color: var(--ea-primary); }
.progress { height: 8px; border-radius: 99px; background: var(--ea-muted-surface); }
.progress-bar { background: linear-gradient(90deg, var(--ea-primary), var(--ea-teal)); border-radius: 99px; }
.activity-bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; }
.activity-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; }
.activity-col span { font-size: .68rem; color: var(--bs-secondary-color); height: 1em; }
.activity-bar { width: 100%; max-width: 28px; border-radius: 6px 6px 3px 3px; background: var(--ea-muted-surface); transition: height .4s ease; }
.activity-bar.on { background: linear-gradient(180deg, var(--ea-teal), var(--ea-primary)); }
.activity-bars-30 { gap: 3px; }
.level-path { list-style: none; padding: 0; margin: 0; position: relative; }
.level-path::before { content: ""; position: absolute; left: 7px; top: 10px; bottom: 10px; width: 2px; background: var(--bs-border-color); }
.level-path li { position: relative; display: flex; gap: .9rem; align-items: center; padding: .45rem 0; }
.level-path .dot { width: 16px; height: 16px; border-radius: 50%; background: var(--ea-surface); border: 2px solid var(--bs-border-color); z-index: 1; flex-shrink: 0; }
.level-path li.done .dot { background: var(--ea-teal); border-color: var(--ea-teal); }
.level-path li.current .dot { background: var(--ea-primary); border-color: var(--ea-primary); box-shadow: 0 0 0 4px rgba(var(--ea-primary-rgb), .2); }
.level-path li.current strong { color: var(--ea-primary); }
.badge-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border-radius: 999px; background: rgba(242,165,65,.15); color: #a76510; font-weight: 600; font-size: .8rem; }
[data-bs-theme="dark"] .badge-chip { color: var(--ea-accent); }

/* ---- Auth / public pages */
.auth-shell { min-height: 100vh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 500px at 10% -10%, rgba(var(--ea-primary-rgb), .12), transparent 60%),
              radial-gradient(900px 500px at 110% 10%, rgba(31,165,149,.12), transparent 60%), var(--bs-body-bg); }
.auth-nav { padding: 1rem 0; }
.auth-main { flex: 1; padding: 2rem 1rem; }
.auth-card { max-width: 460px; margin: 0 auto; border: 0; }
.auth-card-wide { max-width: 620px; }
.auth-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 1.6rem;
  background: rgba(var(--ea-primary-rgb), .1); color: var(--ea-primary); margin-bottom: 1rem; }
.hero { padding-top: 2rem; padding-bottom: 2rem; }
.hero-pill { background: rgba(var(--ea-primary-rgb), .1); color: var(--ea-primary); font-weight: 600; padding: .5rem .9rem; }
.text-gradient { background: linear-gradient(90deg, var(--ea-primary), var(--ea-teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-letters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.letter-tile { background: var(--ea-surface); border-radius: 18px; padding: 1.25rem 1.4rem; box-shadow: 0 10px 30px rgba(20, 40, 90, .08); }
.letter-tile:nth-child(2) { transform: translateY(18px); } .letter-tile:nth-child(4) { transform: translateY(18px); }
.letter-big { font-size: 3rem; font-weight: 800; line-height: 1; margin-bottom: .4rem; color: var(--ea-primary); }
.level-card { border: 0; border-top: 4px solid var(--ea-primary); }
.level-card.level-0 { border-top-color: #9aa7c2; } .level-card.level-1, .level-card.level-2 { border-top-color: var(--ea-teal); }
.level-card.level-3, .level-card.level-4 { border-top-color: var(--ea-primary); } .level-card.level-5, .level-card.level-6 { border-top-color: var(--ea-accent); }
.level-code { font-weight: 800; font-size: 1.3rem; color: var(--bs-emphasis-color); }
.feature { background: var(--ea-surface); border-radius: var(--ea-radius); padding: 1.4rem; height: 100%; }
.feature i { font-size: 1.5rem; color: var(--ea-primary); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---- Phase 2: notifications */
.notif-dot { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: #e5484d; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
.notif-menu { width: 330px; max-width: calc(100vw - 2rem); }
.notif-row { white-space: normal; padding: .6rem 1rem; border-bottom: 1px solid var(--bs-border-color-translucent); }
.notif-row.unread { background: rgba(var(--ea-primary-rgb), .06); font-weight: 600; }
.notif-item.unread { background: rgba(var(--ea-primary-rgb), .05); box-shadow: inset 3px 0 0 var(--ea-primary); }
.notif-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: rgba(var(--ea-primary-rgb), .1); color: var(--ea-primary); font-size: 1.1rem; }
.notif-achievement { background: rgba(242,165,65,.18); color: #b86e0f; }
.notif-success, .notif-level { background: rgba(31,165,149,.15); color: var(--ea-teal); }
.notif-warning { background: rgba(229,72,77,.12); color: #c4363b; }
.notif-body { overflow-wrap: anywhere; }
.min-w-0 { min-width: 0; }

/* ---- Phase 2: progressive disclosure */
.sidebar-locked { padding: 0 .75rem; margin: 0; }
.sidebar-locked li { display: flex; align-items: center; gap: .75rem; padding: .45rem .8rem; color: var(--bs-secondary-color); font-size: .9rem; }
.sidebar-locked .badge { font-size: .65rem; }

/* ---- Phase 2: admin tools */
.perm-matrix { max-height: 70vh; }
.perm-matrix thead th { background: var(--ea-surface); z-index: 2; vertical-align: bottom; }
.perm-matrix .perm-col { min-width: 260px; }
.perm-matrix .role-col { min-width: 110px; }
.perm-matrix tr.table-group th { background: var(--ea-muted-surface); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--bs-secondary-color); }
.perm-matrix .form-check-input { width: 1.2em; height: 1.2em; }
.audit-meta { max-width: 420px; max-height: 260px; overflow: auto; font-size: .75rem; background: var(--ea-muted-surface); padding: .5rem; border-radius: 8px; }
.sticky-save { position: sticky; bottom: 0; padding: 1rem 0; background: linear-gradient(to top, var(--bs-body-bg) 70%, transparent); z-index: 5; }

/* ---- Phase 3: shared learning components */
.ipa { font-family: "Charis SIL", "Doulos SIL", "Gentium Plus", "Lucida Sans Unicode", "Segoe UI", system-ui, sans-serif; color: var(--ea-teal); letter-spacing: .02em; }
.speak-group { display: inline-flex; gap: .25rem; vertical-align: middle; }
.speak-group .btn { line-height: 1; }
.word-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .4rem .3rem .75rem; border-radius: 999px; border: 1px solid var(--bs-border-color); background: var(--ea-surface); color: var(--bs-body-color); }
.rich p:last-child, .rich ul:last-child { margin-bottom: 0; }
.example-list li { padding: .55rem 0; border-bottom: 1px dashed var(--bs-border-color); }
.example-list li:last-child { border-bottom: 0; }
.recorder { background: var(--ea-muted-surface); border-radius: 12px; padding: .8rem 1rem; }

/* lesson player */
.lesson-block { transition: box-shadow .2s ease; }
.lesson-block.is-done { box-shadow: inset 4px 0 0 var(--ea-teal); }
.exercise-q { margin-bottom: 1.4rem; }
.q-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(var(--ea-primary-rgb), .12); color: var(--ea-primary); font-size: .8rem; flex-shrink: 0; }
.exercise-options { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.exercise-option { display: flex; align-items: center; gap: .6rem; padding: .65rem .9rem; border: 1px solid var(--bs-border-color); border-radius: 10px; cursor: pointer; background: var(--ea-surface); }
.exercise-option:hover { border-color: var(--ea-primary); }
.exercise-option:has(input:checked) { border-color: var(--ea-primary); background: rgba(var(--ea-primary-rgb), .06); }
.exercise-option.correct { border-color: #1fa595; background: rgba(31,165,149,.12); }
.exercise-option.wrong { border-color: #e5484d; background: rgba(229,72,77,.1); }
.exercise-feedback { min-height: 1.2em; margin-top: .4rem; }
.lesson-img { max-height: 380px; }
.ref-letter { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.ref-letter-glyph { display: flex; gap: .4rem; font-size: 4rem; font-weight: 800; line-height: 1; color: var(--ea-primary); min-width: 140px; }
.ref-letter-glyph span:last-child { color: var(--ea-teal); }
.ref-facts { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; align-items: center; margin-bottom: .5rem; }
.ref-facts dt { font-weight: 500; color: var(--bs-secondary-color); font-size: .85rem; }
.ref-facts dd { margin: 0; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.ref-grapheme { min-width: 96px; padding: .8rem 1rem; border-radius: 16px; background: rgba(var(--ea-primary-rgb), .08); color: var(--ea-primary); font-size: 2.4rem; font-weight: 800; text-align: center; line-height: 1.1; }
.continue-card { border: 0; background: linear-gradient(120deg, rgba(var(--ea-primary-rgb), .1), rgba(31,165,149,.1)); }
.continue-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--ea-primary); color: #fff; font-size: 1.6rem; }
.course-card.locked { opacity: .65; }
.lesson-row a:hover .fw-semibold { color: var(--ea-primary); }
.lesson-status { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--ea-muted-surface); color: var(--bs-secondary-color); flex-shrink: 0; }
.lesson-status.in_progress { background: rgba(var(--ea-primary-rgb), .12); color: var(--ea-primary); }
.lesson-status.completed { background: var(--ea-teal); color: #fff; }

/* alphabet & phonics */
.letter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .75rem; }
.letter-card { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .9rem .5rem; border-radius: 14px; background: var(--ea-surface);
  border: 1px solid var(--bs-border-color-translucent); text-decoration: none; color: var(--bs-body-color); transition: transform .15s ease, box-shadow .15s ease; }
.letter-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20,40,90,.1); }
.letter-card.vowel { border-color: rgba(242,165,65,.6); background: rgba(242,165,65,.07); }
.letter-pair { font-size: 2rem; font-weight: 800; color: var(--ea-primary); line-height: 1; }
.letter-pair small { font-size: 1.4rem; color: var(--ea-teal); margin-left: .2rem; }
.legend { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: middle; }
.legend.vowel { background: rgba(242,165,65,.5); }
.letter-hero-glyph { display: flex; justify-content: center; gap: 1rem; font-size: 7rem; font-weight: 800; line-height: 1; color: var(--ea-primary); }
.letter-hero-glyph span:last-child { color: var(--ea-teal); }
.fact-box { border: 1px solid var(--bs-border-color-translucent); border-radius: 12px; padding: 1rem; height: 100%; }
.fact-label { font-size: .8rem; color: var(--bs-secondary-color); }
.fact-value { font-size: 2rem; font-weight: 700; }
.phonics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.phonics-card { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border-radius: 14px; background: var(--ea-surface); border: 1px solid var(--bs-border-color-translucent); text-decoration: none; color: var(--bs-body-color); }
.phonics-card:hover { border-color: var(--ea-primary); }
.phonics-grapheme { font-size: 1.8rem; font-weight: 800; color: var(--ea-primary); line-height: 1.1; }
.practice-prompt { font-size: 1.35rem; font-weight: 700; }
.practice-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.practice-option { font-size: 1.15rem; padding: .8rem; font-weight: 600; }

/* vocabulary */
.wotd { border: 0; background: linear-gradient(120deg, #1d3f90, #2b59c3 55%, #1fa595 130%); }
.wotd .ipa { color: rgba(255,255,255,.7); }
.flashcard { min-height: 240px; border-radius: 18px; border: 1px solid var(--bs-border-color); background: var(--ea-surface); display: grid; place-items: center;
  text-align: center; padding: 2rem 1.5rem; cursor: pointer; box-shadow: 0 10px 30px rgba(20,40,90,.07); }
.flashcard.flipped { cursor: default; border-color: var(--ea-primary); }
.flashcard-word { font-size: 2.6rem; font-weight: 800; }

/* content admin */
.block-admin { margin-bottom: 1rem; }
.block-admin.editing .lesson-block { outline: 2px solid var(--ea-primary); }
.block-toolbar { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.ipa-keys { display: flex; flex-wrap: wrap; gap: 3px; }
.ipa-keys .btn { padding: 0 .45rem; font-family: "Charis SIL", "Doulos SIL", "Segoe UI", sans-serif; }

/* ---- Phase 4: skills */
.skill-item { transition: transform .15s ease, box-shadow .15s ease; }
.skill-item:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(20,40,90,.08); }
.skill-item-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(var(--ea-primary-rgb), .1); color: var(--ea-primary); }
.listen-player { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.diff { display: inline-block; padding: .05rem .35rem; border-radius: 6px; margin: .1rem 0; }
.diff.ok { background: rgba(31,165,149,.14); }
.diff.spelling { background: rgba(242,165,65,.25); }
.diff.wrong { background: rgba(229,72,77,.18); }
.diff.missing { border: 1px dashed #e5484d; color: #c4363b; }
.diff.extra { background: var(--ea-muted-surface); text-decoration: line-through; color: var(--bs-secondary-color); }
.diff s { opacity: .7; }
.dictation-diff { line-height: 2.1; font-size: 1.1rem; }
.reader-toolbar { position: sticky; top: 64px; z-index: 20; }
.reader-text { line-height: 1.9; font-family: Georgia, "Times New Roman", serif; }
.reader-text .w { cursor: pointer; border-radius: 4px; }
.reader-text .w:hover { background: rgba(var(--ea-primary-rgb), .1); }
.reader-text .w.active { background: rgba(var(--ea-primary-rgb), .22); }
.reader-text .w.hl { background: rgba(255, 214, 10, .55); }
.reader-text[data-mode="sentence"] .sent { cursor: pointer; }
.reader-text[data-mode="sentence"] .sent:hover { background: rgba(31,165,149,.1); }
.reader-text .sent.reading { background: rgba(31,165,149,.18); border-radius: 4px; }
.word-panel { min-height: 160px; }
.writing-area { font-size: 1.05rem; line-height: 1.7; }
.writing-text { white-space: normal; line-height: 1.7; }
.correction-orig { color: #c4363b; }
.correction-fix { color: #158a7c; font-weight: 600; }
.correction-row { border: 1px solid var(--bs-border-color-translucent); border-radius: 12px; padding: .75rem; margin-bottom: .75rem; }
.rubric-row { display: flex; align-items: center; gap: 1rem; padding: .5rem 0; border-bottom: 1px dashed var(--bs-border-color); }
.rubric-row > div:first-child { flex-grow: 1; }
.recorder-upload audio { height: 38px; }

/* ---- Phase 5: questions & grammar */
.question-head { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .75rem; }
.question-prompt { font-weight: 600; font-size: 1.05rem; }
.question-img { max-height: 260px; }
.question.is-correct { box-shadow: inset 4px 0 0 #1fa595; padding-left: .75rem; }
.question.is-partial { box-shadow: inset 4px 0 0 #f2a541; padding-left: .75rem; }
.question.is-wrong { box-shadow: inset 4px 0 0 #e5484d; padding-left: .75rem; }
.fill-blank { font-size: 1.1rem; line-height: 2.6; }
.gap-input { display: inline-block; width: 8.5rem; margin: 0 .3rem; padding: .2rem .5rem; vertical-align: baseline; }
.matching-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: .75rem; align-items: center; padding: .35rem 0; }
.matching-left { font-weight: 600; }
.order-list { padding-left: 1.4rem; }
.order-list li { display: flex; gap: .4rem; align-items: center; padding: .45rem .6rem; margin-bottom: .4rem; border: 1px solid var(--bs-border-color); border-radius: 10px; background: var(--ea-surface); cursor: grab; }
.sentence-line { min-height: 54px; border: 2px dashed var(--bs-border-color); border-radius: 12px; padding: .5rem; display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.word-bank { display: flex; flex-wrap: wrap; gap: .4rem; }
.word-tile { font-weight: 600; }
@media (max-width: 575.98px) { .matching-row { grid-template-columns: 1fr; } .matching-row .bi-arrow-right { display: none; } }

/* ---- Phase 6: AI tutor, pronunciation lab, usage dashboard */
.tutor-list { max-height: 55vh; overflow-y: auto; }
.tutor-messages { height: 58vh; min-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; }
.tutor-msg { max-width: 85%; }
.tutor-user { align-self: flex-end; text-align: right; }
.tutor-assistant { align-self: flex-start; }
.tutor-bubble { display: inline-block; text-align: left; padding: .6rem .9rem; border-radius: 16px; line-height: 1.55; }
.tutor-user .tutor-bubble { background: var(--bs-primary); color: #fff; border-bottom-right-radius: 4px; }
.tutor-assistant .tutor-bubble { background: var(--bs-tertiary-bg); border-bottom-left-radius: 4px; }
.tutor-bubble p:last-child, .tutor-bubble ul:last-child, .tutor-bubble ol:last-child { margin-bottom: 0; }
.tutor-bubble ul, .tutor-bubble ol { padding-left: 1.2rem; }
[data-tutor-mic].active { background: var(--bs-danger); color: #fff; }
.ai-box { border: 1px solid var(--bs-border-color); border-left: 4px solid #7c5cff; border-radius: 10px; padding: .6rem .75rem; }
.pron-target { line-height: 1.3; word-break: break-word; }
.pron-list { max-height: 60vh; overflow-y: auto; }
.pr-words { line-height: 2.2; font-size: 1.1rem; }
.pr-word { display: inline-block; padding: 0 .35rem; border-radius: 6px; }
.pr-ok { background: rgba(31,165,149,.15); color: #117a6d; }
.pr-close { background: rgba(242,165,65,.2); color: #8a5a10; }
.pr-bad { background: rgba(229,72,77,.15); color: #b42328; text-decoration: underline wavy; }
.pr-missing { background: rgba(229,72,77,.08); color: #b42328; text-decoration: line-through; }
.pr-extra { color: var(--bs-secondary-color); font-style: italic; }
[data-bs-theme="dark"] .pr-ok { color: #5fd6c6; }
[data-bs-theme="dark"] .pr-close { color: #f5c27a; }
[data-bs-theme="dark"] .pr-bad, [data-bs-theme="dark"] .pr-missing { color: #ff8a8e; }
.usage-bars { display: flex; align-items: flex-end; gap: 3px; height: 120px; }
.usage-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.usage-bar span { display: block; width: 100%; background: var(--bs-primary); border-radius: 3px 3px 0 0; min-height: 0; }

/* ---- Phase 7: exams, certificates, reports */
.exam-bar { position: sticky; top: .5rem; z-index: 20; }
.exam-palette { display: flex; flex-wrap: wrap; gap: 4px; }
.exam-dot { width: 2rem; height: 2rem; border-radius: 8px; border: 1px solid var(--bs-border-color); background: var(--bs-body-bg); font-size: .8rem; }
.exam-dot.answered { background: rgba(31,165,149,.18); border-color: #1fa595; }
.exam-dot.current { outline: 2px solid var(--bs-primary); outline-offset: 1px; font-weight: 700; }
.exam-timer { font-variant-numeric: tabular-nums; min-width: 4.5rem; }
.certificate { max-width: 1000px; margin: 2rem auto; background: #fff; color: #222; border: 12px double #1f4e79; padding: 3rem 3.5rem; text-align: center; position: relative; }
.certificate h1 { font-family: Georgia, 'Times New Roman', serif; letter-spacing: .08em; color: #1f4e79; }
.certificate .cert-name { font-family: Georgia, 'Times New Roman', serif; font-size: 2.4rem; border-bottom: 1px solid #999; display: inline-block; padding: 0 2rem .25rem; }
.certificate .cert-meta { font-size: .85rem; color: #555; }
.certificate .cert-sign { border-top: 1px solid #555; padding-top: .25rem; min-width: 220px; display: inline-block; }
.certificate.revoked::after { content: 'REVOKED'; position: absolute; top: 40%; left: 0; right: 0; font-size: 6rem; color: rgba(200,0,0,.25); transform: rotate(-12deg); font-weight: 800; }
.print-shell { background: #eef1f5; }
.trend-table td { min-width: 3.2rem; }
@media print {
  .no-print, .sidebar, .app-topbar, .navbar { display: none !important; }
  .print-shell { background: #fff; }
  .certificate { margin: 0 auto; border-width: 10px; page-break-inside: avoid; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  @page { size: A4 landscape; margin: 10mm; }
}
