/* =====================================================================
   AI Teaching — school learning portal
   Chalkboard navigation on the left, paper-white workspace, binder-style courses.
   ===================================================================== */
:root {
  /* chalkboard */
  --board: #233a30;
  --board-deep: #1a2c24;
  --chalk: #eef3ef;
  --chalk-dim: #a3b8ad;
  --chalk-yellow: #f5c543;
  /* paper & ink */
  --paper: #f3f5f4;
  --bg-card: #ffffff;
  --ink: #1b2420;
  --ink-2: #47544e;
  --ink-3: #75837c;
  --line: #dde4e0;
  /* actions */
  --primary: #2c6e52;
  --primary-dark: #215640;
  --primary-tint: #e5efea;
  /* binder colours (one per course) */
  --binder-1: #2f5da8; --binder-2: #b5473c; --binder-3: #c08a1e; --binder-4: #2f7a57; --binder-5: #6a4c9c; --binder-6: #1f7a85;
  /* older names used by components */
  --dark-green: #1f3b2f;
  --deep-green: var(--board-deep);
  --mid-green: var(--primary);
  --bright-green: #4fae84;
  --light-green: var(--primary-tint);
  --bg-page: var(--paper);
  --gold: #c08a1e;
  --danger: #b03a31;
  --danger-bg: #fbecea;
  --warn-bg: #fdf3da;
  --ok-bg: #e5f3ec;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(27, 36, 32, .05), 0 2px 8px rgba(27, 36, 32, .04);
  --shadow-lg: 0 20px 50px rgba(20, 34, 28, .24);
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-read: "Literata", "IBM Plex Sans Arabic", Georgia, serif;
  --board-w: 264px;
  --topbar-h: 0px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--primary); }
