/* ==========================================================================
   delight.css - Phase 1 of UX_ENGAGEMENT_PROPOSAL.md (see delight.js). Loaded after every other stylesheet.
   Student pages only (body.st-student, set by studio.js) except the loading screen. The tutor's look is unchanged.
   Colour meaning (H2): navy = the frame · green = do this now / right · amber = "not yet" (never red for a child's
   mistake) · gold + flame orange = rewards · purple = a challenge (bosses) · ring colours = the three daily habits.
   ========================================================================== */
:root {
  --dl-go: #1f9d63;        --dl-go-edge: #157049;
  --dl-navy-edge: #0d1f3d;
  --dl-gold: #f5b100;      --dl-gold-soft: #fff6db;
  --dl-flame: #ff7a1a;
  --dl-notyet: #d9741f;    --dl-notyet-soft: #fff4e8;  --dl-notyet-line: #f3d2ad;
  --dl-boss: #7c3aed;      --dl-boss-soft: #f1eafe;
  --dl-ring-d5: #f59e0b;   --dl-ring-read: #0fa89a;     --dl-ring-focus: #3b82f6;
  /* motion (H3) */
  --dl-fast: 120ms; --dl-med: 220ms;
  --dl-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dl-out: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- H6: loading screen (until the first screen is ready) */
.boot { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; background: var(--canvas, #f4f6f9); transition: opacity .3s ease, visibility .3s; }
body.booted .boot { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-card { display: grid; justify-items: center; gap: 16px; padding: 24px; text-align: center; max-width: 360px; }
.boot-logo { width: 64px; height: 64px; border-radius: 18px; background: var(--violet, #1f3a68); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 30px rgba(31, 58, 104, .25); animation: dlBreathe 1.6s ease-in-out infinite; }
.boot-logo svg { width: 38px; height: 38px; }
.boot-text { color: var(--ink-soft, #46546a); font-weight: 500; margin: 0; }
.boot-skel { display: grid; gap: 8px; width: 240px; }
.boot-skel i { display: block; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #e6ebf2 0%, #f5f7fa 50%, #e6ebf2 100%); background-size: 200% 100%; animation: dlShimmer 1.2s linear infinite; }
.boot-skel i:nth-child(2) { width: 80%; } .boot-skel i:nth-child(3) { width: 60%; }
.boot-retry { margin-top: 4px; }
@keyframes dlBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes dlShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- C5: buttons that feel pressable (students only) */
body.st-student .btn:not(.btn-ghost):not(.btn-outline):not(:disabled) {
  box-shadow: 0 3px 0 var(--dl-navy-edge) !important;
  transition: transform var(--dl-fast) ease, box-shadow var(--dl-fast) ease, background-color .15s ease;
}
body.st-student .btn-go:not(:disabled), body.st-student .btn.dl-cta:not(.btn-ghost):not(:disabled) { box-shadow: 0 3px 0 var(--dl-go-edge) !important; }
body.st-student .btn.btn-ghost:not(:disabled), body.st-student .btn.btn-outline:not(:disabled) { box-shadow: 0 2px 0 #d5dce6 !important; transition: transform var(--dl-fast) ease, box-shadow var(--dl-fast) ease, background-color .15s; }
body.st-student .btn:not(:disabled):active { transform: translateY(2px) !important; box-shadow: 0 1px 0 var(--dl-navy-edge) !important; }
body.st-student .btn-go:not(:disabled):active, body.st-student .btn.dl-cta:not(.btn-ghost):active { box-shadow: 0 1px 0 var(--dl-go-edge) !important; }
body.st-student .btn.btn-ghost:not(:disabled):active, body.st-student .btn.btn-outline:not(:disabled):active { box-shadow: 0 0 0 #d5dce6 !important; }
body.st-student .btn { min-height: 40px; }
body.st-student .btn-lg, body.st-student .btn-xl { border-radius: 14px; }
body.st-student .btn-go { background: var(--dl-go); }
body.st-student .btn-go:hover { background: var(--dl-go-edge); }
body.st-student .exam .ex-opt { transition: transform var(--dl-fast) ease, box-shadow var(--dl-fast) ease, background-color .15s; }
body.st-student .exam .ex-opt:not(:disabled):active { transform: scale(.98); }

/* ---------- B2: status bar (streak flame, level ring and XP) */
.dl-status { display: flex; align-items: center; gap: 8px; }
.dl-status[hidden] { display: none; }
.dl-chip { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 12px 0 8px; border-radius: 99px; border: 1px solid var(--line, #e1e6ee); background: #fff; color: var(--ink, #1b2537); font: inherit; font-size: .92rem; cursor: pointer; transition: transform var(--dl-fast) ease, box-shadow var(--dl-fast) ease; }
.dl-chip:hover { box-shadow: var(--shadow-sm); }
.dl-chip:active { transform: scale(.96); }
.dl-chip b { font-weight: 750; font-variant-numeric: tabular-nums; }
.dl-chip-lab { color: var(--muted, #5f6b7d); font-size: .8rem; }
.dl-streak svg { width: 22px; height: 22px; }
.dl-streak .dl-fl-o { fill: #cfd6e0; } .dl-streak .dl-fl-i { fill: #e6eaf0; }
.dl-streak.is-lit { border-color: #ffd7b5; background: #fff8f1; }
.dl-streak.is-lit .dl-fl-o { fill: var(--dl-flame); } .dl-streak.is-lit .dl-fl-i { fill: var(--dl-gold); }
.dl-streak.is-lit b { color: #b44f00; }
.dl-streak.is-lit svg { animation: dlFlicker 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.dl-streak.is-catch svg { animation: dlCatch .9s var(--dl-spring); }
@keyframes dlFlicker { 0%, 100% { transform: scale(1) rotate(0); } 30% { transform: scale(1.05, .97) rotate(-2deg); } 60% { transform: scale(.97, 1.04) rotate(2deg); } }
@keyframes dlCatch { 0% { transform: scale(.4); } 60% { transform: scale(1.4); } 100% { transform: scale(1); } }
.dl-lv { --p: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--dl-gold) calc(var(--p) * 1%), #e9eef7 0); position: relative; }
.dl-lv::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.dl-lv b { position: relative; font-size: .78rem; color: var(--violet, #1f3a68); }
.dl-xp { color: var(--ink-soft, #46546a); font-size: .85rem; }
.dl-level.is-bump { animation: dlBump .5s var(--dl-spring); }
@keyframes dlBump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@media (max-width: 640px) {
  .dl-status { gap: 6px; }
  .dl-chip { height: 36px; padding: 0 9px 0 6px; gap: 5px; }
  .dl-chip-lab, .dl-xp { display: none; }
  .dl-level { display: none; }                         /* the "Me" tab shows the level on phones */
  body.st-student .st-crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.st-student .st-top { gap: 8px; }
}

/* ---------- B1: Today, with three rings */
.dl-today { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px 28px; align-items: center; margin-bottom: 20px; padding: 22px 24px; border-radius: 20px; background: radial-gradient(120% 140% at 0% 0%, #fff8ea 0%, #fff 45%) , #fff; border: 1px solid var(--line, #e1e6ee); box-shadow: var(--shadow-md); }
.dl-today.is-complete { border-color: #f6dc8f; background: radial-gradient(120% 140% at 0% 0%, #fff1c7 0%, #fffaf0 50%, #fff 100%); }
.dl-kicker { margin: 0 0 4px; font-size: .78rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: #a8660a; }
.dl-today h2 { margin: 0; font-size: 1.65rem; }
.dl-line { margin: 6px 0 14px; font-size: 1.05rem; color: var(--ink-soft, #46546a); }
.dl-today.is-complete .dl-line { color: #8a5a12; font-weight: 600; }
.dl-cta-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.dl-cta:not(.btn-ghost) { background: var(--dl-go); font-size: 1.05rem; padding: 13px 24px; }
.btn.dl-cta:not(.btn-ghost):hover { background: var(--dl-go-edge); }
.dl-meta { margin: 12px 0 0; font-size: .88rem; color: var(--muted, #5f6b7d); }
.dl-rings { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-width: 250px; }
.dl-ring { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; border-radius: 16px; border: 1px solid transparent; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: background-color .15s, transform var(--dl-fast) ease; }
.dl-ring:hover { background: #f5f7fb; }
.dl-ring:active { transform: scale(.98); }
.dl-ring.is-next { background: #fff; border-color: var(--line, #e1e6ee); box-shadow: var(--shadow-sm); }
.dl-ring-svg { position: relative; width: 52px; height: 52px; flex-shrink: 0; display: grid; place-items: center; }
.dl-ring-svg > svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.dl-ring-bg { fill: none; stroke: #edf0f5; stroke-width: 6; }
.dl-ring-fg { fill: none; stroke: var(--ring, var(--dl-ring-focus)); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 100; transition: stroke-dashoffset .9s var(--dl-out); }
.dl-ring[data-ring="d5"] { --ring: var(--dl-ring-d5); }
.dl-ring[data-ring="read"], .dl-ring[data-ring="words"] { --ring: var(--dl-ring-read); }
.dl-ring[data-ring="focus"] { --ring: var(--dl-ring-focus); }
.dl-ring-ic { position: relative; width: 22px; height: 22px; color: var(--ring); }
.dl-ring.is-done .dl-ring-svg::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--ring); opacity: .12; }
.dl-ring.is-done .dl-ring-fg { stroke-dashoffset: 0 !important; }
.dl-ring-txt { display: grid; line-height: 1.25; }
.dl-ring-txt strong { font-weight: 650; }
.dl-ring-txt small { color: var(--muted, #5f6b7d); font-size: .82rem; }
.dl-ring.is-done .dl-ring-txt small { color: #1d7a4f; font-weight: 600; }
.dl-ring.is-next .dl-ring-svg { animation: dlNudge 2.8s ease-in-out infinite; }
@keyframes dlNudge { 0%, 80%, 100% { transform: scale(1); } 88% { transform: scale(1.08); } }
@media (max-width: 860px) {
  .dl-today { grid-template-columns: 1fr; padding: 18px; }
  .dl-rings { grid-template-columns: repeat(3, minmax(0, 1fr)); min-width: 0; }
  .dl-ring { flex-direction: column; text-align: center; padding: 10px 4px; gap: 6px; }
  .dl-ring-txt small { font-size: .74rem; }
  .dl-cta-row .btn { width: 100%; justify-content: center; }
}

/* ---------- B4: a first step instead of a row of zeros */
.dsub-first { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 6px; padding: 8px 10px; border-radius: 10px; background: var(--dl-gold-soft); color: #7a5208; font-size: .88rem; line-height: 1.35; }

/* ---------- C1: "Not yet", a hint, another go */
body.st-student .ex-fb.is-wrong { background: var(--dl-notyet-soft); border-color: var(--dl-notyet-line); }
body.st-student .ex-fb.is-wrong .ex-fb-head strong { color: #9a4d0b; }
body.st-student .ex-fb.is-wrong .ex-fb-ic { background: var(--dl-notyet); }
.ex-fb.is-notyet { background: var(--dl-notyet-soft); border-color: var(--dl-notyet-line); }
.ex-fb.is-notyet .ex-fb-ic { background: var(--dl-notyet); }
.ex-fb.is-notyet .ex-fb-head strong { color: #9a4d0b; }
.ex-fb-praise { color: var(--ink-soft, #46546a); font-weight: 500; }
.ex-fb.is-right .ex-fb-praise { color: #1d6b45; }
.ex-fb-hint { display: flex; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #fff; border: 1px dashed var(--dl-notyet-line); line-height: 1.45; }
.ex-fb-hint b { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: #a35a0c; }
.ex-fb-hint-ic { font-size: 1.2rem; line-height: 1.2; }
.ex-fb-btns { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.exam .ex-answer.is-res-retry .ex-opt.is-on, .exam .ex-answer.is-res-retry .ex-box { background: var(--dl-notyet-soft); box-shadow: inset 0 0 0 2px var(--dl-notyet); }
.exam .ex-answer.is-res-retry .ex-opt.is-on .ex-tick { background: var(--dl-notyet); }
body.st-student .exam .ex-answer.is-res-wrong .ex-opt.is-on, body.st-student .exam .ex-answer.is-res-wrong .ex-box { background: var(--dl-notyet-soft); box-shadow: inset 0 0 0 2px var(--dl-notyet); }
body.st-student .exam .ex-answer.is-res-wrong .ex-opt.is-on .ex-tick { background: var(--dl-notyet); }
.exam .ex-opt.is-ruled { opacity: .45; cursor: not-allowed; }
.exam .ex-opt.is-ruled > span:last-child { text-decoration: line-through; text-decoration-thickness: 2px; }
.exam .ex-card.pulse-notyet { animation: dlNotYet .45s ease; }
@keyframes dlNotYet { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 55% { transform: translateX(4px); } 80% { transform: translateX(-2px); } }
body.st-student .rv-row.is-wrong { border-left-color: var(--dl-notyet); background: #fffaf4; }
body.st-student .rv-row.is-wrong .rv-mark-ic { background: var(--dl-notyet); }

/* ---------- C2: sparkles and the run banner */
.dl-spark { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.dl-spark i { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--dl-gold); animation: dlSpark .6s var(--dl-out) forwards; }
.dl-spark i:nth-child(even) { background: var(--dl-go); width: 5px; height: 5px; }
@keyframes dlSpark { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.exam .ex-card.pulse-right { animation: dlPop .42s var(--dl-spring); }
@keyframes dlPop { 0% { transform: scale(1); } 40% { transform: scale(1.015); } 100% { transform: scale(1); } }
.dl-combo { position: fixed; left: 50%; top: 84px; z-index: 900; padding: 10px 22px; border-radius: 99px; background: linear-gradient(135deg, var(--dl-flame), var(--dl-gold)); color: #fff; font-weight: 800; font-size: 1.05rem; letter-spacing: .01em; box-shadow: 0 10px 28px rgba(255, 122, 26, .35); opacity: 0; transform: translate(-50%, -16px) scale(.9); pointer-events: none; }
.dl-combo.is-on { animation: dlCombo 1.5s var(--dl-out) forwards; }
@keyframes dlCombo { 0% { opacity: 0; transform: translate(-50%, -16px) scale(.85); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.06); } 25% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -10px) scale(.96); } }

/* boss battles: a challenge colour, not danger red */
body.st-student .mt-hp-fill { background: var(--dl-boss); }
body.st-student .mt-boss-dmg { color: var(--dl-boss); }
body.st-student .mt-boss-hud.is-won .mt-hp-fill, body.st-student .mt-boss-result.is-won .mt-br-bar .mt-hp-fill { background: var(--dl-go); }

/* ---------- C4: the end of a set */
.dl-end { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; margin: 16px 0; padding: 20px 22px; border-radius: 20px; background: radial-gradient(120% 140% at 0% 0%, #fff4d6 0%, #fff 55%), #fff; border: 1px solid #f3e1b0; box-shadow: var(--shadow-md); animation: dlRise .5s var(--dl-out) both; }
.dl-end-burst { font-size: 3rem; line-height: 1; animation: dlBurst .7s var(--dl-spring) .1s both; }
.dl-end-kicker { margin: 0; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #a8660a; }
.dl-end-line { margin: 4px 0 12px; font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.dl-end-stats { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding: 0; }
.dl-end-stats li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font-weight: 650; font-size: .92rem; }
.dl-end-stats li.is-flame { border-color: #ffd7b5; background: #fff8f1; color: #b44f00; }
.dl-end-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.dl-end-btns .btn { flex: 1 1 180px; justify-content: center; }
@keyframes dlRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dlBurst { from { transform: scale(.2) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 640px) { .dl-end { grid-template-columns: 1fr; text-align: center; } .dl-end-stats, .dl-end-btns { justify-content: center; } }

/* ---------- motion off for those who ask */
@media (prefers-reduced-motion: reduce) {
  .boot-logo, .boot-skel i, .dl-streak.is-lit svg, .dl-streak.is-catch svg, .dl-level.is-bump, .dl-ring.is-next .dl-ring-svg,
  .exam .ex-card.pulse-notyet, .exam .ex-card.pulse-right, .dl-end, .dl-end-burst, .dl-spark i { animation: none !important; }
  .dl-combo.is-on { animation: none !important; opacity: 1; transform: translate(-50%, 0); }
  .dl-ring-fg { transition: none; }
  body.st-student .btn:not(:disabled):active { transform: none !important; }
}

/* ==========================================================================
   Phase 2 (D1 D2 D6 E1 C3 C6 G1 G4 I1 B3 B5)
   ========================================================================== */

/* ---------- E1: gems in the status bar, and the "+5 💎" that floats up */
.dl-gems span { font-size: 1rem; line-height: 1; }
.dl-gems b { color: #0e6f8a; }
.dl-gems.is-bump { animation: dlBump .5s var(--dl-spring); }
.dl-float-gem { position: fixed; z-index: 950; transform: translate(-50%, 0); font-weight: 800; color: #0e6f8a; background: #e6f7fb; border: 1px solid #b6e3ee; padding: 4px 10px; border-radius: 99px; pointer-events: none; animation: dlFloatUp 1.25s var(--dl-out) forwards; }
@keyframes dlFloatUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.9); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -46px) scale(1); } }
.dl-end-stats li.is-gems { border-color: #b6e3ee; background: #f1fbfd; color: #0e6f8a; }

/* ---------- D2: overlays (streak milestone, streak panel) and the 14-day calendar */
.dl-overlay { position: fixed; inset: 0; z-index: 980; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .45); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; }
.dl-overlay.is-open { opacity: 1; visibility: visible; }
.dl-ms-card, .dl-sp-card { position: relative; width: min(440px, 100%); background: #fff; border-radius: 24px; padding: 26px 24px 22px; box-shadow: var(--shadow-lg); text-align: center; transform: scale(.94); transition: transform .3s var(--dl-spring); }
.dl-overlay.is-open .dl-ms-card, .dl-overlay.is-open .dl-sp-card { transform: none; }
.dl-ms-card { background: radial-gradient(120% 90% at 50% 0%, #fff1dc 0%, #fff 60%); }
.dl-ms-flame { position: relative; width: 108px; height: 108px; margin: 0 auto 6px; animation: dlCatch .9s var(--dl-spring); }
.dl-ms-flame svg { width: 100%; height: 100%; }
.dl-ms-flame .dl-fl-o { fill: var(--dl-flame); } .dl-ms-flame .dl-fl-i { fill: var(--dl-gold); }
.dl-ms-flame b { position: absolute; left: 0; right: 0; bottom: 18px; font-size: 1.6rem; font-weight: 850; color: #fff; text-shadow: 0 2px 6px rgba(180, 79, 0, .5); }
.dl-ms-card h2 { margin: 0; font-size: 1.7rem; }
.dl-ms-card > p { margin: 6px 0 0; color: var(--ink-soft); }
.dl-ms-gems { font-weight: 750; color: #0e6f8a !important; }
.dl-ms-card .btn { margin-top: 16px; min-width: 200px; }
.dl-cal { list-style: none; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 16px 0 0; padding: 0; }
.dl-cal li { display: grid; justify-items: center; gap: 2px; }
.dl-cal li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #f1f4f8; font-size: .9rem; }
.dl-cal li span svg { width: 20px; height: 20px; }
.dl-cal li span svg .dl-fl-o { fill: var(--dl-flame); } .dl-cal li span svg .dl-fl-i { fill: var(--dl-gold); }
.dl-cal li.is-lit span { background: #fff1e4; }
.dl-cal li.is-saved span { background: #eef3ff; }
.dl-cal li.is-today span { box-shadow: inset 0 0 0 2px #d5dce6; background: #fff; }
.dl-cal li small { font-size: .68rem; color: var(--muted); }
.dl-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f1f4f8; cursor: pointer; font-size: 1rem; }
.dl-sp-card { text-align: left; }
.dl-sp-head { display: flex; gap: 12px; align-items: center; }
.dl-sp-head h2 { margin: 0; font-size: 1.45rem; }
.dl-sp-head p { margin: 2px 0 0; color: var(--muted); }
.dl-sp-flame { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: #f1f4f8; }
.dl-sp-flame svg { width: 34px; height: 34px; }
.dl-sp-flame .dl-fl-o { fill: #cfd6e0; } .dl-sp-flame .dl-fl-i { fill: #e6eaf0; }
.dl-sp-flame.is-lit { background: #fff1e4; } .dl-sp-flame.is-lit .dl-fl-o { fill: var(--dl-flame); } .dl-sp-flame.is-lit .dl-fl-i { fill: var(--dl-gold); }
.dl-sp-line { margin: 12px 0 0; color: var(--ink-soft); }
.dl-sp-savers { display: flex; gap: 12px; align-items: center; margin-top: 16px; padding: 12px; border-radius: 14px; background: #f6f8fc; }
.dl-sp-savers p { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.dl-sp-shields { display: flex; gap: 2px; font-size: 1.4rem; flex-shrink: 0; }
.dl-sp-shields i { width: 22px; height: 26px; border: 2px dashed #cfd6e0; border-radius: 6px 6px 11px 11px; }
.dl-sp-buy { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.dl-sp-buy small { color: var(--muted); }

/* ---------- D6: tomorrow */
.dl-teaser { margin: 12px 0 0; padding: 8px 12px; border-radius: 12px; background: #f3f0ff; color: #4c2a9e; font-size: .9rem; }
.dl-teaser b { color: #3b1d8a; }

/* ---------- G1: cheers from the tutor (student) and the tutor's cheer card */
.dl-cheers { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 14px 18px; border-radius: 18px; background: linear-gradient(135deg, #fff7e0, #ffeef6); border: 1px solid #f6d9a6; box-shadow: var(--shadow-sm); animation: dlRise .45s var(--dl-out) both; transition: opacity .3s, transform .3s; }
.dl-cheers.is-leaving { opacity: 0; transform: translateY(-6px); }
.dl-cheer-emoji { display: flex; font-size: 1.9rem; }
.dl-cheer-emoji i { font-style: normal; animation: dlBurst .7s var(--dl-spring) both; }
.dl-cheer-emoji i:nth-child(2) { animation-delay: .1s; margin-left: -6px; } .dl-cheer-emoji i:nth-child(3) { animation-delay: .2s; margin-left: -6px; }
.dl-cheer-text { flex: 1; display: grid; }
.dl-cheer-text small { color: var(--ink-soft); }
.dl-cheer-list { list-style: none; margin: 0; padding: 0; }
.dl-cheer-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.dl-cheer-row:first-child { border-top: 0; }
.dl-cheer-row > div { flex: 1; display: grid; min-width: 0; }
.dl-cheer-row small { color: var(--muted); }
.dl-cheer-btns { display: flex; gap: 6px; }
.dl-cheer-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 1.2rem; cursor: pointer; transition: transform var(--dl-fast) ease, background-color .15s; }
.dl-cheer-btn:hover:not(:disabled) { transform: scale(1.12); background: #fff8ea; }
.dl-cheer-btn:disabled { cursor: default; opacity: .35; }
.dl-cheer-btn.is-sent { opacity: 1; background: #fff3d6; border-color: #f3cf7a; transform: scale(1.08); }
.tn-fieldwrap { display: grid; gap: 6px; align-content: start; min-width: 0; }
.tn-starters { display: flex; flex-wrap: wrap; gap: 5px; }
.tn-starter { border: 1px solid var(--line); background: #f7f9fc; color: var(--ink-soft); border-radius: 99px; padding: 3px 9px; font: inherit; font-size: .76rem; cursor: pointer; }
.tn-starter:hover { background: #eef3fb; color: var(--ink); }

/* ---------- I1: homework inbox */
.hw-row.is-new strong { font-weight: 800; }
.hw-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: #2b6cb0; vertical-align: 1px; }
.hw-group.is-late .st-card-head h2 { color: #9a4d0b; }
details.hw-group > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
details.hw-group > summary::-webkit-details-marker { display: none; }
details.hw-group > summary h2 { margin: 0; font-size: 1.1rem; }
details.hw-group > summary span { color: var(--muted); font-size: .88rem; }
details.hw-group > summary::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s; }
details.hw-group[open] > summary::after { transform: rotate(180deg); }
details.hw-group[open] > summary { margin-bottom: 8px; }
.hw-snooze { white-space: nowrap; }
.hw-zero { display: flex; gap: 18px; align-items: center; background: radial-gradient(120% 140% at 0% 0%, #e9fbf1 0%, #fff 60%); border-color: #c7ecd7; }
.hw-zero h2 { margin: 0 0 4px; }
.hw-zero p { margin: 0 0 12px; color: var(--ink-soft); }
.hw-zero-art { font-size: 3rem; animation: dlBurst .7s var(--dl-spring) both; }
@media (max-width: 640px) { .hw-row { flex-wrap: wrap; } .hw-row .hw-main { flex: 1 1 60%; } .hw-snooze { order: 9; } }

/* ---------- B3: "More for you" */
.dash-more { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px 16px; }
.dash-more > summary { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 12px 0; cursor: pointer; list-style: none; }
.dash-more > summary::-webkit-details-marker { display: none; }
.dash-more > summary span { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.dash-more > summary small { color: var(--muted); }
.dash-more > summary::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s; }
.dash-more[open] > summary::after { transform: rotate(180deg); }
.dash-more[open] { padding-bottom: 16px; }

/* ---------- B5: tab bar at the bottom (students, phones and tablets) */
.dl-tabs { display: none; }
@media (max-width: 860px) {
  body.st-student .dl-tabs:not([hidden]) { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 18px rgba(16, 24, 40, .06); }
  .dl-tabs button { position: relative; display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; font: inherit; font-size: .72rem; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 12px; }
  .dl-tabs button[hidden] { display: none; }
  .dl-tabs button .st-ic { width: 22px; height: 22px; }
  .dl-tabs button.is-active { color: var(--violet); background: var(--violet-soft); }
  .dl-tabs button:active { transform: scale(.94); }
  .dl-tab-n { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--dl-flame); color: #fff; font-size: .68rem; line-height: 18px; }
  body.st-student .st-main { padding-bottom: 92px; }
  body.st-student .dl-toast { bottom: 84px; }
}

/* ---------- a toast with Undo */
.dl-toast { position: fixed; left: 50%; bottom: 24px; z-index: 990; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 18px; border-radius: 14px; background: var(--ink, #1b2537); color: #fff; box-shadow: var(--shadow-lg); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .25s var(--dl-out); }
.dl-toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.dl-undo { border: 0; background: none; color: #9cc8ff; font: inherit; font-weight: 750; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.dl-undo:hover { background: rgba(255, 255, 255, .1); }

/* ---------- C3: the boss goes down; C6: the progress bar cheers */
.mt-boss-sprite.is-defeat { animation: dlDefeat .9s var(--dl-out) both; }
.mt-boss-result.is-won .mt-boss-sprite.is-big { animation: dlDefeat 1s var(--dl-out) 1.4s both; }
@keyframes dlDefeat { 0% { transform: none; filter: none; } 25% { transform: scale(1.25) rotate(-10deg); } 55% { transform: scale(.85) rotate(12deg); filter: saturate(0); } 100% { transform: scale(1) rotate(0); } }
body.st-student #testProgressFill { position: relative; }
#testProgressFill.dl-bar-glow { animation: dlGlow 1.2s ease; }
#testProgressFill.dl-bar-done { animation: dlGlowGold 1.4s ease; }
@keyframes dlGlow { 0%, 100% { box-shadow: none; } 40% { box-shadow: 0 0 0 4px rgba(245, 177, 0, .35); } }
@keyframes dlGlowGold { 0% { filter: none; } 40% { filter: brightness(1.25) saturate(1.3); box-shadow: 0 0 12px rgba(245, 177, 0, .7); } 100% { filter: none; } }
body.st-student .test-topbar .lp-track { position: relative; }
body.st-student .test-topbar .lp-track::after { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; border-radius: 2px; background: rgba(27, 37, 55, .18); }

@media (prefers-reduced-motion: reduce) {
  .dl-float-gem, .dl-ms-flame, .dl-cheers, .dl-cheer-emoji i, .hw-zero-art, .mt-boss-sprite.is-defeat, .mt-boss-result.is-won .mt-boss-sprite.is-big,
  #testProgressFill.dl-bar-glow, #testProgressFill.dl-bar-done, .dl-gems.is-bump { animation: none !important; }
  .dl-ms-card, .dl-sp-card, .dl-toast { transition: none; }
}

/* ==========================================================================
   Phase 3 (H1 G3 E2 E3 D4 F2 F3 I2 H7)
   ========================================================================== */

/* ---------- G3: Coach Ben, five moods */
.dl-coach { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; isolation: isolate; }
.dl-coach-head { position: relative; display: block; width: 100%; height: 100%; border-radius: 50%; }
.dl-coach-head svg { display: block; width: 100%; height: 100%; overflow: visible; }
.dl-coach.is-sm { width: 44px; height: 44px; }
.dl-coach.is-md { width: 64px; height: 64px; }
.dl-coach.is-lg { width: 84px; height: 84px; }
.dl-coach.has-ring::before { content: ''; position: absolute; inset: -5px; border-radius: 50%; background: conic-gradient(#f59e0b, #ec4899, #6366f1, #10b981, #f59e0b); z-index: -1; animation: dlSpin 4s linear infinite; }
.dl-coach.has-ring::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; background: #fff; z-index: -1; }
@keyframes dlSpin { to { transform: rotate(360deg); } }
.dl-coach.is-idle .dl-coach-head { animation: dlBob 3.6s ease-in-out infinite; }
.dl-coach.is-happy .dl-coach-head { animation: dlHop .7s var(--dl-spring) both; }
.dl-coach.is-celebrating .dl-coach-head { animation: dlCheer 1.1s var(--dl-spring) 2; }
.dl-coach.is-celebrating > .dl-coach-head::before, .dl-coach.is-celebrating > .dl-coach-head::after { content: '✦'; position: absolute; color: var(--dl-gold); font-size: 1.1em; animation: dlTwinkle 1.4s ease-in-out infinite; }
.dl-coach.is-celebrating > .dl-coach-head::before { left: -10%; top: 4%; }
.dl-coach.is-celebrating > .dl-coach-head::after { right: -8%; top: 22%; animation-delay: .5s; color: #ec4899; }
.dl-coach.is-thinking .dl-coach-head { animation: dlThink 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
.dl-coach.is-thinking .eq-eyes { transform: translate(1.5px, -1.5px); }
.dl-coach.is-encouraging .dl-coach-head { animation: dlNod 1.6s ease-in-out 2; transform-origin: 50% 85%; }
.dl-coach.is-wave .dl-coach-head { animation: dlHop .6s var(--dl-spring); }
@keyframes dlBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes dlHop { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-8px) scale(1.04); } 70% { transform: translateY(1px) scale(.99); } 100% { transform: none; } }
@keyframes dlCheer { 0%, 100% { transform: none; } 25% { transform: translateY(-10px) rotate(-6deg); } 55% { transform: translateY(-4px) rotate(6deg); } }
@keyframes dlTwinkle { 0%, 100% { opacity: .2; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.2); } }
@keyframes dlThink { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-5deg); } }
@keyframes dlNod { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(4deg) translateY(2px); } 60% { transform: rotate(-2deg); } }
.dl-coach-say { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; font-size: .9rem; white-space: nowrap; box-shadow: var(--shadow-sm); }
/* outfits (Me page): his blazer, on every Coach Ben */
.dl-wear-red svg path[fill="#1f2937"], body.dl-outfit-red .eq-head svg path[fill="#1f2937"] { fill: #b91c1c; }
.dl-wear-green svg path[fill="#1f2937"], body.dl-outfit-green .eq-head svg path[fill="#1f2937"] { fill: #15803d; }
.dl-wear-purple svg path[fill="#1f2937"], body.dl-outfit-purple .eq-head svg path[fill="#1f2937"] { fill: #6d28d9; }
/* where he appears */
.dl-today-top { display: flex; gap: 16px; align-items: center; }
.dl-coach-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.dl-coach-btn:focus-visible { outline: 3px solid var(--sea); outline-offset: 4px; }
.dl-story-pill { margin-top: 2px; margin-bottom: 10px; border: 0; border-radius: 99px; padding: 6px 14px; background: linear-gradient(135deg, #6366f1, #ec4899); color: #fff; font: inherit; font-weight: 700; font-size: .85rem; cursor: pointer; box-shadow: 0 6px 16px rgba(99, 102, 241, .3); }
.ex-fb { position: relative; }
.ex-fb > .dl-coach { float: right; margin: -4px -4px 4px 10px; }
.dl-end-burst .dl-coach { width: 84px; height: 84px; }
.hw-zero-art .dl-coach { width: 84px; height: 84px; }
@media (max-width: 640px) { .dl-coach.is-lg { width: 64px; height: 64px; } .dl-today-top { gap: 12px; } }

/* ---------- H1: Explorer look for Years 3–6 (Studio, Years 7–11, keeps the calm look) */
body.st-student.st-primary {
  --violet: #4338ca; --violet-deep: #3730a3; --violet-soft: #e0e7ff; --dl-navy-edge: #2e2894;
  --canvas: #faf8f4; --r-lg: 20px; --r-md: 14px;
  --font-display: "Lexend", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.st-student.st-primary h1, body.st-student.st-primary h2, body.st-student.st-primary h3 { font-weight: 600; letter-spacing: -.01em; }
body.st-student.st-primary .st-card { box-shadow: 0 2px 10px rgba(67, 56, 202, .06); }
body.st-student.st-primary .st-nav button { border-radius: 14px; }
body.st-student.st-primary .st-nav button.is-active { background: linear-gradient(90deg, #e0e7ff, #ede9fe); }
body.st-student.st-primary .dl-today { border-radius: 24px; }
body.st-student.st-primary .exam .ex-opt { border-radius: 16px; }

/* ---------- F3: For you */
.dl-foryou { margin-bottom: 18px; }
.dl-foryou-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.dl-foryou-head h2 { margin: 0; font-size: 1.2rem; }
.dl-foryou-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.dl-foryou-row { list-style: none; margin: 0; padding: 2px 2px 8px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; }
.dl-foryou-row li { scroll-snap-align: start; }
.dl-fy-card { width: 100%; height: 100%; display: grid; gap: 4px; align-content: start; text-align: left; padding: 14px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: #fff; font: inherit; color: inherit; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform var(--dl-fast) ease, box-shadow .15s; border-top: 4px solid var(--maths, #1f3a68); }
.dl-fy-card.is-english { border-top-color: var(--english, #1d5c63); } .dl-fy-card.is-science { border-top-color: #2d6a4f; }
.dl-fy-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dl-fy-tag { font-size: .74rem; font-weight: 700; color: #8a5a12; }
.dl-fy-card.is-new .dl-fy-tag { color: #4338ca; } .dl-fy-card.is-fresh .dl-fy-tag { color: #0f766e; }
.dl-fy-card strong { font-size: 1.02rem; }
.dl-fy-card small { color: var(--muted); }
.dl-fy-why { font-size: .85rem; color: var(--ink-soft); margin-top: 4px; }
.dl-fy-cta { margin-top: 8px; font-weight: 700; color: var(--dl-go-edge); }

/* ---------- E3: a star that has just become Secure */
.gx-star.is-newlit .gx-dot { animation: dlNewStar 1.6s var(--dl-spring) calc(var(--k, 0) * .25s + .3s) both; }
@keyframes dlNewStar { 0% { transform: scale(.4); filter: brightness(2.2); } 45% { transform: scale(1.8); filter: brightness(1.8) drop-shadow(0 0 12px #fde68a); } 100% { transform: none; filter: none; } }

/* ---------- F2: Play & Learn as a picture grid */
body.st-student .pg-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
body.st-student .pg-card { padding: 0 0 14px; border-radius: 20px; gap: 4px; }
body.st-student .pg-card::before { display: none; }
body.st-student .pg-card > *:not(.pg-card-ic):not(.pg-new) { margin-left: 16px; margin-right: 16px; }
body.st-student .pg-card-ic { width: 100%; height: 120px; border-radius: 0; margin-bottom: 6px; background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, .55) 0 18%, transparent 19%), radial-gradient(circle at 12% 85%, rgba(255, 255, 255, .4) 0 14%, transparent 15%), var(--pgbg); }
body.st-student .pg-card-ic svg { width: 64px; height: 64px; transition: transform .3s var(--dl-spring); }
body.st-student .pg-card:hover .pg-card-ic svg { transform: scale(1.12) rotate(-4deg); }
body.st-student .pg-card-foot { margin-left: 16px; margin-right: 16px; }
body.st-student .pg-grid > .pg-card:first-child { grid-column: span 2; }
body.st-student .pg-grid > .pg-card:first-child .pg-card-ic { height: 150px; }
.pg-new { position: absolute; top: 10px; left: 10px; z-index: 2; padding: 3px 10px; border-radius: 99px; background: #fff; color: #be185d; font-size: .72rem; font-weight: 800; letter-spacing: .04em; box-shadow: var(--shadow-sm); }
@media (max-width: 560px) { body.st-student .pg-grid > .pg-card:first-child { grid-column: auto; } }

/* ---------- E2: the Me page */
.dl-emb { position: relative; display: inline-grid; place-items: center; border-radius: 50%; flex-shrink: 0; }
.dl-emb .emb { border-radius: 50% !important; }
.dl-emb.is-sm .emb { width: 36px; height: 36px; } .dl-emb.is-sm .emb svg { width: 21px; height: 21px; }
.dl-emb.is-md .emb { width: 52px; height: 52px; } .dl-emb.is-md .emb svg { width: 28px; height: 28px; }
.dl-emb.is-xl .emb { width: 104px; height: 104px; } .dl-emb.is-xl .emb svg { width: 56px; height: 56px; }
.dl-emb[class*="dl-frame-"] { padding: 4px; }
.dl-emb.is-xl[class*="dl-frame-"] { padding: 6px; }
.dl-frame-leaf { background: linear-gradient(135deg, #6ee7b7, #059669); }
.dl-frame-stars { background: linear-gradient(135deg, #fbbf24, #6366f1); }
.dl-frame-stars::after { content: '✦'; position: absolute; top: -4px; right: -2px; color: #fbbf24; font-size: .9em; text-shadow: 0 0 6px #fff; }
.dl-frame-gold { background: linear-gradient(135deg, #fde68a, #d97706 50%, #fde68a); box-shadow: 0 0 12px rgba(217, 119, 6, .35); }
.dl-frame-rainbow { background: conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #3b82f6, #8b5cf6, #ef4444); }
.dl-frame-flame { background: linear-gradient(180deg, #f5b100, #ff7a1a 60%, #e11d48); animation: dlFlameGlow 2.4s ease-in-out infinite; }
@keyframes dlFlameGlow { 0%, 100% { box-shadow: 0 0 6px rgba(255, 122, 26, .4); } 50% { box-shadow: 0 0 16px rgba(255, 122, 26, .75); } }
.dl-emb[class*="dl-frame-"] .emb { box-shadow: 0 0 0 2px #fff; }
.dl-col-sky .emb { background: #e0f2fe !important; color: #0369a1 !important; }
.dl-col-mint .emb { background: #d1fae5 !important; color: #047857 !important; }
.dl-col-sunset .emb { background: linear-gradient(135deg, #fed7aa, #fecdd3) !important; color: #c2410c !important; }
.dl-col-lilac .emb { background: #ede9fe !important; color: #6d28d9 !important; }
.dl-col-midnight .emb { background: #1e1b4b !important; color: #c7d2fe !important; }
.st-who .dl-emb.is-sm[class*="dl-frame-"] { padding: 3px; }
.dl-me-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; padding: 24px; background: radial-gradient(120% 140% at 0% 0%, #eef0ff 0%, #fff 55%); }
.dl-me-who h2 { margin: 0; font-size: 1.6rem; }
.dl-me-who p { margin: 2px 0 8px; color: var(--ink-soft); }
.dl-me-who small { color: var(--muted); }
.dl-me-stats { list-style: none; margin: 0; padding: 0; display: flex; gap: 10px; }
.dl-me-stats li { display: grid; justify-items: center; padding: 10px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); min-width: 84px; }
.dl-me-stats b { font-size: 1.15rem; }
.dl-me-stats span { font-size: .75rem; color: var(--muted); }
.dl-me-hero > .btn { grid-column: 1 / -1; justify-self: start; }
.dl-shop-h { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; font-size: 1rem; }
.dl-shop-h .link-btn { font-size: .82rem; }
.dl-shop-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.dl-shop-item { display: grid; justify-items: center; gap: 8px; padding: 14px 10px; border-radius: 16px; border: 1px solid var(--line); background: #fff; text-align: center; }
.dl-shop-item.is-on { border-color: var(--dl-go); box-shadow: 0 0 0 3px #d1f2e1; }
.dl-shop-item strong { font-size: .9rem; }
.dl-shop-prev { height: 70px; display: grid; place-items: center; }
.dl-shop-on { font-size: .8rem; font-weight: 700; color: var(--dl-go-edge); }
.dl-shop-lock { font-size: .75rem; color: var(--muted); }
.dl-shop-note { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
.dl-shelf-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dl-trophy { display: grid; justify-items: center; gap: 4px; padding: 14px 10px; border-radius: 16px; background: #f6f7fa; text-align: center; opacity: .55; filter: grayscale(1); }
.dl-trophy.is-on { opacity: 1; filter: none; background: linear-gradient(180deg, #fff8e6, #fff); border: 1px solid #f4dfa3; }
.dl-trophy.is-on.is-relic { background: linear-gradient(180deg, #eef0ff, #fff); border-color: #c7cdfa; }
.dl-trophy-ic { font-size: 1.8rem; }
.dl-trophy strong { font-size: .85rem; }
.dl-trophy small { font-size: .74rem; color: var(--muted); line-height: 1.3; }
.dl-me-note { margin: 12px 0 0; font-size: .88rem; color: var(--ink-soft); }
.dl-me-card { padding: 0; overflow: hidden; }
.dl-me-card .idc-top { padding: 10px 16px; background: var(--violet); color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.dl-me-card-body { display: flex; gap: 14px; align-items: center; padding: 16px; }
.dl-me-card-body div { display: grid; }
.dl-me-card-body span { color: var(--muted); font-size: .88rem; }
.dl-me-card .idc-foot { display: flex; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
@media (max-width: 760px) { .dl-me-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; } .dl-me-hero > .btn { justify-self: center; } }

/* ---------- D4: your week in review (story) */
#dlStory { background: rgba(10, 12, 30, .82); }
.dl-story { position: relative; width: min(420px, 100%); height: min(720px, calc(100vh - 32px)); border-radius: 26px; overflow: hidden; background: linear-gradient(160deg, #4338ca, #7c3aed 55%, #db2777); color: #fff; box-shadow: var(--shadow-lg); }
.dl-st-bars { position: absolute; top: 12px; left: 12px; right: 52px; z-index: 3; display: flex; gap: 4px; }
.dl-st-bars span { flex: 1; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .3); overflow: hidden; }
.dl-st-bars i { display: block; height: 100%; width: 0; background: #fff; }
.dl-st-bars i.is-done { width: 100%; }
.dl-st-bars i.is-run { animation: dlBar 5s linear forwards; }
@keyframes dlBar { to { width: 100%; } }
.dl-st-x { z-index: 4; background: rgba(255, 255, 255, .2); color: #fff; top: 4px; }
.dl-st-stage { position: absolute; inset: 0; }
.dl-st-slide { position: absolute; inset: 0; display: grid; place-items: center; padding: 48px 28px 28px; text-align: center; }
.dl-st-slide[hidden] { display: none; }
.dl-st-card { display: grid; justify-items: center; gap: 10px; animation: dlRise .45s var(--dl-out) both; }
.dl-st-card h2 { margin: 0; color: #fff; font-size: 1.8rem; }
.dl-st-card p { margin: 0; color: rgba(255, 255, 255, .9); font-size: 1.05rem; }
.dl-st-k { font-size: .8rem !important; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fde68a !important; }
.dl-st-big { font-size: 4rem !important; font-weight: 850; line-height: 1; color: #fff !important; }
.dl-st-big small { font-size: 1.1rem; font-weight: 600; }
.dl-st-mid { font-size: 1.4rem !important; font-weight: 700; }
.dl-st-tip { opacity: .7; font-size: .85rem !important; }
.dl-st-days { list-style: none; display: flex; gap: 6px; margin: 6px 0; padding: 0; }
.dl-st-days li { display: grid; justify-items: center; gap: 2px; }
.dl-st-days span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .15); }
.dl-st-days li.is-lit span { background: rgba(255, 255, 255, .95); }
.dl-st-days small { font-size: .7rem; opacity: .8; }
.dl-st-card .dl-coach.has-ring::after, .dl-st-card .dl-coach::after { background: transparent; }
.dl-st-card .btn { margin-top: 10px; min-width: 200px; }
.dl-st-nav { position: absolute; top: 60px; bottom: 0; width: 38%; border: 0; background: transparent; cursor: pointer; z-index: 2; }
.dl-st-nav.is-prev { left: 0; } .dl-st-nav.is-next { right: 0; width: 62%; }
.dl-st-slide .btn { position: relative; z-index: 5; }

/* ---------- I2: keyboard shortcuts */
.dl-kbd { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 4px 10px; font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer; }
.dl-kbd:hover { color: var(--ink); }
.ex-foot { flex-wrap: wrap; }
@media (pointer: coarse) { .dl-kbd { display: none; } }
.dl-keys-card dl { display: grid; gap: 10px; margin: 14px 0 0; }
.dl-keys-card dl div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; align-items: center; }
.dl-keys-card dd { margin: 0; color: var(--ink-soft); }
kbd { display: inline-block; padding: 3px 8px; border-radius: 7px; border: 1px solid #cfd7e2; border-bottom-width: 3px; background: #f7f9fc; font: 600 .85rem var(--font-body); color: var(--ink); }

/* ---------- H7: dark mode (Settings → Appearance) */
body.dl-dark {
  color-scheme: dark;
  --canvas: #0e1422; --paper: #161d2e; --cream: #141b2b; --sky-1: #121a2b; --sky-2: #121a2b;
  --ink: #e7ecf5; --ink-soft: #b8c2d4; --muted: #8f9bb0; --line: #273149;
  --violet: #4263eb; --violet-deep: #3451d1; --violet-soft: #1d2747; --dl-navy-edge: #233a9e;
  --go-soft: #12301f; --sun-soft: #33270f; --coral-soft: #3a1c1c; --sea-soft: #15263d; --english-soft: #123033; --maths-soft: #1d2747;
  --zone-soft: #1d2747; --zone-bg: #0e1422;
  --dl-surface: #161d2e; --dl-surface-2: #1c2539;
  --dl-notyet-soft: #352312; --dl-notyet-line: #5c3c1d; --dl-gold-soft: #33290f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 2px 10px rgba(0, 0, 0, .45); --shadow-lg: 0 14px 36px rgba(0, 0, 0, .6);
  background: var(--canvas); color: var(--ink);
}
body.dl-dark.st-student.st-primary { --violet: #5b5bf0; --violet-soft: #23224d; --canvas: #100f1f; }
body.dl-dark .st-side, body.dl-dark .st-card, body.dl-dark .dl-chip, body.dl-dark .st-bell, body.dl-dark .st-menu, body.dl-dark .btn-ghost, body.dl-dark .btn-outline,
body.dl-dark .text-input, body.dl-dark .st-select, body.dl-dark input, body.dl-dark select, body.dl-dark textarea, body.dl-dark .icon-btn,
body.dl-dark .st-tabs button, body.dl-dark .subject-tab, body.dl-dark .paper-year, body.dl-dark .paper-btn, body.dl-dark .mtc-intro,
body.dl-dark .ex-card, body.dl-dark .ex-opt, body.dl-dark .ex-box, body.dl-dark .ex-text, body.dl-dark .rv-row, body.dl-dark .rv-banner, body.dl-dark .rv-game,
body.dl-dark .ex-start-card, body.dl-dark .modal-card, body.dl-dark .dl-ms-card, body.dl-dark .dl-sp-card, body.dl-dark .dl-shop-item, body.dl-dark .dl-me-stats li,
body.dl-dark .dl-fy-card, body.dl-dark .dash-more, body.dl-dark .pg-card, body.dl-dark .dl-end-stats li, body.dl-dark .dl-kbd, body.dl-dark .dl-x, body.dl-dark .ex-foot .btn-ghost,
body.dl-dark .lesson-topbar, body.dl-dark .test-topbar, body.dl-dark .ex-nav button, body.dl-dark .dl-coach-say, body.dl-dark .ex-fb-hint, body.dl-dark .tn-starter, body.dl-dark .dl-cheer-btn,
body.dl-dark .bell-panel, body.dl-dark .st-bell-panel, body.dl-dark .dl-tabs, body.dl-dark .dl-ring.is-next, body.dl-dark .hw-row, body.dl-dark .auth-main, body.dl-dark .auth-card, body.dl-dark .boot {
  background-color: var(--dl-surface) !important; color: var(--ink); border-color: var(--line) !important;
}
body.dl-dark .st-side, body.dl-dark .lesson-topbar, body.dl-dark .test-topbar { background-color: #111827 !important; }
body.dl-dark .st-card, body.dl-dark .dl-today, body.dl-dark .dl-end, body.dl-dark .dl-me-hero, body.dl-dark .hw-zero, body.dl-dark .dl-cheers { background-image: none !important; }
body.dl-dark .dl-today, body.dl-dark .dl-end, body.dl-dark .dl-me-hero, body.dl-dark .hw-zero { background-color: var(--dl-surface-2) !important; border-color: var(--line) !important; }
body.dl-dark .dl-cheers { background-color: #2a2215 !important; border-color: #5c4a1d !important; }
body.dl-dark h1, body.dl-dark h2, body.dl-dark h3, body.dl-dark h4, body.dl-dark strong, body.dl-dark .st-card-head h2 { color: var(--ink); }
body.dl-dark .st-nav button { color: var(--ink-soft); }
body.dl-dark .st-nav button:hover { background: #1c2539; color: var(--ink); }
body.dl-dark .st-nav button.is-active, body.dl-dark .dl-tabs button.is-active { background: var(--violet-soft) !important; color: #c7d2fe !important; }
body.dl-dark .link-btn, body.dl-dark a { color: #93b4ff; }
body.dl-dark .st-bar, body.dl-dark .lp-track, body.dl-dark .mt-hp { background: #273149; }
body.dl-dark .dl-ring-bg { stroke: #273149; }
body.dl-dark .dl-ring:hover { background: #1c2539; }
body.dl-dark .ex-fb.is-right { background: #12301f; border-color: #1f5a37; }
body.dl-dark .ex-fb.is-tutor { background: #1c2539; }
body.dl-dark .ex-fb-pts, body.dl-dark .ex-hud-chip { background: #1c2539; color: var(--ink); }
body.dl-dark .ex-opt.is-on { background: #1d2747 !important; }
body.dl-dark .dl-emb[class*="dl-frame-"] .emb { box-shadow: 0 0 0 2px var(--dl-surface); }
body.dl-dark .dl-coach.has-ring::after { background: var(--dl-surface-2); }
body.dl-dark .dl-teaser { background: #23224d; color: #d6d3ff; }
body.dl-dark .dl-teaser b { color: #fff; }
body.dl-dark .dl-trophy { background: #1c2539; }
body.dl-dark .dl-trophy.is-on { background: #2a2414; border-color: #5c4a1d; }
body.dl-dark .dsub-first { background: #2a2414; color: #f4d58d; }
body.dl-dark .dl-sp-savers, body.dl-dark .dl-cal li span { background: #1c2539; }
body.dl-dark .dl-cal li.is-lit span { background: #3a2412; }
body.dl-dark .st-pill { filter: brightness(.9); }
body.dl-dark .mt-foot { color: var(--muted); }
body.dl-dark .ex-text, body.dl-dark .ex-passage { background-color: #141b2b !important; }
body.dl-dark img:not([src$=".svg"]) { filter: brightness(.92); }

@media (prefers-reduced-motion: reduce) {
  .dl-coach .dl-coach-head, .dl-coach.has-ring::before, .dl-coach > .dl-coach-head::before, .dl-coach > .dl-coach-head::after,
  .gx-star.is-newlit .gx-dot, .dl-frame-flame, .dl-st-card, .dl-st-bars i.is-run { animation: none !important; }
}
/* dark mode: smaller pieces */
body.dl-dark .st-user-actions button { background: #1c2539 !important; color: var(--ink-soft) !important; border-color: var(--line) !important; }
body.dl-dark .lt-dot-mark { background: #273149 !important; border-color: #3a4560 !important; }
body.dl-dark .st-pill { background-color: #1c2539; color: var(--ink-soft); }
body.dl-dark .st-pill.is-done { background: #12301f; color: #7ee2a8; }
body.dl-dark .st-pill.is-due { background: #33270f; color: #f4cf7a; }
body.dl-dark .st-pill.is-late { background: #3a1c1c; color: #ffadad; }
body.dl-dark .st-crumb, body.dl-dark .st-stat-label, body.dl-dark small { color: var(--muted); }body.dl-dark .ex-article { color: #d9dcea; }
body.dl-dark .ex-article h2, body.dl-dark .ex-article h3 { color: #f3e7c9; }
body.dl-dark .ex-article p, body.dl-dark .ex-article li { color: #d9dcea; }
body.dl-dark .ex-textlink { background: #2a2414; border-color: #5c4a1d; }
body.dl-dark .ex-tl-text, body.dl-dark .ex-tl-text strong { color: #f4d58d; }
body.dl-dark .ex-tl-text em { color: #f0b860; }
body.dl-dark .mt-boss-hud, body.dl-dark .mt-boss-result { background: var(--dl-surface-2) !important; border-color: var(--line) !important; color: var(--ink); }
body.dl-dark .mt-boss-name, body.dl-dark .mt-boss-status { color: var(--ink-soft); }
body.dl-dark .ex-prompt, body.dl-dark .ex-stem, body.dl-dark .ex-sub { color: var(--ink); }
body.dl-dark .ex-text-tabs button { background: #1c2539; color: #f4d58d; }body.dl-dark .ex-fb.is-right .ex-fb-head strong, body.dl-dark .ex-fb.is-right .ex-fb-praise { color: #7ee2a8; }
body.dl-dark .ex-fb.is-notyet .ex-fb-head strong, body.dl-dark .ex-fb.is-wrong .ex-fb-head strong { color: #f7b267; }
body.dl-dark .ex-fb-ms, body.dl-dark .ex-fb-key { color: var(--ink-soft); }
/* ==========================================================================
   Phase 4 (F1 Quick Bites, D3 league + team goal, D5 install + reminders)
   ========================================================================== */

/* ---------- F1: Quick Bites */
.qb-start.is-done { opacity: .7; }
.qb { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
.qb-deck { height: calc(100vh - 150px); height: calc(100dvh - 150px); min-height: 420px; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; border-radius: 24px; outline: none; scrollbar-width: none; }
.qb-deck::-webkit-scrollbar { display: none; }
.qb-deck:focus-visible { box-shadow: 0 0 0 3px var(--violet-soft); }
.qb-card { scroll-snap-align: start; scroll-snap-stop: always; height: 100%; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; gap: 12px; padding: 36px clamp(20px, 6vw, 72px); margin-bottom: 14px; border-radius: 24px; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-md); overflow-y: auto; }
.qb-card.is-word { background: linear-gradient(160deg, #eef0ff, #fff 60%); }
.qb-card.is-q { background: linear-gradient(160deg, #fff6e5, #fff 60%); }
.qb-card.is-idea { background: linear-gradient(160deg, #e9f8f1, #fff 60%); }
.qb-card.is-ex { background: linear-gradient(160deg, #f3ecff, #fff 60%); }
.qb-card.is-tip { background: linear-gradient(160deg, #e8f3fd, #fff 60%); }
.qb-card.is-end { align-items: center; text-align: center; background: radial-gradient(120% 90% at 50% 0%, #fff1d6 0%, #fff 60%); }
.qb-tag { margin: 0; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.qb-tag.is-word { color: #4338ca; } .qb-tag.is-q { color: #b45309; } .qb-tag.is-idea { color: #047857; } .qb-tag.is-ex { color: #6d28d9; } .qb-tag.is-tip { color: #0369a1; }
.qb-from { margin: -6px 0 4px; color: var(--muted); font-size: .85rem; }
.qb-word { margin: 0; font-size: clamp(2.2rem, 6vw, 3.4rem); }
.qb-pos { margin: -6px 0 0; color: var(--muted); font-style: italic; }
.qb-prompt, .qb-text, .qb-stem { font-size: 1.15rem; line-height: 1.55; }
.qb-text.is-big { font-size: 1.35rem; font-weight: 600; }
.qb-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 4px; }
.qb-opt { text-align: left; padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: 1rem; cursor: pointer; transition: transform var(--dl-fast) ease, border-color .15s, background-color .15s; }
.qb-opt:hover { border-color: #c4cbe0; }
.qb-opt:active { transform: scale(.98); }
.qb-card.is-answered .qb-opt { cursor: default; }
.qb-opt.is-right { border-color: var(--dl-go); background: #e5f6ee; }
.qb-opt.is-wrong { border-color: var(--dl-notyet); background: var(--dl-notyet-soft); }
.qb-fb p { margin: 4px 0 0; line-height: 1.5; color: var(--ink-soft); }
.qb-fb .is-right b { color: #1d6b45; } .qb-fb .is-wrong b { color: #9a4d0b; }
.qb-reveal { align-self: flex-start; border: 1.5px dashed #c4b5fd; background: #faf7ff; color: #5b21b6; border-radius: 14px; padding: 12px 16px; font: inherit; font-weight: 700; cursor: pointer; }
.qb-hidden { display: none; }
.qb-card.is-open .qb-hidden { display: block; animation: dlRise .35s var(--dl-out) both; }
.qb-mean { font-size: 1.3rem; font-weight: 700; margin: 0 0 6px; }
.qb-say { margin: 0; color: var(--ink-soft); font-style: italic; }
.qb-steps { margin: 0 0 8px; padding-left: 22px; line-height: 1.6; }
.qb-ans { margin: 0; }
.qb-link { align-self: flex-start; border: 0; background: none; color: var(--sea); font: inherit; font-weight: 700; cursor: pointer; padding: 4px 0; }
.qb-end-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.qb-card.is-end h2 { margin: 6px 0 0; font-size: 1.8rem; }
.qb-card.is-end p { margin: 0; color: var(--ink-soft); }
.qb-side { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.qb-step { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow-sm); }
.qb-dots { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qb-dots li { width: 8px; height: 8px; border-radius: 50%; background: #d5dce6; transition: transform .2s, background-color .2s; }
.qb-dots li.is-past { background: #9aa9c4; }
.qb-dots li.is-on { background: var(--violet); transform: scale(1.4); }
@media (max-width: 860px) {
  .qb { grid-template-columns: 1fr; }
  .qb-side { display: none; }
  .qb-deck { height: calc(100dvh - 190px); }
  .qb-card { padding: 28px 20px; }
}

/* ---------- D3: beat last week's you, and the team goal */
.dl-league { margin-bottom: 18px; }
.dl-lg-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.dl-lg-head h2 { margin: 0; font-size: 1.15rem; }
.dl-lg-head p { margin: 0; color: var(--muted); font-size: .85rem; }
.dl-lg-bars { display: grid; gap: 8px; }
.dl-lg-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 70px; gap: 12px; align-items: center; font-size: .9rem; color: var(--ink-soft); }
.dl-lg-row b { text-align: right; color: var(--ink); }
.dl-lg-bar { display: block; height: 12px; border-radius: 99px; background: #edf0f5; overflow: hidden; }
.dl-lg-bar i { display: block; height: 100%; border-radius: inherit; background: #b8c2d4; transition: width .8s var(--dl-out); }
.dl-lg-row.is-now .dl-lg-bar i { background: linear-gradient(90deg, var(--dl-flame), var(--dl-gold)); }
.dl-lg-msg { margin: 10px 0 0; font-weight: 600; }
.dl-lg-msg small { display: block; font-weight: 400; color: var(--muted); }
.dl-team { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.dl-team p { margin: 0 0 6px; }
.dl-team small { display: block; margin-top: 6px; color: var(--muted); font-size: .8rem; }
.dl-lg-bar.is-team i { background: linear-gradient(90deg, #10b981, #3b82f6); }

/* ---------- D5: on this device */
.dl-device { display: grid; gap: 12px; }
.dl-dev-row { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; border-radius: 14px; background: #f6f8fc; }
.dl-dev-row > div { display: grid; gap: 2px; flex: 1 1 260px; }
.dl-dev-row small { color: var(--muted); font-size: .84rem; }
.dl-rem-pick { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: .85rem; color: var(--ink-soft); }
.dl-rem-pick label { display: flex; gap: 6px; align-items: center; }
.set-extra .dl-device { margin-top: 6px; }

/* dark mode for Phase 4 */
body.dl-dark .qb-card, body.dl-dark .qb-opt, body.dl-dark .qb-step { background: var(--dl-surface) !important; background-image: none !important; border-color: var(--line); color: var(--ink); }
body.dl-dark .qb-opt.is-right { background: #12301f !important; }
body.dl-dark .qb-opt.is-wrong { background: #352312 !important; }
body.dl-dark .qb-reveal { background: #23224d; color: #d6d3ff; border-color: #4c48a8; }
body.dl-dark .dl-lg-bar, body.dl-dark .qb-dots li { background: #273149; }
body.dl-dark .dl-dev-row { background: #1c2539; }
@media (prefers-reduced-motion: reduce) { .qb-card.is-open .qb-hidden, .dl-lg-bar i { animation: none !important; transition: none !important; } }
/* ---------- daily reminders by push (D5) and XP in "Beat last week's you" (D3) */
.dl-dev-row.is-push[hidden] { display: none; }
.dl-push-on { color: #1d7a4f !important; font-weight: 700; }
.dl-push-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.dl-cheer-remind { margin: -4px 0 10px; font-size: .88rem; color: var(--ink-soft); }
.dl-lg-set + .dl-lg-set { margin-top: 10px; }
.dl-lg-k { margin: 0 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.dl-lg-bars { gap: 4px; }
/* ==========================================================================
   Tutor hub (tutor-hub.js): sidebar, Set work, Today dashboard, Marking, student tabs
   ========================================================================== */
.th-nav-head { margin: 14px 12px 4px; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.th-quick { display: inline-flex; align-items: center; gap: 6px; background: var(--dl-go) !important; }
.th-quick:hover { background: var(--dl-go-edge) !important; }
.th-ic { width: 18px; height: 18px; flex-shrink: 0; }
@media (max-width: 640px) { .th-quick span { display: none; } .th-quick { padding: 8px 10px; } }

/* Set work */
.th-set { width: min(640px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; text-align: left; }
.th-set h2 { margin: 0 0 14px; }
.th-set-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 12px; align-items: start; margin-bottom: 14px; }
.th-set-row > span { padding-top: 8px; font-weight: 600; color: var(--ink-soft); font-size: .9rem; }
.th-set .th-what { margin: 0 0 14px 82px; }
.th-set .th-what .tt-assign-row { margin-bottom: 10px; }
.th-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.th-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: .88rem; cursor: pointer; }
.th-chip input { margin: 0; }
.th-chip:has(input:checked), .th-chip.is-on { background: var(--violet-soft); border-color: var(--violet); color: var(--violet); font-weight: 600; }
.th-chip.is-all { font-weight: 600; }
.th-set-item { display: flex; flex-direction: column; gap: 4px; padding-top: 6px; }
.th-set-foot { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.th-set-msg { color: var(--dl-notyet); font-weight: 600; font-size: .9rem; }
@media (max-width: 560px) { .th-set-row { grid-template-columns: 1fr; gap: 6px; } .th-set .th-what { margin-left: 0; } }

/* Today */
.th-hello { margin-bottom: 16px; }
.th-hello h2 { margin: 0; font-size: 1.6rem; }
.th-hello p { margin: 4px 0 0; color: var(--ink-soft); }
.th-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 4px; }
.th-tile { display: grid; gap: 2px; padding: 14px 16px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); }
.th-tile span { font-size: .78rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.th-tile b { font-family: var(--font-display); font-size: 1.7rem; line-height: 1.1; }
.th-tile b small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.th-tile small { color: var(--ink-soft); font-size: .84rem; }
.th-tile.is-warn { border-color: #f3d2ad; background: #fffaf3; }
.th-tile.is-bad { border-color: #f0c9c9; background: #fff8f8; }
.th-tile.is-bad small { color: #b42318; font-weight: 600; }
.th-todo-list { list-style: none; margin: 0; padding: 0; }
.th-todo-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line); }
.th-todo-item:first-child { border-top: 0; }
.th-todo-item > div { flex: 1; min-width: 0; }
.th-todo-item p { margin: 0; }
.th-todo-item small { color: var(--muted); }
.th-todo-item .th-ic { width: 34px; height: 34px; padding: 8px; border-radius: 10px; background: #eef2f8; color: var(--violet); box-sizing: border-box; }
.th-todo-item.is-mark .th-ic { background: #fff1e4; color: #b45309; }
.th-todo-item.is-q .th-ic { background: #e8f1fd; color: #1d4ed8; }
.th-todo-item.is-late .th-ic { background: #fdecec; color: #b42318; }
.th-todo-item.is-quiet .th-ic { background: #f1edfb; color: #6d28d9; }
.th-todo-item.is-low .th-ic { background: #fff6db; color: #92400e; }
.th-sec-head { display: flex; align-items: baseline; gap: 12px; margin: 22px 0 10px; flex-wrap: wrap; }
.th-sec-head h2 { margin: 0; font-size: 1.25rem; }
.th-sec-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.th-sec-head .link-btn { margin-left: auto; }
.th-roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.th-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px; cursor: pointer; transition: box-shadow .15s, transform .15s; border-top: 4px solid #cfd6e0; }
.th-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.th-card.is-green { border-top-color: #22a06b; } .th-card.is-amber { border-top-color: #f59e0b; } .th-card.is-red { border-top-color: #e5484d; }
.th-card header { display: flex; align-items: center; gap: 10px; }
.th-card header .emb { width: 38px; height: 38px; border-radius: 50%; } .th-card header .emb svg { width: 22px; height: 22px; }
.th-card header > div { flex: 1; min-width: 0; display: grid; }
.th-card header small { color: var(--muted); }
.th-dot { width: 10px; height: 10px; border-radius: 50%; background: #cfd6e0; }
.is-green .th-dot { background: #22a06b; } .is-amber .th-dot { background: #f59e0b; } .is-red .th-dot { background: #e5484d; }
.th-line { margin: 0; font-size: .88rem; color: var(--ink-soft); }
.is-red .th-line { color: #b42318; font-weight: 600; }
.th-mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.th-mini div { display: grid; gap: 2px; }
.th-mini dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.th-mini dd { margin: 0; font-weight: 650; font-size: .9rem; }
.th-mini .is-late { color: #b42318; }
.th-card-bars { color: var(--violet); }
.th-bars { width: 100%; height: 26px; display: block; }
.th-card-acts { display: flex; gap: 8px; margin-top: auto; }
.th-card-acts .btn { flex: 1; justify-content: center; }
.th-feed { cursor: pointer; }

/* Marking */
.th-mk-intro { margin: 0 0 12px; color: var(--ink-soft); }
.th-mk-empty { display: flex; gap: 18px; align-items: center; }
.th-mk-empty h2 { margin: 0 0 4px; }
.th-mk-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.th-mk { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 200px; gap: 16px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: #fbfcfe; transition: opacity .4s, transform .4s; }
.th-mk.is-done { opacity: 0; transform: translateX(30px); }
.th-mk-n { display: inline-block; margin-right: 8px; padding: 2px 9px; border-radius: 8px; background: var(--violet); color: #fff; font-weight: 700; font-size: .85rem; }
.th-mk-max { font-size: .82rem; color: var(--muted); font-weight: 600; }
.th-mk-stem, .th-mk-prompt { margin-top: 8px; line-height: 1.5; }
.th-mk-fig { max-width: 100%; max-height: 220px; margin-top: 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.th-mk-lab { margin: 0 0 6px; font-size: .75rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.th-mk-ans { padding: 10px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); line-height: 1.5; white-space: normal; }
.th-mk-draw { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.th-mk-draw img { display: block; width: 100%; }
.th-mk-draw svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.th-mk-work, .th-mk-ms { margin-top: 8px; }
.th-mk-work summary, .th-mk-ms summary { cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--ink-soft); }
.th-mk-work svg { width: 100%; height: auto; max-height: 300px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.th-mk-ms div { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #f3f7ee; font-size: .92rem; line-height: 1.5; }
.th-mk-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.th-mk-b { min-width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-weight: 750; font-size: 1.05rem; cursor: pointer; }
.th-mk-b:hover { border-color: var(--violet); }
.th-mk-b.is-auto { border-style: dashed; border-color: #94a3b8; }
.th-mk-b.is-given { background: var(--dl-go); border-color: var(--dl-go); color: #fff; }
.th-mk-give small { display: block; margin-top: 6px; color: var(--muted); font-size: .8rem; }
@media (max-width: 1000px) { .th-mk { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .th-tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .th-tile { padding: 10px 12px; }
  .th-tile b, .th-tile strong { font-size: 1.35rem; }
}

/* Student page tabs */
.th-tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 14px; background: #eef1f6; overflow-x: auto; position: sticky; top: 0; z-index: 5; }
.th-tabs button { flex: 0 0 auto; border: 0; background: none; padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.th-tabs button.is-active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.th-panel[hidden] { display: none; }
.th-quick-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; }
.th-quick-acts .btn { display: inline-flex; align-items: center; gap: 6px; }
.th-att, .th-sug { list-style: none; margin: 0; padding: 0; }
.th-att li, .th-sug li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); }
.th-att li:first-child, .th-sug li:first-child { border-top: 0; }
.th-att li > div, .th-sug li > div { display: grid; gap: 2px; min-width: 0; }
.th-att small, .th-sug small { color: var(--muted); }
.th-sug-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex-shrink: 0; }

/* dark mode */
body.dl-dark .th-tile, body.dl-dark .th-chip, body.dl-dark .th-mk, body.dl-dark .th-mk-ans, body.dl-dark .th-mk-b, body.dl-dark .th-mk-draw, body.dl-dark .th-tabs button.is-active { background: var(--dl-surface) !important; color: var(--ink); border-color: var(--line); }
body.dl-dark .th-tabs { background: #1c2539; }
body.dl-dark .th-mk-ms div { background: #12301f; }