/* ===== D'sPinnacle Dome portal (uses tokens from styles.css) ===== */
.page-portal { background: var(--surface-2); min-height: 100dvh; }
.page-portal [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.btn--sm { min-height: 40px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn--danger { color: var(--danger); }
.btn--danger-solid { background: var(--danger); color: #fff; }
.btn--danger-solid:hover { background: #A51F1F; }

.portal-user { display: flex; align-items: center; gap: 10px; }
.portal-user__name { font-weight: 600; color: var(--brand-900); }
.role-badge { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--brand-100); color: var(--brand-700); }
.role-badge[data-role="director"] { background: var(--accent-500); color: var(--brand-900); }
.role-badge[data-role="teacher"] { background: var(--swim-tint); color: var(--swim-ink); }
@media (max-width: 640px) { .portal-user__name { display: none; } }
@media (max-width: 479px) { .page-portal .header__inner:has(.portal-user:not([hidden])) .brand__text { display: none; } }

.portal-loading { display: grid; place-items: center; gap: 12px; padding: 80px 16px; color: var(--ink-3); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--brand-100); border-top-color: var(--brand-600); animation: spin 0.9s linear infinite; }

/* passport photos / avatars */
.avatar-btn { position: relative; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 2px solid var(--brand-100); background: var(--brand-50); overflow: hidden; cursor: pointer; display: grid; place-items: center; flex: none; }
.avatar-btn:hover { border-color: var(--brand-600); }
.avatar-btn__img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.avatar-btn__initials { font-family: var(--font-head); font-weight: 800; color: var(--brand-700); font-size: 15px; }
.avatar { display: inline-grid; place-items: center; flex: none; object-fit: cover; object-position: center top; background: var(--brand-50); color: var(--brand-700); font-family: var(--font-head); font-weight: 800; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.avatar--sm { width: 32px; height: 32px; border-radius: 50%; font-size: 12px; }
.avatar--md { width: 52px; height: 52px; border-radius: 50%; font-size: 16px; }
.avatar--lg { width: 96px; height: 128px; border-radius: 12px; font-size: 26px; }
.avatar--xl { width: 150px; height: 200px; border-radius: 14px; font-size: 40px; box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.avatar--empty { background: repeating-linear-gradient(45deg, var(--brand-50) 0 10px, #fff 10px 20px); }
.who { display: inline-flex; align-items: center; gap: 10px; }
.item--person { grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; }
@media (min-width: 768px) { .item--person { grid-template-columns: auto 1fr auto; } }
.item--person .item__actions { grid-column: 1 / -1; }
@media (min-width: 768px) { .item--person .item__actions { grid-column: auto; } }

.profile-card { display: grid; gap: var(--s-5); align-items: start; }
@media (min-width: 640px) { .profile-card { grid-template-columns: auto 1fr; } }
.profile-card__photo { display: grid; justify-items: center; gap: 6px; text-align: center; }
.profile-card__caption { font-size: 13px; color: var(--ink-3); max-width: 170px; }
.profile-facts { margin: 0; display: grid; gap: 10px; }
@media (min-width: 900px) { .profile-facts { grid-template-columns: 1fr 1fr; column-gap: var(--s-5); } }
.profile-facts div { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.profile-facts dt { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.profile-facts dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.notice { background: var(--brand-50); border-left: 4px solid var(--brand-500); border-radius: 10px; padding: 12px 14px; color: var(--ink-2); }

.photo-tips { list-style: disc; padding-left: 20px; display: grid; gap: 4px; color: var(--ink-2); font-size: 15px; }
.photo-picker { display: grid; gap: var(--s-5); align-items: center; }
@media (min-width: 560px) { .photo-picker { grid-template-columns: auto 1fr; } }
.photo-frame { width: 150px; height: 200px; border-radius: 14px; border: 2px dashed #CFCCE0; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; justify-self: center; }
.photo-frame__img { width: 100%; height: 100%; object-fit: cover; }
.photo-frame__empty { color: var(--ink-3); font-size: 14px; text-align: center; padding: 8px; }
.photo-picker__controls { display: grid; gap: var(--s-3); justify-items: start; }
.photo-picker__choose { cursor: pointer; }
.photo-picker__choose:focus-within { outline: 3px solid var(--brand-500); outline-offset: 3px; }

/* auth */
.auth { display: grid; place-items: center; padding: var(--s-7) 16px var(--s-8); }
.auth__card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow); padding: var(--s-6) var(--s-5); display: grid; gap: var(--s-4); }
.auth__card--wide { max-width: 640px; }
.auth__title { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.auth__sub, .auth__help { color: var(--ink-2); }
.auth__card form { display: grid; gap: var(--s-4); }
.auth__alt { border-top: 1px solid var(--line); padding-top: var(--s-4); display: grid; gap: var(--s-2); color: var(--ink-2); }
.input-with-btn { display: flex; border: 1.5px solid #CFCCE0; border-radius: 12px; overflow: hidden; }
.input-with-btn:focus-within { border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(138,37,181,.15); }
.input-with-btn input { border: 0 !important; box-shadow: none !important; flex: 1; min-width: 0; }
.input-with-btn__btn { border: 0; background: var(--surface-2); padding: 0 16px; font-weight: 600; color: var(--brand-700); cursor: pointer; }

/* app shell */
.app { max-width: 1240px; margin: 0 auto; padding: var(--s-5) 16px var(--s-8); display: grid; gap: var(--s-5); }
.app__nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.app__nav a { flex: none; padding: 10px 16px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 12px; text-decoration: none; font-weight: 600; color: var(--ink-2); background: #fff; border: 1px solid var(--line); }
.app__nav a:hover { color: var(--brand-600); border-color: var(--brand-100); }
.app__nav a.is-active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
@media (min-width: 1024px) {
  .app { grid-template-columns: 220px 1fr; align-items: start; }
  .app__nav { flex-direction: column; position: sticky; top: calc(var(--header-h) + 16px); overflow: visible; }
}
.app__main { min-width: 0; outline: none; }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s-3); margin-bottom: var(--s-5); }
.page-title { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; }
.page-sub { color: var(--ink-2); margin-top: 4px; }
.page-sub code, .item__meta code, td code, .plain-list code { background: var(--brand-50); padding: 1px 6px; border-radius: 6px; color: var(--brand-700); }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s-5); margin-bottom: var(--s-5); }
.page-portal .panel__title { font-size: 19px; color: var(--brand-900); margin-bottom: var(--s-4); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sub-title { font-size: 16px; margin: var(--s-5) 0 var(--s-3); }
.empty { padding: var(--s-5); text-align: center; color: var(--ink-3); background: var(--surface-2); border-radius: var(--radius); }
.count { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--brand-100); color: var(--brand-700); font-size: 13px; font-weight: 800; }
.stack { display: grid; gap: var(--s-3); }
.stack .btn { justify-self: start; }

.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; vertical-align: middle; }
.badge--wait { background: var(--robot-tint); color: var(--robot-ink); }
.badge--score { background: var(--home-tint); color: var(--home-ink); }
.badge--today { background: var(--accent-500); color: var(--brand-900); }
.badge--done { background: var(--surface-2); color: var(--ink-3); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--brand-50); color: var(--brand-700); }
.tag--asg { background: var(--code-tint); color: var(--code-ink); }

/* items */
.item { border-top: 1px solid var(--line); padding: var(--s-4) 0; display: grid; gap: var(--s-2); }
.item:first-of-type { border-top: 0; padding-top: 0; }
.panel > .item:first-child { border-top: 0; }
.item__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.item__title { font-size: 17px; }
.item__text { color: var(--ink); white-space: normal; overflow-wrap: anywhere; }
.item__meta, .item__who { font-size: 14px; color: var(--ink-3); }
.item__who a { font-weight: 700; }
.item__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.item--row { grid-template-columns: 1fr; }
@media (min-width: 768px) { .item--row { grid-template-columns: 1fr auto; align-items: center; } }
.feedback { background: var(--home-tint); border-radius: var(--radius-sm); padding: 10px 12px; color: var(--ink); }
.submission { border-left: 3px solid var(--brand-100); padding-left: var(--s-4); display: grid; gap: var(--s-3); margin-top: var(--s-2); }
.submission__title { font-size: 15px; display: flex; gap: 8px; align-items: center; }
.grade-form { display: grid; gap: var(--s-3); background: var(--surface-2); border-radius: var(--radius); padding: var(--s-3) var(--s-4); }
@media (min-width: 768px) { .grade-form { grid-template-columns: 140px 1fr auto; align-items: end; } }

/* files */
.files { display: flex; flex-wrap: wrap; gap: 10px; }
.files__loading { color: var(--ink-3); font-size: 14px; }
.file--img img { width: 140px; height: 105px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.file--video { width: 100%; max-width: 420px; border-radius: 10px; background: #000; }
.file--audio { width: 100%; max-width: 420px; }
.file--doc { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
input[type=file] { padding: 10px; border: 1.5px dashed #CFCCE0; border-radius: 12px; background: var(--surface-2); width: 100%; }

/* calendar */
.upcoming { display: grid; gap: 8px; }
.upcoming li { display: flex; gap: 12px; align-items: baseline; }
.date-chip { flex: none; min-width: 64px; text-align: center; font-size: 13px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: var(--brand-50); color: var(--brand-700); }
.date-chip.is-today { background: var(--accent-500); color: var(--brand-900); }
.lessons { display: grid; gap: 6px; }
.lessons__week { font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand-600); margin-top: var(--s-3); }
.lesson { display: grid; grid-template-columns: 76px 1fr; gap: var(--s-3); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; }
.lesson--today { border-color: var(--accent-500); box-shadow: 0 0 0 3px rgba(52,193,191,.2); }
.lesson--past { background: var(--surface-2); }
.lesson--past .lesson__title { color: var(--ink-2); }
.lesson__date { display: grid; align-content: start; text-align: center; font-size: 13px; color: var(--ink-3); }
.lesson__date strong { font-size: 15px; color: var(--brand-900); }
.lesson__body { display: grid; gap: 6px; min-width: 0; }
.lesson__title { font-weight: 600; color: var(--ink); }
.lesson__obj { font-size: 14px; color: var(--ink-2); }
.lesson__links { display: flex; flex-wrap: wrap; gap: 6px; }
.lessons--edit textarea { width: 100%; padding: 10px 12px; border: 1.5px solid #CFCCE0; border-radius: 10px; font-size: 15px; }
.lessons--edit .btn { justify-self: start; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.inline-form input { flex: 1 1 220px; min-height: 48px; padding: 10px 14px; border: 1.5px solid #CFCCE0; border-radius: 12px; font-size: 16px; }
.lesson__title-input { width: 100%; font-weight: 600; padding: 8px 12px; border: 1.5px solid #CFCCE0; border-radius: 10px; font-size: 15px; }
.lesson__when { display: flex; flex-wrap: wrap; gap: 12px; }
.lesson__when label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.lesson__when input, .lesson__when select { width: 84px; min-height: 40px; padding: 6px 8px; border: 1.5px solid #CFCCE0; border-radius: 8px; background: #fff; }
.syl-hint { margin: -8px 0 var(--s-4); }
.filters { align-items: flex-end; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-bottom: var(--s-4); }
.filters label { display: grid; gap: 4px; font-weight: 600; color: var(--brand-900); }
.filters select { min-height: 44px; padding: 8px 12px; border: 1.5px solid #CFCCE0; border-radius: 10px; background: #fff; }

/* tables & kpis */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 15px; }
.table th { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table td a { font-weight: 700; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); margin-bottom: var(--s-5); }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s-4) var(--s-5); text-decoration: none; display: grid; gap: 2px; }
.kpi strong { font-family: var(--font-head); font-size: 32px; color: var(--brand-900); }
.kpi span { color: var(--ink-3); font-weight: 600; }
.kpi:hover { border-color: var(--brand-600); }
.kpi--alert { border: 2px solid var(--accent-500); background: #F1FBFB; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(5, 1fr); } }
.transfer__amount { font-size: 16px; color: var(--ink); }
.transfer__amount strong { font-family: var(--font-head); font-size: 20px; color: var(--brand-900); }
.transfer__receipt .file--img img { width: 180px; height: auto; max-height: 260px; object-fit: contain; background: #fff; }
.plain-list { display: grid; gap: 8px; }
.danger-zone { display: flex; flex-wrap: wrap; gap: 10px; margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px dashed var(--line); }
.stars { color: #E2A400; font-size: 20px; letter-spacing: 2px; }
.rating { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rating legend { margin-bottom: 8px; font-weight: 600; }

/* classes, payments, registers */
.badge--bad { background: #FDE8E8; color: #A51F1F; }
.kpi--bad { border: 2px solid var(--danger); background: #FFF6F6; }
.alert { display: grid; gap: 10px; border-radius: var(--radius-lg); padding: var(--s-4) var(--s-5); margin-bottom: var(--s-4); border: 1px solid; }
@media (min-width: 768px) { .alert { grid-template-columns: 1fr auto; align-items: center; } }
.alert p { margin-top: 4px; color: var(--ink-2); }
.alert--warn { background: #FFF8E6; border-color: #F2D48A; }
.alert--bad { background: #FFF1F1; border-color: #F3B4B4; }
.status-card { border-left: 6px solid var(--line); display: grid; gap: var(--s-3); }
.status-card--ok { border-left-color: #2E9E6B; }
.status-card--warn { border-left-color: #E2A400; }
.status-card--bad { border-left-color: var(--danger); }
.pass__body { display: grid; gap: var(--s-5); align-items: center; }
@media (min-width: 560px) { .pass__body { grid-template-columns: 200px 1fr; } }
.pass__qr { width: 200px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px; justify-self: center; }
.pass__qr svg { display: block; width: 100%; height: auto; }
.pass__label { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.pass__code, .code-lg { font-family: var(--font-head); font-weight: 800; letter-spacing: .18em; color: var(--brand-900); }
.pass__code { font-size: 40px; line-height: 1.1; margin: 4px 0 8px; }
.code-lg { font-size: 18px; background: var(--brand-50); padding: 2px 10px; border-radius: 8px; }
.att-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.att-day { display: grid; gap: 2px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 13px; color: var(--ink-3); }
.att-day strong { font-size: 15px; color: var(--brand-900); }
.att-day__wk { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.att-day--present, .att-day--late { background: #EAF7F0; border-color: #A8DCC0; }
.att-day--absent, .att-day--missed { background: #FFF1F1; border-color: #F3C4C4; }
.att-table { min-width: 0; }
.att-table th, .att-table td { padding: 8px 10px; }
.att-table__day { text-align: center !important; white-space: nowrap; }
.att-table__day.is-today { color: var(--brand-700); }
.att-table__cell { text-align: center !important; }
.att-btn { width: 40px; height: 40px; border-radius: 10px; border: 1.5px solid #CFCCE0; background: #fff; font-weight: 800; font-size: 17px; cursor: pointer; }
.att-btn:disabled { opacity: .35; cursor: not-allowed; }
.att-btn--present { background: #2E9E6B; border-color: #2E9E6B; color: #fff; }
.att-btn--absent { background: var(--danger); border-color: var(--danger); color: #fff; }
.att-btn--late { background: #E2A400; border-color: #E2A400; color: #fff; }
.table--compact { min-width: 560px; }
.table--compact th, .table--compact td { padding: 9px 12px; font-size: 14px; }
.table__note td { font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); }
.checkin-form input { font-family: var(--font-head); font-weight: 800; font-size: 24px; letter-spacing: .2em; text-transform: uppercase; }
.ck { display: grid; gap: var(--s-5); margin-top: var(--s-4); padding: var(--s-5); border-radius: var(--radius-lg); border: 3px solid; align-items: start; }
@media (min-width: 640px) { .ck { grid-template-columns: auto 1fr; } }
.ck--ok { border-color: #2E9E6B; background: #F1FAF5; }
.ck--warn { border-color: #E2A400; background: #FFF9EA; }
.ck--bad { border-color: var(--danger); background: #FFF3F3; }
.ck__info { display: grid; gap: 8px; justify-items: start; }
.ck__verdict { font-family: var(--font-head); font-weight: 800; font-size: 22px; text-transform: uppercase; letter-spacing: .04em; }
.ck--ok .ck__verdict { color: #1F7A50; }
.ck--warn .ck__verdict { color: #8A6400; }
.ck--bad .ck__verdict { color: #A51F1F; }
.ck__name { font-size: 26px; }
.ck__warn { font-weight: 700; color: #8A6400; }
.disclosure { margin-top: var(--s-4); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s-3) var(--s-4); }
.disclosure summary { cursor: pointer; font-weight: 700; color: var(--brand-700); min-height: 32px; display: flex; align-items: center; }
.disclosure[open] summary { margin-bottom: var(--s-4); }
.sig-row { display: grid; gap: var(--s-4); align-items: center; margin-bottom: var(--s-4); }
@media (min-width: 640px) { .sig-row { grid-template-columns: 280px 1fr; } }
.sig-box { height: 120px; border: 1.5px dashed #CFCCE0; border-radius: 12px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.sig-box img { max-height: 110px; max-width: 100%; }
.sticky-save { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; }
.sticky-save .btn { box-shadow: var(--shadow-lg); }
.choice.field--full { grid-column: 1 / -1; }

/* =========================================================
   Colourful portal theme (deep logo gradients, role colours)
   ========================================================= */
.page-portal {
  --role-grad: linear-gradient(120deg, #4A0E8F 0%, #8A25B5 50%, #DB2777 100%);
  --role-soft: #F6ECFF; --role-ink: #6A12A8;
  background:
    radial-gradient(900px 600px at 0% 0%, rgba(170, 58, 206, .16), transparent 60%),
    radial-gradient(800px 600px at 100% 20%, rgba(52, 193, 191, .16), transparent 60%),
    radial-gradient(900px 700px at 40% 100%, rgba(247, 178, 103, .14), transparent 60%),
    #F7F2FF;
  background-attachment: fixed;
}
/* Students: playful violet → pink → orange. Teachers: calm teal → purple. Director: deep purple with gold. */
.page-portal[data-role="student"]  { --role-grad: linear-gradient(120deg, #8A25B5 0%, #DB2777 52%, #FF9F43 100%); --role-soft: #FFF0F7; --role-ink: #B4207A; }
.page-portal[data-role="teacher"]  { --role-grad: linear-gradient(120deg, #0E7490 0%, #34C1BF 45%, #8A25B5 100%); --role-soft: #E8FAF9; --role-ink: #0E7490; }
.page-portal[data-role="director"] { --role-grad: linear-gradient(120deg, #1C0340 0%, #4A0E8F 45%, #8A25B5 80%, #E8B23A 140%); --role-soft: #F3ECFF; --role-ink: #4A0E8F; }

/* Sign-in, sign-up, password & photo screens: deep gradient with glows */
.page-portal[data-view]:not([data-view="app"]) {
  background:
    radial-gradient(600px 500px at 10% 20%, rgba(52, 193, 191, .45), transparent 60%),
    radial-gradient(700px 600px at 90% 80%, rgba(219, 39, 119, .40), transparent 60%),
    radial-gradient(500px 400px at 80% 10%, rgba(255, 217, 61, .25), transparent 60%),
    linear-gradient(150deg, #1C0340 0%, #3A0C78 40%, #6A12A8 75%, #8A25B5 100%);
  background-attachment: fixed;
}
.page-portal[data-view]:not([data-view="app"]) .back-link { color: var(--brand-700); }
.auth__card { position: relative; overflow: hidden; border: 0; box-shadow: 0 30px 80px rgba(20, 0, 50, .45), 0 0 0 1px rgba(255,255,255,.4);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); }
.auth__card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; background: var(--rainbow); }
.auth__title { background: linear-gradient(110deg, #4A0E8F, #8A25B5 40%, #DB2777 75%, #FF9F43); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth__card .btn--primary { background: linear-gradient(120deg, #5E0FA0, #8A25B5 45%, #DB2777); background-size: 180% 100%; }
.auth__card .btn--primary:hover { background-position: 100% 50%; }
.auth__alt .btn--outline { border-color: #34C1BF; color: #0E7490; }
.auth__alt .btn--outline:hover { background: #E8FAF9; }

/* Header bits */
#logout { white-space: nowrap; }
@media (max-width: 560px) { .page-portal .header__inner:has(.portal-user:not([hidden])) .brand__sub { display: none; } }
.role-badge { background: var(--role-grad); color: #fff; }
.role-badge[data-role="director"], .role-badge[data-role="teacher"] { background: var(--role-grad); color: #fff; }
.avatar-btn { border: 0; padding: 2px; background: var(--rainbow); }
.avatar-btn__img, .avatar-btn__initials { border-radius: 50%; background: #fff; }
.avatar-btn__initials { width: 100%; height: 100%; display: grid; place-items: center; }

/* Navigation: colourful dots, gradient active pill */
.app__nav a { position: relative; gap: 10px; transition: transform .15s var(--ease-out), box-shadow .2s, background .2s; }
.app__nav a::before { content: ""; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--dot, #8A25B5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, #8A25B5) 18%, transparent); }
.app__nav a:nth-child(8n+1) { --dot: #8A25B5; } .app__nav a:nth-child(8n+2) { --dot: #DB2777; }
.app__nav a:nth-child(8n+3) { --dot: #FF9F43; } .app__nav a:nth-child(8n+4) { --dot: #34C1BF; }
.app__nav a:nth-child(8n+5) { --dot: #339DC7; } .app__nav a:nth-child(8n+6) { --dot: #4CD964; }
.app__nav a:nth-child(8n+7) { --dot: #FFD93D; } .app__nav a:nth-child(8n+8) { --dot: #FF5A5F; }
.app__nav a:hover { transform: translateX(3px); box-shadow: 0 6px 16px rgba(138, 37, 181, .12); }
.app__nav a.is-active { background: var(--role-grad); border-color: transparent; color: #fff; box-shadow: 0 10px 24px rgba(106, 18, 168, .3); }
.app__nav a.is-active::before { background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
@media (max-width: 1023px) { .app__nav a:hover { transform: translateY(-2px); } }

/* Page header becomes a colourful welcome banner */
.page-head { position: relative; overflow: hidden; background: var(--role-grad); color: #fff; border-radius: var(--radius-lg);
  padding: var(--s-5) var(--s-5) var(--s-5); box-shadow: 0 18px 40px rgba(74, 14, 143, .22); }
.page-head::before, .page-head::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.page-head::before { width: 220px; height: 220px; right: -60px; top: -90px; background: radial-gradient(circle, rgba(255,255,255,.28), transparent 70%); }
.page-head::after { width: 160px; height: 160px; left: 38%; bottom: -110px; background: radial-gradient(circle, rgba(255, 217, 61, .35), transparent 70%); }
.page-head > * { position: relative; z-index: 1; }
.page-portal .page-title { color: #fff; text-shadow: 0 2px 12px rgba(20, 0, 50, .2); }
.page-sub { color: rgba(255,255,255,.88); }
.page-sub strong { color: #fff; }
.page-sub code { background: rgba(255,255,255,.2) !important; color: #fff !important; }
.page-head .btn--primary { background: #fff; color: var(--role-ink); box-shadow: 0 8px 20px rgba(20, 0, 50, .2); }
.page-head .btn--outline { border-color: rgba(255,255,255,.75); color: #fff; }
.page-head .btn--outline:hover { background: rgba(255,255,255,.15); }

/* Panels with a rainbow top edge */
.panel { position: relative; overflow: hidden; border-color: rgba(138, 37, 181, .12); box-shadow: 0 10px 30px rgba(74, 14, 143, .07); }
.panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--rainbow); opacity: .9; }
.page-portal .panel__title { color: var(--role-ink); }
.empty { background: linear-gradient(135deg, var(--role-soft), #fff); border: 1.5px dashed rgba(138, 37, 181, .2); }

/* KPI tiles: each a different deep gradient */
.kpi { position: relative; overflow: hidden; border: 0; color: #fff; box-shadow: 0 12px 28px rgba(74, 14, 143, .18); transition: transform .2s var(--ease-out), box-shadow .2s; }
.kpi strong, .kpi span { color: #fff; position: relative; }
.kpi span { opacity: .9; }
.kpi::after { content: ""; position: absolute; width: 120px; height: 120px; right: -40px; top: -40px; border-radius: 50%; background: rgba(255,255,255,.16); }
.kpi:nth-child(6n+1) { background: linear-gradient(135deg, #4A0E8F, #8A25B5); }
.kpi:nth-child(6n+2) { background: linear-gradient(135deg, #B4207A, #DB2777 55%, #FF9F43); }
.kpi:nth-child(6n+3) { background: linear-gradient(135deg, #0E7490, #34C1BF); }
.kpi:nth-child(6n+4) { background: linear-gradient(135deg, #1D4ED8, #339DC7); }
.kpi:nth-child(6n+5) { background: linear-gradient(135deg, #15803D, #4CD964); }
.kpi:nth-child(6n+6) { background: linear-gradient(135deg, #B45309, #F7B267); }
.kpi:hover { transform: translateY(-4px); box-shadow: 0 18px 36px rgba(74, 14, 143, .26); border: 0; }
.kpi--alert { outline: 3px solid #FFD93D; outline-offset: 2px; }
.kpi--bad { outline: 3px solid #FF5A5F; outline-offset: 2px; }

/* Buttons inside the portal follow the role colours */
.page-portal .app .btn--primary { background: var(--role-grad); background-size: 160% 100%; }
.page-portal .app .btn--primary:hover { background-position: 100% 50%; }
.page-portal .app .page-head .btn--primary { background: #fff; }

/* Calendar & badges */
.lesson--today { border-color: transparent; background: linear-gradient(#fff, #fff) padding-box, var(--role-grad) border-box; border: 2px solid transparent; box-shadow: 0 8px 22px rgba(138, 37, 181, .16); }
.badge--today, .date-chip.is-today { background: linear-gradient(120deg, #FFD93D, #FF9F43); color: #3A1A00; }
.lessons__week { background: linear-gradient(90deg, #8A25B5, #DB2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.count { background: var(--role-grad); color: #fff; }
.tag { background: var(--role-soft); color: var(--role-ink); }
.avatar { box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(170, 58, 206, .35); }
.avatar--xl { border: 0; box-shadow: 0 0 0 4px #fff, 0 0 0 8px transparent, 0 14px 30px rgba(74, 14, 143, .25); outline: 4px solid; outline-color: #AA3ACE; outline-offset: 4px; }
.pass { background: linear-gradient(160deg, #fff 0%, var(--role-soft) 100%); }
.pass__code { background: var(--role-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.status-card--ok { background: linear-gradient(135deg, #fff 60%, #EAF7F0); }
.status-card--warn { background: linear-gradient(135deg, #fff 60%, #FFF6E0); }
.ck--ok { background: linear-gradient(160deg, #F1FAF5, #DDF5E7); }
.toast { background: var(--role-grad, #2B0660); }
.modal__head { border-bottom: 0; }
.modal__head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--rainbow); }
.modal::backdrop { background: rgba(28, 3, 64, .6); backdrop-filter: blur(3px); }

/* modal & toast */
.modal { border: 0; border-radius: var(--radius-xl); padding: 0; width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(28,3,64,.55); }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal__title { font-size: 20px; }
.modal__close { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--surface-2); font-size: 18px; cursor: pointer; }
.modal__body { padding: var(--s-5); display: grid; gap: var(--s-4); }
.modal__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.creds { margin: 0; display: grid; gap: 8px; background: var(--brand-50); border-radius: var(--radius); padding: var(--s-4); }
.creds div { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.creds dt { color: var(--ink-3); }
.creds dd { margin: 0; }
.creds code { font-size: 20px; font-weight: 800; color: var(--brand-900); letter-spacing: .04em; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2000; background: var(--brand-900); color: #fff; padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; max-width: calc(100vw - 32px); }
.toast[data-type="error"] { background: var(--danger); }

/* =========================================================
   Director layout: app bar · slide-in drawer · bottom tab bar
   ========================================================= */
.ic { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.appbar-btn { position: relative; width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; border: 0; border-radius: 12px; background: transparent; color: var(--brand-900); cursor: pointer; text-decoration: none; }
.appbar-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.appbar-btn:hover, .appbar-btn.is-active { background: var(--role-soft); color: var(--role-ink); }
.appbar-title { font-family: var(--font-head); font-weight: 800; font-size: 20px; color: var(--brand-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: linear-gradient(120deg, #DB2777, #FF5A5F); color: #fff; font-size: 11.5px; font-weight: 800; line-height: 1; box-shadow: 0 0 0 2px #fff; }
.appbar-bell .nav-badge { position: absolute; top: 2px; right: 0; }

/* Drawer contents (grouped sections) */
.drawer__head, .drawer__foot, .drawer__group { display: none; }
.app__nav--drawer a .nav-badge { margin-left: auto; }
.app__nav--drawer a.is-active .nav-badge { background: #fff; color: var(--role-ink); box-shadow: none; }
.drawer__foot button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 12px; background: transparent; font: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; text-align: left; }
.drawer__foot button:hover { background: var(--role-soft); color: var(--role-ink); }
.drawer__foot [data-action="logout"] { color: var(--danger); }

body.has-appbar .app__nav--drawer { display: flex; flex-direction: column; gap: 2px; }
body.has-appbar .app__nav--drawer a { gap: 12px; border: 0; background: transparent; padding: 10px 14px; }
body.has-appbar .app__nav--drawer a::before { content: none; }
body.has-appbar .app__nav--drawer a .ic { color: var(--role-ink); }
body.has-appbar .app__nav--drawer a:hover { background: var(--role-soft); color: var(--role-ink); box-shadow: none; transform: none; }
body.has-appbar .app__nav--drawer a.is-active { background: var(--role-grad); color: #fff; }
body.has-appbar .app__nav--drawer a.is-active .ic { color: #fff; }
body.has-appbar .drawer__group { display: block; margin: 14px 14px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
body.has-appbar .drawer__group:first-of-type { margin-top: 4px; }

/* Bottom tab bar (phones & tablets) */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); backdrop-filter: saturate(1.4) blur(10px);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(74, 14, 143, .08); }
.tabbar a, .tabbar button { position: relative; display: grid; justify-items: center; gap: 3px; padding: 7px 2px 6px; min-height: 56px; border: 0; border-radius: 16px;
  background: transparent; color: var(--ink-3); font: inherit; font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; }
.tabbar a:hover, .tabbar button:hover { color: var(--role-ink); }
.tabbar a.is-active { background: var(--role-soft); color: var(--role-ink); box-shadow: inset 0 0 0 1px rgba(138, 37, 181, .15); }
.tabbar a.is-active .ic { stroke-width: 2.2; }
.tabbar .nav-badge { position: absolute; top: 2px; left: calc(50% + 4px); }
.drawer-scrim { position: fixed; inset: 0; z-index: 140; background: rgba(28, 3, 64, .5); backdrop-filter: blur(2px); }

@media (max-width: 1023px) {
  body.has-appbar .header__inner { justify-content: flex-start; gap: 6px; }
  body.has-appbar .brand, body.has-appbar .role-badge, body.has-appbar #logout, body.has-appbar .portal-user__name { display: none; }
  body.has-appbar .appbar-title { flex: 1; margin-left: 4px; }
  body.has-appbar .portal-user { gap: 4px; }
  body.has-appbar .avatar-btn { width: 40px; height: 40px; margin-left: 4px; }
  body.has-appbar .app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.has-appbar .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  body.has-appbar .sticky-save { bottom: calc(88px + env(safe-area-inset-bottom)); }
  /* The section list becomes a drawer that slides in from the left */
  body.has-appbar .app__nav--drawer { position: fixed; top: 0; bottom: 0; left: 0; z-index: 150; width: min(320px, 86vw); overflow-y: auto; overscroll-behavior: contain;
    padding: 0 12px calc(16px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 20px 0 60px rgba(28, 3, 64, .3);
    transform: translateX(-105%); visibility: hidden; transition: transform .28s var(--ease-out), visibility 0s .28s; }
  body.drawer-open .app__nav--drawer { transform: none; visibility: visible; transition: transform .28s var(--ease-out); }
  body.drawer-open { overflow: hidden; }
  body.has-appbar .drawer__head { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 1; margin: 0 -12px 8px; padding: 18px 12px 18px 18px;
    background: var(--role-grad); color: #fff; }
  body.has-appbar .drawer__head .avatar { box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
  .drawer__who { display: grid; min-width: 0; flex: 1; }
  .drawer__who strong { font-family: var(--font-head); font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .drawer__who small { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #FFD98A; }
  .drawer__close { color: #fff; }
  .drawer__close:hover { background: rgba(255,255,255,.15); color: #fff; }
  body.has-appbar .drawer__foot { display: grid; gap: 2px; margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
}
@media (min-width: 1024px) {
  .tabbar, .drawer-scrim, .appbar-menu, .appbar-title { display: none !important; }
  body.has-appbar .app { grid-template-columns: 260px 1fr; }
  body.has-appbar .app__nav--drawer a { white-space: nowrap; }
  body.has-appbar .app__nav--drawer { background: #fff; border: 1px solid rgba(138, 37, 181, .12); border-radius: var(--radius-lg); padding: 10px; box-shadow: 0 10px 30px rgba(74, 14, 143, .07);
    max-height: calc(100dvh - var(--header-h) - 32px); overflow-y: auto; }
  body.has-appbar .drawer__foot { display: grid; gap: 2px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
  body.has-appbar .drawer__foot [data-action="logout"] { display: none; } /* Sign out is in the header on desktop */
}

/* Director home: dashboard card like the reference (eyebrow, welcome, inline stats) */
.page-head--hero { display: block; padding: var(--s-6) var(--s-5); border-radius: var(--radius-xl); }
.page-eyebrow { font-size: 13px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: #FFD98A; margin-bottom: 10px; }
.page-head--hero .page-title { font-size: clamp(1.8rem, 5vw, 2.4rem); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: var(--s-5); }
.hero-stats a { color: #fff; font-weight: 600; text-decoration: underline; text-decoration-color: rgba(255,255,255,.55); text-underline-offset: 4px; }
.hero-stats a:hover { text-decoration-color: #FFD98A; }
.hero-stats strong { font-family: var(--font-head); font-weight: 800; margin-right: 2px; }

/* =========================================================
   Extra features
   ========================================================= */
.page-head { gap: var(--s-3); }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.panel__link { margin-left: auto; font-size: 15px; font-weight: 700; color: #E58A2E; text-decoration: none; }
.panel__link:hover { text-decoration: underline; }
.panel__action { margin-left: auto; }
.grid-2 { display: grid; gap: 0 var(--s-5); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.kpis--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .kpis.kpis--4 { grid-template-columns: repeat(4, 1fr); } }
.steps { padding-left: 22px; display: grid; gap: 8px; list-style: decimal; }

/* theme toggle */
.theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: none; }
html[data-theme="dark"] .theme-moon { display: block; }

/* device reminders card (like the reference) */
.device-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 18px; margin-bottom: var(--s-4); border-radius: var(--radius-lg);
  background: var(--surface, #fff); border: 1.5px solid rgba(138, 37, 181, .18); box-shadow: 0 10px 30px rgba(74, 14, 143, .06); }
.device-card > .ic { color: var(--role-ink); }
.device-card p { flex: 1 1 180px; margin: 0; color: var(--ink-2); }
.device-card__actions { display: flex; gap: 6px; align-items: center; }
.device-card--on { border-color: #2E9E6B; background: linear-gradient(135deg, #F1FAF5, #fff 70%); }
.device-card--on .device-card__tick { color: #2E9E6B; width: 26px; height: 26px; stroke-width: 2.4; }
.device-card--off { opacity: .9; }

/* today & next classes */
.agenda__row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.agenda__row:first-of-type { border-top: 0; padding-top: 0; }
.agenda__row:hover strong { color: var(--role-ink); }
.date-box { flex: none; width: 64px; display: grid; justify-items: center; padding: 8px 0; border-radius: 14px; background: var(--role-soft); color: var(--role-ink); line-height: 1.1; }
.date-box small { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.date-box strong { font-family: var(--font-head); font-size: 26px; font-weight: 800; }
.date-box.is-hot { background: linear-gradient(160deg, #FF7A1A, #D9480F); color: #fff; box-shadow: 0 8px 20px rgba(217, 72, 15, .3); }
.agenda__body { display: grid; gap: 3px; min-width: 0; }
.agenda__kicker { font-size: 12.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #E58A2E; }
.agenda__body strong { font-family: var(--font-head); font-size: 17px; color: var(--ink); }
.agenda__text { font-size: 14px; color: var(--ink-3); }

/* income charts (single hue, hover values, table view) */
.colchart { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; align-items: end; height: 220px; padding-top: 24px; border-bottom: 1px solid var(--line); }
.colchart__col { position: relative; height: 100%; display: grid; grid-template-rows: auto 1fr auto; justify-items: center; align-items: end; outline: none; }
.colchart__val { font-size: 12.5px; font-weight: 700; color: var(--ink-2); min-height: 18px; }
.colchart__bar { width: min(48px, 70%); align-self: end; background: #B98AE0; border-radius: 4px 4px 0 0; transition: background .15s; }
.colchart__col.is-current .colchart__bar { background: #6A12A8; }
.colchart__col:hover .colchart__bar, .colchart__col:focus-visible .colchart__bar { background: #4A0E8F; }
.colchart__lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 6px 0 4px; }
.colchart__col:hover::after, .colchart__col:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% - 8px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--brand-900); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow); z-index: 2; pointer-events: none; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.hbar__label { color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__track { height: 12px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.hbar__fill { display: block; height: 100%; background: #8A25B5; border-radius: 0 4px 4px 0; }
.hbar__val { font-weight: 700; color: var(--ink); min-width: 52px; text-align: right; }
.perf__bar { display: inline-block; vertical-align: middle; width: 54px; height: 8px; margin-right: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.perf__bar span { display: block; height: 100%; background: #8A25B5; border-radius: 0 4px 4px 0; }
.stars--sm { font-size: 14px; letter-spacing: 1px; }

/* search */
.search { display: grid; gap: var(--s-3); }
.search__input { width: 100%; min-height: 52px; padding: 12px 16px; border: 1.5px solid #CFCCE0; border-radius: 14px; font-size: 17px; background: var(--surface, #fff); color: var(--ink); }
.search__input:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(138,37,181,.15); }
.search__results { display: grid; gap: 4px; min-height: 120px; }
.search__group { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 8px 0 2px; }
.search__row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.search__row:hover, .search__row:focus-visible { background: var(--role-soft); }
.search__row > .ic { color: var(--role-ink); width: 32px; }
.search__row span { display: grid; min-width: 0; }
.search__row small { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* WhatsApp one-by-one */
.stepper { display: grid; gap: 8px; }
.stepper__bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.stepper__bar span { display: block; height: 100%; background: linear-gradient(90deg, #25D366, #128C7E); transition: width .3s; }
.stepper__count { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.stepper__name { font-size: 22px; }
.stepper__msg { background: #E7FCE3; color: #1d2b1a; border-radius: 12px 12px 12px 2px; padding: 12px 14px; white-space: normal; overflow-wrap: anywhere; }
.stepper [data-step-send] { background: #1FA855; }
.stepper-done { display: grid; justify-items: center; gap: 12px; text-align: center; padding: var(--s-4) 0; }
.stepper-done .ic { width: 48px; height: 48px; color: #1FA855; }
.disclosure-panel > summary { cursor: pointer; list-style: none; margin-bottom: 0; }
.disclosure-panel > summary::-webkit-details-marker { display: none; }
.disclosure-panel > summary::after { content: "+"; margin-left: auto; font-size: 22px; line-height: 1; }
.disclosure-panel[open] > summary { margin-bottom: var(--s-4); }
.disclosure-panel[open] > summary::after { content: "–"; }

/* journals & streaks */
.streak-card { display: flex; gap: 14px; align-items: center; padding: 14px 18px; margin-bottom: var(--s-4); border-radius: var(--radius-lg); background: var(--surface, #fff); border: 1.5px dashed rgba(138, 37, 181, .25); }
.streak-card p { margin: 2px 0 0; color: var(--ink-2); font-size: 14.5px; }
.streak-card strong { font-family: var(--font-head); font-size: 18px; color: var(--ink); }
.streak-card__flame { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); color: var(--ink-3); flex: none; }
.streak-card.is-on { border-style: solid; border-color: #FF9F43; background: linear-gradient(135deg, #FFF4E6, var(--surface, #fff) 70%); }
.streak-card.is-on .streak-card__flame { background: linear-gradient(160deg, #FFB347, #FF6A00); color: #fff; }
.streaks { display: grid; gap: 8px; list-style: none; padding: 0; counter-reset: s; }
.streaks li { display: flex; align-items: center; justify-content: space-between; gap: 10px; counter-increment: s; }
.streaks li::before { content: counter(s); width: 22px; font-weight: 800; color: var(--ink-3); }
.streaks .who { flex: 1; text-decoration: none; color: var(--ink); font-weight: 600; }
.streak-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: #FFF1E0; color: #B4490A; font-weight: 800; font-size: 13px; }
.streak-pill .ic { width: 16px; height: 16px; }

/* chat */
.chat { display: grid; gap: var(--s-4); }
.chat .panel { margin: 0; }
.chat__title { font-size: 24px; margin-bottom: var(--s-3); }
.chat__search { width: 100%; min-height: 44px; padding: 8px 14px; border: 1.5px solid #CFCCE0; border-radius: 12px; margin-bottom: var(--s-3); background: var(--surface, #fff); color: var(--ink); font-size: 15px; }
.chat__rows { display: grid; gap: 2px; max-height: calc(100dvh - 300px); overflow-y: auto; margin: 0 -8px; }
.chat-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 14px; text-decoration: none; color: var(--ink); }
.chat-row:hover { background: var(--role-soft); }
.chat-row.is-active { background: var(--role-soft); box-shadow: inset 3px 0 0 var(--role-ink); }
.chat-row__body { flex: 1; display: grid; gap: 2px; min-width: 0; }
.chat-row__top { display: flex; justify-content: space-between; gap: 8px; }
.chat-row__top small { color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.chat-row__last { font-size: 14px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__thread { display: none; padding: 0; flex-direction: column; min-height: 60dvh; }
.chat--thread .chat__list { display: none; }
.chat--thread .chat__thread { display: flex; }
.chat__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat__who { flex: 1; display: grid; }
.chat__who small { color: var(--ink-3); font-size: 12.5px; }
.chat__msgs { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 16px; overflow-y: auto; max-height: calc(100dvh - 330px); min-height: 280px; }
.chat__empty { margin: auto; color: var(--ink-3); }
.bubble { max-width: min(78%, 520px); align-self: flex-start; background: var(--surface-2); color: var(--ink); padding: 9px 13px; border-radius: 16px 16px 16px 4px; }
.bubble p { margin: 0; overflow-wrap: anywhere; }
.bubble time { display: block; margin-top: 3px; font-size: 11.5px; color: var(--ink-3); }
.bubble--me { align-self: flex-end; background: var(--role-grad); color: #fff; border-radius: 16px 16px 4px 16px; }
.bubble--me time { color: rgba(255,255,255,.8); text-align: right; }
.chat__form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); }
.chat__form textarea { flex: 1; resize: none; min-height: 46px; max-height: 160px; padding: 11px 14px; border: 1.5px solid #CFCCE0; border-radius: 14px; font: inherit; font-size: 16px; background: var(--surface, #fff); color: var(--ink); }
.chat__form textarea:focus { outline: none; border-color: var(--brand-600); }
.chat__send { width: 48px; height: 46px; min-height: 46px; padding: 0; display: grid; place-items: center; border-radius: 14px; }
.chat__send .ic { width: 20px; height: 20px; }
.chat__placeholder { margin: auto; display: grid; justify-items: center; gap: 8px; color: var(--ink-3); padding: 40px; }
.chat__placeholder .ic { width: 44px; height: 44px; }
@media (min-width: 1024px) {
  .chat { grid-template-columns: 320px 1fr; align-items: stretch; }
  .chat--thread .chat__list, .chat__list { display: block; }
  .chat__thread { display: flex; }
  .chat__back { display: none; }
}
.report-inline { margin-bottom: var(--s-5); }
.report-inline .rep { box-shadow: 0 10px 30px rgba(74, 14, 143, .08); }
.app__nav:not(.app__nav--drawer) a .nav-badge { margin-left: auto; }

/* =========================================================
   Student "action required" popups (full screen)
   ========================================================= */
body.gate-open { overflow: hidden; }
.gate { position: fixed; inset: 0; z-index: 2500; overflow-y: auto; overscroll-behavior: contain; padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
  color: #F3ECFF; display: grid; place-items: start center;
  background: radial-gradient(600px 420px at 10% 0%, rgba(52, 193, 191, .28), transparent 60%), radial-gradient(700px 520px at 100% 100%, rgba(219, 39, 119, .30), transparent 60%),
    linear-gradient(160deg, #12021F 0%, #1C0340 45%, #2E0A5E 100%);
  animation: gate-in .35s var(--ease-out); }
.gate--pay { background: radial-gradient(600px 420px at 90% 0%, rgba(255, 159, 67, .30), transparent 60%), radial-gradient(700px 520px at 0% 100%, rgba(219, 39, 119, .28), transparent 60%),
    linear-gradient(160deg, #12021F 0%, #1C0340 45%, #2E0A5E 100%); }
@keyframes gate-in { from { opacity: 0; } to { opacity: 1; } }
.gate__card { width: 100%; max-width: 560px; display: grid; gap: 16px; outline: none; }
.gate__card.is-shake { animation: gate-shake .5s cubic-bezier(.36, .07, .19, .97); }
@keyframes gate-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
.gate__head { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 8px 0 18px; border-bottom: 3px solid; border-image: linear-gradient(90deg, #8A25B5, #DB2777, #FF9F43, #34C1BF) 1; }
.gate__logo { justify-self: start; width: 64px; height: 64px; border-radius: 16px; background: #fff; padding: 6px; box-shadow: 0 12px 30px rgba(0, 0, 0, .4); }
.gate__badge { padding: 6px 14px; border-radius: 999px; background: linear-gradient(120deg, #DB2777, #FF5A5F); color: #fff; font-size: 12.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; box-shadow: 0 6px 18px rgba(219, 39, 119, .4); }
.gate--pay .gate__badge { background: linear-gradient(120deg, #FF9F43, #DB2777); }
.gate__title { color: #fff; font-size: clamp(1.35rem, 5vw, 1.75rem); font-weight: 800; letter-spacing: -.01em; }
.gate__sub { color: rgba(243, 236, 255, .85); max-width: 46ch; }
.gate__sub strong { color: #fff; }
.gate__amount { font-family: var(--font-head); font-size: clamp(2rem, 9vw, 2.8rem); font-weight: 800; color: #FFD98A; line-height: 1; }
.gate__chip { padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .12); color: #fff; font-size: 13.5px; font-weight: 700; }
.gate__steps { display: grid; gap: 14px; }
.gate-step { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 16px; border-radius: 20px; background: rgba(255, 255, 255, .05); border: 1.5px solid #DB2777; box-shadow: 0 0 0 4px rgba(219, 39, 119, .08); }
.gate--pay .gate-step { border-color: #FF9F43; box-shadow: 0 0 0 4px rgba(255, 159, 67, .08); }
.gate-step.is-done { border-color: rgba(76, 217, 100, .6); box-shadow: none; background: rgba(76, 217, 100, .06); }
.gate-step__num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(140deg, #DB2777, #8A25B5); color: #fff; font-weight: 800; }
.gate--pay .gate-step__num { background: linear-gradient(140deg, #FF9F43, #DB2777); }
.gate-step__num .ic { width: 18px; height: 18px; }
.gate-step.is-done .gate-step__num { background: #2E9E6B; }
.gate-step__main { display: grid; gap: 10px; min-width: 0; }
.gate-step__title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: #fff; font-size: 17px; }
.gate-step__title .ic { width: 20px; height: 20px; color: #E9C9FF; }
.gate-step__ok { font-family: var(--font-body); font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: rgba(76, 217, 100, .2); color: #9FF0B4; }
.gate-step__text { color: rgba(243, 236, 255, .78); font-size: 15px; }
.gate .btn--primary { background: linear-gradient(120deg, #8A25B5, #DB2777); color: #fff; border: 0; }
.gate--pay .btn--primary { background: linear-gradient(120deg, #FF9F43, #DB2777); }
.btn--gate { background: transparent; color: #FFB3D1; border: 1.5px solid #DB2777; }
.btn--gate:hover { background: rgba(219, 39, 119, .12); }
.btn--block { width: 100%; justify-content: center; text-align: center; }
.gate-tip { background: rgba(0, 0, 0, .28); border-radius: 12px; padding: 12px 14px; font-size: 14.5px; color: rgba(243, 236, 255, .9); }
.gate-tip strong { color: #fff; }
.gate-tip--bad { background: rgba(198, 40, 40, .2); border: 1px solid rgba(255, 90, 95, .35); }
.kbd { display: inline-grid; place-items: center; min-width: 20px; padding: 0 4px; border-radius: 6px; background: rgba(255, 255, 255, .15); font-weight: 800; }
.gate__status { text-align: center; padding: 14px; border-radius: 16px; background: rgba(255, 159, 67, .16); color: #FFE2C2; font-weight: 700; }
.gate__status--ok { background: rgba(76, 217, 100, .15); color: #B8F5C7; }
.gate__skip { justify-self: center; background: none; border: 0; color: rgba(243, 236, 255, .75); text-decoration: underline; text-underline-offset: 4px; font: inherit; font-size: 14.5px; padding: 10px 14px; min-height: 44px; cursor: pointer; }
.gate__skip[aria-disabled="true"] { opacity: .45; cursor: not-allowed; text-decoration: none; }
.gate__skip.is-flash { animation: gate-flash .6s; }
@keyframes gate-flash { 30% { color: #FF9F43; opacity: 1; transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .gate, .gate__card.is-shake, .gate__skip.is-flash { animation: none; } }
/* the profile / photo window opens on top of the popup */
body.gate-open .modal { z-index: 3000; }

/* =========================================================
   Dark mode (sun / moon in the top bar)
   ========================================================= */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] .page-portal {
  --ink: #ECE8F7; --ink-2: #CFC8E3; --ink-3: #A39CBB; --line: #2F2748;
  --surface: #1B1331; --surface-2: #150E28;
  --brand-900: #EFE6FF; --brand-700: #DCC6FF; --brand-600: #C08BFF; --brand-500: #CF9CFF; --brand-100: #33245A; --brand-50: #241A42;
  --role-soft: #2B1D4B; --role-ink: #D7B8FF;
  --home-tint: #1C3326; --home-ink: #8FE0AE; --robot-tint: #3A2615; --robot-ink: #FFC08A; --code-tint: #1B2647; --code-ink: #A9C2FF; --swim-tint: #123540; --swim-ink: #8EE3F5;
  background: radial-gradient(900px 600px at 0% 0%, rgba(170, 58, 206, .18), transparent 60%), radial-gradient(800px 600px at 100% 20%, rgba(52, 193, 191, .10), transparent 60%), #0F0920;
  color: var(--ink);
}
html[data-theme="dark"] .page-portal[data-view]:not([data-view="app"]) { color: #1B1840; }
html[data-theme="dark"] .page-portal .header { background: rgba(20, 12, 38, .94); border-bottom-color: var(--line); }
html[data-theme="dark"] .page-portal :is(.panel, .table-wrap, .lesson, .att-day, .modal, .modal__head, .tabbar, .device-card, .streak-card, .att-btn, .lesson--past) { background-color: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .page-portal .lesson--past { background: var(--surface-2); }
html[data-theme="dark"] .page-portal .tabbar { background: rgba(20, 12, 38, .96); }
html[data-theme="dark"] .page-portal .app__nav a { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .page-portal.has-appbar .app__nav--drawer a:not(.is-active) { background: transparent; }
html[data-theme="dark"] .page-portal .app__nav--drawer { background: var(--surface) !important; border-color: var(--line) !important; }
html[data-theme="dark"] .page-portal :is(.field input, .field select, .field textarea, .inline-form input, .filters select, .lesson__when input, .lesson__when select, .lessons--edit textarea, .lesson__title-input, input[type=file], .choice span, .search__input, .chat__search, .chat__form textarea) { background-color: var(--surface-2); border-color: #463B66; color: var(--ink); }
html[data-theme="dark"] .page-portal .field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23EFE6FF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html[data-theme="dark"] .page-portal .choice input:checked + span { background: #8A25B5; border-color: #8A25B5; color: #fff; }
html[data-theme="dark"] .page-portal .empty { background: linear-gradient(135deg, var(--role-soft), var(--surface)); border-color: #463B66; }
html[data-theme="dark"] .page-portal .table th { background: var(--surface-2); }
html[data-theme="dark"] .page-portal .alert--warn { background: #33280F; border-color: #6B5320; }
html[data-theme="dark"] .page-portal .alert--bad, html[data-theme="dark"] .page-portal .badge--bad { background: #3A1518; border-color: #7A2A30; color: #FFB4B4; }
html[data-theme="dark"] .page-portal :is(.status-card--ok, .status-card--warn, .ck--ok, .ck--warn, .ck--bad, .pass, .device-card--on, .streak-card.is-on) { background: var(--surface); }
html[data-theme="dark"] .page-portal :is(.att-day--present, .att-day--late) { background: #16301F; border-color: #2D6A45; }
html[data-theme="dark"] .page-portal :is(.att-day--absent, .att-day--missed) { background: #36171A; border-color: #6E2B31; }
html[data-theme="dark"] .page-portal .input-with-btn__btn, html[data-theme="dark"] .page-portal .modal__close { background: var(--surface-2); color: var(--ink); }
html[data-theme="dark"] .page-portal .btn--outline { border-color: #B887F0; color: #E0C8FF; }
html[data-theme="dark"] .page-portal .btn--outline:hover { background: var(--role-soft); }
html[data-theme="dark"] .page-portal .nav-badge { box-shadow: 0 0 0 2px var(--surface); }
html[data-theme="dark"] .page-portal .avatar--empty { background: repeating-linear-gradient(45deg, #2B1D4B 0 10px, #1B1331 10px 20px); }
html[data-theme="dark"] .page-portal .avatar { border-color: var(--surface); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px rgba(192, 139, 255, .35); }
html[data-theme="dark"] .page-portal .tabbar a.is-active { box-shadow: inset 0 0 0 1px rgba(192, 139, 255, .25); }
html[data-theme="dark"] .page-portal .colchart__bar { background: #7B4FA8; }
html[data-theme="dark"] .page-portal .colchart__col.is-current .colchart__bar { background: #C08BFF; }
html[data-theme="dark"] .page-portal .colchart__col:hover .colchart__bar { background: #E0C8FF; }
html[data-theme="dark"] .page-portal :is(.hbar__fill, .perf__bar span) { background: #B37BEA; }
html[data-theme="dark"] .page-portal .colchart__col::after { background: #EFE6FF; color: #1B1331; }
html[data-theme="dark"] .page-portal .streak-pill { background: #3A2615; color: #FFC08A; }
html[data-theme="dark"] .page-portal .stepper__msg { background: #163A24; color: #DDF7E3; }
html[data-theme="dark"] .page-portal .feedback { color: var(--ink); }
html[data-theme="dark"] .page-portal .panel__link, html[data-theme="dark"] .page-portal .agenda__kicker { color: #FFB066; }
html[data-theme="dark"] .page-portal .brand__name { color: #EFE6FF; }

/* =========================================================
   Finance pages (finance.js): summary grid, cash flow, payroll, assets
   ========================================================= */
.fin-status { font-size: 14px; color: var(--ink-3); font-weight: 600; }
.fin-status[data-ok="0"] { color: var(--danger-solid, #b42318); }
.kpis.kpis--4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 900px) { .kpis.kpis--4 { grid-template-columns: repeat(4, 1fr); } }
.kpis--4 .kpi strong { font-size: clamp(20px, 3.2vw, 28px); overflow-wrap: anywhere; }
.kpi--bad strong { color: var(--danger-solid, #b42318); }
.fin-range { align-items: center; gap: 8px; flex-wrap: wrap; }
.fin-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fin-table { min-width: 0; }
.fin-table th, .fin-table td { padding: 6px 8px; font-size: 14px; vertical-align: middle; }
.fin-table tbody th { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); background: transparent; }
.fin-table tbody th small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }
.fin-table thead th:first-child, .fin-table tbody th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--surface, #fff); min-width: 190px; max-width: 260px; }
.fin-table tr.fin-sect th { background: var(--surface-2); color: var(--brand-900); text-transform: uppercase; letter-spacing: .06em; font-size: 12px; padding-top: 12px; }
.fin-table tr.fin-calc td, .fin-table tr.fin-calc th { color: var(--ink); }
.fin-table tr.fin-total td, .fin-table tr.fin-total th { font-weight: 800; color: var(--ink); border-top: 2px solid var(--line); }
.fin-table tr.fin-profit td, .fin-table tr.fin-profit th { color: var(--brand-700); font-size: 15px; }
.fin-table tr.fin-add th { border-bottom: 0; padding-top: 0; }
.fin-table td.fin-missing { background: repeating-linear-gradient(45deg, transparent 0 6px, var(--surface-2) 6px 12px); }
.fin-table .num, .fin-table td { text-align: right; white-space: nowrap; }
.fin-table td:has(> .fin-in--text), .fin-assets td:first-child, .fin-pay td:first-child { text-align: left; }
.fin-in { width: 9.5em; max-width: 100%; padding: 6px 8px; border: 1.5px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; text-align: right;
  background: var(--surface, #fff); color: var(--ink); font-variant-numeric: tabular-nums; }
.fin-in:focus { outline: none; border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--brand-100); }
.fin-in--text { text-align: left; width: 12em; }
.fin-pay .fin-in { width: 7.5em; }
.fin-pay .fin-in--text { width: 10em; }
.fin-pay select.fin-in { display: block; margin-top: 4px; font-size: 12px; }
.fin-table td, .fin-table .num { font-variant-numeric: tabular-nums; }
.fin-x { border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; margin-left: 4px; }
.fin-x:hover, .fin-x:focus-visible { color: var(--danger-solid, #b42318); background: var(--surface-2); }
.fin-reco .fin-in { width: 10em; }
.fin-bs { max-width: 560px; }
.fin-actions { flex-wrap: wrap; gap: 8px; margin: var(--s-4) 0; }
.fin-roles li { margin-bottom: 10px; line-height: 1.5; }
.colchart__bar.fin-neg { background: var(--danger-solid, #b42318); }
.fin-table .files { justify-content: flex-start; }
.fin-table .file--img img { max-height: 44px; }
@media print {
  .fin-in { border: 0; padding: 0; width: auto; }
  .fin-x, .fin-actions, [data-pay-add], .fin-range { display: none !important; }
}

/* ---------- Registrations (website sign-ups) ---------- */
.reg-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.reg-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.reg-tabs button[aria-selected="true"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.reg-tabs .count { margin-left: 4px; opacity: .8; }
.reg-card.is-focus { box-shadow: 0 0 0 3px var(--brand-500); }
.reg-card details { margin: 8px 0; }
.reg-card summary { cursor: pointer; font-weight: 600; color: var(--brand-600); }
.reg-details { margin-top: 8px; }
.reg-warn { color: #8A4B00; background: #FFF4D6; padding: 8px 12px; border-radius: 10px; }
.reg-digest { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.reg-digest select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); }

/* ---------- Centre check-in: camera QR scanner ---------- */
.checkin-form { flex-wrap: wrap; }
.checkin-form .ic { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
.ck-scanner { position: relative; margin-top: 14px; border-radius: 16px; overflow: hidden; background: #000; max-width: 520px; aspect-ratio: 4 / 3; }
.ck-scanner[hidden] { display: none; }
.ck-scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ck-scanner__frame { position: absolute; inset: 18% 22%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); }
.ck-scanner__hint { position: absolute; left: 0; right: 0; bottom: 52px; margin: 0; padding: 0 12px; text-align: center; color: #fff; font-weight: 600; text-shadow: 0 1px 3px #000; }
.ck-scanner__stop { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(0, 0, 0, .55); color: #fff; border-color: rgba(255, 255, 255, .7); }
/* ---------- Letter & settings: assign teachers & email letters ---------- */
.letter-row { display: grid; gap: 10px; grid-template-columns: 1fr; align-items: end; padding: 12px 0; border-top: 1px solid var(--line); }
@media (min-width: 900px) { .letter-row { grid-template-columns: 1.6fr 1fr 1.2fr auto; } }
.letter-row__who { display: grid; gap: 2px; min-width: 0; }
.letter-row__who .muted { font-size: 13px; }
.letter-row__field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.letter-row__field select, .letter-row__field input { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: inherit; font: inherit; }
.letter-ok { color: #15803D; font-size: 13px; font-weight: 600; }
.letter-bad { color: #B91C1C; font-size: 13px; font-weight: 600; }
/* =========================================================
   Music: notation, song diary, lesson notes, listening coach
   ========================================================= */
.modal.modal--wide { width: min(1100px, calc(100vw - 24px)); max-width: none; }
.music-switch { margin-bottom: 14px; }
/* text notation (emerald / topaz / sapphire) */
.mn { display: flex; flex-wrap: wrap; gap: 6px 4px; align-items: flex-end; padding: 10px; border-radius: 14px; background: var(--surface-2, #F6F5FB); }
.mn__bar { display: inline-flex; gap: 4px; align-items: flex-end; padding: 18px 8px 4px; border-right: 2px solid rgba(100, 100, 140, .35); position: relative; }
.mn__bar:last-child { border-right: 0; }
.mn__chord { position: absolute; top: 0; left: 8px; font-size: 12px; font-weight: 800; color: #0284C7; }
.mn__n { display: inline-flex; flex-direction: column; align-items: center; min-width: 30px; padding: 4px 6px; border-radius: 10px; background: #fff; border: 2px solid transparent; font-weight: 800; font-size: 18px; color: #1B1840; line-height: 1.1; position: relative; transition: transform .15s, background .15s; }
.mn__n small { font-size: 11px; font-weight: 600; color: #6B6987; margin-top: 2px; min-height: 12px; }
.mn--emerald .mn__n b { color: #047857; font-size: 22px; }
.mn--topaz .mn__n b { color: #B45309; }
.mn--sapphire .mn__n b { color: #1D4ED8; font-style: italic; }
.mn__n--left { background: #F3E8FF; border-color: #A855F7; border-radius: 50%; }
.mn__n--short { font-size: 15px; min-width: 24px; }
.mn__n--stretch b::after { content: "↗"; font-size: 11px; color: #7C3AED; margin-left: 1px; }
.mn__n--rest { color: #94A3B8; }
.mn__shift { position: absolute; top: -12px; left: 2px; font-style: normal; font-size: 12px; color: #DB2777; }
.mn__n.is-now { background: #FDE68A; border-color: #F59E0B; transform: translateY(-4px) scale(1.12); box-shadow: 0 6px 16px rgba(245, 158, 11, .35); }
.mn__n.is-done { background: #DCFCE7; }
.mn__n.is-demo { background: #E0F2FE; border-color: #0EA5E9; }
/* chord names sit above the note they start on (two per bar where the chord changes mid-bar) */
.mn__n .mn__chord { position: absolute; top: -25px; left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 800; white-space: nowrap; line-height: 1; }
.mn__chord { background: #FDE68A; color: #78350F !important; border: 1.5px solid #F59E0B; border-radius: 7px; padding: 2px 6px; box-shadow: 0 2px 0 rgba(120, 53, 15, .25); z-index: 1; }
.mn__bar:has(.mn__chord) { padding-top: 30px; }
.mstaff__chord { fill: #B45309; font-weight: 800; font-size: 15px; }
/* chord chart under a song (one box per bar) */
.chart { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 10px; }
.chart span { min-width: 46px; padding: 6px 8px; border-radius: 8px; background: #FEF3C7; border: 1.5px solid #F59E0B; color: #78350F; font: 800 14px Inter, sans-serif; text-align: center; }
.chart span small { display: block; font-size: 10px; font-weight: 600; color: #92400E; }
.chords-toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.mstaff__chord { font: 800 13px system-ui, sans-serif; fill: #0284C7; }
/* left-hand chord cards (Beta) */
.lhc { border-radius: 12px; background: var(--surface-2, #F6F5FB); padding: 8px 10px 10px; }
.lhc__title { margin: 0 0 6px; font-size: 13px; font-weight: 800; color: var(--ink, #1B1840); }
.lhc__title span { font-weight: 500; color: var(--ink-3, #6B6987); }
.lhc__row { display: flex; flex-wrap: wrap; gap: 8px; }
.lhc__card { margin: 0; background: var(--surface, #fff); border: 1px solid var(--line, #E4E2EF); border-radius: 10px; padding: 6px 6px 2px; width: 150px; }
.lhc__card figcaption { display: flex; flex-wrap: wrap; gap: 0 6px; justify-content: space-between; align-items: baseline; font-size: 14px; margin-bottom: 2px; color: var(--ink, #1B1840); }
.lhc__card figcaption b { color: #0284C7; font-size: 16px; }
.lhc__card figcaption span { font-size: 11.5px; color: var(--ink-3, #6B6987); }
.lhc__card figcaption span::before { content: "fingers "; }
.lhc__kb { width: 100%; height: auto; display: block; }
.lhc__w { fill: #fff; stroke: #A1A1AA; }
.lhc__w.is-on { fill: #E0F2FE; stroke: #0284C7; stroke-width: 1.5; }
.lhc__b { fill: #27272A; }
.lhc__b.is-on { fill: #0284C7; }
.lhc__dot { fill: #0284C7; }
.lhc__f { font: 800 9.5px system-ui, sans-serif; fill: #fff; }
.lhc__f--b { font-size: 8.5px; }
.lhc__c3 { font: 700 7px system-ui, sans-serif; fill: #E11D48; }
.lhc__cap { font: 700 10px system-ui, sans-serif; fill: var(--ink-2, #4A4868); color: var(--ink-2, #4A4868); margin: 0; }
.song__edited { color: #B45309; font-weight: 700; }
.badge--ext { background: #ECFEFF; color: #0E7490; border: 1px solid #67E8F9; }
.choice--block { display: flex; width: 100%; }
.lvl-chip { display: inline-flex; gap: 4px; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1.5px solid color-mix(in srgb, var(--c) 45%, transparent); vertical-align: middle; }
.lvl-chip small { font-weight: 600; opacity: .8; }
.lvl-line { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; }
.lvl-preview { max-width: 520px; }
.song-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; font-size: 13.5px; }
/* song editor */
.se { display: grid; gap: 12px; }
.se__h { margin: 6px 0 0; font-size: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.se__h small { font-size: 12.5px; font-weight: 500; color: var(--ink-3, #6B6987); }
.se__h select { margin-left: auto; }
.se__score { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-radius: 14px; background: var(--surface-2, #F6F5FB); max-height: 320px; overflow: auto; }
.se__bar { display: flex; gap: 4px; align-items: flex-end; padding: 18px 8px 6px; border-radius: 10px; border: 2px solid var(--line, #E4E2EF); background: var(--surface, #fff); position: relative; }
.se__bar.is-bad { border-color: #F87171; background: #FEF2F2; }
.se__count { position: absolute; top: 2px; left: 8px; font-size: 10.5px; font-weight: 700; color: var(--ink-3, #6B6987); }
.se__bar.is-bad .se__count { color: #DC2626; }
.se__n { display: inline-flex; flex-direction: column; align-items: center; min-width: 38px; padding: 4px 6px; border-radius: 9px; border: 2px solid #D4D4D8; background: #fff; color: #1B1840; cursor: pointer; font: inherit; line-height: 1.1; }
.se__n b { font-size: 17px; }
.se__n small { font-size: 12px; color: #6B6987; }
.se__n.is-rest b { color: #94A3B8; }
.se__n.is-sel { border-color: #F59E0B; background: #FEF3C7; box-shadow: 0 0 0 3px rgba(245, 158, 11, .3); }
.se__n:focus-visible, .se__k:focus-visible { outline: 3px solid #0284C7; outline-offset: 2px; }
.se__tools { display: grid; gap: 8px; padding: 10px 12px; border-radius: 14px; border: 1px dashed var(--line, #E4E2EF); }
.se__now { margin: 0; font-size: 14px; }
.se__group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.se__lab { width: 58px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3, #6B6987); }
.se__k { min-height: 36px; padding: 4px 10px; border-radius: 9px; border: 1px solid var(--line, #D4D4D8); background: var(--surface, #fff); color: var(--ink, #1B1840); font: inherit; font-weight: 700; cursor: pointer; }
.se__k small { font-weight: 500; color: var(--ink-3, #6B6987); font-size: 11px; }
.se__k:hover { border-color: #0284C7; }
.se__k.is-on { background: #0284C7; border-color: #0284C7; color: #fff; }
.se__k.is-on small { color: #E0F2FE; }
.se__chords { display: flex; gap: 8px; flex-wrap: wrap; }
.se__chords input { flex: 1 1 260px; min-height: 40px; font-family: ui-monospace, Consolas, monospace; }
.se__raw textarea { width: 100%; font-family: ui-monospace, Consolas, monospace; }
.se__warn { margin: 0; color: #B91C1C; font-size: 13px; font-weight: 600; }
.se__foot { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 0 4px; background: var(--surface, #fff); border-top: 1px solid var(--line, #E4E2EF); }
@media (min-width: 641px) { .se__foot { position: sticky; bottom: -1px; } }
html[data-theme="dark"] .se__bar.is-bad { background: #3B1520; }
@media (max-width: 640px) { .se__lab { width: 100%; } .lhc__card { width: calc(50% - 4px); } }
/* "Hear it": the note sounding now glows */
.mn__n.is-playing { background: #FEF9C3; border-color: #FACC15; transform: translateY(-4px) scale(1.15); box-shadow: 0 0 0 4px rgba(250, 204, 21, .35), 0 0 18px 4px rgba(250, 204, 21, .75); z-index: 1; }
.mstaff__note.is-playing .mstaff__head { fill: #FACC15; stroke: #CA8A04; filter: drop-shadow(0 0 5px rgba(250, 204, 21, .95)); }
@media (prefers-reduced-motion: reduce) { .mn__n.is-playing { transform: none; } }
/* staff notation (diamond) */
.mstaff { width: 100%; height: auto; background: #FFFDF7; border-radius: 14px; border: 1px solid #EDE7D9; }
.mstaff__line { stroke: #57534E; stroke-width: 1; }
.mstaff__bar { stroke: #44403C; stroke-width: 1.4; }
.mstaff__clef { font-size: 44px; fill: #1C1917; font-family: "Noto Music", "Segoe UI Symbol", "Bravura", serif; }
.mstaff__clef--bass { font-size: 30px; }
.mstaff__time { font: 800 15px Georgia, serif; fill: #1C1917; }
.mstaff__head { fill: #1C1917; stroke: #1C1917; stroke-width: 1.2; }
.mstaff__head--open { fill: #FFFDF7; }
.mstaff__stem, .mstaff__flag { stroke: #1C1917; stroke-width: 1.5; fill: none; }
.mstaff__dot { fill: #1C1917; }
.mstaff__acc { font-size: 15px; fill: #1C1917; }
.mstaff__rest { font-size: 22px; fill: #57534E; }
.mstaff__note.is-now .mstaff__head { fill: #F59E0B; stroke: #B45309; }
.mstaff__note.is-done .mstaff__head { fill: #16A34A; stroke: #15803D; }
.mstaff__note.is-demo .mstaff__head { fill: #0EA5E9; stroke: #0284C7; }
/* song cards */
.song-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.song-cat .panel__title { color: var(--sc); }
.song { border: 1px solid var(--line, #E4E2EF); border-top: 5px solid var(--sc); border-radius: 16px; padding: 12px; background: var(--surface, #fff); display: grid; gap: 10px; }
.song__head { display: flex; gap: 10px; align-items: center; }
.song__n { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--sc); color: #fff; font-weight: 800; flex: none; }
.song__title { font-size: 17px; margin: 0; }
.song__meta { margin: 0; font-size: 12.5px; color: var(--ink-3, #6B6987); }
.song__chords { font-size: 13px; margin: 0; color: #0369A1; }
.song__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.song__best { font-size: 13px; font-weight: 700; color: #B45309; }
.song-more { margin-top: 12px; font-size: 13.5px; line-height: 2; }
.asg-song { margin: 12px 0; padding: 12px; border-radius: 16px; background: linear-gradient(135deg, #FDF2F8, #EEF2FF); display: grid; gap: 10px; }
.asg-song__title { margin: 0; font-weight: 800; }
.music-asg { border: 2px dashed #C4B5FD; border-radius: 16px; padding: 12px; }
.music-asg legend { font-weight: 800; padding: 0 6px; }
/* music level picker */
.lvl-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin: 10px 0; }
.lvl-card { display: flex; gap: 10px; padding: 12px; border-radius: 14px; border: 2px solid var(--line, #E4E2EF); cursor: pointer; background: var(--surface, #fff); }
.lvl-card:has(input:checked) { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent); }
.lvl-card input { accent-color: var(--c); margin-top: 3px; }
.lvl-card span { display: grid; gap: 4px; }
.lvl-card b { color: var(--c); }
.lvl-card small { color: var(--ink-3, #6B6987); line-height: 1.35; }
/* lesson note */
.ln { display: grid; gap: 14px; }
.ln__hero { border-radius: 20px; padding: 20px; color: #fff; background: linear-gradient(135deg, #7C3AED, #DB2777 55%, #F59E0B); box-shadow: 0 10px 30px rgba(124, 58, 237, .25); }
.ln__eyebrow { margin: 0; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 800; opacity: .9; }
.ln__title { margin: 6px 0 2px; font-size: clamp(24px, 4vw, 34px); color: #fff; }
.ln__topic { margin: 0 0 10px; opacity: .9; }
.ln__kid { font-size: 17px; background: rgba(255, 255, 255, .16); border-radius: 14px; padding: 12px 14px; margin: 0; }
.ln__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.ln__chip { background: #fff; color: var(--c, #7C3AED); border-radius: 999px; padding: 5px 12px; font-weight: 800; font-size: 13px; }
.ln__sec { border: 1px solid var(--line, #E4E2EF); border-radius: 18px; padding: 16px; background: var(--surface, #fff); }
.ln__sec h3 { margin: 0 0 10px; font-size: 18px; }
.ln__sec--tips { background: #FFFBEB; border-color: #FDE68A; }
.ln__sec--home { background: #ECFDF5; border-color: #A7F3D0; }
.ln__goals li { margin: 4px 0; }
.ln__ills { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.ln__fig { margin: 0; border-radius: 16px; background: linear-gradient(180deg, #FAF5FF, #FFF7ED); padding: 10px; }
.ln__steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ln__steps li { display: grid; grid-template-columns: 70px 1fr; gap: 10px; align-items: start; }
.ln__steps p { margin: 2px 0 0; color: var(--ink-2, #4A4868); }
.ln__min { background: #EDE9FE; color: #6D28D9; font-weight: 800; border-radius: 10px; padding: 6px; text-align: center; font-size: 13px; }
.ln__inst { list-style: none; padding: 0; display: grid; gap: 8px; }
.ln__hint { font-size: 13px; color: var(--ink-3, #6B6987); }
.ln-songs { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
/* illustrations */
.ill { width: 100%; height: auto; display: block; }
.ill-row { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; }
.ill-row--chords { grid-template-columns: repeat(4, 1fr); }
.ill__klab { font: 800 14px "Plus Jakarta Sans", Inter, sans-serif; fill: #fff; }
.ill__fnum { font: 800 14px Inter, sans-serif; }
.ill__fnum2 { font: 800 16px Inter, sans-serif; fill: #fff; paint-order: stroke; stroke: #5C3A1A; stroke-width: 3px; }
.ill__cap { font: 600 12px Inter, sans-serif; fill: #4A4868; color: #4A4868; text-align: center; margin: 6px 0 0; }
.ill__small { font: 500 10px Inter, sans-serif; fill: #475569; }
.ill__vlab { font: 700 8px Inter, sans-serif; fill: #FDE68A; }
.ill__vstr { font: 800 13px Inter, sans-serif; fill: #1B1840; }
.ill__vnote { font: 800 11px Inter, sans-serif; fill: #C2410C; }
.ill__chname { font: 800 14px Inter, sans-serif; fill: #1B1840; }
.rh { display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: #fff; margin-bottom: 6px; }
.rh__sym { font-size: 36px; text-align: center; color: #7C3AED; }
.rh__claps { font-size: 18px; }
.ill--solfa { display: grid; gap: 4px; }
.sl { display: grid; grid-template-columns: 40px 1fr 30px; align-items: center; gap: 8px; width: var(--w); margin: 0 auto; background: var(--c); color: #fff; border-radius: 10px; padding: 4px 10px; font-weight: 700; }
.sl b { font-size: 18px; } .sl em { font-style: normal; text-align: right; opacity: .9; }
/* on-screen instruments */
.vk { position: relative; height: 170px; user-select: none; touch-action: none; }
.vk__whites { display: flex; height: 100%; gap: 2px; }
.vk__w { flex: 1; border: 1px solid #A1A1AA; border-radius: 0 0 10px 10px; background: linear-gradient(180deg, #fff 0%, #F4F4F5 85%, #D4D4D8 100%); display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 8px; cursor: pointer; position: relative; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .06); }
.vk__w::before { content: ""; position: absolute; left: 50%; bottom: 30px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; background: var(--kc); opacity: .9; }
.vk__lab { position: relative; z-index: 1; font-weight: 800; font-size: 13px; color: #1B1840; margin-bottom: 26px; }
.vk__mid { position: absolute; top: 4px; font-size: 9px; color: #E11D48; font-weight: 700; }
.vk__b { position: absolute; top: 0; width: calc(100% / var(--whites) * .62); left: calc(100% / var(--whites) * var(--wi) - (100% / var(--whites) * .31)); height: 60%; border: 0; border-radius: 0 0 7px 7px; background: linear-gradient(180deg, #3F3F46, #09090B 85%, #52525B); cursor: pointer; z-index: 2; }
.vk__w.is-next { background: linear-gradient(180deg, #FEF3C7, #FDE68A); box-shadow: 0 0 0 3px #F59E0B inset, 0 0 18px rgba(245, 158, 11, .6); animation: vkpulse 1s infinite; }
.vk__b.is-next { background: linear-gradient(180deg, #F59E0B, #B45309); animation: vkpulse 1s infinite; }
.vk .is-right { background: linear-gradient(180deg, #BBF7D0, #4ADE80) !important; }
.vk .is-wrong { background: linear-gradient(180deg, #FECACA, #F87171) !important; }
.vk .is-demo { background: linear-gradient(180deg, #E0F2FE, #7DD3FC) !important; }
@keyframes vkpulse { 50% { filter: brightness(1.08); } }
.vv, .gv { width: 100%; max-height: 300px; display: block; margin: 0 auto; }
.vv__sn, .gv__sn { font: 800 12px Inter, sans-serif; fill: #1B1840; }
.vv__fn, .gv__fn { font: 700 11px Inter, sans-serif; fill: #94A3B8; }
.vv__dot, .gv__dot { font: 800 13px Inter, sans-serif; fill: #fff; }
.vv__tip { text-align: center; font-weight: 700; margin: 6px 0 0; }
/* the coach */
body.mc-open { overflow: hidden; }
.mc { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 10, 40, .6); display: grid; place-items: center; padding: 10px; }
.mc__box { position: relative; width: min(980px, 100%); max-height: calc(100dvh - 20px); overflow: auto; background: #fff; color: #1B1840; border-radius: 22px; padding: 16px; display: grid; gap: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.mc__head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.mc__eyebrow { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #7C3AED; }
.mc__title { margin: 2px 0; font-size: clamp(20px, 3vw, 28px); }
.mc__sub { margin: 0; color: #6B6987; font-size: 14px; }
.mc__close { border: 0; background: #F1F5F9; width: 40px; height: 40px; border-radius: 50%; font-size: 24px; cursor: pointer; flex: none; }
.mc__bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.mc__seg { display: inline-flex; background: #F1F5F9; border-radius: 999px; padding: 4px; gap: 2px; }
.mc__seg button { border: 0; background: none; padding: 7px 12px; border-radius: 999px; font-weight: 700; cursor: pointer; color: #475569; }
.mc__seg button[aria-pressed="true"] { background: #7C3AED; color: #fff; }
.mc__tempo { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.mc__instsel { display: inline-flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; }
.mc__instsel select { min-height: 40px; border-radius: 12px; padding: 4px 10px; font: inherit; font-weight: 700; border: 2px solid #C4B5FD; background: #F5F3FF; color: #4C1D95; }
.mc__lines { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; }
.mc__lines-lab { font-weight: 800; color: #475569; }
.mc__lines-tip { color: #64748B; font-size: 12.5px; }
.mc__chip { border: 2px solid #CBD5E1; background: #fff; color: #334155; border-radius: 999px; padding: 4px 12px; font-weight: 700; cursor: pointer; min-height: 34px; }
.mc__chip.is-on { background: #7C3AED; border-color: #7C3AED; color: #fff; }
.mc__loop { display: inline-flex; gap: 4px; align-items: center; font-weight: 700; color: #334155; padding: 0 6px; cursor: pointer; }
.mc__notes [data-i] { cursor: pointer; }
.mc__notes .mn__n.is-range { box-shadow: inset 0 -4px 0 #A78BFA; }
.mc__notes .mstaff__note.is-range .mstaff__head { stroke: #7C3AED; stroke-width: 2; }
.mc__pulse { animation: mcpulse .6s ease-out; }
@keyframes mcpulse { 0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .8); } 100% { box-shadow: 0 0 0 14px rgba(245, 158, 11, 0); } }
.mc__inst.is-demo .vvwrap, .mc__inst.is-demo .gvwrap, .mc__inst.is-demo .rvwrap { outline: 3px solid #38BDF8; outline-offset: 4px; border-radius: 14px; }
.rvwrap { display: flex; flex-direction: column; align-items: center; }
.rv { width: 120px; height: auto; }
.rv__lab { font: 700 11px system-ui, sans-serif; fill: #475569; }
.rv__lab--s { font-size: 8.5px; }
@media (prefers-reduced-motion: reduce) { .mc__pulse { animation: none; } }
.mc__notes { overflow-x: auto; }
.mc__notes .mn { flex-wrap: wrap; }
.mc__msg { padding: 12px 14px; border-radius: 14px; background: #EEF2FF; font-size: 16px; min-height: 48px; }
.mc__msg--ok { background: #DCFCE7; color: #14532D; }
.mc__msg--bad { background: #FEE2E2; color: #7F1D1D; }
.mc__msg--done { background: linear-gradient(135deg, #FEF3C7, #FCE7F3); font-size: 17px; }
.mc__stars { font-size: 26px; margin-right: 6px; }
.mc__level { height: 6px; border-radius: 99px; background: #F1F5F9; overflow: hidden; }
.mc__level span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #22C55E, #EAB308, #EF4444); transition: width .08s; }
.mc__foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mc__foot .is-on { background: #DC2626; border-color: #DC2626; }
.mc__progress { margin-left: auto; font-weight: 700; color: #6B6987; }
.mc__shake { animation: mcshake .35s; }
@keyframes mcshake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.mc__confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.mc__confetti span { position: absolute; top: -30px; left: calc(var(--x) * 1%); font-size: 24px; animation: mcfall 2.4s ease-in var(--d) forwards; }
@keyframes mcfall { to { transform: translateY(110vh) rotate(540deg); opacity: .2; } }
@media (prefers-reduced-motion: reduce) { .mc__confetti, .vk__w.is-next, .vk__b.is-next, .mc__shake { animation: none; } }
@media (max-width: 640px) { .vk { height: 140px; } .mn__n { font-size: 16px; min-width: 26px; } .ill-row--chords { grid-template-columns: repeat(2, 1fr); } }
/* music: readable in light and dark portal themes */
.ln__sec { color: var(--ink, #1B1840); }
.ln__sec--tips { background: #FFFBEB; border-color: #FDE68A; color: #3B2F0B; }
.ln__sec--home { background: #ECFDF5; border-color: #A7F3D0; color: #0B3B2A; }
.ln__fig, .rh, .asg-song, .mn, .mc__box, .sl { color: #1B1840; }
.asg-song .muted, .ln__fig .muted { color: #6B6987; }
.song { color: var(--ink, #1B1840); }.mc__title { color: #1B1840; }
.mc__notes { max-height: 32vh; overflow: auto; border-radius: 14px; }
.mc__notes .mn { background: #F6F5FB; }
.mn__n { flex-direction: column; }.vk__w::before { bottom: 8px; width: 16px; height: 16px; margin-left: -8px; }
.vk__lab { margin-bottom: 30px; font-size: 14px; }
.vk__mid { font-size: 8px; line-height: 1; padding: 0 2px; text-align: center; }
.mc .btn--outline { color: #6D28D9; border-color: #C4B5FD; background: #fff; }
.mc .btn--outline:hover { background: #F5F3FF; }
/* teacher's own changes */
.ln__sec--teacher { background: #EFF6FF; border-color: #BFDBFE; color: #1E3A8A; }
.ln__sec--private { background: #F5F3FF; border-color: #DDD6FE; color: #3B0764; }
.ln__sec--private small { font-weight: 500; opacity: .8; font-size: 12px; }
.ln-edit { margin-top: 14px; }
.ln-edit summary { font-weight: 800; cursor: pointer; }
.choices--songs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 10px; }.ln__sec h3, .ln__sec h3 small { color: inherit; }
/* =========================================================
   CODING (Scratch 3) lesson notes: blocks, screen, animations
   ========================================================= */
.ln__hero--code { background: linear-gradient(135deg, #855CD6, #4C97FF 55%, #59C059); }
.ln__ills--code { grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); }
.ln__fig--wide { grid-column: 1 / -1; }
.ln__fig--anim { background: linear-gradient(180deg, #F5F3FF, #EFF6FF); }
.ani__title { margin: 0 0 8px; font-weight: 800; color: #4C1D95; }
.ln__fig figcaption { margin-top: 8px; font-size: 13.5px; color: #334155; }

/* blocks */
.sbs { display: inline-flex; flex-direction: column; align-items: flex-start; filter: drop-shadow(0 1px 0 rgba(0,0,0,.12)); }
.sb { position: relative; display: inline-flex; align-items: center; gap: 5px; flex-wrap: wrap; min-height: 34px; padding: 5px 10px 5px 10px; margin-top: 4px; background: var(--c); color: #fff; border: 1px solid var(--d); border-radius: 5px; font: 700 13px/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif; white-space: nowrap; flex-wrap: nowrap; }
.sbs > .sb:first-child, .sbc__in > .sb:first-child, .sbc__in > .sbc:first-child { margin-top: 0; }
.sb::before { content: ""; position: absolute; top: -1px; left: 14px; width: 18px; height: 5px; background: rgba(255,255,255,.95); border-radius: 0 0 5px 5px; border: 1px solid var(--d); border-top: 0; }   /* dent on top */
.sb::after { content: ""; position: absolute; bottom: -5px; left: 14px; width: 18px; height: 5px; background: var(--c); border-radius: 0 0 5px 5px; border: 1px solid var(--d); border-top: 0; z-index: 1; }   /* bump below */
.sb--hat { border-radius: 22px 22px 5px 5px; padding-top: 14px; margin-top: 0; }
.sb--hat::before { display: none; }
.sb--cap::after { display: none; }
.sb--rep, .sb--bool { min-height: 26px; margin: 0; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; }
.sb--rep::before, .sb--rep::after, .sb--bool::before, .sb--bool::after { display: none; }
.sb--bool { border-radius: 4px; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%); padding: 2px 14px; }
.sb__num, .sb__txt { display: inline-block; min-width: 22px; padding: 2px 8px; border-radius: 999px; background: #fff; color: #575E75; font-weight: 600; text-align: center; border: 1px solid rgba(0,0,0,.12); }
.sb__txt { border-radius: 999px; }
.sb__drop { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--d); color: #fff; border: 1px solid rgba(0,0,0,.15); }
.sb__swatch { display: inline-block; width: 26px; height: 18px; border-radius: 999px; border: 2px solid #fff; }
.sb__slot { display: inline-block; width: 40px; height: 20px; background: var(--d); clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%); }
.sb__flag { color: #4CBF56; font-size: 17px; text-shadow: 0 0 0 #fff, 0 1px 0 #2E7D32; background: #fff; border-radius: 4px; padding: 0 3px; line-height: 1.1; }
/* C blocks */
.sbc { display: flex; flex-direction: column; align-items: flex-start; margin-top: 4px; }
.sbc > .sb--top { border-bottom-left-radius: 0; margin-top: 0; }
.sbc > .sb--top::after { left: 30px; }
.sbc > .sb--mid { border-radius: 0 5px 5px 0; margin-top: 0; min-height: 28px; }
.sbc > .sb--mid::before { left: 30px; }
.sbc > .sb--bot { min-height: 18px; width: 70px; border-top-left-radius: 0; margin-top: 0; padding: 0; }
.sbc > .sb--bot::before { left: 30px; }
.sbc--cap > .sb--bot::after { display: none; }
.sbc__mouth { display: flex; }
.sbc__arm { width: 16px; background: var(--c); border-left: 1px solid var(--d); border-right: 1px solid var(--d); }
.sbc__in { display: flex; flex-direction: column; align-items: flex-start; padding: 4px 0 6px 0; }
.sbc__empty { width: 60px; height: 22px; }
.sbw { display: flex; flex-wrap: wrap; gap: 12px; }
.sbw__card { margin: 0; padding: 10px 12px 14px; border-radius: 14px; background: #F9F9FB; border: 1px dashed #CBD5E1; background-image: radial-gradient(#D8DEE9 1px, transparent 1px); background-size: 14px 14px; max-width: 100%; overflow-x: auto; }
.sbw__card figcaption { font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 8px; }
.sbw__sprite { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #EDE9FE; color: #5B21B6; }

/* families & shapes */
.fam { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.fam__card { border-radius: 12px; padding: 10px 12px; background: color-mix(in srgb, var(--c) 14%, #fff); border-left: 8px solid var(--c); }
.fam__card b { display: block; color: #1E293B; } .fam__card small { color: #475569; }
.shps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.shp { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 12px; padding: 10px; border: 1px solid #E2E8F0; }
.shp__b { min-width: 120px; } .shp b { display: block; } .shp small { color: #475569; }
.ln-grid { width: 100%; max-width: 340px; height: auto; } .ln-grid__t { font: 700 10px system-ui, sans-serif; fill: #475569; }

/* the Scratch screen mock-up */
.scr { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid #C4B5FD; background: #E9F1FC; font: 600 11px/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif; color: #575E75; user-select: none; }
.scr__menu { display: flex; gap: 12px; align-items: center; background: #855CD6; color: #fff; padding: 6px 10px; white-space: nowrap; overflow: hidden; }
.scr__logo { font: 900 15px "Comic Sans MS", system-ui; color: #FFAB19; text-shadow: 0 1px 0 #fff; }
.scr__title { background: rgba(255,255,255,.22); padding: 3px 10px; border-radius: 4px; }
.scr__tabs { display: flex; gap: 4px; align-items: flex-end; padding: 6px 8px 0; }
.scr__tabs > span:not(.scr__run) { padding: 5px 10px; border-radius: 8px 8px 0 0; background: #D9E3F2; }
.scr__tabs > span.is-on { background: #fff; color: #855CD6; }
.scr__tabs > span.is-on2 { background: #fff; color: #855CD6; }
.scr__run { margin-left: auto; display: inline-flex; gap: 10px; align-items: center; padding: 0 0 4px; }
.scr__flag { color: #4CBF56; font-size: 20px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.scr__stop { width: 16px; height: 16px; background: #EC5959; clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
.scr__body { display: grid; grid-template-columns: 62px 150px 1fr 200px; min-height: 250px; background: #fff; }
.scr__cats { display: flex; flex-direction: column; gap: 4px; padding: 6px 2px; border-right: 1px solid #E2E8F0; }
.scr__cat { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9px; padding: 2px 0; border-radius: 6px; }
.scr__cat b { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.scr__cat.is-on { background: #E9EEF2; }
.scr__pal { padding: 6px; border-right: 1px solid #E2E8F0; background: #F9F9F9; overflow: hidden; }
.scr__palh { margin: 0 0 4px; font-weight: 800; color: #575E75; }
.scr__pal .sb, .scr__code .sb, .ani__ghost .sb { font-size: 10.5px; min-height: 26px; padding: 3px 7px; }
.scr__pal .sb--hat, .scr__code .sb--hat { padding-top: 10px; }
.scr__pal .sb__num, .scr__pal .sb__txt, .scr__code .sb__num, .scr__code .sb__txt, .ani__ghost .sb__num { padding: 0 5px; min-width: 16px; }
.scr__pb { margin-bottom: 6px; transform-origin: left; }
.scr__code { position: relative; padding: 10px; background-image: radial-gradient(#D8DEE9 1px, transparent 1px); background-size: 14px 14px; overflow: hidden; }
.scr__zoom { position: absolute; right: 6px; bottom: 6px; display: flex; flex-direction: column; gap: 3px; }
.scr__zoom i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 1px solid #CBD5E1; display: grid; place-items: center; font-size: 11px; }
.scr__right { display: flex; flex-direction: column; border-left: 1px solid #E2E8F0; background: #E9F1FC; }
.scr__stage { position: relative; height: 120px; margin: 6px; background: #fff; border: 1px solid #D9E3F2; border-radius: 6px; overflow: hidden; }
.scr__sprite { position: absolute; left: 50%; top: 50%; font-size: 34px; transform: translate(-50%, -50%); }
.scr__info { display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 4px 8px; background: #fff; margin: 0 6px; border-radius: 6px 6px 0 0; font-size: 9px; }
.scr__lower { display: grid; grid-template-columns: 1fr 52px; gap: 4px; margin: 0 6px 6px; flex: 1; }
.scr__sprites { position: relative; background: #fff; border-radius: 0 0 6px 6px; padding: 4px; display: flex; gap: 4px; align-items: flex-start; flex-wrap: wrap; min-height: 54px; }
.scr__thumb { display: flex; flex-direction: column; align-items: center; width: 40px; padding: 2px; border-radius: 6px; border: 2px solid transparent; font-size: 18px; }
.scr__thumb small { font-size: 8px; } .scr__thumb.is-on { border-color: #855CD6; background: #EDE7FA; }
.scr__choose { position: absolute; right: 4px; bottom: 4px; width: 30px; height: 30px; border-radius: 50%; background: #855CD6; color: #fff; display: grid; place-items: center; font-size: 10px; box-shadow: 0 0 0 3px rgba(133,92,214,.3); }
.scr__bd { position: relative; background: #fff; border-radius: 6px; display: flex; flex-direction: column; align-items: center; padding: 3px; }
.scr__bdthumb { width: 34px; height: 20px; border: 1px solid #CBD5E1; border-radius: 3px; margin-top: 2px; }
.scr__choose--bd { position: static; margin-top: auto; width: 26px; height: 26px; }
.scr__num { position: absolute; z-index: 3; display: grid; place-items: center; width: 18px; height: 18px; margin: -4px 0 0 -4px; border-radius: 50%; background: #F43F5E; color: #fff; font: 800 10px system-ui; font-style: normal; box-shadow: 0 0 0 2px #fff; }
.scr__menu .scr__num, .scr__tabs .scr__num { position: relative; margin: 0; }
.scr__menu, .scr__tabs, .scr__cats, .scr__pal, .scr__code, .scr__stage, .scr__info, .scr__sprites, .scr__bd { position: relative; }
.scr-legend { columns: 2 260px; margin: 8px 0 0; padding-left: 22px; font-size: 13px; }
.scr-legend li { margin-bottom: 4px; break-inside: avoid; } .scr-legend li::marker { color: #F43F5E; font-weight: 800; }
/* the screen keeps its real proportions and is shrunk to fit (CODING_NOTES.fit sets zoom) */
.ani, .ln__fig > .scr { width: 760px; max-width: none; }
.ln__fig--anim, .ln__fig--wide { overflow: hidden; }
.ln__ills--code > .ln__fig, .ln--code .ln__sec { min-width: 0; }
.ln--code { max-width: 100%; overflow-wrap: anywhere; }

/* animations (8s loop) */
.ani { position: relative; }
.ani__hand { position: absolute; z-index: 6; font-size: 26px; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.ani__snap { position: absolute; z-index: 6; left: 46%; top: 44%; font: 900 13px system-ui; color: #16A34A; opacity: 0; }
.ani__ghost { position: absolute; z-index: 5; left: 68px; top: 92px; }
.ani--drag .ani__ghost { animation: aniDrag 6s ease-in-out infinite; }
.ani--drag .ani__hand { left: 120px; top: 100px; animation: aniDragHand 6s ease-in-out infinite; }
.ani--drag .ani__snap { animation: aniSnap 6s ease-in-out infinite; }
@keyframes aniDrag { 0%, 15% { transform: translate(0, 0); } 55%, 100% { transform: translate(var(--dx, 170px), var(--dy, -8px)); } }
@keyframes aniDragHand { 0%, 10% { transform: translate(0, 0); opacity: 1; } 15% { transform: translate(0, 4px) scale(.92); } 55% { transform: translate(170px, -4px) scale(.92); } 62%, 85% { transform: translate(170px, -14px); opacity: 1; } 100% { opacity: 0; } }
@keyframes aniSnap { 0%, 55% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.2); } 75% { opacity: 1; transform: scale(1); } 85%, 100% { opacity: 0; } }
.ani--run .ani__hand { right: 130px; top: 40px; animation: aniRunHand 8s ease-in-out infinite; }
.ani--run .scr__flag { animation: aniFlag 8s infinite; }
.ani--run .scr__stop { animation: aniStop 8s infinite; }
.ani--run .scr__sprite { animation: aniWalk 8s linear infinite; }
@keyframes aniRunHand { 0% { transform: translate(-60px, 40px); } 12%, 18% { transform: translate(0, 0); } 15% { transform: translate(0, 3px) scale(.9); } 55% { transform: translate(0, 0); } 62%, 70% { transform: translate(30px, 0); } 66% { transform: translate(30px, 3px) scale(.9); } 100% { transform: translate(-60px, 40px); } }
@keyframes aniFlag { 0%, 14% { background: transparent; } 16%, 64% { background: #E5F5E7; box-shadow: 0 0 0 3px #4CBF56; } 66%, 100% { background: transparent; box-shadow: none; } }
@keyframes aniStop { 0%, 64% { transform: none; } 66%, 72% { transform: scale(1.3); } 74%, 100% { transform: none; } }
@keyframes aniWalk { 0%, 16% { left: 50%; transform: translate(-50%, -50%) scaleX(1); } 30% { left: 85%; transform: translate(-50%, -50%) scaleX(1); } 31% { transform: translate(-50%, -50%) scaleX(-1); } 46% { left: 15%; transform: translate(-50%, -50%) scaleX(-1); } 47% { transform: translate(-50%, -50%) scaleX(1); } 66%, 100% { left: 60%; transform: translate(-50%, -50%) scaleX(1); } }
.ani__lib { position: absolute; z-index: 4; left: 8%; right: 8%; top: 18%; background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); overflow: hidden; opacity: 0; }
.ani__lib p { margin: 0; padding: 6px; background: #855CD6; color: #fff; font: 800 12px system-ui; text-align: center; }
.ani__lib div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px; font-size: 26px; text-align: center; }
.ani__lib span { border: 2px solid #E2E8F0; border-radius: 8px; padding: 4px; }
.ani--sprite .ani__lib, .ani--backdrop .ani__lib { animation: aniLib 8s ease-in-out infinite; }
.ani--sprite .ani__pick, .ani--backdrop .ani__pick { animation: aniPick 8s infinite; }
.ani--sprite .ani__hand { right: 30px; bottom: 30px; animation: aniSpriteHand 8s ease-in-out infinite; }
.ani--backdrop .ani__hand { right: 18px; bottom: 26px; animation: aniSpriteHand 8s ease-in-out infinite; }
.ani__newsprite, .ani__newthumb { animation: aniAppear 8s infinite; }
.ani__newsprite { left: 72%; }
.ani--backdrop .scr__stage { animation: aniSky 8s infinite; }
@keyframes aniLib { 0%, 20% { opacity: 0; transform: translateY(10px); } 26%, 60% { opacity: 1; transform: none; } 66%, 100% { opacity: 0; } }
@keyframes aniPick { 0%, 44% { border-color: #E2E8F0; } 48%, 60% { border-color: #855CD6; background: #EDE7FA; } 100% { border-color: #E2E8F0; } }
@keyframes aniSpriteHand { 0% { transform: translate(-40px, -40px); } 15%, 20% { transform: translate(0, 0); } 18% { transform: scale(.9); } 46%, 52% { transform: translate(-160px, -120px); } 49% { transform: translate(-160px, -118px) scale(.9); } 70%, 100% { transform: translate(-40px, -40px); } }
@keyframes aniAppear { 0%, 60% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 66%, 95% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }
.ani__newthumb { animation-name: aniAppearThumb; }
@keyframes aniAppearThumb { 0%, 60% { opacity: 0; } 66%, 95% { opacity: 1; } 100% { opacity: 0; } }
.bd { height: 34px; padding: 0 !important; } .bd--sky { background: linear-gradient(#7DD3FC, #E0F2FE); } .bd--sea { background: linear-gradient(#0EA5E9, #1E3A8A); } .bd--space { background: radial-gradient(#fff 1px, transparent 1px) 0 0/8px 8px, #1E1B4B; } .bd--park { background: linear-gradient(#BAE6FD 60%, #4ADE80 60%); }
@keyframes aniSky { 0%, 60% { background: #fff; } 66%, 95% { background: linear-gradient(#7DD3FC, #E0F2FE); } 100% { background: #fff; } }
/* paint editor */
.paint { border-radius: 12px; overflow: hidden; border: 1px solid #C4B5FD; background: #fff; font: 600 11px system-ui; color: #575E75; }
.paint__tabs { display: flex; gap: 4px; padding: 6px 8px 0; background: #E9F1FC; }
.paint__tabs span { padding: 5px 10px; border-radius: 8px 8px 0 0; background: #D9E3F2; } .paint__tabs .is-on { background: #fff; color: #855CD6; }
.paint__body { display: grid; grid-template-columns: 60px 42px 1fr; gap: 6px; padding: 8px; }
.paint__list { display: flex; flex-direction: column; gap: 4px; } .paint__list span { display: flex; flex-direction: column; align-items: center; border: 2px solid #E2E8F0; border-radius: 6px; font-size: 18px; padding: 2px; } .paint__list small { font-size: 8px; } .paint__list .is-on { border-color: #855CD6; }
.paint__add { font-size: 16px !important; color: #855CD6; }
.paint__tools { display: grid; grid-template-columns: 1fr; gap: 3px; } .paint__tools span { display: grid; place-items: center; height: 22px; border-radius: 5px; background: #F1F5F9; } .paint__tools .is-on { background: #855CD6; color: #fff; }
.paint__canvas { width: 100%; height: auto; background: #fff; border: 1px solid #E2E8F0; border-radius: 6px; }
.paint__stroke { stroke-dasharray: 320; stroke-dashoffset: 320; animation: aniDraw 6s ease-in-out infinite; }
.paint__fill { opacity: 0; animation: aniFill 6s infinite; }
@keyframes aniDraw { 0%, 10% { stroke-dashoffset: 320; } 55%, 100% { stroke-dashoffset: 0; } }
@keyframes aniFill { 0%, 65% { opacity: 0; } 70%, 100% { opacity: 1; } }
.ani--costume .ani__hand { left: 46%; top: 40%; animation: aniBrush 6s ease-in-out infinite; }
@keyframes aniBrush { 0%, 10% { transform: translate(-60px, 40px); } 30% { transform: translate(0, -30px); } 55% { transform: translate(70px, 10px); } 68% { transform: translate(-30px, 40px); } 100% { transform: translate(-60px, 40px); } }
.ani--category .ani__hand { left: 18px; top: 92px; animation: aniCatHand 5s ease-in-out infinite; }
.ani--category .scr__pal { animation: aniPal 5s infinite; }
@keyframes aniCatHand { 0% { transform: translate(10px, 60px); } 30%, 40% { transform: translate(0, 0); } 35% { transform: scale(.9); } 100% { transform: translate(10px, 60px); } }
@keyframes aniPal { 0%, 34% { opacity: .35; } 40%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ani *, .paint__stroke, .paint__fill { animation: none !important; } .paint__stroke { stroke-dashoffset: 0; } .paint__fill, .ani__lib { opacity: 1; } }

/* solutions */
.csol h4 { margin: 10px 0 6px; } .csol__note { margin: 0; padding: 8px 10px; border-radius: 10px; background: #FEF3C7; color: #78350F; font-size: 13.5px; }
.csol__steps { margin: 0; padding-left: 20px; } .csol__steps li { margin-bottom: 4px; }
.code-asg { border: 2px dashed #A78BFA; border-radius: 14px; padding: 12px; background: #FAF5FF; display: grid; gap: 10px; }
.code-asg__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
html[data-theme="dark"] .sbw__card, html[data-theme="dark"] .shp, html[data-theme="dark"] .code-asg { color: #1B1840; }

/* Online classes list */
.badge--live { background: #DC2626; color: #fff; animation: oc-blink 1.2s infinite; }
@keyframes oc-blink { 50% { opacity: .55; } }
.oc-share { white-space: pre-wrap; background: var(--role-soft, #F6ECFF); border-radius: 12px; padding: 12px 14px; font: 14px/1.5 Inter, sans-serif; margin: 0; }
.oc-students { max-height: 220px; overflow: auto; }
.oc-new summary { cursor: pointer; }

/* Assignment library */
.lib-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.lib-tab { border: 1.5px solid var(--line, #E2E8F0); background: var(--surface, #fff); color: var(--ink, #1B1840); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.lib-tab:hover { border-color: #7C3AED; }
.lib-tab.is-on { background: #7C3AED; border-color: #7C3AED; color: #fff; }
.lib-item .disclosure summary { color: #7C3AED; font-weight: 600; }
.csol--music .notation, .csol--music > div { margin-bottom: 10px; }

/* Music solution: hear / listen buttons */
.csol__play { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 12px; }
.csol__play .field__hint { flex-basis: 100%; margin: 0; }

/* Scratch outcome screen (animated stage) */
.sst { margin: 0 0 16px; border: 1.5px solid var(--line, #E2E8F0); border-radius: 14px; overflow: hidden; background: var(--surface, #fff); width: 100%; max-width: 560px; }
.lib-item, .lib-item .disclosure { min-width: 0; max-width: 100%; }
.lib-item [data-lib-sol-body] { overflow-x: auto; }
.sst-top { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: #E9F1FC; border-bottom: 1px solid #C7D7EE; }
.sst-btn { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; display: grid; place-items: center; padding: 3px; }
.sst-btn:hover { background: #fff; } .sst-btn svg { width: 22px; height: 22px; }
.sst-title { font: 700 13px Inter, sans-serif; color: #33405E; margin-left: 4px; }
.sst-stage { position: relative; aspect-ratio: 4 / 3; overflow: hidden; container-type: inline-size; background: #fff; }
.sst-stage.is-paused *, .sst-stage.is-paused { animation-play-state: paused !important; }
.sst--white { background: #fff; }
.sst--sky { background: linear-gradient(#9BD7FF, #DDF3FF 75%, #7BCB6A 75%); }
.sst--grass { background: linear-gradient(#BDE8FF, #E8F8FF 55%, #8BD17C 55%, #5DB04E); }
.sst--night { background: radial-gradient(1.2cqw 1.2cqw at 20% 20%, #fff8 50%, transparent 52%), radial-gradient(.9cqw .9cqw at 70% 30%, #fff8 50%, transparent 52%), radial-gradient(1cqw 1cqw at 45% 75%, #fff6 50%, transparent 52%), linear-gradient(#0B1030, #24306B); }
.sst--space { background: radial-gradient(.8cqw .8cqw at 15% 30%, #fff 50%, transparent 52%), radial-gradient(.6cqw .6cqw at 80% 20%, #fff 50%, transparent 52%), radial-gradient(.7cqw .7cqw at 60% 60%, #fffa 50%, transparent 52%), radial-gradient(.5cqw .5cqw at 30% 85%, #fff 50%, transparent 52%), #05060F; }
.sst--sea { background: radial-gradient(1.5cqw 1.5cqw at 20% 70%, #ffffff55 45%, transparent 50%), radial-gradient(1cqw 1cqw at 80% 40%, #ffffff55 45%, transparent 50%), linear-gradient(#4FC3F7, #0277BD 85%, #E9D8A6 85%); }
.sst--road { background: repeating-linear-gradient(90deg, #fff 0 6%, transparent 6% 12%) 0 51% / 100% 1.2% no-repeat, linear-gradient(#7BCB6A 0 18%, #555 18% 82%, #7BCB6A 82%); }
.sst--stage { background: linear-gradient(90deg, #B91C1C 0 12%, transparent 12% 88%, #B91C1C 88%), linear-gradient(#3B0764, #6D28D9 72%, #92400E 72%); }
.sst--dark { background: #111827; }
.sst--maze { background: #fff; }
.sst--daynight { animation: sst-daynight 6s steps(1) infinite; }
@keyframes sst-daynight { 0% { background: linear-gradient(#8FD3FF, #E7F7FF 70%, #7BCB6A 70%); } 50% { background: linear-gradient(#0B1030, #2B3A80 70%, #2F5B2A 70%); } }
.sst--scenes { animation: sst-scenes 9s steps(1) infinite; }
@keyframes sst-scenes { 0% { background: linear-gradient(#BDE8FF 60%, #8BD17C 60%); } 33% { background: linear-gradient(#FDE68A 60%, #E9C46A 60%); } 66% { background: linear-gradient(#3B0764 60%, #6D28D9 60%); } }
.sst-maze { position: absolute; inset: 0; width: 100%; height: 100%; }
.sst-i { position: absolute; transform: translate(-50%, -50%); animation-delay: var(--d, 0s); animation-iteration-count: infinite; z-index: 2; }
.sst-e { display: block; font-size: calc(var(--s, 12) * 1cqw); line-height: 1; transform-origin: center; animation-iteration-count: infinite; }
.sst-bar { display: block; width: calc(var(--s, 12) * 1.6cqw); height: 2.2cqw; border-radius: 1cqw; background: #F59E0B; }
.sst-say { position: absolute; z-index: 4; transform: translate(-15%, -100%); background: #fff; color: #1B1840; border: 2px solid #C9CCD6; border-radius: 3cqw; padding: 1.2cqw 2.4cqw; font: 600 max(11px, 3.2cqw) Inter, sans-serif; white-space: nowrap; max-width: 70cqw; overflow: hidden; text-overflow: ellipsis; animation: sst-pop .4s ease-out both; }
.sst-say::after { content: ""; position: absolute; left: 14%; bottom: -2.4cqw; border: 1.2cqw solid transparent; border-top-color: #C9CCD6; }
@keyframes sst-pop { from { transform: translate(-15%, -80%) scale(.6); opacity: 0; } }
.sst-vars { position: absolute; left: 1.5cqw; top: 1.5cqw; display: grid; gap: 1cqw; z-index: 5; }
.sst-var { display: inline-flex; align-items: center; gap: 1.2cqw; background: #E6EAF0; border: 1px solid #C2C7D0; border-radius: 1cqw; padding: .6cqw 1.2cqw; font: 700 max(10px, 2.6cqw) Inter, sans-serif; color: #444; }
.sst-var i { font-style: normal; background: #FF8C1A; color: #fff; border-radius: 1cqw; padding: .2cqw 1.4cqw; min-width: 4cqw; text-align: center; }
.sst-lists { position: absolute; right: 1.5cqw; top: 1.5cqw; display: flex; gap: 1cqw; z-index: 5; }
.sst-list { display: grid; gap: .4cqw; background: #E6EAF0; border: 1px solid #C2C7D0; border-radius: 1cqw; padding: 1cqw; font: 600 max(9px, 2.2cqw) Inter, sans-serif; color: #333; }
.sst-list span { background: #FC662C; color: #fff; border-radius: .6cqw; padding: .2cqw 1cqw; } .sst-list span i { font-style: normal; color: #ffffffb0; margin-right: 1cqw; } .sst-list small { color: #666; font-size: max(8px, 1.8cqw); }
.sst-ask { position: absolute; left: 3cqw; right: 3cqw; bottom: 2.5cqw; z-index: 5; background: #fff; border: 2px solid #C9CCD6; border-radius: 2cqw; padding: 1.4cqw 2cqw; display: grid; gap: 1cqw; font: 600 max(11px, 3cqw) Inter, sans-serif; color: #1B1840; }
.sst-ask__in { display: flex; align-items: center; gap: 1.5cqw; border: 2px solid #855CD6; border-radius: 3cqw; padding: .6cqw 1.6cqw; }
.sst-ask__in i { flex: 1; height: 3.4cqw; border-right: 2px solid #1B1840; animation: sst-caret 1s steps(1) infinite; max-width: 1px; }
.sst-ask__in b { margin-left: auto; width: 4.5cqw; height: 4.5cqw; border-radius: 50%; background: #855CD6; color: #fff; display: grid; place-items: center; font-size: 2.6cqw; }
@keyframes sst-caret { 50% { opacity: 0; } }
.sst-plat { position: absolute; height: 3cqw; background: #22C55E; border-radius: 1cqw; box-shadow: inset 0 -1cqw 0 #15803D; }
.sst-pipe { position: absolute; top: 0; bottom: 0; width: 10%; left: 100%; animation: sst-pipe 4.2s linear infinite; }
.sst-pipe i { position: absolute; left: 0; right: 0; background: #22C55E; border: .6cqw solid #15803D; }
.sst-pipe i:first-child { top: 0; height: var(--g); } .sst-pipe i:last-child { bottom: 0; top: calc(var(--g) + 28%); }
@keyframes sst-pipe { to { left: -12%; } }
.sst-bricks { position: absolute; left: 4%; right: 4%; top: 8%; display: grid; grid-template-columns: repeat(8, 1fr); gap: 1cqw; }
.sst-bricks span { height: 5cqw; border-radius: .8cqw; background: hsl(calc(var(--k) * 40) 80% 55%); animation: sst-brick 6s infinite; animation-delay: calc(var(--k) * .7s); }
@keyframes sst-brick { 0%, 60% { opacity: 1; transform: none; } 65%, 100% { opacity: 0; transform: scale(.4); } }
.sst-piano { position: absolute; left: 12%; right: 12%; top: 22%; bottom: 22%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1.5cqw; }
.sst-piano span { background: #fff; border: 2px solid #334155; border-radius: 0 0 2cqw 2cqw; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 2cqw; animation: sst-key 5s infinite; animation-delay: calc(var(--k) * 1s); }
.sst-piano b { font: 800 max(12px, 4cqw) Inter, sans-serif; color: #334155; }
@keyframes sst-key { 0%, 18%, 100% { background: #fff; } 2%, 14% { background: #FDE047; } }
.sst-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.sst-svg rect, .sst-svg path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: sst-draw 9s infinite; animation-delay: calc(var(--k) * .55s); }
@keyframes sst-draw { 0% { stroke-dashoffset: 100; } 12%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.sst-shop { position: absolute; right: 3cqw; bottom: 3cqw; z-index: 5; background: #4C97FF; color: #fff; border-radius: 2cqw; padding: 1.4cqw 2.4cqw; font: 700 max(10px, 2.8cqw) Inter, sans-serif; }
.sst-cap { padding: 8px 12px 10px; font-size: .88rem; color: var(--ink-2, #4A4868); }
.sst-keys { margin: 6px 0 0; font-size: .82rem; } .sst-keys kbd { display: inline-block; min-width: 1.6em; text-align: center; padding: 1px 6px; border: 1px solid #CBD5E1; border-bottom-width: 2px; border-radius: 6px; background: #F8FAFC; color: #1B1840; font: 700 .78rem Inter, sans-serif; }
/* sprite movements (left/top) */
.m-bounceX { animation: sst-bounceX 3s linear infinite; } @keyframes sst-bounceX { 0%, 100% { left: 10%; } 50% { left: 90%; } }
.m-swim1, .m-chase { animation: sst-swim1 8s ease-in-out infinite; } .m-chase { animation-delay: -6.8s; }
@keyframes sst-swim1 { 0%, 100% { left: 30%; top: 40%; } 25% { left: 72%; top: 28%; } 50% { left: 82%; top: 62%; } 75% { left: 40%; top: 72%; } }
.m-swim2 { animation: sst-swim2 9s ease-in-out infinite; } @keyframes sst-swim2 { 0%, 100% { left: 65%; top: 66%; } 30% { left: 20%; top: 55%; } 60% { left: 35%; top: 28%; } 80% { left: 75%; top: 40%; } }
.m-rise { animation: sst-rise 4.5s ease-in infinite; } @keyframes sst-rise { 0%, 35% { top: 80%; opacity: 1; } 90% { top: -12%; opacity: 1; } 100% { top: -12%; opacity: 0; } }
.m-drive { animation: sst-drive 6s ease-in-out infinite; } @keyframes sst-drive { 0%, 100% { left: 25%; top: 55%; } 25% { left: 70%; top: 35%; } 50% { left: 82%; top: 68%; } 75% { left: 35%; top: 75%; } }
.m-orbit, .m-orbit2 { animation: sst-orbit 6s ease-in-out infinite; } .m-orbit2 { animation-delay: -.8s; }
@keyframes sst-orbit { 0%, 100% { left: 35%; top: 35%; } 25% { left: 68%; top: 30%; } 50% { left: 72%; top: 62%; } 75% { left: 32%; top: 66%; } }
.m-keepup { animation: sst-keepup 4s ease-in infinite; } @keyframes sst-keepup { 0%, 100% { top: 22%; } 62% { top: 64%; } 72% { top: 20%; } }
.m-tap { animation: sst-tap 4s infinite; } @keyframes sst-tap { 0%, 55%, 80%, 100% { opacity: 0; top: 74%; } 62%, 70% { opacity: 1; top: 70%; } }
.m-fall { animation: sst-fall 3s linear infinite; animation-delay: var(--d); } @keyframes sst-fall { from { top: -8%; } to { top: 108%; } }
.m-paddle { animation: sst-paddle 3.2s ease-in-out infinite; } @keyframes sst-paddle { 0%, 100% { left: 30%; } 50% { left: 70%; } }
.m-shoot { animation: sst-shoot 1.2s linear infinite; } @keyframes sst-shoot { from { top: 78%; opacity: 1; } to { top: -4%; opacity: .6; } }
.m-maze { animation: sst-maze 7s linear infinite; } @keyframes sst-maze { 0% { left: 12%; top: 86%; } 20% { left: 12%; top: 51%; } 50% { left: 70%; top: 51%; } 65% { left: 70%; top: 31%; } 78% { left: 88%; top: 31%; } 90%, 100% { left: 88%; top: 16%; } }
.m-pong { animation: sst-pong 4s linear infinite; } @keyframes sst-pong { 0%, 100% { left: 20%; top: 18%; } 25% { left: 86%; top: 45%; } 50% { left: 50%; top: 84%; } 75% { left: 12%; top: 52%; } }
.m-carL { animation: sst-carL 3.6s linear infinite; } @keyframes sst-carL { from { left: -10%; } to { left: 110%; } }
.m-carR { animation: sst-carR 2.7s linear infinite; } @keyframes sst-carR { from { left: 110%; } to { left: -10%; } }
.m-hopup { animation: sst-hopup 6s steps(6) infinite; } @keyframes sst-hopup { from { top: 92%; } to { top: 8%; } }
.m-jump { animation: sst-jump 6s ease-in-out infinite; } @keyframes sst-jump { 0%, 100% { left: 18%; top: 70%; } 18% { left: 30%; top: 70%; } 30% { left: 42%; top: 40%; } 40% { left: 52%; top: 54%; } 55% { left: 62%; top: 54%; } 68% { left: 74%; top: 26%; } 78%, 92% { left: 82%; top: 38%; } }
.m-flappy { animation: sst-flappy 2.4s ease-in-out infinite; } @keyframes sst-flappy { 0%, 100% { top: 48%; } 20% { top: 34%; } 45% { top: 58%; } 65% { top: 40%; } 85% { top: 60%; } }
.m-tagA, .m-tagB { animation: sst-tag 5s ease-in-out infinite; } .m-tagB { animation-delay: -.7s; }
@keyframes sst-tag { 0%, 100% { left: 25%; top: 50%; } 25% { left: 55%; top: 28%; } 50% { left: 75%; top: 62%; } 75% { left: 40%; top: 72%; } }
.m-draw { animation: sst-drawpen 4.5s ease-in-out infinite alternate; } @keyframes sst-drawpen { 0% { left: 15%; top: 63%; } 25% { left: 35%; top: 30%; } 50% { left: 48%; top: 68%; } 75% { left: 68%; top: 40%; } 100% { left: 87%; top: 58%; } }
.m-notes { animation: sst-notes 2.2s ease-out infinite; animation-delay: var(--d); } @keyframes sst-notes { from { opacity: 1; transform: translate(-50%, -50%); } to { opacity: 0; transform: translate(-50%, -260%); } }
/* sprite looks (transform / filter) */
.t-colour { animation: sst-colour 3s linear infinite; } @keyframes sst-colour { to { filter: hue-rotate(360deg); } }
.t-hop { animation: sst-hop .7s ease-in-out infinite alternate; } @keyframes sst-hop { to { transform: translateY(-14%); } }
.t-spin { animation: sst-spin 2s linear infinite; } @keyframes sst-spin { to { transform: rotate(360deg); } }
.t-colour.t-spin { animation: sst-spin 2s linear infinite, sst-colour 4s linear infinite; }
.t-pulse { animation: sst-pulse .8s ease-in-out infinite alternate; } @keyframes sst-pulse { to { transform: scale(1.15); } }
.t-colour.t-pulse { animation: sst-pulse .8s ease-in-out infinite alternate, sst-colour 3s linear infinite; }
.t-dance { animation: sst-dance .6s ease-in-out infinite alternate; } @keyframes sst-dance { from { transform: rotate(-10deg) scale(1); } to { transform: rotate(10deg) scale(1.1); } }
.t-flap { animation: sst-flap .35s ease-in-out infinite alternate; } @keyframes sst-flap { to { transform: scaleX(.75); } }
.t-shake { animation: sst-shake .3s ease-in-out infinite alternate; } @keyframes sst-shake { from { transform: rotate(-12deg); } to { transform: rotate(12deg); } }
@media (prefers-reduced-motion: reduce) { .sst-stage * { animation-duration: 0s !important; } }

/* Metronome bar */
.metro { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 8px 0; padding: 6px 10px; border-radius: 12px; background: var(--surface-2, #F6F5FB); border: 1px solid var(--line, #E2E8F0); font-size: .85rem; color: var(--ink, #1B1840); }
.metro__btn { border: 1.5px solid #CBD5E1; background: #fff; color: #1B1840; border-radius: 999px; padding: 4px 12px; font: 700 .82rem Inter, sans-serif; cursor: pointer; }
.metro__btn b { color: #64748B; } .metro.is-on .metro__btn, .metro__btn.is-on { background: #16A34A; border-color: #16A34A; color: #fff; } .metro.is-on .metro__btn b, .metro__btn.is-on b { color: #fff; }
.metro__tempo { display: inline-flex; align-items: center; gap: 4px; } .metro__tempo input { width: 110px; accent-color: #7C3AED; }
.metro__step { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #CBD5E1; background: #fff; color: #1B1840; font-weight: 800; cursor: pointer; line-height: 1; }
.metro__sig { font: 800 .9rem "Plus Jakarta Sans", Inter, sans-serif; padding: 2px 8px; border-radius: 8px; background: #EDE9FE; color: #4C1D95; }
.metro__dots { display: inline-flex; gap: 5px; } .metro__dots i { width: 11px; height: 11px; border-radius: 50%; background: #CBD5E1; transition: transform .08s, background .08s; }
.metro__dots i.is-one { background: #FCA5A5; } .metro__dots i.is-on { background: #16A34A; transform: scale(1.35); } .metro__dots i.is-one.is-on { background: #DC2626; }
.metro--coach { margin: 0; padding: 4px 8px; }
/* Sing a song */
.sing { display: grid; gap: 12px; }
.sing__rec { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: linear-gradient(120deg, #F5F3FF, #ECFEFF); border: 2px dashed #A5B4FC; }
.sing__rec.is-on { border-style: solid; border-color: #DC2626; background: linear-gradient(120deg, #FEF2F2, #FFF7ED); }
.sing__big { display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 999px; padding: 10px 18px; background: #DC2626; color: #fff; font: 800 1rem "Plus Jakarta Sans", Inter, sans-serif; cursor: pointer; box-shadow: 0 8px 20px #DC262644; }
.sing__rec.is-on .sing__big { background: #1B1840; }
.sing__count { font: 800 2rem "Plus Jakarta Sans", Inter, sans-serif; color: #DC2626; min-width: 2ch; text-align: center; }
.sing__level { flex: 1; min-width: 120px; height: 10px; border-radius: 999px; background: #E0E7FF; overflow: hidden; } .sing__level i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #818CF8, #22C55E); }
.sing__heard { display: flex; flex-wrap: wrap; gap: 4px; min-height: 34px; } .sing__heard span { padding: 3px 8px; border-radius: 8px; background: #EDE9FE; color: #3730A3; font-weight: 800; }
.sing__steps { margin: 0; padding-left: 20px; font-size: .9rem; } .sing__steps li { margin: 2px 0; }
.mysong__status { font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #F1F5F9; color: #334155; }
.mysong__status--shared { background: #FEF3C7; color: #92400E; } .mysong__status--published { background: #DCFCE7; color: #166534; }