img { max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2.5px solid var(--chalk-yellow); outline-offset: 2px; }
.muted { color: var(--ink-3); }
svg { flex: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ------------------------------------------------------------ buttons, badges, forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; font-weight: 700; font-size: 14.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-dark { background: var(--board); color: #fff; }
.btn-dark:hover { background: var(--board-deep); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--primary-tint); color: var(--primary-dark); }
.btn-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.btn-light:hover { background: rgba(255,255,255,.24); }
.btn-danger { background: #fff; color: var(--danger); border-color: #edcac6; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 6px 11px; font-size: 13.5px; }
.btn-lg { padding: 12px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; cursor: pointer; background: transparent; color: inherit; font-size: 16px; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 700; font-size: 13px; cursor: pointer; padding: 2px 4px; text-decoration: underline; text-underline-offset: 3px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; background: var(--primary-tint); color: var(--primary-dark); }
.badge-warn { background: var(--warn-bg); color: #845b07; }
.badge-error { background: var(--danger-bg); color: var(--danger); }
.badge-gold { background: #fbf0d6; color: #7d5a0c; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 600; text-decoration: none; margin: 2px 2px 2px 0; }
.chip:hover { border-color: var(--primary); color: var(--primary); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 14px; font-weight: 700; color: var(--ink-2); }
.field input, .field textarea, .field select { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; }
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus, .field textarea:focus, .field select:focus, .chat-input-row textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(44,110,82,.15);
}
.field small { color: var(--ink-3); font-size: 12.5px; }
.form-error { background: var(--danger-bg); color: var(--danger); padding: 9px 12px; border-radius: 8px; font-size: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.check-list { display: grid; gap: 6px; max-height: 240px; overflow-y: auto; padding: 4px 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--primary); width: 16px; height: 16px; }
.role-switch, .mode-chips { display: flex; gap: 8px; }
.role-switch label, .mode-chips label { flex: 1; cursor: pointer; position: relative; }
.role-switch input, .mode-chips input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.role-switch input:focus-visible + span, .mode-chips input:focus-visible + span { outline: 2.5px solid var(--primary); outline-offset: 2px; }

/* ------------------------------------------------------------ sign-in */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 1fr); }
.login-board {
  position: relative; display: flex; align-items: center; padding: 56px clamp(28px, 6vw, 88px);
  background: var(--board); color: var(--chalk); overflow: hidden;
  border-right: 14px solid #6b4a2f;   /* the board's wooden frame */
  box-shadow: inset 0 0 120px rgba(0,0,0,.35);
}
.login-board::before {   /* chalk dust */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background: radial-gradient(ellipse at 20% 30%, rgba(255,255,255,.08), transparent 55%),
              radial-gradient(ellipse at 80% 75%, rgba(255,255,255,.06), transparent 50%);
}
.login-board-inner { position: relative; max-width: 560px; }
.login-board .board-brand { margin-bottom: 56px; padding: 0; }
.chalk-title { font-size: clamp(34px, 4.2vw, 54px); line-height: 1.08; margin: 0 0 20px; font-weight: 700; letter-spacing: -.01em; color: #fff;
  text-shadow: 0 0 1px rgba(255,255,255,.6), 0 0 14px rgba(255,255,255,.08); }
.login-lede { color: var(--chalk-dim); font-size: 17px; max-width: 46ch; margin: 0; }
.login-points { list-style: none; padding: 0; margin: 36px 0 0; display: grid; gap: 12px; }
.login-points li { position: relative; padding-left: 30px; color: var(--chalk); }
.login-points li::before { content: ""; position: absolute; left: 0; top: .55em; width: 18px; height: 3px; border-radius: 2px; background: var(--chalk-yellow); transform: rotate(-4deg); }
.chalk-tray { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: #6b4a2f; }
.chalk-tray::after { content: ""; position: absolute; left: 18%; bottom: 8px; width: 46px; height: 9px; border-radius: 4px; background: #f3f0e6; box-shadow: 70px 0 0 -1px var(--chalk-yellow); }
.login-panel { display: grid; place-items: center; padding: 32px 18px; background: var(--paper); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 14px; padding: 34px 32px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-card h2 { margin: 0; font-size: 28px; }
.login-card > .muted { margin: 2px 0 22px; }
.role-switch { margin-bottom: 18px; background: var(--paper); padding: 4px; border-radius: 10px; }
.role-switch span { display: block; text-align: center; padding: 9px; border-radius: 8px; font-weight: 700; color: var(--ink-2); transition: background .15s; }
.role-switch input:checked + span { background: #fff; color: var(--board); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.login-hint { font-size: 13.5px; color: var(--ink-3); margin: -4px 0 16px; }

/* ------------------------------------------------------------ app shell: chalkboard nav + workspace */
.app { display: grid; grid-template-columns: var(--board-w) minmax(0, 1fr); min-height: 100vh; }
.board {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--board); color: var(--chalk); border-right: 6px solid #6b4a2f;
  box-shadow: inset -30px 0 60px rgba(0,0,0,.12);
}
.board-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 18px; color: #fff; text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.brand-mark { width: 34px; height: 34px; color: var(--chalk); }
.board-nav { display: grid; gap: 2px; padding: 4px 12px 14px; border-bottom: 1px solid rgba(255,255,255,.1); }
.board-nav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--chalk); text-decoration: none; font-weight: 700; font-size: 15px; }
.board-nav a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.board-nav a:hover { background: rgba(255,255,255,.07); }
.board-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.board-nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; background: var(--chalk-yellow); }
.board-courses { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 14px 10px 8px; }
.board-courses-head { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px; }
.board-courses-head h2 { margin: 0; font-size: 14px; font-weight: 700; color: var(--chalk-dim); }
.board-add { border: 1px solid rgba(255,255,255,.22); background: transparent; color: var(--chalk); border-radius: 7px; padding: 3px 9px; font-size: 13px; font-weight: 700; cursor: pointer; }
.board-add:hover { background: rgba(255,255,255,.1); }
#course-search { margin: 0 4px 10px; padding: 8px 11px; border-radius: 8px; border: 1px solid rgba(255,255,255,.14); background: rgba(0,0,0,.14); color: #fff; }
#course-search::placeholder { color: #8ea89a; }
#course-search:focus { outline: none; border-color: var(--chalk-yellow); }
.course-list { overflow-y: auto; flex: 1; padding: 0 2px 10px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.panel-empty { padding: 10px 10px; color: var(--chalk-dim); font-size: 14px; }
.board-foot { padding: 10px 12px 14px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 6px; }
.demo-pill { justify-self: start; font-size: 12px; font-weight: 700; color: var(--board-deep); background: var(--chalk-yellow); padding: 2px 9px; border-radius: 999px; margin-left: 4px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px; background: transparent; border: 0; color: var(--chalk); cursor: pointer; text-align: start; }
.user-chip:hover { background: rgba(255,255,255,.07); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 800; font-size: 13px; flex: none; }
.board .avatar { background: var(--chalk-yellow); color: var(--board-deep); }
.user-meta { display: grid; line-height: 1.2; min-width: 0; }
.user-meta strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta small { color: var(--chalk-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-signout { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--chalk-dim); padding: 7px 10px; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 14px; }
.board-signout svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.board-signout:hover { color: #fff; background: rgba(255,255,255,.07); }
.board-scrim { position: fixed; inset: 0; background: rgba(15,25,20,.45); z-index: 44; }
.workspace { min-width: 0; }
.mobile-bar { display: none; }
.main { padding: 34px clamp(18px, 3.4vw, 48px) 120px; min-width: 0; outline: none; }
.main-inner { max-width: 1280px; margin: 0 auto; }

/* my courses outline inside the chalkboard */
.subject { border-radius: 9px; margin-bottom: 2px; }
.subject.open { background: rgba(0,0,0,.14); }
.subject-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: inherit; cursor: pointer; text-align: start; font: inherit; }
.subject-head:hover { background: rgba(255,255,255,.07); }
.subject-swatch { width: 10px; height: 26px; border-radius: 3px; flex: none; background: var(--c, var(--binder-1)); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.subject-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.subject-name { font-weight: 700; font-size: 14.5px; line-height: 1.3; color: #fff; overflow-wrap: anywhere; }
.subject-count { font-size: 12.5px; color: var(--chalk-dim); }
.subject.active .subject-name { color: var(--chalk-yellow); }
.chev { font-size: 18px; color: var(--chalk-dim); transition: transform .2s; line-height: 1; }
.subject.open .chev { transform: rotate(90deg); color: #fff; }
.toc-wrap { padding: 0 6px 8px 20px; }
.toc { list-style: none; margin: 0; padding: 2px 0 0; border-left: 1px dashed rgba(255,255,255,.22); }
.toc a { display: flex; align-items: baseline; gap: 9px; padding: 6px 8px 6px 12px; border-radius: 0 7px 7px 0; color: #d5e2da; text-decoration: none; font-size: 13.5px; line-height: 1.35; }
.toc a:hover { background: rgba(255,255,255,.07); color: #fff; }
.toc a.active { background: rgba(245,197,67,.14); color: #fff; font-weight: 700; box-shadow: inset 3px 0 0 var(--chalk-yellow); }
.toc a.hit .toc-title { text-decoration: underline; text-decoration-color: var(--chalk-yellow); text-underline-offset: 3px; }
.toc-num { flex: none; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 12px; color: var(--chalk-yellow); min-width: 18px; opacity: .9; }
.toc-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toc .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--bright-green); flex: none; align-self: center; }
.toc .dot.processing { background: var(--chalk-yellow); animation: pulse 1.2s infinite; }
.toc .dot.error { background: #f08a80; }
.toc-empty { padding: 6px 12px; font-size: 13px; color: var(--chalk-dim); }
.toc-overview { display: inline-block; margin: 6px 0 0 12px; font-size: 13px; color: var(--chalk-dim); text-decoration: underline; text-underline-offset: 3px; }
.toc-overview:hover { color: #fff; }

/* ------------------------------------------------------------ page headings */
.crumbs { font-size: 13.5px; color: var(--ink-3); margin-bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 32px; line-height: 1.15; letter-spacing: -.015em; }
.page-head .lede { margin: 6px 0 0; color: var(--ink-2); max-width: 64ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--primary-tint); color: var(--primary-dark); font-weight: 700; font-size: 12.5px; }
.eyebrow { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.card-pad { padding: 22px 24px; }
.section-title { font-size: 19px; font-weight: 700; color: var(--ink); margin: 34px 0 12px; letter-spacing: -.005em; }
.section-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 34px 0 12px; }
.section-bar .section-title { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin-bottom: 8px; }
.stat { padding: 16px 18px; }
.stat-num { font-size: 26px; font-weight: 800; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 13.5px; color: var(--ink-3); font-weight: 600; }
a.stat-link { text-decoration: none; color: inherit; }
a.stat-link:hover { border-color: var(--primary); }

/* ------------------------------------------------------------ binder (course) cards */
.binder { --c: var(--binder-1); position: relative; overflow: hidden; color: #fff; background-color: var(--c); }
.binder::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .22; }
.binder.p-ruled::after { background: repeating-linear-gradient(180deg, transparent 0 15px, rgba(255,255,255,.9) 15px 16px); }
.binder.p-graph::after { background: linear-gradient(rgba(255,255,255,.8) 1px, transparent 1px) 0 0/14px 14px, linear-gradient(90deg, rgba(255,255,255,.8) 1px, transparent 1px) 0 0/14px 14px; opacity: .16; }
.binder.p-dots::after { background: radial-gradient(rgba(255,255,255,.95) 1.3px, transparent 1.6px) 0 0/13px 13px; opacity: .3; }
.binder.p-diag::after { background: repeating-linear-gradient(135deg, transparent 0 9px, rgba(255,255,255,.7) 9px 10px); opacity: .16; }
.binder-rings { position: absolute; left: 14px; top: 0; bottom: 0; width: 12px; display: flex; flex-direction: column; justify-content: space-evenly; z-index: 1; }
.binder-rings i { width: 12px; height: 12px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 2px 2px rgba(0,0,0,.25); }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.course-card { display: flex; flex-direction: column; text-decoration: none; color: inherit; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.course-card:hover { border-color: #b9c7c0; box-shadow: 0 6px 22px rgba(27,36,32,.1); }
.course-card .binder { height: 104px; padding: 14px 16px 12px 40px; display: flex; flex-direction: column; justify-content: flex-end; }
.course-card .binder-label { position: relative; z-index: 1; align-self: flex-start; background: rgba(255,255,255,.94); color: var(--ink); font-weight: 800; font-size: 12.5px; padding: 3px 9px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.15); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-card-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.course-card h3 { margin: 0; font-size: 18px; line-height: 1.3; }
.course-card p { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-card .meta { margin-top: 8px; font-size: 13.5px; color: var(--ink-3); display: flex; gap: 14px; flex-wrap: wrap; }
.course-card.add-card { border: 2px dashed var(--line); box-shadow: none; background: transparent; align-items: center; justify-content: center; min-height: 220px; color: var(--ink-2); font-weight: 700; cursor: pointer; font-size: 15px; }
.course-card.add-card:hover { border-color: var(--primary); color: var(--primary); }
.courses-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.courses-tools input { flex: 1; min-width: 220px; max-width: 420px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; }

/* ------------------------------------------------------------ home */
.greeting h1 { margin: 0; font-size: 34px; letter-spacing: -.015em; }
.greeting p { margin: 4px 0 0; color: var(--ink-3); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 26px; align-items: start; margin-top: 26px; }
.continue-card { display: flex; gap: 0; overflow: hidden; text-decoration: none; color: inherit; margin-bottom: 22px; }
.continue-card .binder { width: 92px; flex: none; }
.continue-card .continue-body { padding: 18px 20px; flex: 1; min-width: 0; }
.continue-card small { color: var(--ink-3); font-weight: 700; }
.continue-card h3 { margin: 4px 0 2px; font-size: 20px; }
.continue-card p { margin: 0; color: var(--ink-2); }
.continue-card:hover { border-color: var(--primary); }
.stream { list-style: none; margin: 0; padding: 0; }
.stream li { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.stream li:last-child { border-bottom: 0; }
.stream-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-size: 16px; background: var(--paper); }
.stream-ico.c1 { background: #e3ebf7; } .stream-ico.c2 { background: #f8e6e4; } .stream-ico.c3 { background: #f8efd9; }
.stream-ico.c4 { background: #e2f0e8; } .stream-ico.c5 { background: #ece6f5; } .stream-ico.c6 { background: #ddeff1; }
.stream-text { font-size: 15px; color: var(--ink-2); }
.stream-text b, .stream-text a { color: var(--ink); }
.stream-text a { font-weight: 700; text-decoration: none; }
.stream-text a:hover { text-decoration: underline; color: var(--primary); }
.stream-quote { margin-top: 4px; font-size: 14px; color: var(--ink); background: var(--paper); border-radius: 7px; padding: 5px 9px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stream-time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; padding-top: 2px; }
.side-courses { list-style: none; margin: 0; padding: 0; }
.side-courses li + li { border-top: 1px solid var(--line); }
.side-courses a { display: flex; align-items: center; gap: 12px; padding: 11px 2px; text-decoration: none; color: inherit; }
.side-courses a:hover b { color: var(--primary); }
.side-courses .subject-swatch { height: 34px; width: 8px; }
.side-courses span { display: grid; line-height: 1.3; min-width: 0; }
.side-courses small { color: var(--ink-3); }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.inline-stats { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 16px; color: var(--ink-3); font-size: 14px; }
.inline-stats b { color: var(--ink); font-size: 20px; margin-right: 6px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ course page */
.course-banner { border-radius: 14px; padding: 30px 32px 26px 64px; margin-bottom: 26px; min-height: 170px; display: flex; flex-direction: column; justify-content: flex-end; }
.course-banner .binder-rings { left: 24px; width: 16px; }
.course-banner .binder-rings i { width: 16px; height: 16px; }
.course-banner > *:not(.binder-rings) { position: relative; z-index: 1; }
.course-banner .banner-code { align-self: flex-start; background: rgba(255,255,255,.94); color: var(--ink); font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 4px; margin-bottom: 12px; }
.course-banner h1 { margin: 0; font-size: 36px; line-height: 1.1; letter-spacing: -.015em; text-shadow: 0 1px 2px rgba(0,0,0,.18); }
.course-banner p { margin: 8px 0 0; max-width: 70ch; color: rgba(255,255,255,.92); }
.course-banner .banner-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.content-list { list-style: none; margin: 0; padding: 0; }
.content-row { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 16px 20px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.content-list li:last-child .content-row { border-bottom: 0; }
.content-row:hover { background: #f8faf9; }
.content-row:hover h3 { color: var(--primary); }
.chapter-num { width: 44px; height: 44px; border-radius: 10px; background: var(--primary-tint); color: var(--primary-dark); font-weight: 800; font-size: 16px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.content-row h3 { margin: 0; font-size: 17px; line-height: 1.3; }
.content-row p { margin: 3px 0 0; color: var(--ink-3); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.content-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.about-list { margin: 0; display: grid; gap: 12px; }
.about-list div { display: grid; gap: 2px; }
.about-list dt { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.about-list dd { margin: 0; font-weight: 600; }

/* ------------------------------------------------------------ grades */
.grade-course { margin-bottom: 18px; overflow: hidden; }
.grade-course-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.grade-course-head h3 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.grade-course-head .subject-swatch { height: 22px; width: 7px; }
.grade-avg { font-weight: 800; font-size: 15px; }

.empty { text-align: center; padding: 44px 24px; border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; }
.empty .big { font-size: 38px; }
.empty h3 { margin: 8px 0 4px; }
.empty p { margin: 0 0 16px; color: var(--ink-2); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ------------------------------------------------------------ chapter page */
.chapter-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.chapter-tabs a {
  padding: 10px 16px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.chapter-tabs a.active { color: var(--dark-green); border-color: var(--mid-green); }
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.explain-card { padding: 38px 48px 42px; border-top: 5px solid var(--mid-green); min-height: 60vh; }
.explain-card .card-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.ai-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--mid-green); background: var(--light-green); padding: 4px 10px; border-radius: 999px; }
.side-stack { display: grid; gap: 16px; position: sticky; top: calc(var(--topbar-h) + 20px); }
.side-card { padding: 18px; }
.side-card h4 { margin: 0 0 10px; font-size: 15.5px; font-weight: 700; color: var(--ink); }
.summary-text { font-size: 14px; color: var(--ink-2); margin: 0; }
.key-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.key-points li { position: relative; padding-left: 20px; font-size: 14px; }
.key-points li::before { content: ""; position: absolute; left: 3px; top: 8px; width: 8px; height: 8px; border-radius: 2px; background: var(--mid-green); transform: rotate(45deg); }
.photo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-strip > button { padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; aspect-ratio: 3/4; background: var(--bg-page); }
.photo-strip > button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.practice-cta { background: #fdf6e0; border-color: #f1e2b4; }
.practice-cta p { margin: 0 0 12px; font-size: 14px; color: #6b5414; }

/* markdown content */
.prose { font-family: var(--font-read); font-size: 18.5px; line-height: 1.75; color: #1d2b24; overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--font); line-height: 1.25; color: var(--dark-green); letter-spacing: -.01em; }
.prose h1 { font-size: 26px; } .prose h2 { font-size: 22px; margin-top: 1.6em; } .prose h3 { font-size: 18px; margin-top: 1.4em; }
.prose > :first-child { margin-top: 0; }
.prose blockquote { margin: 1em 0; padding: 10px 18px; border-left: 4px solid var(--mid-green); background: var(--light-green); border-radius: 0 10px 10px 0; }
.prose code { font-family: Consolas, monospace; font-size: .88em; background: var(--bg-page); padding: 2px 6px; border-radius: 5px; }
.prose pre { background: #0f2219; color: #dff1e7; padding: 14px 16px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; width: 100%; font-family: var(--font); font-size: 14px; display: block; overflow-x: auto; }
.prose th { background: var(--dark-green); color: #fff; text-align: left; }
.prose th, .prose td { padding: 8px 12px; border: 1px solid var(--line); }
.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.prose img { border-radius: 10px; }
[dir="rtl"].prose blockquote { border-left: 0; border-right: 4px solid var(--mid-green); border-radius: 10px 0 0 10px; }

details.transcript { margin-top: 18px; }
details.transcript summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
details.transcript pre { white-space: pre-wrap; font-family: Consolas, monospace; font-size: 13px; background: var(--bg-page); padding: 14px; border-radius: 10px; max-height: 360px; overflow: auto; }

/* processing / error states */
.status-card { padding: 40px 30px; text-align: center; }
.status-card h3 { margin: 16px 0 6px; }
.status-card p { margin: 0 auto; color: var(--ink-2); max-width: 460px; }
.loader { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; border: 4px solid var(--light-green); border-top-color: var(--mid-green); animation: spin 1s linear infinite; }
.loader.sm { width: 18px; height: 18px; border-width: 2.5px; margin: 0; display: inline-block; vertical-align: middle; }
.scan-photos { display: flex; justify-content: center; gap: 8px; margin-top: 22px; }
.scan-photos img { width: 64px; height: 84px; object-fit: cover; border-radius: 8px; animation: float 2s ease-in-out infinite; }
.scan-photos img:nth-child(2) { animation-delay: .2s } .scan-photos img:nth-child(3) { animation-delay: .4s }
.error-box { background: var(--danger-bg); color: var(--danger); padding: 12px 16px; border-radius: 10px; margin: 16px auto 0; max-width: 520px; }

/* ------------------------------------------------------------ practice */
.practice-setup { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.practice-setup .field { margin: 0; min-width: 160px; }
.segmented { display: inline-flex; background: var(--bg-page); padding: 4px; border-radius: 10px; gap: 2px; }
.segmented label { cursor: pointer; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.segmented span { display: block; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.segmented input:checked + span { background: #fff; color: var(--dark-green); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.quiz { display: grid; gap: 14px; margin-top: 20px; }
.q-card { padding: 22px 24px; }
.q-head { display: flex; gap: 10px; align-items: baseline; margin-bottom: 14px; }
.q-num { flex: none; font-weight: 800; color: var(--mid-green); font-size: 14px; }
.q-text { font-weight: 600; font-size: 16.5px; }
.options { display: grid; gap: 8px; }
.option {
  display: flex; gap: 12px; align-items: center; text-align: start; width: 100%;
  padding: 12px 14px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; transition: all .12s;
}
.option:hover:not(:disabled) { border-color: var(--mid-green); }
.option .letter { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-page); font-weight: 700; font-size: 13px; }
.option.selected { border-color: var(--mid-green); background: var(--light-green); }
.option.selected .letter { background: var(--mid-green); color: #fff; }
.option.correct { border-color: var(--mid-green); background: var(--ok-bg); }
.option.correct .letter { background: var(--mid-green); color: #fff; }
.option.wrong { border-color: #e2a29d; background: var(--danger-bg); }
.option.wrong .letter { background: var(--danger); color: #fff; }
.option:disabled { cursor: default; }
.q-explain { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--bg-page); font-size: 14.5px; }
.q-explain.ok { background: var(--ok-bg); } .q-explain.bad { background: #fdf3f2; }
.score-banner { display: flex; align-items: center; gap: 22px; padding: 22px 26px; margin-top: 20px; flex-wrap: wrap; }
.score-ring { --p: 0; width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--mid-green) calc(var(--p) * 1%), var(--light-green) 0); flex: none; }
.score-ring span { width: 66px; height: 66px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 19px; color: var(--dark-green); }
.score-banner h3 { margin: 0 0 4px; }
.score-banner p { margin: 0; color: var(--ink-2); }
.quiz-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ------------------------------------------------------------ chat */
.chat-fab {
  position: fixed; z-index: 40; right: 28px; bottom: 24px;
  display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer;
  padding: 14px 22px; border-radius: 999px; font-weight: 700; font-size: 15px;
  background: var(--dark-green); color: #fff; box-shadow: var(--shadow-lg);
  transition: transform .15s, background .15s;
}
.chat-fab:hover { background: var(--mid-green); transform: translateY(-2px); }
.fab-icon { color: var(--bright-green); font-size: 18px; }
.chat-backdrop { position: fixed; inset: 0; background: rgba(8,44,27,.35); z-index: 49; }
.chat-drawer {
  position: fixed; z-index: 50; top: 0; right: 0; height: 100%; width: min(720px, 100vw);
  background: var(--bg-page); display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  transform: translateX(105%); transition: transform .25s ease;
}
.chat-drawer.open { transform: none; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 18px;
  background: linear-gradient(120deg, var(--dark-green), var(--mid-green)); color: #fff;
}
.chat-title { font-weight: 800; font-size: 17px; }
.spark { color: var(--bright-green); }
.chat-subtitle { font-size: 13px; color: #cfe6da; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-actions { display: flex; gap: 4px; }
.chat-drawer.large { width: min(1180px, 100vw); }
.chat-drawer .chat-messages > *, .chat-drawer .chat-form, .chat-drawer .chat-suggestions { width: 100%; max-width: 980px; margin-left: auto; margin-right: auto; }
.chat-head-btn { border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff; border-radius: 9px; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.chat-head-btn:hover { background: rgba(255,255,255,.22); }
.chat-messages { flex: 1; overflow-y: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg-avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--dark-green); color: var(--bright-green); display: grid; place-items: center; font-size: 14px; }
.bubble { padding: 13px 18px; border-radius: 14px; max-width: 88%; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--mid-green); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.prose { font-family: var(--font); font-size: 16px; line-height: 1.65; }
.bubble.prose p { margin: .4em 0; } .bubble.prose > :first-child { margin-top: 0; } .bubble.prose > :last-child { margin-bottom: 0; }
.bubble.prose h1, .bubble.prose h2, .bubble.prose h3 { font-size: 16px; margin: .8em 0 .3em; }
.bubble .media { margin-top: 8px; border-radius: 10px; overflow: hidden; background: var(--bg-page); }
.bubble .media img { display: block; width: 100%; cursor: zoom-in; }
.bubble .media video { display: block; width: 100%; }
.media-actions { display: flex; gap: 8px; margin-top: 8px; }
.pending-line { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s } .typing span:nth-child(3) { animation-delay: .4s }
.chat-welcome { text-align: center; color: var(--ink-2); padding: 30px 16px 10px; }
.chat-welcome .big { font-size: 34px; color: var(--mid-green); }
.chat-welcome h3 { margin: 6px 0; color: var(--ink); }
.chat-suggestions { display: flex; gap: 6px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chat-suggestions button {
  flex: none; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px;
  font-size: 13px; cursor: pointer; color: var(--ink-2);
}
.chat-suggestions button:hover { border-color: var(--mid-green); color: var(--dark-green); }
.chat-form { padding: 12px 14px 16px; background: #fff; border-top: 1px solid var(--line); }
.mode-chips { margin-bottom: 10px; }
.mode-chips span { display: block; text-align: center; padding: 6px 8px; border-radius: 8px; font-size: 13px; font-weight: 600; background: var(--bg-page); color: var(--ink-2); transition: all .12s; }
.mode-chips input:checked + span { background: var(--dark-green); color: #fff; }
.video-length { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -2px 0 10px; font-size: 13px; color: var(--ink-2); }
.video-length span { font-weight: 600; }
.video-length select { padding: 6px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; }
.video-length small { flex-basis: 100%; color: var(--ink-3); font-size: 12px; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea {
  flex: 1; resize: none; max-height: 140px; padding: 11px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; line-height: 1.4;
}
.send-btn { width: 46px; height: 46px; padding: 0; border-radius: 12px; font-size: 17px; }

/* ------------------------------------------------------------ modal, lightbox, toast */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(8,44,27,.45); display: grid; place-items: center; padding: 16px; }
.modal-card { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-card.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head .icon-btn:hover { background: var(--bg-page); }
.modal-body { padding: 20px 22px 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.dropzone {
  border: 2px dashed #b9d6c6; border-radius: 12px; padding: 26px; text-align: center; background: var(--light-green);
  cursor: pointer; transition: all .15s; color: var(--dark-green);
}
.dropzone.drag { border-color: var(--mid-green); background: #d8efe3; }
.dropzone .big { font-size: 30px; }
.dropzone p { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 3/4; border-radius: 8px; overflow: hidden; background: var(--bg-page); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .n { position: absolute; left: 5px; top: 5px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.thumb .x { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; }
.thumb .noprev { display: grid; place-items: center; height: 100%; font-size: 11px; color: var(--ink-3); padding: 4px; text-align: center; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-height: 92vh; border-radius: 8px; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--deep-green); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: calc(100vw - 32px); }
.toast.error { background: var(--danger); }

.skeleton { background: linear-gradient(90deg, #eef2f0 25%, #f7f9f8 50%, #eef2f0 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
.only-mobile { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes shimmer { to { background-position: -200% 0; } }


/* ------------------------------------------------------------ accounts & students */
.login-hint { font-size: 13px; color: var(--ink-3); margin: -4px 0 14px; }
button.user-chip { border: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; transition: background .15s; }
button.user-chip:hover { background: var(--light-green); }
.stat-link { text-decoration: none; color: inherit; transition: border-color .15s; }
.stat-link:hover { border-color: var(--mid-green); }
.table-card { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfcfb; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: #fafcfb; }
.data-table code { background: var(--bg-page); padding: 3px 7px; border-radius: 6px; font-size: 13px; }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table .actions .btn { margin-left: 4px; }
.row-disabled td { opacity: .55; }
.nowrap { white-space: nowrap; }
.person { display: flex; align-items: center; gap: 10px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; flex: none; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; flex: none; }
.account-head { display: flex; align-items: center; gap: 14px; padding: 14px; background: var(--bg-page); border-radius: 12px; }
.input-with-btn { display: flex; gap: 6px; }
.input-with-btn input { flex: 1; min-width: 0; font-family: Consolas, monospace; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--mid-green); width: 16px; height: 16px; }
.cred-note { background: var(--warn-bg); color: #6d4f0c; padding: 10px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.cred-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; max-height: 52vh; overflow: auto; }
.cred-card { border: 1.5px dashed #9ccbb2; border-radius: 12px; padding: 14px 16px; background: #fbfdfc; }
.cred-name { font-weight: 700; margin-bottom: 8px; }
.cred-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; margin: 4px 0; }
.cred-row span { color: var(--ink-3); }
.cred-row b { font-weight: 600; font-size: 12px; overflow-wrap: anywhere; text-align: right; }
.cred-row code { font-family: Consolas, monospace; background: var(--light-green); color: var(--dark-green); padding: 2px 8px; border-radius: 6px; }
.code-big { font-size: 16px; letter-spacing: .12em; font-weight: 700; }
@media (max-width: 900px) {
  .hide-sm { display: none; }
  .data-table th:nth-child(4), .data-table td:nth-child(4) { display: none; }
}
@media (max-width: 560px) {
  .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
  .data-table .actions .btn { padding: 6px 8px; }
}


/* ------------------------------------------------------------ manage page & lesson files */
.section-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 30px 0 12px; border-bottom: 2px solid var(--light-green); }
.section-bar .section-title { margin: 0; padding-bottom: 8px; border: 0; }
.section-bar .page-actions, .section-bar > .btn { margin-bottom: 8px; }
.manage-tabs { overflow-x: auto; scrollbar-width: none; }
.manage-tabs a { white-space: nowrap; }
.stats-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.manage-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; }
.card-h { margin: 0 0 14px; font-size: 16px; }
.small { font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 6px 0 0; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.bar { width: 100%; max-width: 46px; min-height: 3px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--bright-green), var(--mid-green)); }
.bar-num { font-size: 12px; font-weight: 700; color: var(--dark-green); min-height: 16px; }
.bar-day { font-size: 12px; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0 0 16px; font-size: 14px; align-items: center; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv code { background: var(--bg-page); padding: 2px 7px; border-radius: 6px; font-size: 12.5px; }
.select-sm { padding: 7px 10px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; max-width: 260px; }
.course-cell { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.course-code.sm { min-width: 0; height: 28px; padding: 0 8px; font-size: 11px; background: var(--light-green); color: var(--dark-green); border-radius: 7px; display: inline-grid; }
.avatar.admin { background: var(--gold); }
.avatar.student { background: var(--mid-green); }
.settings-form { display: grid; gap: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }
.form-row-3 { grid-template-columns: 1.3fr 1fr 1fr; }
.test-list { list-style: none; padding: 0; margin: 14px 0 8px; display: grid; gap: 8px; }
.test-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; overflow-wrap: anywhere; }
.test-list li.ok { background: var(--ok-bg); }
.test-list li.bad { background: var(--danger-bg); }
.test-list .t-ico { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; }
.test-list .ok .t-ico { background: var(--mid-green); }
.test-list .bad .t-ico { background: var(--danger); }
.test-list code { font-size: 12.5px; }

.file-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.file-list li:hover { border-color: var(--mid-green); }
.file-list a { flex: 1; min-width: 0; text-decoration: none; color: inherit; display: grid; }
.file-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-list small { color: var(--ink-3); font-size: 12px; }
.file-ico { font-size: 22px; flex: none; }
.thumb-wrap { position: relative; }
.thumb-wrap > button:first-child { width: 100%; height: 100%; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: zoom-in; aspect-ratio: 3/4; background: var(--bg-page); display: block; }
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mat-del { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 0; cursor: pointer; background: rgba(180,55,47,.1); color: var(--danger); font-size: 11px; }
.mat-del:hover { background: var(--danger); color: #fff; }
.thumb-wrap .mat-del { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; }
.scan-doc { width: 64px; height: 84px; border-radius: 8px; background: var(--bg-page); display: grid; place-items: center; align-content: center; gap: 2px; padding: 4px; animation: float 2s ease-in-out infinite; }
.scan-doc span { font-size: 26px; }
.scan-doc small { font-size: 9px; color: var(--ink-3); max-width: 58px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.thumb .noprev { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 100%; padding: 6px; text-align: center; font-size: 11px; color: var(--ink-2); overflow: hidden; }
.thumb .noprev span:not(.big-ico) { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.thumb .noprev small { color: var(--ink-3); font-size: 10px; }
.big-ico { font-size: 28px; }
@media (max-width: 1100px) {
  .stats-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .manage-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .form-row-2, .form-row-4, .form-row-3 { grid-template-columns: 1fr 1fr; }
  .stats-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .lesson-layout, .course-layout { grid-template-columns: 1fr; }
  .side-stack { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .board { position: fixed; left: 0; top: 0; z-index: 45; width: min(var(--board-w), 86vw); transform: translateX(-105%); transition: transform .25s; }
  .board.open { transform: none; box-shadow: var(--shadow-lg); }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 12px; background: var(--board); color: var(--chalk); border-bottom: 4px solid #6b4a2f; }
  .mobile-bar .icon-btn:hover { background: rgba(255,255,255,.1); }
  .mobile-brand { color: #fff; font-weight: 800; text-decoration: none; font-size: 17px; }
  .main { padding: 22px 16px 110px; }
  .chat-fab { right: 16px; bottom: 16px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .login { grid-template-columns: 1fr; }
  .login-board { padding: 34px 22px 40px; border-right: 0; border-bottom: 12px solid #6b4a2f; }
  .login-board .board-brand { margin-bottom: 26px; }
  .login-points, .chalk-tray { display: none; }
  .course-banner { padding: 24px 20px 20px 52px; }
  .course-banner h1 { font-size: 28px; }
}
@media (max-width: 560px) {
  .explain-card { padding: 22px 18px; }
  .prose { font-size: 16.5px; }
  .page-head h1, .greeting h1 { font-size: 26px; }
  .chat-fab span:last-child { display: none; }
  .chat-fab { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .content-row { grid-template-columns: 36px minmax(0,1fr); padding: 14px; }
  .content-meta { grid-column: 2; justify-content: flex-start; }
  .chapter-num { width: 36px; height: 36px; font-size: 14px; }
  .stream li { grid-template-columns: 32px minmax(0,1fr); }
  .stream-time { grid-column: 2; }
}
/* =====================================================================
   Lesson card: "read in" language switch, marker
   ===================================================================== */
.read-in { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; background: var(--bg-page); border-radius: 11px; width: fit-content; max-width: 100%; margin: 0 0 12px; }
.read-in-label { font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 8px 0 6px; }
.read-in button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.read-in button:hover { color: var(--dark-green); background: rgba(255,255,255,.7); }
.read-in button.active { background: #fff; color: var(--dark-green); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.marker-hint { margin: 0 0 18px; font-size: 13px; color: var(--ink-3); }
.translate-wait { text-align: center; padding: 60px 20px; color: var(--ink-2); }
.translate-wait .loader { margin: 0 auto 16px; }
.translate-wait h3 { margin: 0 0 6px; color: var(--dark-green); }
.translate-wait .error-box { margin: 12px auto; }

/* highlighter colours */
.hl-yellow { --hl: #fff176; --hl-strong: #f2c200; }
.hl-green  { --hl: #b9f6ca; --hl-strong: #2fae66; }
.hl-pink   { --hl: #ffc1dc; --hl-strong: #e0558f; }
.hl-blue   { --hl: #bfe3ff; --hl-strong: #3d8fd6; }
mark.hl { background: var(--hl); color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.hl:hover { box-shadow: 0 0 0 2px var(--hl-strong); }
mark.hl.has-note::after { content: "📝"; font-size: .7em; vertical-align: super; margin-inline-start: 2px; }
.katex.hl-math { background: var(--hl); border-radius: 4px; cursor: pointer; }
mark.hl.flash, .katex.hl-math.flash { animation: hlflash 1.4s; }
@keyframes hlflash { 0%, 60% { box-shadow: 0 0 0 4px var(--hl-strong); } 100% { box-shadow: none; } }

.hl-toolbar {
  position: absolute; z-index: 60; display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  background: var(--deep-green); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.hl-toolbar-label { font-size: 16px; padding: 0 2px; }
.hl-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); background: var(--hl); cursor: pointer; padding: 0; }
.hl-dot:hover { transform: scale(1.12); }
.hl-dot.on { box-shadow: 0 0 0 3px var(--hl-strong); }
.hl-note-btn { border: 0; background: rgba(255,255,255,.12); color: #fff; font: inherit; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.hl-note-btn:hover { background: rgba(255,255,255,.22); }
.hl-pop { position: absolute; z-index: 60; padding: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.hl-pop-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.hl-pop-quote { background: var(--hl); padding: 2px 6px; border-radius: 4px; font-size: 13px; line-height: 1.45; }
.hl-pop .hl-colors { display: flex; gap: 8px; margin-bottom: 10px; }
.hl-pop .hl-dot { border-color: #fff; box-shadow: 0 0 0 1px var(--line); }
.hl-pop .hl-dot.on { box-shadow: 0 0 0 3px var(--hl-strong); }
.hl-pop textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 14px; resize: vertical; }
.hl-pop-actions { display: flex; justify-content: space-between; margin-top: 8px; }

/* my highlights & notes */
.notes-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.note-item { width: 100%; text-align: start; border: 0; background: var(--bg-page); border-radius: 9px; padding: 8px 10px; font: inherit; cursor: pointer; display: grid; gap: 4px; }
.note-item:hover { background: var(--light-green); }
.note-quote { background: var(--hl); border-radius: 3px; padding: 0 3px; font-size: 13px; line-height: 1.5; box-decoration-break: clone; -webkit-box-decoration-break: clone; justify-self: start; }
.note-text { font-size: 12.5px; color: var(--ink-2); }
.note-img { cursor: default; grid-template-columns: 44px 1fr; align-items: center; }
.note-img img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }

/* sidebar scrolls by itself when it is taller than the screen */
@media (min-width: 1101px) {
  .side-stack { max-height: calc(100vh - var(--topbar-h) - 40px); overflow-y: auto; padding: 2px 4px 2px 2px; scrollbar-width: thin; }
}

/* =====================================================================
   Image course (schematic representations)
   ===================================================================== */
.image-course .ic-thumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.ic-thumb { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; text-align: start; font: inherit; }
.ic-thumb img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #fafcfb; display: block; }
.ic-thumb span { display: block; padding: 5px 7px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-thumb:hover { border-color: var(--mid-green); }
.ic-actions { display: flex; gap: 8px; margin-top: 8px; }
.ic-actions .btn { flex: 1; }
.ic-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.ic-fig { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.ic-img { border: 0; padding: 0; background: #fafcfb; cursor: zoom-in; display: block; }
.ic-img img { width: 100%; aspect-ratio: 4/3; object-fit: contain; display: block; }
.ic-fig figcaption { padding: 10px 12px 8px; display: grid; gap: 4px; }
.ic-fig figcaption p { margin: 0; font-size: 13px; color: var(--ink-2); }
.ic-n { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px; background: var(--light-green); color: var(--dark-green); font-size: 11px; margin-inline-end: 4px; }
.ic-fig-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.danger-text { color: var(--danger) !important; }
.img-note { margin: 2px 0 0; padding: 6px 8px; background: #fffbe0; border-radius: 7px; font-size: 13px; color: #5c4a00; }
.note-modal-img { display: block; max-width: 100%; max-height: 220px; margin: 0 auto 14px; border-radius: 10px; border: 1px solid var(--line); }
.ic-ideas { display: grid; gap: 8px; margin: 14px 0; }
.ic-idea { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.ic-idea:hover { border-color: var(--mid-green); }
.ic-idea input { margin-top: 4px; accent-color: var(--mid-green); }
.ic-idea span { display: grid; gap: 2px; }
.ic-idea small { color: var(--ink-3); font-size: 12.5px; }
.ic-own { margin-top: 16px; }
.ic-own input { margin-bottom: 8px; }

/* lightbox with caption */
.lightbox figure { margin: 0; display: grid; gap: 10px; justify-items: center; max-width: 100%; }
.lightbox img { max-width: 100%; max-height: 84vh; background: #fff; }
.lightbox figcaption { color: #fff; font-size: 15px; text-align: center; max-width: 900px; }

/* =====================================================================
   Features tab (student creations)
   ===================================================================== */
.features-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 14px; }
.features-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.features-tools input[type=search] { padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; min-width: 240px; background: #fff; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.feat-card { overflow: hidden; display: flex; flex-direction: column; }
.feat-media { position: relative; background: #0f2219; }
.feat-media button { border: 0; padding: 0; display: block; width: 100%; cursor: zoom-in; background: #fafcfb; }
.feat-media img, .feat-media video { width: 100%; aspect-ratio: 16/10; object-fit: contain; display: block; }
.feat-kind-tag { position: absolute; top: 8px; left: 8px; background: rgba(8,44,27,.82); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.feat-body { padding: 12px 14px 10px; display: grid; gap: 4px; }
.feat-prompt { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.feat-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
@media (max-width: 560px) {
  .features-tools input[type=search] { min-width: 0; width: 100%; }
  .read-in-label { width: 100%; padding: 2px 6px; }
}

/* =====================================================================
   Admin oversight: activity feed, profiles, chat viewer
   ===================================================================== */
.act-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.act-filters input[type=search] { flex: 1; min-width: 220px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.act-filters select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--light-green); color: var(--dark-green); font-weight: 600; font-size: 13px; padding: 5px 6px 5px 10px; border-radius: 999px; }
.filter-chip button { border: 0; background: rgba(11,59,36,.12); color: inherit; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 11px; }
.act-day { margin: 18px 0 6px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.act-day:first-child { margin-top: 0; }
.act-list { list-style: none; margin: 0; padding: 0; }
.act-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.act-row:last-child { border-bottom: 0; }
.act-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--bg-page); display: grid; place-items: center; font-size: 15px; }
.act-line { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.act-line a { color: var(--dark-green); font-weight: 600; text-decoration: none; }
.act-line a:hover { text-decoration: underline; }
.act-user { color: var(--ink) !important; }
.role-tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--light-green); color: var(--mid-green); vertical-align: 1px; margin-inline-end: 2px; }
.role-tag.teacher { background: #e6eefb; color: #2a5aa8; }
.role-tag.admin { background: #fbf2dc; color: #876414; }
.act-quote { margin-top: 4px; padding: 6px 10px; background: var(--bg-page); border-radius: 8px; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.act-detail { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.act-time { font-size: 12px; color: var(--ink-3); white-space: nowrap; padding-top: 6px; }
.act-quiz_result .act-ico { background: #fbf2dc; }
.act-chat_question .act-ico, .act-chat_image .act-ico, .act-chat_video .act-ico { background: var(--light-green); }

.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.profile-id { flex: 1; min-width: 220px; }
.profile-id h1 { margin: 0 0 4px; font-size: 26px; }
.profile-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.profile-meta code { background: var(--bg-page); padding: 2px 8px; border-radius: 6px; font-size: 13px; }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.mini-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mini-card button { border: 0; padding: 0; display: block; width: 100%; cursor: zoom-in; background: #fafcfb; }
.mini-card img, .mini-card video { width: 100%; aspect-ratio: 16/10; object-fit: contain; display: block; background: #0f2219; }
.mini-card button img { background: #fafcfb; }
.mini-body { padding: 8px 10px; }
.mini-body p { margin: 0 0 2px; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-body small { font-size: 11.5px; }
.score-pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-inline-start: 4px; }
.score-pill.good { background: var(--ok-bg); color: var(--mid-green); }
.score-pill.mid { background: var(--warn-bg); color: #8a6111; }
.score-pill.low { background: var(--danger-bg); color: var(--danger); }
.teacher-course { margin-bottom: 14px; }
.teacher-course-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; padding: 14px 16px 10px; }
.teacher-course-head a { color: var(--dark-green); text-decoration: none; font-size: 16px; }
.admin-notes { max-height: none; }
.admin-notes .note-item { cursor: default; }
.admin-chat { display: grid; gap: 12px; background: var(--bg-page); padding: 16px; border-radius: 12px; max-height: 65vh; overflow-y: auto; }
.admin-chat .media img, .admin-chat .media video { max-width: 100%; display: block; cursor: zoom-in; }
.msg-time { margin-top: 6px; font-size: 11px; opacity: .65; font-family: var(--font); }
@media (max-width: 560px) {
  .act-row { grid-template-columns: 28px minmax(0, 1fr); }
  .act-time { grid-column: 2; padding-top: 0; }
}
.admin-chat .msg.user .bubble { white-space: pre-wrap; }
.admin-chat .msg.user .msg-time { white-space: normal; }
.admin-chat .media img { max-height: 340px; width: auto; margin: 0 auto; }

.profile-teachers { margin-top: 8px; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.explain-card { border-top-color: var(--primary); }
.chat-fab { background: var(--board); }
.chat-fab:hover { background: var(--board-deep); }
.chapter-tabs a { font-size: 15px; }
.chapter-tabs a.active { color: var(--ink); border-color: var(--chalk-yellow); }

.person a { color: inherit; text-decoration: none; }
.person a:hover { color: var(--primary); text-decoration: underline; }
.grade-course-head a { color: inherit; text-decoration: none; }
.grade-course-head a:hover { color: var(--primary); text-decoration: underline; }
.grade-course .data-table { table-layout: fixed; }
.grade-course .data-table th:first-child, .grade-course .data-table td:first-child { width: 38%; }
.data-table td .chip { margin: 2px 4px 2px 0; }

.badge-blue { background: #e3ebf7; color: #24497f; }
.badge-hidden { background: #2b2f2d; color: #f5c543; }
.badge-hidden::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.badge { white-space: nowrap; }

/* =====================================================================
   Interactive maths (GeoGebra / Desmos)
   ===================================================================== */
.math-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.math-side { display: grid; gap: 14px; position: sticky; top: 20px; }
.math-activities { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.math-activity { width: 100%; text-align: start; display: grid; gap: 3px; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; }
.math-activity:hover { border-color: #b5c6bd; }
.math-activity.active { border-color: var(--primary); background: var(--primary-tint); }
.math-activity b { font-size: 14.5px; line-height: 1.3; }
.math-activity span { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.math-activity small { font-size: 11.5px; font-weight: 700; color: var(--primary); }
.boards-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.boards-list li { display: flex; align-items: center; gap: 4px; }
.board-item { flex: 1; min-width: 0; text-align: start; border: 0; background: var(--paper); border-radius: 8px; padding: 7px 10px; cursor: pointer; font: inherit; display: grid; }
.board-item:hover { background: var(--primary-tint); }
.board-item span { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-item small { color: var(--ink-3); font-size: 12px; }
.math-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tool-switch { display: inline-flex; gap: 2px; padding: 4px; background: #e9eeeb; border-radius: 10px; }
.tool-switch button { border: 0; background: transparent; padding: 6px 13px; border-radius: 7px; font: inherit; font-weight: 700; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.tool-switch button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.activity-steps { padding: 14px 18px; margin-bottom: 10px; border-left: 4px solid var(--chalk-yellow); }
.activity-steps h3 { margin: 0 0 4px; font-size: 16.5px; }
.activity-steps p { margin: 0 0 6px; color: var(--ink-2); }
.activity-steps ol { margin: 4px 0 6px; padding-inline-start: 20px; color: var(--ink); }
.activity-steps li { margin: 2px 0; }
.math-board { height: min(72vh, 720px); min-height: 440px; overflow: hidden; padding: 0; position: relative; }
.math-board > div { width: 100%; height: 100%; }
.board-loading, .board-error { display: grid; place-content: center; justify-items: center; text-align: center; height: 100%; gap: 6px; color: var(--ink-2); padding: 20px; }
.board-error h3 { margin: 0; color: var(--ink); }
.board-credit { margin: 6px 2px 0; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 1000px) {
  .math-layout { grid-template-columns: 1fr; }
  .math-side { position: static; order: 2; }
  .math-board { height: 62vh; min-height: 360px; }
}

.chapter-tabs a.tab-new { animation: hlflash 1.6s; }
.summary-text .katex { font-size: 1em; }

/* Geometry tab: use the whole width of the screen */
.main-inner.wide { max-width: none; }
.math-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 18px; }
.math-layout.focus { grid-template-columns: minmax(0, 1fr); }
.math-layout.focus .math-side { display: none; }
.math-board { height: calc(100vh - 230px); min-height: 520px; max-height: none; }
.activity-steps { padding: 10px 16px; }
.activity-steps summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; list-style: none; }
.activity-steps summary::-webkit-details-marker { display: none; }
.activity-steps summary::before { content: "▾"; color: var(--ink-3); }
.activity-steps details:not([open]) summary::before { content: "▸"; }
.activity-steps summary b { font-size: 16px; }
.activity-steps summary span { color: var(--ink-2); font-size: 14.5px; }
.activity-steps ol { margin: 8px 0 4px; }
@media (max-width: 1000px) { .math-board { height: 70vh; min-height: 380px; } }

/* =====================================================================
   REALISM + MOTION LAYER
   Materials: slate chalkboard, wooden frame, metal binder rings, paper.
   Motion: one or two meaningful moments per view; all off with reduced motion.
   ===================================================================== */
:root {
  --font-hand: "Kalam", "IBM Plex Sans Arabic", "Segoe Print", cursive;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --noise-dark: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  --wood: repeating-linear-gradient(0deg, rgba(0,0,0,.10) 0 1px, transparent 1px 6px, rgba(255,255,255,.04) 6px 7px, transparent 7px 13px),
          linear-gradient(90deg, #4f3420, #7b5536 35%, #8a6140 52%, #6a4729 78%, #4c321e);
  --metal: radial-gradient(circle at 34% 30%, #ffffff 0, #e3e7ea 18%, #a9b1b7 48%, #6d757b 78%, #4c5358 100%);
}

/* ------------------------------------------------ the chalkboard */
.board, .login-board, .mobile-bar {
  background-color: var(--board);
  background-image:
    var(--noise),
    radial-gradient(ellipse 60% 30% at 30% 18%, rgba(255,255,255,.055), transparent 70%),   /* old chalk smudges */
    radial-gradient(ellipse 50% 22% at 70% 62%, rgba(255,255,255,.04), transparent 70%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(0,0,0,.28), transparent 70%),
    linear-gradient(180deg, #284236, #1f342b);
}
.board { border-right: 0; box-shadow: inset -28px 0 50px rgba(0,0,0,.18); }
.board::after {          /* wooden frame */
  content: ""; position: absolute; top: 0; right: -10px; width: 10px; height: 100%;
  background: var(--wood); box-shadow: inset 2px 0 2px rgba(255,255,255,.12), inset -2px 0 3px rgba(0,0,0,.35), 4px 0 10px rgba(0,0,0,.12);
  z-index: 2; pointer-events: none;
}
.login-board { border-right: 0; }
.login-board::after { content: ""; position: absolute; top: 0; right: 0; width: 16px; height: 100%; background: var(--wood);
  box-shadow: inset 3px 0 3px rgba(255,255,255,.12), inset -3px 0 4px rgba(0,0,0,.35); }
.mobile-bar { border-bottom: 0; box-shadow: 0 4px 0 #6b4a2f, 0 6px 12px rgba(0,0,0,.18); }

/* chalk text on the board */
.board-nav a, .subject-name, .board-brand { text-shadow: 0 0 1px rgba(255,255,255,.35); }

/* sliding chalk mark for the active menu item */
.board-nav { position: relative; }
.board-nav a.active::before { display: none; }
.nav-chalk {
  position: absolute; left: 0; top: 0; width: 5px; height: 24px; border-radius: 3px 4px 4px 2px;
  background: var(--chalk-yellow); box-shadow: 0 0 10px rgba(245,197,67,.55);
  transform: translateY(var(--y, 0)); opacity: 0;
  transition: transform .5s var(--ease-spring), opacity .25s, height .3s var(--ease-out);
}
.nav-chalk.on { opacity: 1; }

/* ------------------------------------------------ paper, binders, metal */
body { background-image: var(--noise-dark); }
.card { box-shadow: 0 1px 1px rgba(27,36,32,.04), 0 2px 4px rgba(27,36,32,.04), 0 10px 24px -12px rgba(27,36,32,.14); }
.explain-card {
  background-color: #fffefb; background-image: var(--noise-dark);
  box-shadow: 0 1px 1px rgba(27,36,32,.05), 0 6px 14px -6px rgba(27,36,32,.12), 0 24px 48px -28px rgba(27,36,32,.28);
}
.binder::before {          /* spine shading: a real binder is curved at the rings */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 46px; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.28), rgba(0,0,0,.06) 60%, rgba(255,255,255,.10) 85%, transparent);
}
.binder { box-shadow: inset 0 -12px 18px -10px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.18); }
.binder-rings { z-index: 2; }
.binder-rings i { background: var(--metal); box-shadow: 0 2px 2px rgba(0,0,0,.45), inset 0 -1px 1px rgba(0,0,0,.3); }
.course-card .binder-label, .course-banner .banner-code {
  background-color: #fffdf6; background-image: var(--noise-dark);
  transform: rotate(-1.6deg); box-shadow: 0 1px 1px rgba(0,0,0,.18), 0 3px 6px -2px rgba(0,0,0,.25);
  border-radius: 2px; font-family: var(--font-hand); font-size: 15px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 10px 1px; position: relative; z-index: 2;
}
.course-banner .banner-code { font-size: 17px; }
.course-banner { box-shadow: inset 0 -30px 40px -20px rgba(0,0,0,.3), 0 18px 40px -24px rgba(0,0,0,.45); }

/* course cards lift and tilt like a real binder under the hand */
.course-card { transform-style: preserve-3d; transition: transform .45s var(--ease-out), box-shadow .45s var(--ease-out), border-color .2s; will-change: transform; position: relative; }
.course-card::after {      /* light glare that follows the pointer */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 0%), rgba(255,255,255,.28), transparent 45%);
}
.course-card.tilting { transition: transform .08s linear, box-shadow .3s; box-shadow: 0 22px 44px -18px rgba(27,36,32,.35); }
.course-card.tilting::after { opacity: 1; }

/* ------------------------------------------------ handwriting moments */
.chalk-title { font-family: var(--font-hand); font-weight: 700; letter-spacing: 0; line-height: 1.12; }
.greeting h1 { font-family: var(--font-hand); font-weight: 700; font-size: 44px; color: var(--board); position: relative; display: inline-block; }
.greeting h1::after {        /* yellow chalk underline, drawn once */
  content: ""; position: absolute; left: -4px; right: -8px; bottom: 2px; height: 10px; border-radius: 6px 10px 4px 8px;
  background: linear-gradient(90deg, rgba(245,197,67,.75), rgba(245,197,67,.45)); transform-origin: left; transform: rotate(-.6deg) scaleX(1);
  z-index: -1; animation: underline-draw .9s .25s var(--ease-out) both;
}
@keyframes underline-draw { from { transform: rotate(-.6deg) scaleX(0); } }

/* ------------------------------------------------ sign-in: chalk drawing */
.chalk-doodles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .9; }
.doodle path, .doodle circle, .doodle ellipse { stroke: rgba(236,242,238,.42); stroke-width: 3; stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: chalk-stroke 1.6s var(--ease-out) forwards; }
.doodle .d1 { animation-delay: .5s; } .doodle .d2 { animation-delay: 1.4s; stroke-width: 2.2; stroke: rgba(160,200,255,.4); }
.doodle .d3 { animation-delay: 2.1s; stroke: rgba(245,197,67,.55); } .doodle .d4 { animation-delay: .9s; stroke-width: 2; }
.doodle .d5 { animation-delay: 1.7s; stroke: rgba(245,197,67,.45); } .doodle .d6 { animation-delay: 1.1s; stroke-width: 2.2; }
.doodle .d7 { animation-delay: 2.3s; fill: rgba(236,242,238,.4); }
@keyframes chalk-stroke { to { stroke-dashoffset: 0; } }
.doodle-text text { font-family: var(--font-hand); font-size: 34px; fill: rgba(236,242,238,.45); opacity: 0; animation: chalk-fade 1s 2.6s ease-out forwards; }
.doodle-text text.small { font-size: 24px; animation-delay: 3s; }
@keyframes chalk-fade { to { opacity: 1; } }
.login-board .chalk-title { clip-path: inset(0 100% 0 0); animation: handwrite 1.8s .3s cubic-bezier(.45,.05,.35,1) forwards; }
@keyframes handwrite { to { clip-path: inset(0 -2% 0 0); } }
.login-lede, .login-points { animation: rise .7s 1.6s var(--ease-out) both; }
.login-card { animation: card-in .7s .2s var(--ease-out) both; }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.chalk-tray { background: var(--wood); height: 14px; box-shadow: inset 0 3px 3px rgba(255,255,255,.12), 0 -2px 6px rgba(0,0,0,.25); }
.chalk-tray::after { display: none; }
.chalk-stick { position: absolute; bottom: 9px; left: 16%; width: 54px; height: 10px; border-radius: 3px; background: linear-gradient(180deg, #fbfaf3, #dcd8cc); box-shadow: 0 2px 2px rgba(0,0,0,.35); }
.chalk-stick.yellow { left: calc(16% + 70px); width: 38px; background: linear-gradient(180deg, #ffe08a, #e2b53a); transform: rotate(-4deg); }
.eraser { position: absolute; bottom: 9px; left: calc(16% + 130px); width: 86px; height: 20px; border-radius: 4px;
  background: linear-gradient(180deg, #9b7246 0 55%, #3b3f44 55%); box-shadow: 0 3px 4px rgba(0,0,0,.35); }

/* ------------------------------------------------ motion system */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.stagger > * { animation: rise .5s var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 12) * 45ms); }

/* page changes: the workspace slides softly, the chalkboard stays put */
#main { view-transition-name: main; }
.board { view-transition-name: board; }
::view-transition-old(main) { animation: vt-out .16s ease-in both; }
::view-transition-new(main) { animation: vt-in .34s var(--ease-out) both; }
::view-transition-group(*) { animation-duration: .5s; animation-timing-function: var(--ease-out); }
::view-transition-old(board), ::view-transition-new(board) { animation: none; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }

/* chapter tabs: a chalk line that slides between tabs */
.chapter-tabs a { position: relative; display: inline-flex; align-items: center; gap: 8px; border-bottom-color: transparent !important; }
.chapter-tabs a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.tab-ink { position: absolute; left: 10px; right: 10px; bottom: -2px; height: 4px; border-radius: 3px 5px 2px 4px; background: var(--chalk-yellow); view-transition-name: tab-ink; }

/* chalk circle loader: draws itself, then erases */
@property --sweep { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.loader {
  border: 0 !important; border-radius: 50%;
  background: conic-gradient(from -90deg, var(--primary) var(--sweep), transparent 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4.5px));
  animation: chalk-draw 1.5s cubic-bezier(.65,0,.35,1) infinite !important;
}
.loader.sm { -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); }
.board .loader, .btn-primary .loader, .btn-dark .loader { background: conic-gradient(from -90deg, #fff var(--sweep), transparent 0); }
@keyframes chalk-draw { 0% { --sweep: 0deg; transform: rotate(0deg); } 55% { --sweep: 340deg; } 100% { --sweep: 0deg; transform: rotate(360deg); } }

/* tactile buttons */
.btn { transition: background .15s, border-color .15s, color .15s, transform .12s var(--ease-out), box-shadow .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary { box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 2px 6px -2px rgba(33,86,64,.6); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 8px 18px -8px rgba(33,86,64,.7); }

/* dialogs, toasts, chat */
.modal { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.modal:not([hidden]) .modal-card { animation: pop .3s var(--ease-out) both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.toast:not([hidden]) { animation: toast-in .4s var(--ease-spring) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
.chat-backdrop { backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.chat-drawer { transition: transform .42s var(--ease-out) !important; }
.chat-fab { animation: rise .6s .4s var(--ease-out) both; }
.msg { animation: rise .35s var(--ease-out) both; }

/* quiz score ring fills up */
@property --p { syntax: "<number>"; inherits: true; initial-value: 0; }
.score-ring { animation: ring-fill 1.1s var(--ease-out) both; }
@keyframes ring-fill { from { --p: 0; } }

/* opening a course outline in the chalkboard */
.toc-wrap { animation: toc-open .35s var(--ease-out) both; }
@keyframes toc-open { from { opacity: 0; transform: translateY(-6px); clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

@media (prefers-reduced-motion: reduce) {
  .login-board .chalk-title { clip-path: none; }
  .doodle path, .doodle circle, .doodle ellipse { stroke-dashoffset: 0; }
  .doodle-text text { opacity: 1; }
  .course-card, .course-card.tilting { transform: none !important; }
  .nav-chalk { transition: none; }
}
@media (max-width: 900px) {
  .board::after { display: none; }
  .greeting h1 { font-size: 34px; }
  .chalk-doodles { opacity: .45; }
}
@media (max-width: 900px) { .login-board::after { display: none; } }

/* =====================================================================
   3D LAYER
   ===================================================================== */
/* sign-in: Three.js chalk scene in front of the board */
.chalk-3d { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; animation: chalk-fade 1.2s .2s ease-out forwards; }
.login-board.has-3d .doodle, .login-board.has-3d .doodle-text .small { display: none; }
.login-board-inner { z-index: 1; }

/* page changes turn like the page of a notebook */
/* the old page clears quickly and the new one starts just after, so the two never show on top of each other */
::view-transition-old(main) { animation: page-away .16s cubic-bezier(.3,0,.7,1) both; transform-origin: 0 50%; }
::view-transition-new(main) { animation: page-in .48s .12s var(--ease-out) both; transform-origin: 0 50%; }
@keyframes page-away { to { opacity: 0; transform: perspective(1800px) rotateY(-16deg) translateX(-1.5%); } }
@keyframes page-in { from { opacity: 0; transform: perspective(1800px) rotateY(11deg) translateX(2.5%); } }

/* binders have real thickness: a stack of paper under the cover */
.course-card:not(.add-card) {
  box-shadow: 0 1px 1px rgba(27,36,32,.05),
    2px 3px 0 -1px #fdfdfb, 2px 3px 0 0 #d9e0dc,
    4px 6px 0 -1px #fbfbf8, 4px 6px 0 0 #d3dbd6,
    6px 9px 0 -1px #f8f8f4, 6px 9px 0 0 #cdd5d0,
    0 18px 30px -18px rgba(27,36,32,.35);
}
.course-card.tilting {
  box-shadow: 2px 3px 0 -1px #fdfdfb, 2px 3px 0 0 #d9e0dc, 4px 6px 0 -1px #fbfbf8, 4px 6px 0 0 #d3dbd6,
    6px 9px 0 -1px #f8f8f4, 6px 9px 0 0 #cdd5d0, 0 30px 50px -22px rgba(27,36,32,.45);
}

/* the "continue" binder on Home opens slightly towards you */
.continue-card { perspective: 900px; }
.continue-card .binder { transform-origin: 0 50%; transition: transform .6s var(--ease-out); transform-style: preserve-3d; }
.continue-card:hover .binder { transform: rotateY(-24deg); }

/* gold medal for 80% or more */
.score-banner { position: relative; }
.medal3d { position: relative; width: 92px; height: 112px; perspective: 700px; flex: none; margin-inline-start: 6px; animation: chalk-fade .5s .3s ease-out both; }
.medal-spin { position: absolute; top: 18px; left: 6px; width: 80px; height: 80px; transform-style: preserve-3d;
  animation: medal-in 1.6s .3s cubic-bezier(.2,.9,.25,1) both, medal-sway 4s 2s ease-in-out infinite; }
.medal-face { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: radial-gradient(circle at 32% 28%, #fff6c9 0, #f6d36b 22%, #d9a62e 52%, #a8761a 78%, #7c5510 100%);
  box-shadow: inset 0 0 0 4px rgba(255,236,170,.55), inset 0 0 0 7px rgba(140,95,20,.45), 0 6px 14px rgba(0,0,0,.25); color: #6b4708; }
.medal-face svg { width: 30px; height: 30px; fill: #fff3c4; stroke: #a57418; stroke-width: 1; margin-top: -10px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.25)); }
.medal-face b { position: absolute; bottom: 14px; font-size: 15px; font-weight: 800; letter-spacing: .02em; text-shadow: 0 1px 0 rgba(255,240,190,.8); }
.medal-face.back { transform: rotateY(180deg); }
.medal-face.back svg { margin-top: 0; width: 38px; height: 38px; }
.medal-edge { position: absolute; inset: 0; border-radius: 50%; transform: translateZ(-2px); background: #8d6214; }
.medal-face.front { transform: translateZ(1px); }
.medal-ribbon { position: absolute; top: -6px; left: 30px; width: 32px; height: 34px;
  background: linear-gradient(90deg, #2f5da8 0 33%, #f5c543 33% 66%, #2f5da8 66%); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 75%, 0 100%);
  animation: rise .6s .3s var(--ease-out) both; }
@keyframes medal-in { 0% { transform: translateY(-60px) rotateY(-1080deg) scale(.6); } 100% { transform: rotateY(0deg); } }
@keyframes medal-sway { 0%, 100% { transform: rotateY(0deg); } 50% { transform: rotateY(22deg) rotateX(6deg); } }

@media (prefers-reduced-motion: reduce) {
  .medal-spin { animation: none; }
  .continue-card:hover .binder { transform: none; }
}

/* =====================================================================
   LEARNING FEATURES: placement test, learning path, labs, scores, knowledge test, games
   ===================================================================== */
.badge-purple { background: #ece6f6; color: #4c3380; }
.course-banner { position: relative; }
.course-banner > .banner-games { position: absolute; z-index: 2; align-self: auto; top: 18px; right: 20px; background: rgba(255,255,255,.92); color: var(--ink); font-weight: 800; font-size: 14px;
  padding: 7px 14px; border-radius: 999px; text-decoration: none; box-shadow: 0 6px 16px -6px rgba(0,0,0,.4); transition: transform .2s var(--ease-out); }
.course-banner > .banner-games:hover { transform: translateY(-2px) rotate(-2deg); }
.start-here { animation: pulse-gold 2.4s ease-in-out infinite; }
@keyframes pulse-gold { 50% { box-shadow: 0 0 0 5px rgba(192,138,30,.18); } }
.lesson-main { display: grid; gap: 18px; min-width: 0; }
.card-label-end { display: inline-flex; align-items: center; gap: 10px; }
.lab-cta { margin-top: 8px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.lab-cta svg, .chapter-tabs svg { width: 17px; height: 17px; }
.lab-cta svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- placement test */
.pl-card { padding: 36px clamp(20px, 5vw, 56px); max-width: 820px; margin: 0 auto; position: relative; overflow: hidden; }
.pl-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: linear-gradient(90deg, var(--binder-1), var(--binder-4), var(--binder-3)); }
.pl-langs { display: inline-flex; gap: 2px; background: #e9eeeb; padding: 4px; border-radius: 10px; }
.pl-langs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font: inherit; font-weight: 700; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.pl-langs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pl-intro, .pl-result { text-align: center; }
.pl-intro h2, .pl-result h2 { font-size: 28px; margin: 8px 0; }
.pl-intro p, .pl-result p { color: var(--ink-2); max-width: 560px; margin: 8px auto; }
.pl-compass { display: inline-grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; font-size: 44px; background: var(--primary-tint);
  animation: compass 6s ease-in-out infinite; }
@keyframes compass { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(14deg); } }
.pl-intro .btn { margin-top: 14px; }
.pl-q h2 { font-size: 23px; margin: 6px 0 20px; line-height: 1.35; animation: rise .45s var(--ease-out) both; }
.pl-progress { height: 6px; background: var(--primary-tint); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.pl-progress i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .5s var(--ease-out); }
.pl-options { display: grid; gap: 10px; margin-bottom: 16px; }
.pl-option { display: flex; align-items: center; gap: 14px; text-align: start; padding: 16px 18px; border: 2px solid var(--line); border-radius: 12px; background: #fff;
  font: inherit; font-size: 16px; color: var(--ink); cursor: pointer; transition: border-color .15s, transform .2s var(--ease-out), background .15s; animation: rise .45s var(--ease-out) both; }
.pl-option:nth-child(2) { animation-delay: .06s; } .pl-option:nth-child(3) { animation-delay: .12s; }
.pl-option:hover { border-color: var(--bright-green); transform: translateX(4px); }
[dir="rtl"] .pl-option:hover { transform: translateX(-4px); }
.pl-option.selected { border-color: var(--primary); background: var(--primary-tint); }
.pl-letter { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--paper); font-weight: 800; }
.pl-option.selected .pl-letter { background: var(--primary); color: #fff; }
.pl-badge { font-size: 54px; line-height: 1; animation: pop-in .6s var(--ease-out) both; }
@keyframes pop-in { from { transform: scale(.3) rotate(-20deg); opacity: 0; } }
.pl-bars { max-width: 420px; margin: 20px auto; display: grid; gap: 8px; }
.pl-bar { display: grid; grid-template-columns: 90px 1fr 24px; gap: 10px; align-items: center; font-size: 14px; text-align: start; }
.pl-bar div { height: 10px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.pl-bar i { display: block; height: 100%; background: var(--primary); border-radius: inherit; animation: grow-w 1s var(--ease-out) both; transform-origin: left; }
@keyframes grow-w { from { transform: scaleX(0); } }
.pl-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.placement-cta { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 16px; text-decoration: none; color: #fff;
  background: radial-gradient(circle at 15% 20%, #3c8a68, var(--board) 70%); border: 0; position: relative; overflow: hidden; }
.placement-cta .pl-compass { width: 54px; height: 54px; font-size: 28px; background: rgba(255,255,255,.14); flex: none; }
.placement-cta > span:nth-child(2) { display: grid; gap: 2px; flex: 1; }
.placement-cta small { color: var(--chalk-yellow); font-weight: 700; font-size: 12px; }
.placement-cta b { font-size: 17px; font-family: var(--font-hand); letter-spacing: .02em; }
.placement-cta span span, .placement-cta > span:nth-child(2) > span { font-size: 13px; color: var(--chalk-dim); }
.placement-cta:hover { transform: translateY(-2px); }
.path-card .path-icon { font-size: 20px; }
.path-nudge { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-left: 4px solid var(--chalk-yellow); }
.path-nudge > span { font-size: 28px; }
.path-nudge p { margin: 2px 0 0; color: var(--ink-2); font-size: 14px; }
.path-nudge div { flex: 1; }

/* ---- visual summary + listen */
.visual-summary { padding: 18px 20px; overflow: hidden; }
.vs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.vs-head h4 { margin: 0; font-size: 16px; }
.path-chip { font-size: 12.5px; color: var(--ink-3); background: var(--paper); padding: 3px 10px; border-radius: 99px; }
.vs-strip { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.vs-img { flex: none; width: 180px; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; cursor: zoom-in; scroll-snap-align: start;
  display: grid; gap: 6px; font: inherit; text-align: start; transition: transform .25s var(--ease-out), box-shadow .25s; }
.vs-img:hover { transform: translateY(-3px) rotate(-1deg); box-shadow: var(--shadow-lg); }
.vs-img img { width: 100%; height: 110px; object-fit: contain; background: #fafcfb; border-radius: 6px; }
.vs-img span { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.vs-empty { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--paper); border-radius: 10px; margin-bottom: 10px; }
.vs-empty span { font-size: 26px; } .vs-empty p { margin: 0; flex: 1; color: var(--ink-2); font-size: 14px; }
.vs-points { list-style: none; padding: 0; margin: 6px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.vs-points li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: color-mix(in srgb, var(--binder-1) 6%, #fff);
  border: 1px solid color-mix(in srgb, var(--binder-1) 18%, #fff); font-size: 14px; animation: rise .5s var(--ease-out) both; animation-delay: calc(var(--i) * 60ms); }
.vs-points li:nth-child(3n+2) { background: color-mix(in srgb, var(--binder-4) 7%, #fff); border-color: color-mix(in srgb, var(--binder-4) 20%, #fff); }
.vs-points li:nth-child(3n) { background: color-mix(in srgb, var(--binder-3) 8%, #fff); border-color: color-mix(in srgb, var(--binder-3) 22%, #fff); }
.vs-points b { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; }
.listen-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin: 4px 0 12px; border-radius: 12px;
  background: linear-gradient(90deg, var(--primary-tint), #f4f8f6); border: 1px solid #d4e4dc; }
.listen-bar.off { color: var(--ink-2); font-size: 14px; }
.listen-bar select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 13px; background: #fff; }
.listen-progress { flex: 1; min-width: 80px; height: 6px; background: #fff; border-radius: 99px; overflow: hidden; }
.listen-progress i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .4s; }
.listen-wave { display: inline-flex; gap: 3px; align-items: center; height: 20px; }
.listen-wave i { width: 3px; height: 6px; background: var(--primary); border-radius: 2px; opacity: .35; }
.listen-bar.playing .listen-wave i { opacity: 1; animation: wave 1s ease-in-out infinite; }
.listen-wave i:nth-child(2) { animation-delay: .15s !important; } .listen-wave i:nth-child(3) { animation-delay: .3s !important; }
.listen-wave i:nth-child(4) { animation-delay: .45s !important; } .listen-wave i:nth-child(5) { animation-delay: .6s !important; }
@keyframes wave { 50% { height: 20px; } }

/* ---- labs */
.lab-switch { display: inline-flex; gap: 6px; margin: 0 0 18px; padding: 5px; background: #e9eeeb; border-radius: 12px; }
.lab-switch button { border: 0; background: transparent; padding: 9px 16px; border-radius: 9px; font: inherit; font-weight: 800; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.lab-switch button small { font-weight: 600; color: var(--ink-3); margin-left: 4px; font-size: 12px; }
.lab-switch button.active { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.lab-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.lab-main { min-width: 0; }
.mol-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.mol-list li { position: relative; }
.mol-item { width: 100%; text-align: start; display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer;
  transition: border-color .15s, transform .2s var(--ease-out); }
.mol-item:hover { border-color: var(--binder-5); transform: translateX(3px); }
.mol-item.active { border-color: var(--binder-5); background: #f4f0fa; box-shadow: inset 3px 0 0 var(--binder-5); }
.mol-item span { font-size: 12.5px; color: var(--ink-2); }
.mol-remove, .sim-remove { position: absolute; top: 6px; right: 6px; border: 0; background: rgba(255,255,255,.9); border-radius: 50%; width: 24px; height: 24px; cursor: pointer; color: var(--danger); font-size: 12px; }
.mol-search { display: flex; gap: 8px; }
.mol-search input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 14px; }
.mol-stage { position: relative; height: min(68vh, 620px); overflow: hidden; padding: 0;
  background: radial-gradient(circle at 50% 40%, #ffffff, #eef2f0 70%); }
.mol-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.mol-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--ink-2); gap: 10px; padding: 20px; }
.mol-atom { position: relative; width: 120px; height: 120px; }
.mol-atom i { position: absolute; inset: 0; border: 2px solid color-mix(in srgb, var(--binder-5) 55%, transparent); border-radius: 50%; transform: rotateX(70deg) rotateZ(0deg);
  animation: orbit 5s linear infinite; }
.mol-atom i:nth-child(2) { transform: rotateX(70deg) rotateY(60deg); animation-duration: 6.5s; border-color: color-mix(in srgb, var(--binder-1) 55%, transparent); }
.mol-atom i:nth-child(3) { transform: rotateX(70deg) rotateY(-60deg); animation-duration: 8s; border-color: color-mix(in srgb, var(--binder-3) 60%, transparent); }
.mol-atom i::after { content: ""; position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; border-radius: 50%; background: currentColor; color: var(--binder-5); }
.mol-atom b { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3c4, var(--chalk-yellow) 45%, #a8761a); box-shadow: 0 0 18px rgba(245,197,67,.6); }
@keyframes orbit { to { rotate: 360deg; } }
.mol-info { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; padding: 10px 2px 0; font-size: 14px; }
.mol-info > b { font-size: 17px; text-transform: capitalize; }
.mol-info a { margin-left: auto; font-weight: 700; }
.sim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.sim-card { position: relative; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; padding: 0; transition: transform .3s var(--ease-out), box-shadow .3s; outline-offset: 3px; }
.sim-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.sim-thumb { position: relative; aspect-ratio: 16 / 10; background: linear-gradient(135deg, #e7f0ff, #eaf6ef 60%, #fff4dc); overflow: hidden; }
.sim-thumb::before { content: "PhET"; position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 28px; color: rgba(31,59,47,.14); letter-spacing: .1em; }
.sim-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out); }
.sim-card:hover .sim-thumb img { transform: scale(1.06); }
.sim-play { position: absolute; right: 10px; bottom: 10px; width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center;
  font-size: 14px; box-shadow: 0 6px 14px rgba(0,0,0,.25); transform: scale(.8); opacity: 0; transition: .25s var(--ease-out); }
.sim-card:hover .sim-play, .sim-card:focus-visible .sim-play { transform: none; opacity: 1; }
.sim-body { padding: 12px 14px 14px; display: grid; gap: 5px; }
.sim-body b { font-size: 15px; }
.sim-body p { margin: 0; font-size: 13px; color: var(--ink-2); }
.sim-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.sim-tags span { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--paper); color: var(--ink-2); }
.sim-tags .t-teacher { background: #fbf0d6; color: #7d5a0c; }
.sim-stage { padding: 0; overflow: hidden; margin-bottom: 22px; animation: rise .4s var(--ease-out) both; }
.sim-stage-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sim-frame-wrap { position: relative; aspect-ratio: 16 / 10; max-height: 74vh; background: #000; }
.sim-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.sim-stage .board-credit { padding: 8px 14px 10px; margin: 0; }
.lab-teacher-row { margin-top: 22px; max-width: 520px; }
.labs-lang { margin: 0; min-width: 160px; }
.labs-hero { display: flex; align-items: center; gap: 24px; padding: 20px 24px; margin-bottom: 22px; background: linear-gradient(110deg, #f6f2fc, #fff 60%); }
.labs-hero h3 { margin: 0 0 4px; } .labs-hero p { margin: 0 0 10px; color: var(--ink-2); }
.labs-hero > div:last-child { flex: 1; max-width: 520px; }
.labs-hero-art .mol-atom { width: 92px; height: 92px; }
.labs-tools { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.labs-tools input { flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-row .chip { cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 700; padding: 5px 13px; }
.chip-row .chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---- scores */
.score-ring small { display: block; font-size: 10.5px; font-weight: 700; color: var(--ink-3); margin-top: -3px; }
.score-ring span { line-height: 1.05; text-align: center; }
.score-big { display: flex; gap: 16px; align-items: center; }
.score-bars { flex: 1; display: grid; gap: 10px; }
.score-bars div { display: grid; grid-template-columns: 1fr auto; font-size: 13px; gap: 4px; }
.score-bars span { color: var(--ink-2); }
.score-bars i { grid-column: 1 / -1; height: 7px; border-radius: 99px; background: var(--primary-tint); position: relative; overflow: hidden; }
.score-bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--primary); border-radius: inherit; animation: grow-w 1s var(--ease-out) both; transform-origin: left; }
.gscore-card { padding: 18px; margin-bottom: 16px; background: linear-gradient(160deg, #fff, #f6faf8); }
.gs-top { display: flex; gap: 16px; align-items: center; }
.gs-main { flex: 1; min-width: 0; }
.gs-total { font-size: 30px; font-weight: 800; line-height: 1.1; color: var(--ink); }
.gs-total span:last-child { font-size: 14px; font-weight: 700; color: var(--ink-3); }
.gs-level { height: 6px; background: var(--primary-tint); border-radius: 99px; margin-top: 8px; position: relative; overflow: hidden; }
.gs-level i { position: absolute; inset: 0 auto 0 0; width: var(--w); background: linear-gradient(90deg, var(--chalk-yellow), var(--gold)); border-radius: inherit; animation: grow-w 1.2s var(--ease-out) both; transform-origin: left; }
.gs-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 84px; margin-top: 14px; }
.gs-week span { display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 4px; text-align: center; }
.gs-week i { align-self: end; height: max(4px, var(--h)); background: color-mix(in srgb, var(--primary) 55%, #fff); border-radius: 5px 5px 2px 2px; animation: grow-h .9s var(--ease-out) both; transform-origin: bottom; }
.gs-week i.goal { background: linear-gradient(var(--chalk-yellow), var(--gold)); }
.gs-week span:nth-child(2) i { animation-delay: .05s; } .gs-week span:nth-child(3) i { animation-delay: .1s; } .gs-week span:nth-child(4) i { animation-delay: .15s; }
.gs-week span:nth-child(5) i { animation-delay: .2s; } .gs-week span:nth-child(6) i { animation-delay: .25s; } .gs-week span:nth-child(7) i { animation-delay: .3s; }
.gs-week b { font-size: 11px; color: var(--ink-3); font-weight: 700; }
@keyframes grow-h { from { transform: scaleY(0); } }
.mini-score { --p: 0; margin-left: auto; flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; color: var(--ink);
  background: radial-gradient(closest-side, #fff 76%, transparent 78%), conic-gradient(var(--primary) calc(var(--p) * 1%), var(--primary-tint) 0); }
.side-courses a { display: flex; align-items: center; }
.course-score-chip { margin-right: 12px; font-size: 13.5px; background: var(--primary-tint); padding: 3px 10px; border-radius: 99px; }
.profile-scores { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin: 18px 0 4px; }
.profile-scores .gs-total { font-size: 26px; margin: 4px 0; }
.data-table.compact td, .data-table.compact th { padding: 7px 10px; font-size: 13px; }
.email-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.email-tools input { min-width: 240px; flex: 1; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font: inherit; font-size: 14px; }

/* ---- knowledge test editor */
.kq-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 4px; margin: 0 0 12px; }
.kq-edit legend { font-weight: 800; padding: 0 6px; display: flex; gap: 12px; align-items: center; }
.kq-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.kq-opt { display: flex; align-items: center; gap: 8px; }
.kq-opt input[type=radio] { accent-color: var(--primary); width: 18px; height: 18px; flex: none; }
.kq-opt input:not([type]) , .kq-opt input[name^=o] { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; font: inherit; font-size: 14px; }
.kq-opt:has(input[type=radio]:checked) input[name^=o] { border-color: var(--primary); background: var(--ok-bg); }
.ktest-result h3 span { color: var(--primary-dark); }

/* ---- games */
.games-bar { display: flex; gap: 14px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.game-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.game-pick { display: grid; gap: 6px; text-align: start; padding: 18px; font: inherit; color: var(--ink); cursor: pointer; border: 1px solid var(--line);
  transition: transform .3s var(--ease-out), box-shadow .3s; }
.game-pick:hover:not(.soon) { transform: translateY(-4px) rotate(-.6deg); box-shadow: var(--shadow-lg); }
.game-pick b { font-size: 16.5px; } .game-pick span { color: var(--ink-2); font-size: 13.5px; } .game-pick small { color: var(--primary); font-weight: 800; }
.game-pick.soon { opacity: .55; cursor: default; }
.gp-art { height: 64px; display: grid; place-items: center; font-size: 34px; border-radius: 10px; background: var(--paper); font-weight: 900; }
.gp-memory { grid-template-columns: repeat(4, 24px); gap: 6px; place-content: center; }
.gp-memory i { width: 24px; height: 32px; border-radius: 5px; background: var(--binder-1); transform: rotate(-6deg); }
.gp-memory i:nth-child(2) { background: var(--binder-2); transform: rotate(4deg) translateY(-4px); } .gp-memory i:nth-child(3) { background: var(--binder-3); transform: rotate(-3deg); }
.gp-memory i:nth-child(4) { background: var(--binder-4); transform: rotate(7deg) translateY(-2px); }
.game-pick:hover .gp-memory i { animation: card-bob .8s ease-in-out infinite alternate; }
@keyframes card-bob { to { translate: 0 -5px; } }
.gp-tf { color: var(--primary); letter-spacing: .2em; }
.game-panel { padding: 18px; position: relative; overflow: hidden; animation: rise .4s var(--ease-out) both; }
.game-hud { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; font-size: 14px; color: var(--ink-2); }
.game-hud > b { color: var(--ink); font-size: 16px; margin-right: auto; }
.mm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; perspective: 1000px; max-width: 980px; margin: 0 auto; }
.mm-card { aspect-ratio: 4 / 3; border: 0; padding: 0; background: transparent; cursor: pointer; font: inherit; }
.mm-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .55s var(--ease-out); }
.mm-card.flipped .mm-inner { transform: rotateY(180deg); }
.mm-front, .mm-back { position: absolute; inset: 0; border-radius: 12px; display: grid; place-items: center; padding: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; text-align: center; }
.mm-front { background: repeating-linear-gradient(45deg, var(--board), var(--board) 8px, #2a4639 8px, #2a4639 16px); color: var(--chalk-yellow); font-family: var(--font-hand); font-size: 30px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.12), 0 6px 14px -8px rgba(0,0,0,.5); }
.mm-back { transform: rotateY(180deg); background: #fff; border: 2px solid var(--line); font-size: 14px; font-weight: 700; line-height: 1.3; color: var(--ink); }
.mm-back.term { border-color: color-mix(in srgb, var(--binder-1) 45%, #fff); color: var(--binder-1); font-size: 15.5px; }
.mm-card.matched .mm-back { background: var(--ok-bg); border-color: var(--bright-green); animation: matched .6s var(--ease-out); }
.mm-card.miss .mm-back { border-color: #e2a29d; animation: shake .4s; }
@keyframes matched { 40% { transform: rotateY(180deg) scale(1.08); } }
@keyframes shake { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
.tf-panel { text-align: center; }
.tf-timer { height: 8px; border-radius: 99px; background: var(--paper); overflow: hidden; margin-bottom: 18px; }
.tf-timer i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--danger), var(--chalk-yellow), var(--bright-green)); transition: width .25s linear; }
.tf-card { max-width: 620px; margin: 0 auto 18px; padding: 30px 26px; border-radius: 16px; background: var(--board); color: var(--chalk); box-shadow: inset 0 0 0 6px #6b4a2b, 0 16px 30px -18px rgba(0,0,0,.6);
  animation: tf-in .45s var(--ease-out) both; transition: box-shadow .2s; }
.tf-card small { color: var(--chalk-dim); font-weight: 700; }
.tf-card p { font-family: var(--font-hand); font-size: 25px; margin: 8px 0 0; line-height: 1.35; }
.tf-card.ok { box-shadow: inset 0 0 0 6px var(--bright-green), 0 0 0 6px rgba(79,174,132,.25); }
.tf-card.bad { box-shadow: inset 0 0 0 6px var(--danger), 0 0 0 6px rgba(176,58,49,.2); animation: shake .4s; }
@keyframes tf-in { from { opacity: 0; transform: perspective(800px) rotateX(-35deg) translateY(-10px); } }
.tf-buttons { display: flex; gap: 14px; justify-content: center; }
.tf-buttons .btn { min-width: 150px; font-size: 18px; padding: 14px 20px; border-radius: 14px; font-weight: 800; color: #fff; border: 0; }
.tf-true { background: var(--primary); } .tf-false { background: var(--danger); }
.tf-buttons .btn:active { transform: scale(.95); }
.tf-why { min-height: 24px; color: var(--ink-2); margin: 14px 0 0; }
.game-over { position: absolute; inset: 0; background: rgba(255,255,255,.95); display: grid; place-content: center; text-align: center; padding: 20px; animation: rise .4s var(--ease-out) both; }
.game-over h3 { font-size: 28px; margin: 0 0 6px; } .game-over p { margin: 4px 0; color: var(--ink-2); }
.go-points { font-weight: 800; color: var(--primary) !important; font-size: 17px; margin: 10px 0 16px !important; }
.go-burst { position: absolute; left: 50%; top: 38%; }
.go-burst i { position: absolute; width: 9px; height: 16px; border-radius: 2px; background: var(--binder-1); animation: burst 1.2s var(--ease-out) both; }
.go-burst i:nth-child(3n+2) { background: var(--chalk-yellow); } .go-burst i:nth-child(3n) { background: var(--binder-2); }
.go-burst i:nth-child(1) { --a: 0deg; } .go-burst i:nth-child(2) { --a: 30deg; } .go-burst i:nth-child(3) { --a: 60deg; } .go-burst i:nth-child(4) { --a: 90deg; }
.go-burst i:nth-child(5) { --a: 120deg; } .go-burst i:nth-child(6) { --a: 150deg; } .go-burst i:nth-child(7) { --a: 180deg; } .go-burst i:nth-child(8) { --a: 210deg; }
.go-burst i:nth-child(9) { --a: 240deg; } .go-burst i:nth-child(10) { --a: 270deg; } .go-burst i:nth-child(11) { --a: 300deg; } .go-burst i:nth-child(12) { --a: 330deg; }
@keyframes burst { from { transform: rotate(var(--a)) translateY(0) scale(.4); opacity: 1; } to { transform: rotate(var(--a)) translateY(-150px) rotate(200deg); opacity: 0; } }

@media (max-width: 900px) {
  .lab-layout { grid-template-columns: 1fr; }
  .mol-stage { height: 58vh; }
  .mm-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mm-back { font-size: 12.5px; }
  .kq-opts { grid-template-columns: 1fr; }
  .labs-hero { flex-direction: column; align-items: flex-start; }
  .course-banner > .banner-games { top: 14px; right: 14px; padding: 5px 11px; font-size: 13px; }
}
@media (max-width: 520px) { .mm-grid { grid-template-columns: repeat(2, 1fr); } .tf-buttons .btn { min-width: 0; flex: 1; } }
@media (prefers-reduced-motion: reduce) {
  .pl-compass, .start-here, .mol-atom i, .listen-bar.playing .listen-wave i { animation: none; }
  .mm-inner { transition: none; }
}
.lab-layout > .side-stack { min-width: 0; grid-template-columns: minmax(0, 1fr); }
.lab-layout .side-card { min-width: 0; }
.lab-teacher select, .lab-teacher .field { width: 100%; max-width: 100%; }

/* =====================================================================
   LESSON VALIDATION (coordinators) + TEXT-TO-SPEECH MODE
   ===================================================================== */
.rv-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.rv-ok { --rv: #1f7a4f; --rv-bg: #e3f4ea; } .rv-changes { --rv: #a3471b; --rv-bg: #fdebe0; }
.rv-pending { --rv: #8a6510; --rv-bg: #fbf0d3; } .rv-updated { --rv: #2f5da8; --rv-bg: #e5edfb; }
.rv-badge { color: var(--rv); background: var(--rv-bg); }
.rv-head-badge { margin-top: 8px; }
.content-meta { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.review-panel { padding: 18px 20px; border-left: 5px solid var(--rv, var(--line)); background: linear-gradient(90deg, color-mix(in srgb, var(--rv-bg, #fff) 70%, #fff), #fff 60%);
  animation: rise .45s var(--ease-out) both; }
.rv-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rv-head h4 { margin: 0; font-size: 16px; }
.rv-last { margin: 0 0 10px; font-size: 14px; }
.rv-comment { display: block; margin-top: 6px; padding: 8px 12px; background: #fff; border-radius: 8px; border: 1px dashed color-mix(in srgb, var(--rv, #999) 45%, #fff); font-style: italic; }
.rv-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-start; margin-top: 4px; }
#rv-form { margin-top: 8px; }
.rv-history { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.rv-history summary { cursor: pointer; font-weight: 700; }
.rv-history ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.rv-next { margin-top: 14px; display: flex; justify-content: center; animation: rise .4s var(--ease-out) both; }
.rv-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 8px; }
.rv-stat { padding: 16px 18px; display: grid; gap: 2px; border-top: 4px solid var(--rv, var(--ink-3)); }
.rv-stat b { font-size: 28px; line-height: 1.1; color: var(--rv, var(--ink)); }
.rv-stat span { font-size: 13px; color: var(--ink-2); }
.rv-group { margin-bottom: 16px; overflow: hidden; }
.rv-group-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--paper); }
.rv-group td:nth-child(2) { width: 230px; } .rv-group td:nth-child(3) { width: 240px; }
.rv-mini { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.rv-mini li { display: flex; justify-content: space-between; align-items: center; }
.rv-mini b { font-size: 17px; }

/* text to speech */
.tts-toggle.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.tts-bar { padding: 10px 12px; margin: 4px 0 14px; border-radius: 14px; background: linear-gradient(100deg, #eaf4ef, #f6faf8); border: 1px solid #d0e3d9;
  display: grid; gap: 8px; animation: rise .35s var(--ease-out) both; }
.tts-bar.off { color: var(--ink-2); font-size: 14px; display: block; }
.tts-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tts-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; display: grid; place-items: center;
  transition: transform .15s var(--ease-out), background .15s; }
.tts-btn:hover { transform: scale(1.08); }
.tts-main { width: 46px; height: 46px; font-size: 18px; background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 6px 14px -6px rgba(31,90,64,.6); }
.tts-bar.playing .tts-main { animation: tts-pulse 1.6s ease-in-out infinite; }
@keyframes tts-pulse { 50% { box-shadow: 0 0 0 8px rgba(47,122,88,.15), 0 6px 14px -6px rgba(31,90,64,.6); } }
.tts-progress { flex: 1; min-width: 80px; height: 6px; background: #fff; border-radius: 99px; overflow: hidden; }
.tts-progress i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width .4s; }
.tts-count { font-size: 12.5px; color: var(--ink-3); min-width: 54px; text-align: end; font-variant-numeric: tabular-nums; }
.tts-bar.playing .listen-wave i { opacity: 1; animation: wave 1s ease-in-out infinite; }
.tts-opts { font-size: 13px; color: var(--ink-2); gap: 12px; }
.tts-opts label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.tts-opts select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font: inherit; font-size: 13px; background: #fff; max-width: 220px; }
.tts-tip { margin-inline-start: auto; }
.tts-note { margin: 0; padding: 8px 10px; background: #fff8e6; border-radius: 8px; color: #6b4e0b; }
::highlight(tts-now) { background-color: #ffe58f; color: #1b2420; }
body.tts-on .explain-text :is(p, li, h2, h3, h4, blockquote, td),
body.tts-on [data-hl-target=summary], body.tts-on [data-hl-target=keypoints] li { cursor: pointer; border-radius: 6px; transition: background .15s; }
body.tts-on .explain-text :is(p, li, h2, h3, h4, blockquote):hover, body.tts-on [data-hl-target=keypoints] li:hover { background: rgba(255,229,143,.25); }
.bubble { position: relative; }
.msg-speak { float: inline-end; margin: -4px -6px 4px 8px; border: 0; background: transparent; cursor: pointer; font-size: 15px; opacity: .45; border-radius: 50%; width: 28px; height: 28px; }
.msg-speak:hover { opacity: 1; background: rgba(0,0,0,.05); }
.msg-speak.speaking { opacity: 1; background: var(--primary-tint); animation: tts-pulse 1.6s ease-in-out infinite; }
@media (max-width: 900px) { .rv-summary { grid-template-columns: repeat(2, 1fr); } .tts-tip { display: none; } .rv-group td:nth-child(3) { display: none; } }
@media (prefers-reduced-motion: reduce) { .tts-bar.playing .tts-main, .msg-speak.speaking { animation: none; } }
.tts-bar:not(.off) { position: sticky; top: 10px; z-index: 6; box-shadow: 0 10px 24px -16px rgba(20,50,38,.45); backdrop-filter: blur(6px); background: linear-gradient(100deg, rgba(234,244,239,.96), rgba(246,250,248,.96)); }
@media (max-width: 900px) {
  .tts-bar:not(.off) { top: 68px; }                 /* below the 60px mobile top bar */
  .tts-bar.playing .tts-opts { display: none; }     /* compact while reading */
  .tts-btn { width: 34px; height: 34px; } .tts-main { width: 42px; height: 42px; }
}
@media (max-width: 600px) { .explain-card .card-label { flex-wrap: wrap; gap: 8px; } .explain-card .ai-tag { white-space: nowrap; } .card-label-end { width: 100%; justify-content: space-between; } }

/* Lesson column: never wider than its grid track (wide formulas, tables and the reading bar stay inside it) */
.lesson-main { grid-template-columns: minmax(0, 1fr); }
.lesson-main > * { min-width: 0; max-width: 100%; }
.explain-card { min-width: 0; overflow-wrap: anywhere; }
.explain-text :is(table, pre, .katex-display) { display: block; max-width: 100%; overflow-x: auto; }
.explain-text .katex-display > .katex { white-space: nowrap; }
.tts-opts select { min-width: 0; }

/* =====================================================================
   MOTION LAYER (static/js/motion.js)
   ===================================================================== */
:root { --m-out: cubic-bezier(.22, 1, .36, 1); --m-in: cubic-bezier(.4, 0, 1, 1); }

/* top progress bar (page changes, saves) */
#m-progress { position: fixed; z-index: 120; inset: 0 0 auto; height: 3px; pointer-events: none; opacity: 0; transition: opacity .3s; }
#m-progress i { display: block; height: 100%; transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--chalk-yellow), #ffd56a 60%, #fff3c4); box-shadow: 0 0 10px rgba(245,197,67,.7);
  transition: transform 2.4s cubic-bezier(.1, .7, .2, 1); }
#m-progress.on { opacity: 1; }
#m-progress.done i { transition: transform .25s var(--m-out); }
#m-progress.done { opacity: 0; transition: opacity .35s .2s; }

/* headline word reveal */
.mw { display: inline-block; overflow: hidden; vertical-align: top; padding: .12em 0 .14em; margin: -.12em 0 -.14em; }
.mw > span { display: inline-block; animation: m-word .72s var(--m-out) both; animation-delay: calc(var(--w, 0) * 42ms + 60ms); }
.mw-el { animation: m-fade .6s var(--m-out) both; animation-delay: calc(var(--w, 0) * 42ms + 60ms); }
@keyframes m-word { from { transform: translateY(108%) rotate(4deg); opacity: .2; } }
@keyframes m-fade { from { opacity: 0; transform: translateY(6px); } }

/* reveal on enter / scroll */
.m-rv { opacity: 0; transform: translateY(14px); }
.m-rv.m-in { opacity: 1; transform: none; transition: opacity .42s var(--m-out) var(--m-d, 0ms), transform .52s var(--m-out) var(--m-d, 0ms); }

/* images fade in when loaded */
.m-img { opacity: 0; transition: opacity .5s var(--m-out), filter .6s var(--m-out); filter: blur(6px); }
.m-img.m-img-in { opacity: 1; filter: none; }

/* card spotlight that follows the pointer */
.m-spot { background-image: radial-gradient(340px circle at var(--mx, 50%) var(--my, 50%), rgba(47,122,88,.075), transparent 62%); }
.stat, .rv-stat, .side-card, .game-pick { transition: transform .35s var(--m-out), box-shadow .35s var(--m-out), border-color .2s; }
.stat:hover, .rv-stat:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -18px rgba(27,36,32,.35); }

/* magnetic buttons + ink ripple */
.m-mag { transition: translate .25s var(--m-out); }
.m-ink { position: relative; overflow: hidden; isolation: isolate; }
.m-ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; z-index: -1; transform: scale(0); }

/* busy submit buttons */
.btn.m-busy { color: transparent !important; position: relative; pointer-events: none; }
.btn.m-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.35); border-top-color: #fff; animation: m-spin .7s linear infinite; }
.btn-outline.m-busy::after, .btn-ghost.m-busy::after, .btn-light.m-busy::after { border-color: rgba(31,90,64,.25); border-top-color: var(--primary); }
@keyframes m-spin { to { transform: rotate(360deg); } }

/* sign-in: password eye, caps lock, chalk underline on focus */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; top: 50%; translate: 0 -50%; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent;
  color: var(--ink-3); cursor: pointer; display: grid; place-items: center; transition: background .2s, color .2s; }
.pw-eye:hover { background: var(--paper); color: var(--ink); }
.pw-eye:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.pw-eye .pw-slash { stroke-dasharray: 23; stroke-dashoffset: 0; transition: stroke-dashoffset .3s var(--m-out); }
.pw-eye.on .pw-slash { stroke-dashoffset: 23; }
.caps-warn { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: #8a6510; font-weight: 700; font-size: 12.5px; animation: m-fade .3s var(--m-out) both; }
.caps-warn::before { content: "⇪"; font-size: 14px; }
.login-card .field { position: relative; }
.login-card .field input { transition: border-color .2s, box-shadow .25s var(--m-out), background .2s; }
.login-card .field input:focus { box-shadow: 0 0 0 4px rgba(47,122,88,.14); }
.login-card .btn-primary { position: relative; overflow: hidden; }
.login-card .btn-primary::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .8s var(--m-out); }
.login-card .btn-primary:hover::before { transform: translateX(120%); }

/* lessons: reading progress + back to top */
#m-read { position: fixed; z-index: 110; inset: 0 0 auto; height: 3px; pointer-events: none; opacity: 0; transition: opacity .3s; }
#m-read i { display: block; height: 100%; transform: scaleX(0); transform-origin: 0 50%; background: linear-gradient(90deg, var(--mid-green), var(--bright-green)); }
#m-read.on { opacity: 1; }
#m-top { position: fixed; z-index: 70; left: calc(var(--board-w, 260px) + 22px); bottom: 24px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; color: var(--ink); box-shadow: 0 10px 24px -12px rgba(0,0,0,.35); cursor: pointer; display: grid; place-items: center;
  opacity: 0; transform: translateY(14px) scale(.9); pointer-events: none; transition: opacity .3s var(--m-out), transform .4s var(--m-out); }
#m-top.on { opacity: 1; transform: none; pointer-events: auto; }
#m-top:hover { transform: translateY(-2px); }
#m-top svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* toast: timer line, gold for rewards */
.toast.m-toast { overflow: hidden; }
.toast.m-toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: rgba(255,255,255,.45);
  transform-origin: 0 50%; animation: m-timer 3.8s linear both; }
.toast.m-gold { background: linear-gradient(110deg, #8a6510, #c08a1e 45%, #e3b54a); }
@keyframes m-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* sidebar: icons nudge on hover */
.board-nav a svg { transition: transform .3s var(--m-out); }
.board-nav a:hover svg { transform: translateX(2px) scale(1.06); }

@media (max-width: 900px) { #m-top { left: 16px; bottom: 88px; } }
@media (prefers-reduced-motion: reduce) {
  .mw > span, .mw-el, .caps-warn { animation: none; }
  .m-rv { opacity: 1; transform: none; }
  .m-img { opacity: 1; filter: none; }
  .m-mag { translate: none !important; }
  #m-progress i { transition: none; }
  .toast.m-toast::after { animation: none; display: none; }
  .stat:hover, .rv-stat:hover, #m-top:hover { transform: none; }
}

/* =====================================================================
   REAL-WORLD EFFECTS (static/js/realfx.js)
   ===================================================================== */
.rfx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.rfx-write { display: block; overflow: visible; max-width: 100%; height: auto; }
.rfx-write path { fill: transparent; stroke-linecap: round; stroke-linejoin: round; transition: fill .45s ease-out; }
.rfx-chalk path { stroke: rgba(246,248,242,.95); }
.rfx-chalk path.filled { fill: rgba(246,248,242,.96); }
.rfx-marker path { stroke: currentColor; }
.rfx-marker path.filled { fill: currentColor; }
/* the title waits for the chalk (the old reveal is the fallback if scripts fail) */
.rfx .login-board .chalk-title { animation: handwrite 1.8s 2.6s cubic-bezier(.45,.05,.35,1) forwards; }
.rfx .login-board .chalk-title.rfx-host, .rfx .login-board .chalk-title.rfx-pending { animation: none; clip-path: none; }
.rfx .login-board .chalk-title.rfx-pending:not(.rfx-host) { visibility: hidden; }
.rfx .login-board .chalk-title.rfx-fallback { animation: handwrite 1.4s cubic-bezier(.45,.05,.35,1) forwards; visibility: visible; }
.rfx-host { position: relative; }
.rfx-greet { position: relative; }

/* the chalk stick and the marker that write */
.rfx-tool { position: absolute; left: 0; top: 0; z-index: 6; pointer-events: none; transform-origin: 0 50%; will-change: transform; }
.rfx-tool.moving, .rfx-tool.returning { transition: transform .5s cubic-bezier(.22, 1, .36, 1); }
.rfx-tool.returning { transition-duration: .85s; }
.rfx-tool-chalk { width: 62px; height: 11px; margin-top: -5.5px; border-radius: 2px 4px 4px 2px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f1e7 45%, #d9d4c6 100%);
  box-shadow: 0 6px 10px -2px rgba(0,0,0,.45), inset -6px 0 6px -4px rgba(0,0,0,.15); }
.rfx-tool-chalk::before { content: ""; position: absolute; left: -3px; top: 1px; width: 6px; height: 9px; border-radius: 50% 2px 2px 50%; background: #eeeadf; }
.rfx-tool-chalk::after { content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: .35;
  background: repeating-linear-gradient(90deg, transparent 0 5px, rgba(0,0,0,.06) 5px 6px); }
.rfx-tool-marker { width: 104px; height: 16px; margin-top: -8px; border-radius: 3px 8px 8px 3px;
  background: linear-gradient(180deg, #3c7a5e, #1f4d3b 60%, #163a2c); box-shadow: 0 10px 16px -6px rgba(0,0,0,.45); }
.rfx-tool-marker::before { content: ""; position: absolute; left: -12px; top: 3px; border-style: solid; border-width: 5px 12px 5px 0;
  border-color: transparent #20372d transparent transparent; }
.rfx-tool-marker::after { content: ""; position: absolute; right: 8px; top: 2px; width: 30px; height: 12px; border-radius: 3px 7px 7px 3px;
  background: linear-gradient(180deg, #f5c543, #c8961e); box-shadow: inset 2px 0 0 rgba(0,0,0,.15); }

/* the board eraser */
.rfx-wipe { transition: opacity .5s ease-out; }
.rfx-wipe.gone { opacity: 0; }
.rfx-eraser { position: fixed; left: 0; top: 0; z-index: 301; pointer-events: none; border-radius: 10px; will-change: transform;
  background: repeating-linear-gradient(8deg, rgba(0,0,0,.06) 0 3px, transparent 3px 9px), linear-gradient(90deg, #7b4f2c, #b07a48 35%, #c48d58 55%, #8a5a33);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.12), inset 0 -10px 18px rgba(0,0,0,.25),
    0 0 0 5px #66696a, 0 0 0 6px rgba(255,255,255,.35), 0 24px 40px -10px rgba(0,0,0,.6);   /* grey felt around the wooden back */
  transition: opacity .45s; }
.rfx-eraser::before { content: ""; position: absolute; inset: 6px; border-radius: 6px; border: 1px solid rgba(0,0,0,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.rfx-eraser::after { content: "AI"; position: absolute; left: 50%; top: 50%; translate: -50% -50%; rotate: -90deg; font-family: var(--font-hand);
  font-weight: 700; font-size: 20px; letter-spacing: .1em; color: rgba(255,240,210,.55); }
.rfx-eraser.away { opacity: 0; }

/* mechanical counters */
.odo { display: inline-flex; --odo-h: 1.12em; vertical-align: bottom; }
.odo-d { display: inline-block; height: var(--odo-h); overflow: hidden; line-height: var(--odo-h);
  -webkit-mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent); }
.odo-s { display: flex; flex-direction: column; transition: transform 1.7s cubic-bezier(.16, 1, .3, 1); }
.odo-s span { height: var(--odo-h); display: block; text-align: center; }
.odo > span[aria-hidden]:not(.odo-d) { line-height: var(--odo-h); }
@media (prefers-reduced-motion: reduce) { .rfx-tool, .rfx-eraser, .rfx-canvas { display: none !important; } }
