/* =====================================================
   English Learning Hub — Design System
   Author setup for: Al Jubaer
   ===================================================== */

:root{
  --bg:#f4f6fb;
  --bg-soft:#eef1fb;
  --surface:#ffffff;
  --surface-alt:#f8f9ff;
  --border:#e3e7f3;
  --text:#1c2340;
  --text-soft:#5a6182;
  --text-faint:#8890b5;

  --primary:#6d5bff;
  --primary-dark:#4b39d6;
  --primary-soft:#eeecff;
  --secondary:#00c2a8;
  --secondary-soft:#e2fbf6;
  --accent:#ff8a3d;
  --accent-soft:#fff1e4;
  --pink:#ff5da2;
  --pink-soft:#ffe6f2;
  --yellow:#ffc23c;
  --yellow-soft:#fff7e0;
  --danger:#ff5470;
  --success:#22c98f;

  --grad-hero: linear-gradient(135deg,#6d5bff 0%,#8f6bff 45%,#ff8a3d 100%);
  --grad-card1: linear-gradient(135deg,#6d5bff,#8f6bff);
  --grad-card2: linear-gradient(135deg,#00c2a8,#22e0c4);
  --grad-card3: linear-gradient(135deg,#ff8a3d,#ffb066);
  --grad-card4: linear-gradient(135deg,#ff5da2,#ff8ac0);

  --radius-sm:10px;
  --radius:16px;
  --radius-lg:24px;
  --shadow-sm: 0 2px 8px rgba(31,38,82,0.06);
  --shadow: 0 8px 24px rgba(31,38,82,0.09);
  --shadow-lg: 0 16px 40px rgba(31,38,82,0.14);

  --font-head: 'Poppins', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-bn: 'Noto Sans Bengali', sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  min-width:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  line-height:1.6;
  overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}
img,svg,canvas{ max-width:100%; display:block; }
h1,h2,h3,h4{ font-family:var(--font-head); margin:0 0 .5em; line-height:1.25; color:var(--text); }
p{ margin:0 0 1em; }
a{ color:var(--primary); text-decoration:none; }
ul,ol{ padding-left:1.2em; }
.bn{ font-family:var(--font-bn); }

.wrap{
  width:100%;
  max-width:1180px;
  margin:0 auto;
  padding:0 20px;
}

/* ---------- Top Nav ---------- */
.topnav{
  position:sticky; top:0; z-index:50;
  background:rgba(255,255,255,0.85);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border);
}
.topnav-inner{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; padding:14px 20px; max-width:1180px; margin:0 auto; width:100%;
}
.brand{ display:flex; align-items:center; gap:10px; font-family:var(--font-head); font-weight:700; font-size:1.05rem; color:var(--text); min-width:0; }
.brand .logo-badge{
  width:38px; height:38px; border-radius:12px; flex:none;
  background:var(--grad-hero); display:flex; align-items:center; justify-content:center;
  box-shadow:var(--shadow-sm);
}
.brand span.tag{ color:var(--text-faint); font-weight:500; font-size:.75rem; display:block; }
.navlinks{ display:flex; gap:6px; flex-wrap:wrap; }
.navlinks a{
  padding:8px 14px; border-radius:999px; font-size:.88rem; font-weight:600;
  color:var(--text-soft); white-space:nowrap;
}
.navlinks a:hover, .navlinks a.active{ background:var(--primary-soft); color:var(--primary-dark); }

/* ---------- Hero ---------- */
.hero{
  background:var(--grad-hero);
  border-radius:0 0 var(--radius-lg) var(--radius-lg);
  color:#fff; padding:44px 0 56px; position:relative; overflow:hidden;
}
.hero::before{
  content:""; position:absolute; inset:0;
  background:radial-gradient(circle at 85% 20%, rgba(255,255,255,0.18), transparent 45%),
             radial-gradient(circle at 10% 90%, rgba(255,255,255,0.14), transparent 40%);
  pointer-events:none;
}
.hero-grid{ display:grid; grid-template-columns:1.3fr 1fr; gap:28px; align-items:center; position:relative; z-index:1; }
.eyebrow{
  display:inline-flex; align-items:center; gap:8px; background:rgba(255,255,255,0.18);
  padding:6px 14px; border-radius:999px; font-size:.78rem; font-weight:700; letter-spacing:.03em;
  text-transform:uppercase; margin-bottom:16px;
}
.hero h1{ color:#fff; font-size:clamp(1.6rem,3.6vw,2.5rem); max-width:600px; }
.hero p.lead{ color:rgba(255,255,255,0.9); max-width:520px; font-size:1rem; }
.hero-stats{ display:flex; gap:12px; flex-wrap:wrap; margin-top:20px; }
.hero-stat{
  background:rgba(255,255,255,0.14); border:1px solid rgba(255,255,255,0.25);
  border-radius:var(--radius); padding:12px 16px; min-width:110px;
}
.hero-stat b{ display:block; font-size:1.4rem; font-family:var(--font-head); }
.hero-stat span{ font-size:.75rem; color:rgba(255,255,255,0.85); }
.hero-art{ display:flex; justify-content:center; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:8px; justify-content:center;
  padding:11px 20px; border-radius:12px; font-weight:700; font-size:.9rem;
  cursor:pointer; border:none; font-family:var(--font-body); white-space:nowrap;
}
.btn-primary{ background:#fff; color:var(--primary-dark); box-shadow:var(--shadow-sm); }
.btn-primary:hover{ transform:translateY(-2px); box-shadow:var(--shadow); }
.btn-ghost{ background:rgba(255,255,255,0.15); color:#fff; border:1px solid rgba(255,255,255,0.5); }
.btn-solid{ background:var(--primary); color:#fff; box-shadow:var(--shadow-sm); }
.btn-solid:hover{ background:var(--primary-dark); }
.btn-outline{ background:transparent; color:var(--primary); border:2px solid var(--primary-soft); }
.btn-sm{ padding:8px 14px; font-size:.8rem; border-radius:10px; }
.btn:disabled{ opacity:.45; cursor:not-allowed; }

/* ---------- Section ---------- */
.section{ padding:40px 0; min-width:0; }
.section-head{ display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:20px; flex-wrap:wrap; }
.section-head h2{ font-size:1.5rem; margin:0; }
.section-head p{ margin:4px 0 0; color:var(--text-soft); font-size:.92rem; }
.kicker{ color:var(--primary); font-weight:700; font-size:.78rem; text-transform:uppercase; letter-spacing:.05em; }

/* ---------- Cards ---------- */
.card{
  background:var(--surface); border-radius:var(--radius); border:1px solid var(--border);
  padding:20px; box-shadow:var(--shadow-sm); min-width:0; overflow-wrap:break-word;
}
.grid{ display:grid; gap:18px; min-width:0; }
.grid-4{ grid-template-columns:repeat(4,minmax(0,1fr)); }
.grid-3{ grid-template-columns:repeat(3,minmax(0,1fr)); }
.grid-2{ grid-template-columns:repeat(2,minmax(0,1fr)); }
@media (max-width:980px){ .grid-4{grid-template-columns:repeat(2,minmax(0,1fr));} .grid-3{grid-template-columns:repeat(2,minmax(0,1fr));} }
@media (max-width:640px){ .grid-4,.grid-3,.grid-2{grid-template-columns:minmax(0,1fr);} .hero-grid{grid-template-columns:minmax(0,1fr);} }

.icon-badge{
  width:46px; height:46px; border-radius:14px; display:flex; align-items:center; justify-content:center;
  flex:none; box-shadow:var(--shadow-sm);
}
.icon-badge svg{ width:24px; height:24px; }
.bg-purple{ background:var(--grad-card1); color:#fff; }
.bg-teal{ background:var(--grad-card2); color:#fff; }
.bg-orange{ background:var(--grad-card3); color:#fff; }
.bg-pink{ background:var(--grad-card4); color:#fff; }

.stat-card{ display:flex; align-items:center; gap:14px; }
.stat-card b{ font-family:var(--font-head); font-size:1.5rem; display:block; }
.stat-card span{ color:var(--text-faint); font-size:.8rem; }

/* ---------- Progress ---------- */
.progress-track{ height:10px; border-radius:999px; background:var(--bg-soft); overflow:hidden; }
.progress-fill{ height:100%; border-radius:999px; background:var(--grad-hero); transition:width .4s ease; }

/* ---------- Stage roadmap ---------- */
.stage-row{ display:flex; gap:14px; overflow-x:auto; padding-bottom:10px; scrollbar-width:thin; }
.stage-pill{
  flex:0 0 auto; min-width:150px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:14px 16px; box-shadow:var(--shadow-sm);
}
.stage-pill b{ font-family:var(--font-head); font-size:1rem; }
.stage-pill span{ font-size:.75rem; color:var(--text-faint); }
.level-tag{
  display:inline-block; font-size:.68rem; font-weight:800; padding:3px 9px; border-radius:999px; margin-bottom:8px;
}
.tag-A1{ background:var(--secondary-soft); color:#008f7a; }
.tag-A2{ background:#d7f5e8; color:#0a7a4f; }
.tag-B1{ background:var(--primary-soft); color:var(--primary-dark); }
.tag-B2{ background:#e4defc; color:#5b32c4; }
.tag-C1{ background:var(--pink-soft); color:#c22a72; }
.tag-C2{ background:#ffe3d1; color:#b5490d; }
.tag-All{ background:var(--bg-soft); color:var(--text-soft); }
.level-tag{ box-shadow:0 2px 6px rgba(0,0,0,0.08); }

/* ---------- Day grid on dashboard ---------- */
.day-chip{
  display:flex; flex-direction:column; gap:6px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px; text-align:center; box-shadow:var(--shadow-sm);
  font-weight:700; font-size:.82rem; color:var(--text-soft); position:relative;
}
.day-chip.done{ background:var(--secondary-soft); color:#008f7a; border-color:transparent; }
.day-chip.today{ background:var(--grad-hero); color:#fff; }
.day-chip.locked{ opacity:.5; }
.days-grid{ display:grid; grid-template-columns:repeat(10,minmax(0,1fr)); gap:8px; }
@media (max-width:900px){ .days-grid{ grid-template-columns:repeat(6,minmax(0,1fr)); } }
@media (max-width:560px){ .days-grid{ grid-template-columns:repeat(5,minmax(0,1fr)); } }

/* ---------- Footer ---------- */
.site-footer{ background:#161a33; color:#c7cbe8; padding:36px 0 24px; margin-top:40px; }
.site-footer .wrap{ display:flex; justify-content:space-between; gap:20px; flex-wrap:wrap; }
.site-footer a{ color:#c7cbe8; }
.site-footer .credit{ font-size:.8rem; color:#8890b5; margin-top:10px; }

/* ---------- Day Page Layout ---------- */
.breadcrumb-back{
  display:inline-block; font-size:.85rem; font-weight:700; color:var(--primary);
  margin-bottom:14px;
}
.breadcrumb-back:hover{ text-decoration:underline; }

.lesson-stepper{
  display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; position:sticky; top:70px; z-index:10;
  background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:8px;
  box-shadow:var(--shadow-sm);
}
.lesson-stepper a{
  padding:6px 14px; border-radius:999px; font-size:.8rem; font-weight:700; color:var(--text-soft);
  white-space:nowrap;
}
.lesson-stepper a:hover{ background:var(--primary-soft); color:var(--primary-dark); }
@media (max-width:640px){ .lesson-stepper{ position:static; } }

.day-hero{
  background:var(--grad-hero); border-radius:var(--radius-lg); color:#fff; padding:28px;
  display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:24px;
}
.day-hero .day-meta span{ display:block; }
.day-hero .day-num{ font-family:var(--font-head); font-size:2.2rem; font-weight:800; }
.day-nav{ display:flex; gap:10px; }

.lesson-pager{
  display:flex; justify-content:space-between; align-items:stretch; gap:16px; margin:34px 0 14px; flex-wrap:wrap;
}
.lesson-pager-link{
  flex:1; min-width:220px; display:flex; align-items:center; gap:14px;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:16px 20px; box-shadow:var(--shadow-sm);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position:relative; overflow:hidden;
}
.lesson-pager-link::before{
  content:""; position:absolute; inset:0; background:var(--grad-hero); opacity:0;
  transition:opacity .18s ease; z-index:0;
}
.lesson-pager-link:hover{
  transform:translateY(-3px); box-shadow:var(--shadow-lg); border-color:transparent;
}
.lesson-pager-link:hover::before{ opacity:1; }
.lesson-pager-link:hover .lp-label,
.lesson-pager-link:hover .lp-title{ color:#fff; position:relative; z-index:1; }
.lesson-pager-link:hover .lp-arrow-circle{ background:rgba(255,255,255,0.25); color:#fff; position:relative; z-index:1; }
.lesson-pager-link > span{ position:relative; z-index:1; display:flex; align-items:center; gap:14px; }
.lesson-pager-link.next{ justify-content:flex-end; text-align:right; margin-left:auto; }
.lesson-pager-link.next > span{ flex-direction:row-reverse; }
.lp-arrow-circle{
  width:38px; height:38px; border-radius:50%; background:var(--primary-soft); color:var(--primary-dark);
  display:flex; align-items:center; justify-content:center; font-size:1.15rem; font-weight:700; flex:none;
  transition:background .18s ease, color .18s ease;
}
.lp-label{ display:block; font-size:.68rem; font-weight:800; text-transform:uppercase; letter-spacing:.04em; color:var(--text-faint); transition:color .18s ease; }
.lp-title{ display:block; font-weight:700; color:var(--text); font-size:.94rem; transition:color .18s ease; }

.recap-box{
  background:var(--yellow-soft); border:1px dashed #e8b93a; border-radius:var(--radius);
  padding:16px 18px; margin-bottom:24px; min-width:0;
}
.recap-box h4{ margin:0 0 8px; color:#8a6400; }
.recap-tags{ display:flex; flex-wrap:wrap; gap:8px; }
.recap-tags span{ background:#fff; border-radius:999px; padding:5px 12px; font-size:.8rem; font-weight:600; color:#8a6400; }

.lesson-section{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  padding:24px; margin-bottom:22px; min-width:0; overflow:hidden;
}
.lesson-title{ display:flex; align-items:center; gap:12px; margin-bottom:14px; }
.lesson-title h3{ margin:0; font-size:1.15rem; }
.lesson-title .step-no{ font-size:.72rem; color:var(--text-faint); font-weight:700; text-transform:uppercase; }

.story-box{
  background:var(--surface-alt); border-radius:var(--radius); padding:20px; font-size:1.02rem;
  line-height:1.85; color:var(--text); overflow-wrap:break-word;
}
.story-box p{ margin-bottom:1em; }
.vocab{
  display:inline-block; background:var(--primary-soft); border:1.5px solid rgba(108,76,241,0.28);
  font-weight:700; color:var(--primary-dark); cursor:help; padding:1px 7px; margin:0 1px;
  border-radius:7px; position:relative; white-space:normal; line-height:1.5;
  transition:background .15s ease, transform .1s ease;
}
.vocab:hover{ background:#ffe08a; border-color:#e8b93a; transform:translateY(-1px); }
/* Once JS upgrades a story .vocab span to also be .vocab-word, it gets the full
   rich tooltip + click-to-YouGlish treatment (see .vocab-word rules below). */
.vocab.vocab-word{ display:inline-flex; cursor:pointer; }

.vocab-table{ width:100%; border-collapse:collapse; margin-top:8px; font-size:.9rem; }
.vocab-table th{ text-align:left; background:var(--bg-soft); padding:10px 12px; font-family:var(--font-head); font-size:.78rem; text-transform:uppercase; color:var(--text-soft); }
.vocab-table td{ padding:10px 12px; border-bottom:1px solid var(--border); vertical-align:top; }
.vocab-table tr:last-child td{ border-bottom:none; }
.vocab-table .word{ font-weight:800; color:var(--primary-dark); white-space:nowrap; }
.vocab-table-wrap{ overflow-x:auto; border-radius:var(--radius-sm); }

/* ---------- Vocabulary word: click-to-pronounce + hover info ---------- */
.vocab-word{
  display:inline-flex; align-items:center; gap:4px; cursor:pointer;
  border-bottom:2px dotted var(--primary, #6c4cf1);
  padding:1px 2px; border-radius:4px; transition:background .15s ease;
}
.vocab-word:hover{ background:rgba(108,76,241,0.10); }
.vocab-word-icon{ opacity:.55; flex-shrink:0; }
.vocab-tooltip{
  position:absolute; z-index:9999; max-width:280px;
  background:#1c2340; color:#fff; padding:12px 14px; border-radius:10px;
  font-size:.82rem; line-height:1.5; box-shadow:0 12px 28px rgba(0,0,0,0.28);
  pointer-events:none;
}
.vocab-tooltip .vt-word{ font-weight:800; font-size:.95rem; margin-bottom:6px; color:#ffd166; }
.vocab-tooltip .vt-row{ margin-bottom:3px; }
.vocab-tooltip .vt-row.bn{ font-family:inherit; color:#c9d0ff; }
.vocab-tooltip .vt-hint{
  margin-top:8px; padding-top:8px; border-top:1px solid rgba(255,255,255,0.15);
  font-size:.72rem; color:#8fe3c7; font-weight:700;
}

.grammar-box{ background:var(--primary-soft); border-radius:var(--radius); padding:18px; }
.grammar-box .rule{ background:#fff; border-radius:var(--radius-sm); padding:12px 14px; margin:10px 0; box-shadow:var(--shadow-sm); }
.grammar-box .rule b{ color:var(--primary-dark); }

.listen-panel{ display:grid; grid-template-columns:1fr 190px; gap:20px; align-items:center; }
@media (max-width:640px){ .listen-panel{ grid-template-columns:minmax(0,1fr); } }
.qr-card{ background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:14px; text-align:center; box-shadow:var(--shadow-sm); }
.qr-card canvas, .qr-card img{ margin:0 auto; }
.qr-card small{ display:block; margin-top:8px; color:var(--text-faint); font-size:.7rem; }
.resource-link{
  display:flex; align-items:center; gap:12px; background:var(--surface-alt); border-radius:var(--radius-sm);
  padding:12px 14px; margin-bottom:10px; border:1px solid var(--border);
}
.resource-link .meta{ min-width:0; flex:1; }
.resource-link .meta b{ display:block; font-size:.92rem; }
.resource-link .meta span{ font-size:.78rem; color:var(--text-faint); }

.task-list{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:10px; }
.task-list li{ display:flex; gap:10px; align-items:flex-start; background:var(--surface-alt); border-radius:var(--radius-sm); padding:10px 12px; }
.task-list input[type=checkbox]{ margin-top:3px; flex:none; width:18px; height:18px; accent-color:var(--primary); }

.mcq{ margin-bottom:18px; padding-bottom:16px; border-bottom:1px solid var(--border); }
.mcq:last-child{ border-bottom:none; margin-bottom:0; }
.mcq p.q{ font-weight:700; margin-bottom:10px; }
.mcq-opt{
  display:block; width:100%; text-align:left; background:var(--surface-alt); border:1px solid var(--border);
  border-radius:var(--radius-sm); padding:10px 14px; margin-bottom:8px; cursor:pointer; font-size:.92rem; font-family:var(--font-body);
}
.mcq-opt:hover{ border-color:var(--primary); }
.mcq-opt.correct{ background:var(--secondary-soft); border-color:var(--secondary); color:#037a68; font-weight:700; }
.mcq-opt.wrong{ background:#ffe4e9; border-color:var(--danger); color:#b5203c; font-weight:700; }
.mcq-result{ font-size:.85rem; font-weight:700; margin-top:6px; }

.quiz-score{
  display:flex; align-items:center; justify-content:space-between; background:var(--primary-soft);
  border-radius:var(--radius); padding:14px 18px; margin-top:10px; flex-wrap:wrap; gap:10px;
}
.quiz-score b{ font-size:1.3rem; color:var(--primary-dark); font-family:var(--font-head); }

.writing-box textarea{
  width:100%; min-height:140px; border-radius:var(--radius-sm); border:1px solid var(--border);
  padding:14px; font-family:var(--font-body); font-size:.92rem; resize:vertical; background:var(--surface-alt);
}
.word-counter{ font-size:.78rem; color:var(--text-faint); margin-top:6px; }

.badge-row{ display:flex; gap:10px; flex-wrap:wrap; }
.badge{ display:inline-flex; align-items:center; gap:6px; background:var(--bg-soft); border-radius:999px; padding:6px 12px; font-size:.75rem; font-weight:700; color:var(--text-soft); }

.day-footer-nav{ display:flex; justify-content:space-between; gap:14px; margin-top:24px; flex-wrap:wrap; }

.infograph-steps{ display:flex; gap:14px; flex-wrap:wrap; }
.infograph-step{ flex:1; min-width:130px; text-align:center; background:var(--surface-alt); border-radius:var(--radius); padding:16px 10px; }
.infograph-step .num{ width:34px; height:34px; border-radius:50%; background:var(--grad-hero); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:800; margin:0 auto 10px; }

/* ---------- Nav: Admin button ---------- */
.nav-admin-btn{
  background:var(--grad-hero) !important; color:#fff !important;
  box-shadow:var(--shadow-sm); font-weight:700 !important;
}
.nav-admin-btn:hover{ opacity:.92; background:var(--grad-hero) !important; color:#fff !important; }

/* ---------- Book Library / interactive PDF viewer ---------- */
.library-tabs{ display:flex; align-items:center; gap:8px; margin-bottom:18px; flex-wrap:wrap; }
.library-tabs a{
  padding:9px 18px; border-radius:999px; font-weight:700; font-size:.88rem; color:var(--text-soft);
  background:var(--surface); border:1px solid var(--border);
}
.library-tabs a.active{ background:var(--grad-hero); color:#fff; border-color:transparent; }
.library-tabs a.manage-link{ margin-left:auto; color:var(--primary); background:transparent; border:none; }
.library-tabs a.manage-link:hover{ text-decoration:underline; }

.library-layout{
  display:grid; grid-template-columns:300px 1fr; gap:20px; align-items:start;
}
@media (max-width:860px){ .library-layout{ grid-template-columns:minmax(0,1fr); } }

.library-list{
  display:flex; flex-direction:column; gap:8px; max-height:640px; overflow-y:auto;
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:10px; box-shadow:var(--shadow-sm);
}
.library-item{
  display:flex; align-items:center; gap:12px; text-align:left; width:100%;
  background:transparent; border:1px solid transparent; border-left:3px solid transparent; border-radius:var(--radius-sm);
  padding:10px; cursor:pointer; font-family:inherit; transition:background .15s ease, border-color .15s ease;
}
.library-item:hover:not(:disabled){ background:var(--bg-soft); }
.library-item.active{ background:var(--primary-soft); border-left-color:var(--primary); }
.library-item:disabled{ opacity:.5; cursor:not-allowed; }
.library-item .li-text{ min-width:0; }
.library-item .li-title{ font-weight:700; font-size:.87rem; color:var(--text); line-height:1.3; overflow-wrap:break-word; }
.library-item .li-bn{ font-size:.75rem; color:var(--text-faint); }
.library-item .li-author{ font-size:.72rem; color:var(--text-faint); margin-top:2px; }
.library-item .li-missing{ font-size:.7rem; color:#b5203c; font-weight:700; margin-top:2px; }

.book-cover{
  width:42px; height:54px; border-radius:5px; flex:none; position:relative;
  display:flex; align-items:center; justify-content:center; box-shadow:0 3px 8px rgba(0,0,0,0.18);
}
.book-cover::after{
  content:""; position:absolute; left:4px; top:4px; right:4px; bottom:4px;
  border:1px solid rgba(255,255,255,0.35); border-radius:3px; pointer-events:none;
}
.book-cover svg{ width:18px; height:18px; color:#fff; opacity:.9; }
.book-cover-letter{ display:none; }

.library-viewer{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg);
  box-shadow:var(--shadow); overflow:hidden; display:flex; flex-direction:column; min-width:0;
}
.library-viewer-chrome{
  display:flex; align-items:center; gap:6px; padding:10px 14px; background:#e9ebf3;
  border-bottom:1px solid var(--border);
}
.chrome-dot{ width:11px; height:11px; border-radius:50%; flex:none; }
.chrome-url{
  margin-left:10px; background:#fff; border-radius:999px; padding:4px 14px; font-size:.72rem;
  color:var(--text-faint); flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.library-viewer-toolbar{
  display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  padding:12px 16px; border-bottom:1px solid var(--border); background:var(--bg-soft);
  font-weight:700; font-size:.9rem;
}
.library-viewer-actions{ display:flex; gap:8px; }
.library-viewer-frame{ position:relative; height:640px; background:#3d4045; padding:14px; }
.library-viewer-frame iframe{
  width:100%; height:100%; border:0; display:none; border-radius:var(--radius-sm);
  box-shadow:0 8px 30px rgba(0,0,0,0.35); background:#fff;
}
#viewer-placeholder{
  position:absolute; inset:14px; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; color:#cfd3d6; text-align:center; padding:30px; background:#46494f; border-radius:var(--radius-sm);
}
#viewer-placeholder svg{ width:48px; height:48px; opacity:.6; }
#viewer-placeholder p{ max-width:320px; font-size:.85rem; line-height:1.5; }
@media (max-width:640px){ .library-viewer-frame{ height:480px; padding:8px; } }

/* ---------- Media embed wrapper (all resource types try to embed inline) ---------- */
.media-embed-wrap{ min-width:0; }

@media (max-width:640px){
  .day-hero{ padding:20px; }
  .lesson-section{ padding:18px; }
  .section{ padding:26px 0; }
}
