/* منظومة معالي — self-hosted font + icons only (CSP 'self'): no school data leaks to third parties. */
@font-face {
  font-family: "Baloo Bhaijaan 2"; font-weight: 400 800; font-display: swap; src: url(fonts/baloo-arabic.woff2) format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Baloo Bhaijaan 2"; font-weight: 400 800; font-display: swap; src: url(fonts/baloo-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f5f2ff;
  --card: #fff;
  --ink: #2b2250;
  --muted: #857ca8;
  --line: #ece7fb;
  --violet: #6c4cf5;
  --violet-d: #4d30d1;
  --violet-l: #efeaff;
  --sun: #ffc531;
  --pos: #12b679;
  --pos-d: #0b9461;
  --pos-l: #e2f8ee;
  --neg: #ff5a5f;
  --neg-d: #d93f45;
  --neg-l: #ffeaea;
  --r: 24px;
  --shadow: 0 16px 36px -20px rgb(76 48 180 / .5);
  --shadow-sm: 0 6px 16px -10px rgb(76 48 180 / .45);
}
.tone-0 { --t1: #a487ff; --t2: #6a43e6; }
.tone-1 { --t1: #5ccaf7; --t2: #1b86d1; }
.tone-2 { --t1: #45dba6; --t2: #0f9f6e; }
.tone-3 { --t1: #ffbb3d; --t2: #f07a00; }
.tone-4 { --t1: #ff8f7f; --t2: #e04b45; }
.tone-5 { --t1: #ff8fd2; --t2: #cf3f93; }
.tone-6 { --t1: #a2dc3c; --t2: #5a970b; }
.tone-7 { --t1: #3fd9d3; --t2: #0d8e98; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg);
  font: 17px/1.6 "Baloo Bhaijaan 2", "SF Arabic", "Geeza Pro", Tahoma, sans-serif;
  background-image:
    radial-gradient(600px 400px at 100% -5%, rgb(108 76 245 / .14), transparent 70%),
    radial-gradient(500px 380px at -10% 30%, rgb(43 180 245 / .12), transparent 70%),
    radial-gradient(520px 420px at 90% 95%, rgb(255 197 49 / .13), transparent 70%);
  background-attachment: fixed;
}
a { color: var(--violet); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 2rem; font-weight: 800; }
p { margin: .3rem 0; }
main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 16px 6rem; }
.muted { color: var(--muted); font-weight: 400; }
.center { text-align: center; }
.ico { width: 1.6em; height: 1.6em; object-fit: contain; flex: none; user-select: none; }
.inline-ico { width: 1.25em; height: 1.25em; vertical-align: -.2em; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: rgb(255 255 255 / .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 1px 0 var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; padding: .55rem 16px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.brand .ico { width: 42px; height: 42px; animation: spin-in 1s ease; }
.brand span { display: flex; flex-direction: column; line-height: 1.05; }
.brand b { font-size: 1.45rem; font-weight: 800; color: var(--violet); }
.brand small { font-size: .72rem; color: var(--muted); }
.brand.big { justify-content: center; margin-bottom: 1.2rem; }
.brand.big .ico { width: 56px; height: 56px; }
.brand.big b { font-size: 1.9rem; }
.top nav { display: flex; align-items: center; gap: .3rem; }
.top nav a, .top nav button {
  display: flex; align-items: center; gap: .4rem; padding: .4rem .85rem; border-radius: 999px;
  color: var(--ink); text-decoration: none; font: inherit; font-weight: 600; font-size: .95rem; background: none; border: 0; cursor: pointer;
  transition: background .2s;
}
.top nav a:hover, .top nav button:hover { background: var(--violet-l); }
.top nav a.on { background: var(--violet-l); color: var(--violet); }
.top nav .ico { width: 28px; height: 28px; }
.top nav form { margin: 0; }

/* ---------- basics ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.section-title { display: flex; align-items: center; gap: .5rem; font-size: 1.3rem; font-weight: 800; margin: 2rem 0 .9rem; }
.section-title .ico { width: 38px; height: 38px; }
.split { display: grid; grid-template-columns: 1.55fr 1fr; gap: 0 1.5rem; align-items: start; }
.narrow-page { max-width: 620px; margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 16px; padding: .7rem 1.4rem; background: var(--violet); color: #fff;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  box-shadow: 0 5px 0 var(--violet-d); transition: transform .1s, box-shadow .1s, filter .2s; margin-bottom: 5px;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--violet-d); }
.btn.block { width: 100%; }
.btn.small { padding: .35rem .9rem; font-size: .9rem; border-radius: 12px; }
.btn.light { background: #fff; color: var(--violet); box-shadow: 0 4px 0 rgb(0 0 0 / .12); }
.btn-ico { width: 26px; height: 26px; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--violet); cursor: pointer; font-weight: 600; }
.link.danger { color: var(--neg); font-size: .85rem; }
.x { width: 30px; height: 30px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .85rem; flex: none; }
.x:hover { background: var(--neg-l); color: var(--neg); }

label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .85rem; }
input, textarea, select {
  display: block; width: 100%; margin-top: .3rem; padding: .7rem .95rem; border: 2px solid var(--line); border-radius: 14px;
  font: inherit; font-weight: 500; color: var(--ink); background: #fbfaff; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--violet); box-shadow: 0 0 0 4px rgb(108 76 245 / .15); background: #fff; }
textarea { resize: vertical; }
.code { letter-spacing: .25em; text-transform: uppercase; text-align: center; font-weight: 800; font-size: 1.3rem; }
select.num { width: 5.5rem; flex: none; margin: 0; direction: ltr; }
.stack > * + * { margin-top: .8rem; }
.inline { display: flex; gap: .5rem; align-items: center; }
.inline input { margin: 0; }

.flash, .error, .warn { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-radius: 16px; font-weight: 600; }
.flash { background: var(--pos-l); color: var(--pos-d); margin-bottom: 1rem; animation: drop .5s ease; }
.error { background: var(--neg-l); color: var(--neg-d); }
.warn { background: #fff5d9; color: #946200; font-size: .9rem; font-weight: 500; }
.flash .ico, .error .ico, .warn .ico { width: 30px; height: 30px; }

.tag { display: inline-flex; align-items: center; gap: .3rem; border: 0; border-radius: 999px; padding: .2rem .75rem; font: inherit; font-size: .8rem; font-weight: 700; background: var(--violet-l); color: var(--violet); cursor: pointer; white-space: nowrap; }
.tag .ico { width: 18px; height: 18px; }
.tag.pos { background: var(--pos-l); color: var(--pos-d); }
.tag.neg { background: var(--neg-l); color: var(--neg-d); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty .ico { width: 96px; height: 96px; animation: float 4s ease-in-out infinite; }
.empty .btn { margin-top: .8rem; }

/* ---------- hello header ---------- */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #fff; border-radius: 28px; padding: 1.4rem 1.6rem; box-shadow: var(--shadow); margin-bottom: 1.5rem; }
.hello-kicker { font-weight: 700; color: var(--violet); }
.hello-ico { width: 96px; height: 96px; animation: float 5s ease-in-out infinite; }

/* ---------- class tiles (teacher home) ---------- */
.class-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.class-tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .2rem; padding: 1.4rem; min-height: 190px;
  border-radius: 28px; color: #fff; text-decoration: none; background: linear-gradient(140deg, var(--t1), var(--t2));
  box-shadow: 0 18px 30px -18px var(--t2); transition: transform .2s;
}
.class-tile:hover { transform: translateY(-5px) rotate(-.5deg); }
.class-tile strong { font-size: 1.5rem; font-weight: 800; }
.tile-meta { opacity: .92; }
.tile-ico { position: absolute; width: 110px; height: 110px; inset-inline-end: -14px; top: -10px; transform: rotate(12deg); opacity: .95; }
.stack-avatars { display: flex; margin-top: auto; padding-top: .8rem; align-items: center; }
.stack-avatars .avatar { width: 44px; height: 44px; background: #fff; border-radius: 50%; border: 3px solid #fff; margin-inline-start: -10px; }
.stack-avatars .avatar:first-child { margin-inline-start: 0; }
.stack-avatars i { font-style: normal; font-weight: 800; margin-inline-start: .4rem; }

/* ---------- class banner ---------- */
.banner {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.8rem 2rem; border-radius: 32px; color: #fff; background: linear-gradient(130deg, var(--t1), var(--t2));
  box-shadow: 0 22px 40px -24px var(--t2); margin-bottom: 1.6rem;
}
.banner h1 { font-size: 2.3rem; }
.kicker { font-weight: 700; opacity: .9; }
.banner-text, .banner-stats { position: relative; z-index: 1; }
.banner-stats { display: flex; gap: .8rem; }
.banner-stats div { display: flex; flex-direction: column; align-items: center; min-width: 110px; padding: .7rem 1rem; border-radius: 22px; background: rgb(255 255 255 / .2); backdrop-filter: blur(6px); }
.banner-stats .ico { width: 44px; height: 44px; }
.banner-stats b { font-size: 1.8rem; line-height: 1.1; font-weight: 800; }
.banner-stats span { font-size: .85rem; opacity: .9; }
.fl { position: absolute; animation: float 6s ease-in-out infinite; pointer-events: none; }
.b1 { width: 90px; height: 90px; inset-inline-start: 46%; top: -18px; opacity: .35; animation-delay: -1s; }
.b2 { width: 54px; height: 54px; inset-inline-start: 38%; bottom: 8px; opacity: .45; animation-delay: -3s; }
.b3 { width: 70px; height: 70px; inset-inline-start: 58%; bottom: -20px; opacity: .3; animation-delay: -2s; }

/* ---------- roster ---------- */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
.student {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.1rem .6rem 1rem;
  background: #fff; border: 0; border-radius: 26px; box-shadow: var(--shadow-sm); font: inherit; color: inherit; cursor: pointer;
  transition: transform .18s, box-shadow .18s;
}
.student:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.student:hover .avatar, .student:hover .all-ico { animation: wiggle .5s ease; }
.student:active { transform: scale(.95); }
.student .avatar { width: 96px; height: 96px; }
.student .nm { font-weight: 700; font-size: .98rem; line-height: 1.3; text-align: center; }
.student.all { background: linear-gradient(160deg, #fff, var(--violet-l)); border: 2.5px dashed #cbbcff; box-shadow: none; }
.all-ico { display: grid; place-items: center; width: 96px; height: 96px; }
.all-ico .ico { width: 78px; height: 78px; }
.total {
  position: absolute; top: .55rem; inset-inline-end: .55rem; min-width: 2.1rem; height: 2.1rem; padding: 0 .45rem;
  display: grid; place-items: center; border-radius: 999px; background: var(--pos); color: #fff; font-size: .95rem; font-weight: 800;
  box-shadow: 0 3px 0 var(--pos-d);
}
.total.neg { background: var(--neg); box-shadow: 0 3px 0 var(--neg-d); }
.total.bump { animation: bump .5s ease; }

/* ---------- award dialog ---------- */
dialog { border: 0; border-radius: 30px; padding: 0; width: min(660px, calc(100% - 24px)); max-height: calc(100% - 24px); box-shadow: 0 30px 80px rgb(30 20 80 / .35); color: var(--ink); }
dialog[open] { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
dialog.no-modal { position: fixed; inset: 0; margin: auto; z-index: 100; height: fit-content; }
dialog::backdrop { background: rgb(35 25 90 / .5); }
.dlg-head { display: flex; align-items: center; gap: .9rem; padding: 1.1rem 1.4rem .6rem; }
.dlg-head > div { flex: 1; }
.dlg-head h3 { font-size: 1.45rem; font-weight: 800; }
.dlg-head a { font-size: .9rem; font-weight: 600; text-decoration: none; }
#award-avatar { width: 64px; height: 64px; display: grid; place-items: center; }
#award-avatar .avatar, #award-avatar .ico { width: 64px; height: 64px; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--violet-l); color: var(--violet); font-size: 1rem; cursor: pointer; }
.tabs { display: flex; gap: .4rem; margin: .4rem 1.4rem 0; padding: .3rem; background: var(--violet-l); border-radius: 18px; }
.tabs input { position: absolute; opacity: 0; pointer-events: none; }
.tabs label { flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem; margin: 0; padding: .45rem; border-radius: 14px; cursor: pointer; color: var(--muted); transition: background .2s, color .2s; }
.tabs label .ico { width: 26px; height: 26px; }
#tab-pos:checked + label { background: #fff; color: var(--pos-d); box-shadow: var(--shadow-sm); }
#tab-neg:checked + label { background: #fff; color: var(--neg-d); box-shadow: var(--shadow-sm); }
#award:has(#tab-pos:checked) .neg-list, #award:has(#tab-neg:checked) .pos-list { display: none; }
.behaviors { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .8rem; padding: 1.2rem 1.4rem 1.5rem; }
.beh {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1rem .5rem .8rem;
  background: #fff; border: 2.5px solid var(--line); border-radius: 22px; font: inherit; color: var(--ink); cursor: pointer;
  transition: transform .15s, border-color .15s, background .15s;
}
.beh .ico { width: 64px; height: 64px; transition: transform .2s; }
.beh:hover .ico { transform: scale(1.12) rotate(-6deg); }
.beh:active { transform: scale(.93); }
.beh-name { font-weight: 700; font-size: .95rem; line-height: 1.25; text-align: center; }
.beh-pts { position: absolute; top: .45rem; inset-inline-end: .45rem; min-width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 999px; color: #fff; font-weight: 800; font-size: .85rem; }
.beh.pos .beh-pts { background: var(--pos); }
.beh.neg .beh-pts { background: var(--neg); }
.beh.pos:hover { border-color: var(--pos); background: var(--pos-l); }
.beh.neg:hover { border-color: var(--neg); background: var(--neg-l); }

/* celebration overlay (built by app.js) */
.celebrate { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 50; }
.celebrate .burst { display: flex; flex-direction: column; align-items: center; animation: burst 1.3s cubic-bezier(.2, 1.3, .4, 1) forwards; }
.celebrate .ico { width: 170px; height: 170px; filter: drop-shadow(0 18px 24px rgb(0 0 0 / .2)); }
.celebrate b { font-size: 3.4rem; font-weight: 800; color: #fff; padding: 0 1.2rem; border-radius: 999px; background: var(--pos); box-shadow: 0 6px 0 var(--pos-d); direction: ltr; margin-top: -.6rem; }
.celebrate.neg b { background: var(--neg); box-shadow: 0 6px 0 var(--neg-d); }
.celebrate.neg .burst { animation-name: burst-neg; }
.celebrate span { margin-top: .5rem; font-weight: 800; font-size: 1.2rem; background: #fff; padding: .1rem 1rem; border-radius: 999px; box-shadow: var(--shadow); }
.confetti { position: absolute; top: 50%; left: 50%; width: 12px; height: 16px; border-radius: 3px; animation: confetti 1.2s ease-out forwards; }

/* ---------- behaviors list & picker ---------- */
.beh-list { display: flex; flex-direction: column; gap: .4rem; }
.beh-row { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-radius: 14px; }
.beh-row:hover { background: #faf8ff; }
.beh-row .ico { width: 38px; height: 38px; }
.beh-row span { flex: 1; font-weight: 600; }
.beh-row b { min-width: 2.3rem; text-align: center; border-radius: 999px; padding: 0 .4rem; font-size: .9rem; }
.beh-row.pos b { background: var(--pos-l); color: var(--pos-d); }
.beh-row.neg b { background: var(--neg-l); color: var(--neg-d); }
.beh-row small { color: var(--muted); font-size: .75rem; width: 30px; text-align: center; }
.beh-row form { margin: 0; }
.add-box { margin-top: 1rem; border-top: 2px dashed var(--line); padding-top: .8rem; }
.add-box summary { cursor: pointer; font-weight: 700; color: var(--violet); list-style: none; }
.add-box summary::-webkit-details-marker { display: none; }
.add-box form { margin-top: .8rem; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: .35rem; max-height: 210px; overflow-y: auto; padding: .2rem; }
.icon-picker label { margin: 0; display: grid; place-items: center; aspect-ratio: 1; border-radius: 14px; cursor: pointer; border: 2px solid transparent; }
.icon-picker label:hover { background: var(--violet-l); }
.icon-picker input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker .ico { width: 34px; height: 34px; }
.icon-picker label:has(input:checked) { background: var(--violet-l); border-color: var(--violet); }

/* ---------- posts ---------- */
.composer textarea { border: 0; background: transparent; padding: .2rem; font-size: 1.05rem; box-shadow: none; }
.composer textarea:focus { box-shadow: none; }
.composer .warn { margin-top: .6rem; }
.composer-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .8rem; padding-top: .8rem; border-top: 2px solid var(--line); }
.file-btn { display: inline-flex; align-items: center; gap: .4rem; margin: 0; padding: .4rem .9rem; border-radius: 14px; background: var(--violet-l); color: var(--violet); cursor: pointer; font-weight: 700; }
.file-btn .ico { width: 28px; height: 28px; }
.file-btn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.file-btn.has-file { background: var(--pos-l); color: var(--pos-d); }
.post-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .4rem; }
.post-head > div { display: flex; flex-direction: column; line-height: 1.3; flex: 1; }
.post-head .muted { font-size: .85rem; }
.post-head form { margin: 0; }
.post-ico { width: 48px; height: 48px; padding: 6px; background: var(--violet-l); border-radius: 50%; }
.post p { font-size: 1.05rem; }
.post-img { display: block; width: 100%; border-radius: 18px; margin-top: .7rem; }
.feed { max-width: 680px; }

/* ---------- lists ---------- */
.list-row { display: flex; align-items: center; gap: .7rem; padding: .55rem .2rem; border-bottom: 2px solid var(--line); text-decoration: none; color: inherit; }
.list-row:last-of-type { border-bottom: 0; }
.list-row > a, .list-row > span { flex: 1; font-weight: 600; }
.list-row form { margin: 0; }
.list-row.off { opacity: .5; }
.list-row .avatar.sm, .avatar.sm { width: 42px; height: 42px; }
.row-ico { width: 34px; height: 34px; }
.count { flex: none !important; min-width: 2rem; text-align: center; background: var(--sun); color: #5b3b00; border-radius: 999px; font-weight: 800; }

/* ---------- parent home ---------- */
.kids { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.2rem; }
.kid {
  position: relative; display: flex; align-items: center; gap: 1rem; padding: 1.2rem; border-radius: 28px; color: #fff; text-decoration: none;
  background: linear-gradient(135deg, var(--t1), var(--t2)); box-shadow: 0 18px 30px -18px var(--t2); transition: transform .2s;
}
.kid:hover { transform: translateY(-4px); }
.kid .avatar { width: 108px; height: 108px; background: rgb(255 255 255 / .9); border-radius: 50%; padding: 6px; flex: none; }
.kid-info { display: flex; flex-direction: column; gap: .1rem; }
.kid-info strong { font-size: 1.45rem; font-weight: 800; }
.kid-nums { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: rgb(255 255 255 / .22); padding: .15rem .7rem; border-radius: 999px; font-size: .9rem; }
.chip .ico { width: 24px; height: 24px; }
.ping { position: absolute; top: -8px; inset-inline-start: 18px; display: flex; align-items: center; gap: .2rem; background: #fff; color: var(--ink); border-radius: 999px; padding: .1rem .6rem .1rem .3rem; font-weight: 800; box-shadow: var(--shadow-sm); animation: float 3s ease-in-out infinite; }
.ping .ico { width: 26px; height: 26px; }

/* ---------- student page ---------- */
.student-hero {
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; padding: 1.6rem 2rem; border-radius: 32px; color: #fff;
  background: linear-gradient(130deg, var(--t1), var(--t2)); box-shadow: 0 22px 40px -24px var(--t2); margin-bottom: 1.4rem;
}
.avatar.xl { width: 150px; height: 150px; background: rgb(255 255 255 / .92); border-radius: 50%; padding: 10px; animation: float 5s ease-in-out infinite; }
.hero-text { flex: 1; }
.hero-text h1 { font-size: 2.3rem; }
.hero-text .btn { margin-top: .6rem; }
.ring { --pct: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#fff calc(var(--pct) * 1%), rgb(255 255 255 / .25) 0); }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--t2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring b { font-size: 1.6rem; font-weight: 800; }
.ring span { font-size: .8rem; opacity: .9; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat { display: flex; flex-direction: column; align-items: center; text-align: center; background: #fff; border-radius: 26px; padding: 1.1rem .6rem; box-shadow: var(--shadow); }
.stat .ico { width: 64px; height: 64px; margin-top: -2.2rem; animation: float 5s ease-in-out infinite; }
.stat b { font-size: 2.3rem; line-height: 1.1; font-weight: 800; color: var(--violet); }
.stat.pos b { color: var(--pos); }
.stat.neg b { color: var(--neg); }
.stat span { font-size: .9rem; color: var(--muted); }
.stats { margin-top: 2.6rem; }
.strengths { display: flex; flex-wrap: wrap; gap: .8rem; }
.strength { display: flex; align-items: center; gap: .5rem; background: #fff; padding: .5rem 1rem .5rem .6rem; border-radius: 999px; box-shadow: var(--shadow-sm); }
.strength .ico { width: 40px; height: 40px; }
.strength span { color: var(--pos-d); font-weight: 800; }
.timeline { display: flex; flex-direction: column; gap: .3rem; max-height: 560px; overflow-y: auto; }
.tl-row { display: flex; align-items: center; gap: .7rem; padding: .45rem .4rem; border-radius: 16px; }
.tl-row:hover { background: #faf8ff; }
.tl-row .ico { width: 42px; height: 42px; }
.tl-row > div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.tl-row .muted { font-size: .82rem; }
.tl-pts { font-weight: 800; border-radius: 999px; padding: 0 .55rem; }
.tl-row.pos .tl-pts { background: var(--pos-l); color: var(--pos-d); }
.tl-row.neg .tl-pts { background: var(--neg-l); color: var(--neg-d); }
.tl-row form { margin: 0; }
.chat-log { max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; padding: .2rem; }
.msg { max-width: 82%; background: #f3f1fa; border-radius: 20px 20px 20px 6px; padding: .55rem .95rem; align-self: flex-end; }
.msg.mine { align-self: flex-start; background: linear-gradient(135deg, #8a6bff, var(--violet)); color: #fff; border-radius: 20px 20px 6px 20px; }
.msg .meta { font-size: .75rem; opacity: .7; }
.msg p { margin: 0; }
.chat-form { display: flex; gap: .5rem; align-items: flex-end; margin-top: 1rem; }
.chat-form textarea { margin: 0; }
.chat-form .btn { margin-bottom: 5px; }
.chat-photo { flex: none; margin-bottom: 5px; padding: .45rem .7rem; }
.chat-photo span { font-size: .85rem; }
.msg-img { display: block; max-width: 100%; max-height: 320px; margin-top: .4rem; border-radius: 14px; }
.invite { text-align: center; background: linear-gradient(135deg, #fff6d6, #ffe7a3); border-radius: 22px; padding: 1rem; margin-bottom: 1rem; }
.invite > .ico { width: 64px; height: 64px; }
.code-big { font-size: 2.2rem; font-weight: 800; letter-spacing: .15em; color: var(--ink); }

/* ---------- admin ---------- */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; align-items: start; }
.class-row { border-bottom: 2px solid var(--line); padding: .55rem 0; }
.class-row summary { display: flex; align-items: center; gap: .6rem; cursor: pointer; list-style: none; }
.class-row summary::-webkit-details-marker { display: none; }
.class-row summary b { flex: none; }
.class-row summary .muted { flex: 1; font-size: .85rem; }
.class-row summary .btn { margin: 0 0 4px; }
.class-row form { padding: .8rem 0 .3rem; }
.dot { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, var(--t1), var(--t2)); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.chk { margin: 0; cursor: pointer; }
.chk input { position: absolute; opacity: 0; pointer-events: none; }
.chk span { display: inline-block; padding: .25rem .85rem; border-radius: 999px; border: 2px solid var(--line); font-weight: 600; font-size: .9rem; }
.chk:has(input:checked) span { background: var(--violet); border-color: var(--violet); color: #fff; }
.scroll-x { overflow-x: auto; }
.log { width: 100%; border-collapse: collapse; font-size: .88rem; }
.log th { text-align: start; color: var(--muted); font-weight: 600; padding: .4rem; }
.log td { padding: .45rem .4rem; border-top: 2px solid var(--line); white-space: nowrap; }

/* ---------- auth: centred card on a playful stage ---------- */
.auth-page main { max-width: none; padding: 0; }
.auth-page { background: linear-gradient(150deg, #8a6bff 0%, #6c4cf5 45%, #2bb4f5 100%); }
.auth-stage { position: relative; overflow: hidden; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; padding: 2rem 16px; }
.auth-decor { position: absolute; inset: 0; pointer-events: none; }
.auth-decor::before { content: ""; position: absolute; width: 640px; height: 640px; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, rgb(255 255 255 / .22), transparent 65%); }
.auth-decor .fl { width: 84px; height: 84px; }
.d1 { top: 9%; left: 10%; }
.d2 { top: 12%; right: 11%; width: 108px !important; height: 108px !important; animation-delay: -2s !important; }
.d3 { bottom: 34%; left: 6%; animation-delay: -4s !important; }
.d4 { top: 5%; left: 44%; width: 58px !important; height: 58px !important; animation-delay: -1s !important; }
.d5 { bottom: 36%; right: 7%; width: 66px !important; height: 66px !important; animation-delay: -3s !important; }
.d6 { top: 42%; left: 20%; width: 56px !important; height: 56px !important; animation-delay: -5s !important; opacity: .9; }
.mon { position: absolute; width: 170px; height: 170px; filter: drop-shadow(0 16px 18px rgb(20 10 70 / .3)); animation: float 5s ease-in-out infinite; }
.n1 { bottom: 4%; left: 6%; }
.n2 { bottom: -2%; right: 5%; width: 210px; height: 210px; animation-delay: -1.5s; }
.n3 { top: 40%; right: 18%; width: 110px; height: 110px; animation-delay: -3s; }
.n4 { bottom: 8%; left: 24%; width: 110px; height: 110px; animation-delay: -2.2s; }
.auth-card { position: relative; z-index: 1; width: min(440px, 100%); padding: 2.2rem 1.8rem 1.6rem; background: #fff; border-radius: 34px; box-shadow: 0 40px 80px -30px rgb(20 10 70 / .55); animation: pop .5s cubic-bezier(.2, 1.3, .4, 1); }
.auth-tagline { position: relative; z-index: 1; margin: 0; text-align: center; color: #fff; text-shadow: 0 2px 10px rgb(20 10 70 / .3); }
.auth-tagline blockquote { margin: 0; font-size: 1.5rem; font-weight: 800; line-height: 1.5; }
.auth-tagline figcaption { margin-top: .2rem; font-size: .95rem; font-weight: 600; opacity: .85; }
.auth-tagline figcaption::before { content: "— "; }
.auth-card h1 { text-align: center; margin-bottom: 1.2rem; }
.auth-card > .muted { text-align: center; margin: -.8rem 0 1rem; }
.hero-ico { display: block; width: 96px; height: 96px; margin: 0 auto .5rem; animation: float 4s ease-in-out infinite; }
.narrow-page .auth-card { background: #fff; border-radius: 28px; box-shadow: var(--shadow); margin: 1rem auto; }
.join-link { display: flex; align-items: center; gap: .8rem; margin-top: 1.4rem; padding: .9rem 1rem; border-radius: 20px; background: linear-gradient(135deg, #fff6d6, #ffeaa8); color: #5b3b00; text-decoration: none; transition: transform .2s; }
.join-link:hover { transform: translateY(-2px); }
.join-link .ico { width: 46px; height: 46px; }
.join-link b { display: block; }
.secure-note { display: flex; align-items: center; justify-content: center; gap: .4rem; margin-top: 1.2rem; color: var(--muted); font-size: .85rem; }
.secure-note .ico { width: 24px; height: 24px; }

/* ---------- tabs + pop-up sheets (admin, class page) ---------- */
.tabbar { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; padding: .35rem; margin: 0 0 1.5rem; background: #fff; border-radius: 22px; box-shadow: var(--shadow-sm); }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a { display: flex; align-items: center; gap: .45rem; padding: .5rem 1rem; border-radius: 17px; text-decoration: none; color: var(--muted); font-weight: 700; white-space: nowrap; transition: background .2s, color .2s; }
.tabbar a:hover { background: #faf8ff; color: var(--ink); }
.tabbar a.on { background: var(--violet); color: #fff; box-shadow: 0 4px 0 var(--violet-d); }
.tabbar .ico { width: 30px; height: 30px; }
.tabbar b { min-width: 1.7rem; padding: 0 .4rem; text-align: center; border-radius: 999px; background: var(--violet-l); color: var(--violet); font-size: .8rem; }
.tabbar a.on b { background: rgb(255 255 255 / .25); color: #fff; }
.tabbar .tab-side { margin-inline-start: auto; }
.tab-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.tab-head .btn { margin-bottom: 5px; }
.hint { color: var(--muted); font-weight: 600; margin: -.4rem 0 1rem; }
.label { font-weight: 600; font-size: .95rem; margin-bottom: -.4rem !important; }

dialog.sheet { width: min(520px, calc(100% - 24px)); }
.sheet-head { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.4rem .3rem; }
.sheet-head .ico { width: 46px; height: 46px; }
.sheet-head h3 { flex: 1; font-size: 1.35rem; font-weight: 800; }
.sheet form { padding: .8rem 1.4rem 1.4rem; }

button.class-tile { border: 0; font: inherit; text-align: start; cursor: pointer; align-items: flex-start; }
.tile-edit { margin-top: auto; padding-top: .8rem; font-weight: 700; opacity: .85; }
.class-tile .tile-meta .inline-ico { filter: drop-shadow(0 1px 1px rgb(0 0 0 / .15)); }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.person { display: flex; align-items: center; gap: .9rem; margin: 0; }
.person.off { opacity: .55; }
.person-ico { width: 56px; height: 56px; padding: 8px; background: var(--violet-l); border-radius: 50%; }
.person-info { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.person-info b { font-size: 1.1rem; }
.person-info .muted { font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.person-classes { font-size: .85rem; color: var(--violet); font-weight: 600; }
.person-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.person-actions form { margin: 0; }
.person-actions .btn { margin: 0 0 4px; }

.class-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.class-pills a { padding: .35rem 1rem; border-radius: 999px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; box-shadow: var(--shadow-sm); }
.class-pills a b { color: var(--muted); font-size: .85rem; }
.class-pills a.on { background: linear-gradient(135deg, var(--t1), var(--t2)); color: #fff; }
.class-pills a.on b { color: rgb(255 255 255 / .85); }
.student-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.student-card { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; margin: 0; padding: 1rem; }
.student-link { display: flex; flex-direction: column; align-items: center; color: var(--ink); text-decoration: none; }
.student-link .avatar { width: 80px; height: 80px; transition: transform .2s; }
.student-link:hover .avatar { transform: scale(1.08) rotate(-4deg); }
.student-card > .muted { font-size: .82rem; }
.student-card-actions { display: flex; align-items: center; gap: .3rem; margin-top: .3rem; }
.student-card-actions form { margin: 0; }

.behaviors.flat { padding: 0; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.behaviors.flat .beh { cursor: default; box-shadow: var(--shadow-sm); border-color: transparent; }
.behaviors.flat .beh:hover { background: #fff; }
.behaviors.flat .beh form { margin: 0; }
.beh-del { position: absolute; top: .35rem; inset-inline-start: .35rem; opacity: 0; transition: opacity .2s; }
.beh:hover .beh-del, .beh-del:focus { opacity: 1; }
.beh-scope { position: absolute; top: .5rem; inset-inline-start: .6rem; font-size: .72rem; color: var(--muted); }
@media (hover: none) { .beh-del { opacity: .6; } }

.stats.compact { margin-top: 2.4rem; grid-template-columns: repeat(2, minmax(0, 260px)); margin-bottom: 1.4rem; }
.log-list { display: flex; flex-direction: column; }
.log-row { display: flex; align-items: center; gap: .8rem; padding: .55rem .3rem; border-bottom: 2px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row .ico { width: 36px; height: 36px; }
.log-row > div { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.log-row > div .muted { font-size: .85rem; }
.log-row.bad b { color: var(--neg-d); }
.log-meta { display: flex; flex-direction: column; align-items: flex-end; font-size: .82rem; line-height: 1.3; }
.log-meta small { opacity: .7; }

@media (max-width: 640px) {
  .tabbar { margin-inline: -16px; border-radius: 0; padding: .35rem 16px; }
  .tabbar a { padding: .45rem .8rem; }
  .people, .student-grid { grid-template-columns: 1fr; }
  .student-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .student-card-actions .tag { font-size: .72rem; padding: .2rem .5rem; }
  .behaviors.flat { grid-template-columns: repeat(2, 1fr); }
  .stats.compact { grid-template-columns: 1fr 1fr; }
}

/* ---------- class tools: random picker + timer ---------- */
.class-tools { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.class-tools .hint { margin: 0; flex: 1; }
.tool-btn { display: inline-flex; align-items: center; gap: .45rem; border: 0; border-radius: 18px; padding: .45rem 1rem .45rem .8rem; background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm); transition: transform .15s; }
.tool-btn:hover { transform: translateY(-2px); }
.tool-btn:hover .ico { animation: wiggle .5s ease; }
.tool-btn .ico { width: 34px; height: 34px; }
dialog.tool-dlg { width: min(560px, calc(100% - 24px)); padding: 1.6rem 1.4rem 1.4rem; text-align: center; }
dialog.tool-dlg > .close { position: absolute; top: 1rem; inset-inline-end: 1rem; z-index: 2; }
.tool-actions { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.check-line { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; font-size: .9rem; margin: 0; cursor: pointer; }
.check-line input { width: 20px; height: 20px; margin: 0; accent-color: var(--violet); }

.picker-stage { position: relative; display: flex; flex-direction: column; align-items: center; padding: .5rem 0 1rem; }
#picker-face { width: 200px; height: 200px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle, #fff 55%, var(--violet-l)); box-shadow: inset 0 0 0 6px var(--violet-l); }
#picker-face .avatar, #picker-face .ico { width: 170px; height: 170px; }
#picker-name { margin-top: .7rem; font-size: 1.9rem; font-weight: 800; min-height: 2.4rem; }
.tool-dlg.landed #picker-face { animation: pop .5s cubic-bezier(.2, 1.5, .4, 1); box-shadow: inset 0 0 0 6px var(--sun), 0 0 0 10px rgb(255 197 49 / .25); }
.tool-dlg.landed #picker-name { color: var(--violet); animation: drop .4s ease; }
.picker-stage .confetti { top: 40%; }

.timer-ring { position: relative; width: min(320px, 70vw); aspect-ratio: 1; margin: .5rem auto 1rem; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.timer-ring .track { stroke: var(--violet-l); }
.timer-ring .prog { stroke: var(--violet); transition: stroke-dashoffset .2s linear, stroke .3s; }
.timer-ring > div { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#timer-time { font-size: clamp(3rem, 14vw, 4.6rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
#timer-label { color: var(--muted); font-weight: 600; }
.tool-dlg.urgent .prog { stroke: var(--neg); }
.tool-dlg.urgent #timer-time { color: var(--neg); animation: bump 1s ease infinite; }
.tool-dlg.done .prog { stroke: var(--pos); }
.tool-dlg.done #timer-label { color: var(--pos-d); font-size: 1.3rem; font-weight: 800; }
.timer-ring .confetti { top: 50%; }
.timer-presets { display: flex; gap: .4rem; justify-content: center; flex-wrap: wrap; }
.timer-presets button { border: 0; border-radius: 14px; padding: .35rem .9rem; background: var(--violet-l); color: var(--violet); font: inherit; font-weight: 700; cursor: pointer; }
.timer-presets button.on { background: var(--violet); color: #fff; }
#timer-pill { position: fixed; bottom: 1.2rem; inset-inline-start: 1.2rem; z-index: 30; display: flex; align-items: center; gap: .4rem; border: 0; border-radius: 999px; padding: .35rem 1rem .35rem .5rem; background: #fff; color: var(--ink); font: inherit; font-weight: 800; font-size: 1.2rem; box-shadow: var(--shadow); cursor: pointer; }
#timer-pill[hidden] { display: none; }
#timer-pill .ico { width: 34px; height: 34px; }
#timer-pill.urgent { background: var(--neg); color: #fff; animation: bump 1s ease infinite; }
@media (max-width: 640px) {
  .class-tools .hint { flex-basis: 100%; }
  .tool-btn { flex: 1; justify-content: center; }
  #timer-pill { bottom: 5.6rem; }
}

/* ---------- class piggy bank (jar in the banner) ---------- */
.jar-card { --pct: 0; display: flex; flex-direction: column; align-items: center; min-width: 120px; padding: .6rem 1rem; border: 0; border-radius: 22px; background: rgb(255 255 255 / .2); backdrop-filter: blur(6px); color: #fff; font: inherit; cursor: pointer; transition: transform .2s; }
.jar-card:hover { transform: translateY(-3px); }
.jar-card b { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.jar-card > span:last-child { font-size: .8rem; opacity: .92; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jar { position: relative; width: 52px; height: 58px; margin-bottom: .2rem; border-radius: 14px 14px 18px 18px; background: rgb(255 255 255 / .35); box-shadow: inset 0 0 0 3px rgb(255 255 255 / .85); overflow: hidden; }
.jar-fill { position: absolute; inset-inline: 0; bottom: 0; height: calc(var(--pct) * 1%); background: linear-gradient(180deg, #ffe08a, #ffc531 60%, #f5a524); transition: height .8s cubic-bezier(.2, 1.2, .4, 1); }
.jar-fill::before { content: ""; position: absolute; top: -4px; inset-inline: -10%; height: 8px; border-radius: 50%; background: #ffe9a8; }
.jar-lid { position: absolute; top: 0; inset-inline: 8px; height: 6px; border-radius: 0 0 6px 6px; background: rgb(255 255 255 / .9); }
.jar-card.full .jar { box-shadow: inset 0 0 0 3px #fff, 0 0 18px #ffc531; }
.jar-card.bump .jar { animation: bump .5s ease; }
.goal-now { background: var(--violet-l); border-radius: 14px; padding: .5rem .8rem; font-weight: 600; }
.goal-clear { padding: 0 1.4rem 1.2rem; text-align: center; margin: 0; }

/* milestone celebration (level-up / goal) */
.celebrate.milestone { background: rgb(35 25 90 / .45); animation: fade-in .3s ease; }
@keyframes fade-in { from { background: transparent; } }
.celebrate.milestone .burst { animation-duration: 2.1s; }
.celebrate.milestone.big .burst { animation-duration: 3.1s; }
.celebrate.milestone strong { margin-top: .4rem; padding: .3rem 1.4rem; border-radius: 999px; background: var(--violet); color: #fff; font-size: 1.7rem; font-weight: 800; box-shadow: 0 6px 0 var(--violet-d); }
.celebrate.milestone.big strong { background: var(--sun); color: #5b3b00; font-size: 2.2rem; box-shadow: 0 6px 0 #e89a00; }
.celebrate.milestone .ico { width: 190px; height: 190px; }
.avatar.level-pop { animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); }

/* ---------- groups ---------- */
dialog.tool-dlg.wide { width: min(900px, calc(100% - 24px)); }
.tool-title { display: flex; align-items: center; justify-content: center; gap: .5rem; font-size: 1.5rem; margin-bottom: 1rem; }
.tool-title .ico { width: 44px; height: 44px; }
.groups-bar { display: flex; align-items: center; justify-content: center; gap: .8rem; flex-wrap: wrap; font-weight: 700; margin-bottom: 1.2rem; }
.groups-bar .btn { margin-bottom: 5px; }
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; text-align: start; max-height: 60vh; overflow-y: auto; padding: .2rem; }
.group-card { display: flex; flex-direction: column; gap: .6rem; padding: 1rem; border-radius: 24px; color: #fff; background: linear-gradient(140deg, var(--t1), var(--t2)); box-shadow: 0 14px 26px -18px var(--t2); animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.group-head { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; font-weight: 800; }
.group-head .ico { width: 44px; height: 44px; }
.group-members { display: flex; flex-wrap: wrap; gap: .35rem; flex: 1; }
.group-members span { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .7rem .1rem .25rem; border-radius: 999px; background: rgb(255 255 255 / .22); font-weight: 600; font-size: .9rem; }
.group-members .avatar { width: 30px; height: 30px; }
.group-card .btn { align-self: flex-start; margin: .2rem 0 4px; }

/* ---------- quiet meter ---------- */
.quiet-face { position: relative; width: 180px; height: 180px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #fff 55%, var(--violet-l)); transition: background .4s; }
.quiet-face span { position: absolute; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s cubic-bezier(.2, 1.4, .4, 1); }
.quiet-face .ico { width: 130px; height: 130px; }
.quiet-face[data-state="calm"] [data-state="calm"], .quiet-face:not([data-state]) [data-state="calm"],
.quiet-face[data-state="ok"] [data-state="ok"], .quiet-face[data-state="loud"] [data-state="loud"] { opacity: 1; transform: none; }
.quiet-face[data-state="calm"] .ico { animation: float 4s ease-in-out infinite; }
.quiet-face[data-state="loud"] { background: radial-gradient(circle, #fff 50%, var(--neg-l)); animation: shake .4s ease infinite; }
.quiet-label { font-size: 1.3rem; font-weight: 800; margin: .8rem 0; min-height: 2rem; }
.tool-dlg[data-state="calm"] .quiet-label { color: var(--pos-d); }
.tool-dlg[data-state="loud"] .quiet-label { color: var(--neg-d); }
.quiet-meter { position: relative; height: 22px; border-radius: 999px; background: linear-gradient(to left, #12b679, #ffc531 60%, #ff5a5f); overflow: hidden; }
:root:not([dir="rtl"]) .quiet-meter { background: linear-gradient(to right, #12b679, #ffc531 60%, #ff5a5f); }
#quiet-bar { position: absolute; inset-block: 0; inset-inline-end: 0; width: 100%; background: var(--violet-l); transition: width .08s linear; } /* covers the unreached part of the gradient */
#quiet-mark { position: absolute; inset-block: -2px; inset-inline-start: 63%; width: 4px; background: var(--ink); border-radius: 2px; opacity: .5; }
.quiet-stats { display: flex; justify-content: center; gap: 1.5rem; margin: .8rem 0; font-weight: 600; color: var(--muted); }
.quiet-stats b { color: var(--ink); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.quiet-sens { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: 0; }
.quiet-sens input { width: 180px; accent-color: var(--violet); padding: 0; border: 0; background: none; }
@keyframes shake { 25% { transform: translateX(-4px) rotate(-2deg); } 75% { transform: translateX(4px) rotate(2deg); } }
@media (max-width: 640px) {
  .banner-stats { flex-wrap: wrap; }
  .jar-card { flex: 1 1 100%; flex-direction: row; gap: .7rem; justify-content: center; }
  .jar-card .jar { width: 40px; height: 46px; }
  .groups-grid { grid-template-columns: 1fr; }
}

/* ---------- growing monster journey + badges (student page) ---------- */
.journey-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; position: relative; }
.journey-steps::before { content: ""; position: absolute; top: 34px; inset-inline: 10%; height: 4px; border-radius: 2px; background: var(--line); }
.step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .15rem; opacity: .45; filter: grayscale(.9); }
.step.got { opacity: 1; filter: none; }
.step-ico { display: grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); }
.step-ico .ico { width: 46px; height: 46px; }
.step.now .step-ico { box-shadow: 0 0 0 4px var(--sun), var(--shadow); animation: float 4s ease-in-out infinite; }
.step b { font-size: .85rem; line-height: 1.3; }
.step small { color: var(--muted); font-size: .75rem; }
.journey-bar { height: 14px; border-radius: 999px; background: var(--violet-l); overflow: hidden; margin: 1.1rem 0 .5rem; }
.journey-bar span { display: block; height: 100%; width: calc(var(--pct, 0) * 1%); border-radius: inherit; background: linear-gradient(to left, var(--violet), #2bb4f5); transition: width 1s cubic-bezier(.2, 1, .3, 1); }
.journey-top { font-weight: 800; color: #946200; margin-top: 1rem; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; }
.badge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem; padding: 1rem .6rem; background: #fff; border-radius: 22px; box-shadow: var(--shadow-sm); }
.badge-ring { display: grid; place-items: center; width: 86px; height: 86px; border-radius: 50%; background: var(--violet-l); box-shadow: inset 0 0 0 5px #e4defa; }
.badge-ring .ico { width: 54px; height: 54px; }
.tier-1 .badge-ring { background: #fbeee4; box-shadow: inset 0 0 0 5px #d99a6c, 0 6px 14px -6px #b8743f; }
.tier-2 .badge-ring { background: #f1f3f6; box-shadow: inset 0 0 0 5px #b9c0cc, 0 6px 14px -6px #8a93a3; }
.tier-3 .badge-ring { background: #fff6d6; box-shadow: inset 0 0 0 5px #ffc531, 0 6px 18px -4px #e89a00; }
.tier-0 .badge-ring .ico { filter: grayscale(.6); opacity: .7; }
.badge-tier { font-weight: 700; font-size: .85rem; color: var(--violet); }
.tier-0 .badge-tier { color: var(--muted); }
.badge-card small { color: var(--muted); font-size: .75rem; }
@media (max-width: 640px) {
  .step-ico { width: 52px; height: 52px; }
  .step-ico .ico { width: 34px; height: 34px; }
  .journey-steps::before { top: 25px; }
  .step b { font-size: .7rem; }
  .badges { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- grade bands ---------- */
.g-a { --band: #12b679; --band-l: #e2f8ee; }
.g-b { --band: #2b8fe0; --band-l: #e3f1fd; }
.g-c { --band: #e29a00; --band-l: #fff4d6; }
.g-d { --band: #ff5a5f; --band-l: #ffeaea; }
.pill { display: inline-block; min-width: 3rem; padding: .1rem .6rem; border-radius: 999px; text-align: center; font-weight: 800; background: var(--band-l, #f3f1fa); color: var(--band, var(--muted)); }

/* ---------- gradebook ---------- */
.gb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.gb-filters button { display: inline-flex; align-items: center; gap: .3rem; border: 0; border-radius: 999px; padding: .3rem .9rem; background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm); }
.gb-filters button .ico { width: 24px; height: 24px; }
.gb-filters button.on { background: var(--violet); color: #fff; }
.gb-hint { margin-inline-start: auto; color: var(--muted); font-size: .85rem; font-weight: 600; }
.gb-wrap { padding: 0; overflow: auto; max-height: 72vh; }
.gradebook { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.gradebook th, .gradebook td { padding: .45rem .5rem; border-bottom: 2px solid var(--line); text-align: center; white-space: nowrap; }
.gradebook thead th { position: sticky; top: 0; z-index: 2; background: #fff; vertical-align: bottom; }
.gradebook tfoot th, .gradebook tfoot td { position: sticky; bottom: 0; z-index: 2; background: #faf8ff; border-top: 2px solid var(--line); }
.gradebook .gb-name { position: sticky; inset-inline-start: 0; z-index: 1; background: #fff; text-align: start; min-width: 190px; box-shadow: -8px 0 12px -10px rgb(76 48 180 / .25); }
.gradebook thead .gb-name, .gradebook tfoot .gb-name { z-index: 3; }
.gradebook tfoot .gb-name { background: #faf8ff; }
.gb-name a { display: flex; align-items: center; gap: .5rem; color: var(--ink); text-decoration: none; font-weight: 700; }
.gb-head { display: flex; flex-direction: column; align-items: center; gap: .1rem; min-width: 120px; max-width: 170px; white-space: normal; }
.gb-head > .ico { width: 34px; height: 34px; }
.gb-head b { font-size: .92rem; line-height: 1.3; }
.gb-head small { color: var(--muted); font-size: .75rem; }
.gb-actions { display: flex; align-items: center; gap: .1rem; margin-top: .2rem; }
.gb-actions form { margin: 0; }
.gb-actions .x { width: 28px; height: 28px; font-size: .8rem; display: grid; place-items: center; }
.gb-actions .x .ico { width: 20px; height: 20px; }
.gb-cell { width: 4.6rem; margin: 0 auto; padding: .45rem .3rem; text-align: center; font-weight: 800; font-size: 1.05rem; border: 2px solid transparent; border-radius: 12px; background: var(--band-l, #f6f4fd); color: var(--band, var(--ink)); transition: border-color .2s, background .2s; }
.gb-cell:focus { border-color: var(--violet); background: #fff; color: var(--ink); box-shadow: 0 0 0 4px rgb(108 76 245 / .15); }
.gb-cell.saving { opacity: .55; }
.gb-cell.err { border-color: var(--neg); background: var(--neg-l); color: var(--neg-d); }
.gb-avg-h { min-width: 90px; }
.kind-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.kind-picker label { display: flex; flex-direction: column; align-items: center; gap: .1rem; margin: 0; padding: .5rem .2rem; border-radius: 16px; border: 2px solid var(--line); cursor: pointer; font-size: .85rem; }
.kind-picker input { position: absolute; opacity: 0; pointer-events: none; }
.kind-picker .ico { width: 34px; height: 34px; }
.kind-picker label:has(input:checked) { border-color: var(--violet); background: var(--violet-l); color: var(--violet); }
.sheet .inline label { flex: 1; margin: 0; }

/* stats sheet */
.stats-body { padding: .6rem 1.4rem 1.4rem; }
.stats-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; text-align: center; margin-bottom: 1.2rem; }
.stats-nums div { background: var(--violet-l); border-radius: 16px; padding: .5rem .2rem; }
.stats-nums b { display: block; font-size: 1.5rem; font-weight: 800; color: var(--violet); direction: ltr; }
.stats-nums span { font-size: .78rem; color: var(--muted); }
.hist { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; height: 190px; align-items: end; }
.hist > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .2rem; }
.hist i { width: 70%; height: 0; min-height: 4px; border-radius: 12px 12px 4px 4px; background: linear-gradient(180deg, var(--band), color-mix(in srgb, var(--band) 70%, #fff)); }
.hist b { font-size: 1.1rem; color: var(--band); order: -1; }
.hist span { font-size: .72rem; color: var(--muted); font-weight: 600; }

/* ---------- grades on the student page ---------- */
.grades-top { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ring.big-ring { width: 130px; height: 130px; background: conic-gradient(var(--violet) calc(var(--pct) * 1%), var(--violet-l) 0); }
.ring.big-ring > div { width: 100px; height: 100px; background: #fff; color: var(--ink); }
.ring.big-ring b { font-size: 1.7rem; color: var(--violet); }
.ring.big-ring span { color: var(--muted); }
.kind-avgs { display: flex; flex-wrap: wrap; gap: .6rem; flex: 1; }
.kind-avg { display: flex; align-items: center; gap: .4rem; padding: .35rem .9rem .35rem .5rem; border-radius: 999px; background: var(--band-l); font-weight: 700; }
.kind-avg .ico { width: 30px; height: 30px; }
.kind-avg b { color: var(--band); }
.grade-list { display: flex; flex-direction: column; gap: .2rem; }
.grade-row { display: flex; align-items: center; gap: .8rem; padding: .55rem .3rem; border-bottom: 2px solid var(--line); }
.grade-row:last-child { border-bottom: 0; }
.grade-row > .ico { width: 40px; height: 40px; }
.grade-info { flex: 1; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.grade-info .muted { font-size: .82rem; }
.draft { font-style: normal; color: #946200; }
.grade-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: .35rem; }
.grade-bar span { display: block; height: 100%; width: calc(var(--pct, 0) * 1%); border-radius: inherit; background: var(--band, var(--line)); }
.grade-score { font-weight: 800; font-size: 1.1rem; color: var(--band, var(--muted)); min-width: 5.5rem; text-align: center; }

/* ---------- live chat ---------- */
.msg .meta { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.msg-del { margin-inline-start: auto; border: 0; background: rgb(255 90 95 / .12); color: var(--neg-d); border-radius: 999px; padding: 0 .55rem; font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer; }
.msg.mine .msg-del { background: rgb(255 255 255 / .22); color: #fff; }
.msg { overflow: hidden; }
.msg p.pl { white-space: pre-line; }
.chat-form textarea { min-height: 46px; max-height: 140px; }

@media (max-width: 640px) {
  .gb-hint { flex-basis: 100%; margin: 0; }
  .gradebook .gb-name { min-width: 130px; }
  .gb-name a span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
  .stats-nums b { font-size: 1.2rem; }
  .ring.big-ring { width: 104px; height: 104px; }
  .ring.big-ring > div { width: 80px; height: 80px; }
}

/* ---------- bulk invite codes ---------- */
.pick-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.pick-bar #pick-count { margin-inline-start: auto; font-weight: 700; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.pick-card { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .5rem .7rem; border-radius: 16px; border: 2px solid var(--line); cursor: pointer; transition: border-color .15s, background .15s; }
.pick-card input { width: 20px; height: 20px; margin: 0; accent-color: var(--violet); flex: none; }
.pick-card .pick-name { flex: 1; font-weight: 700; }
.pick-card:has(input:checked) { border-color: var(--violet); background: var(--violet-l); }
.print-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.invite-sheet { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.invite-card { display: flex; flex-direction: column; gap: .6rem; padding: 18px 20px; background: #fff; border: 2px dashed #cbbcff; border-radius: 22px; break-inside: avoid; page-break-inside: avoid; }
.invite-card header { display: flex; align-items: center; gap: .5rem; }
.invite-card header .ico { width: 36px; height: 36px; }
.invite-card header b { display: block; color: var(--violet); font-size: 1.2rem; line-height: 1; }
.invite-card header small { color: var(--muted); font-size: .75rem; }
.ic-student { display: flex; align-items: center; gap: .7rem; }
.ic-avatar { width: 64px; height: 64px; flex: none; }
.ic-student span { display: block; font-size: .78rem; color: var(--muted); }
.ic-student strong { display: block; font-size: 1.3rem; line-height: 1.2; }
.ic-student small { color: var(--muted); }
.ic-code { text-align: center; font-size: 2.1rem; font-weight: 800; letter-spacing: .14em; color: var(--ink); background: var(--violet-l); border-radius: 14px; padding: .2rem 0; }
.ic-steps { margin: 0; padding-inline-start: 1.2rem; font-size: .8rem; line-height: 1.6; }
.ic-steps span { font-weight: 700; word-break: break-all; }
.invite-card footer { font-size: .72rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .4rem; }
@media (max-width: 640px) { .invite-sheet { grid-template-columns: 1fr; } }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff !important; }
  .no-print, .flash, #toast, #timer-pill { display: none !important; }
  main { max-width: none; padding: 0; }
  .invite-sheet { gap: 8mm; }
  .invite-card { border-color: #9b86f5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ic-code { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- permission requests ---------- */
.top nav a { position: relative; }
.nav-badge { position: absolute; top: 0; inset-inline-start: 10px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; background: var(--neg); color: #fff; font-style: normal; font-size: .72rem; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; animation: bump 1.6s ease 2; }
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-row .btn { margin-bottom: 5px; }
.leave-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.leave-card { display: flex; flex-direction: column; gap: .4rem; padding: 1.1rem; background: #fff; border-radius: 22px; box-shadow: var(--shadow-sm); border-inline-start: 6px solid var(--line); }
.leave-card.status-pending { border-inline-start-color: var(--sun); }
.leave-card.status-approved { border-inline-start-color: var(--pos); }
.leave-card.status-rejected { border-inline-start-color: var(--neg); }
.leave-card.status-cancelled { opacity: .6; }
.leave-card header { display: flex; align-items: flex-start; gap: .7rem; }
.leave-card header > div { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.leave-ico { width: 46px; height: 46px; flex: none; }
.leave-student { display: inline-flex; align-items: center; gap: .35rem; font-weight: 800; color: var(--ink); text-decoration: none; }
.leave-student .avatar { width: 30px; height: 30px; }
.leave-card header b { font-size: 1.1rem; }
.leave-reason { background: #faf8ff; border-radius: 12px; padding: .5rem .8rem; }
.leave-meta { font-size: .85rem; margin: 0; }
.leave-decide { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.leave-decide form:first-child { flex: 1; display: flex; gap: .4rem; min-width: 220px; }
.leave-decide input { margin: 0; flex: 1; padding: .45rem .7rem; }
.leave-act { margin: 0; }
.btn.danger-btn { color: var(--neg-d); }
.exit-pass { display: flex; align-items: center; gap: .7rem; margin-top: .3rem; padding: .7rem .9rem; border-radius: 16px; background: linear-gradient(135deg, var(--pos-l), #fff); border: 2px dashed var(--pos); }
.exit-pass .ico { width: 44px; height: 44px; }
.exit-pass div { display: flex; flex-direction: column; line-height: 1.35; }
.exit-pass b { color: var(--pos-d); font-size: 1.1rem; }
.exit-pass small { color: var(--muted); }
.kind-picker.cols-3 { grid-template-columns: repeat(3, 1fr); }
.leave-form [hidden] { display: none !important; }
.gate-list td, .gate-list th { font-size: 1rem; }
.gate-list input { width: 22px; height: 22px; accent-color: var(--pos); }
@media print { .gate-list { font-size: 12pt; } .no-print { display: none !important; } }
@media (max-width: 640px) { .leave-list { grid-template-columns: 1fr; } .nav-badge { inset-inline-start: 22px; } }

/* ---------- restroom pass ---------- */
.pass-log .list-row > .tag { flex: none; }
.pass-log .list-row > b { min-width: 3.5rem; text-align: center; }
.pass-btn { display: flex; flex-direction: column; align-items: center; gap: 0; border: 0; border-radius: 16px; padding: .3rem .8rem; background: var(--violet-l); color: var(--violet); font: inherit; font-weight: 700; font-size: .78rem; cursor: pointer; line-height: 1.2; }
.pass-btn .ico { width: 34px; height: 34px; }
.pass-btn small { opacity: .75; }
.pass-btn[hidden] { display: none; }
.pass-badge { position: absolute; top: .55rem; inset-inline-start: .55rem; display: none; padding: 0 .5rem; height: 1.8rem; align-items: center; border-radius: 999px; background: var(--violet); color: #fff; font-size: .85rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.student.out { background: #f4f1ff; }
.student.out .pass-badge { display: inline-flex; }
.student.out .avatar { opacity: .45; filter: grayscale(.4); }
.student.out::after { content: ""; position: absolute; inset-inline-end: .5rem; bottom: 2.4rem; width: 36px; height: 36px; background: url(icons/restroom.png) center / contain no-repeat; }
.student.late { background: #fff6dc; box-shadow: 0 0 0 3px var(--sun); }
.student.late .pass-badge { background: #e29a00; }
.student.alarm { background: var(--neg-l); box-shadow: 0 0 0 3px var(--neg); animation: alarm-pulse 1s ease-in-out infinite; }
.student.alarm .pass-badge { background: var(--neg); }
@keyframes alarm-pulse { 50% { box-shadow: 0 0 0 7px rgb(255 90 95 / .35); } }
.out-strip { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: 1rem; padding: .6rem .9rem; border-radius: 20px; background: #fff; box-shadow: var(--shadow-sm); }
.out-strip[hidden] { display: none; }
.out-title { display: inline-flex; align-items: center; gap: .3rem; font-weight: 800; }
.out-title .ico { width: 32px; height: 32px; }
.out-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.out-chip { display: inline-flex; align-items: center; gap: .35rem; border: 0; border-radius: 999px; padding: .15rem .8rem .15rem .25rem; background: var(--violet-l); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.out-chip .avatar { width: 30px; height: 30px; }
.out-chip b { font-variant-numeric: tabular-nums; color: var(--violet); }
.out-chip.late { background: #fff1c9; } .out-chip.late b { color: #b36f00; }
.out-chip.alarm { background: var(--neg); color: #fff; animation: alarm-pulse 1s ease-in-out infinite; } .out-chip.alarm b { color: #fff; }
.pass-stage { display: flex; flex-direction: column; align-items: center; }
#pass-avatar .avatar { width: 130px; height: 130px; }
#pass-name { font-size: 1.8rem; font-weight: 800; }
.pass-state { font-weight: 800; color: var(--violet); margin: .3rem 0; }
.pass-clock { font-size: 4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
#pass-dlg[data-state="late"] .pass-state, #pass-dlg[data-state="late"] .pass-clock { color: #b36f00; }
#pass-dlg[data-state="alarm"] .pass-state, #pass-dlg[data-state="alarm"] .pass-clock { color: var(--neg-d); }
#pass-dlg[data-state="alarm"] .pass-clock { animation: bump 1s ease infinite; }

/* ---------- attendance ---------- */
.attendance-bar { display: none; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; padding: .7rem 1rem; border-radius: 20px; background: var(--violet); color: #fff; box-shadow: var(--shadow); }
.attendance-bar.on { display: flex; }
.att-mode-note { flex: 1; font-weight: 700; }
.att-counts b { font-size: 1.2rem; }
.attendance-bar .btn { background: #fff; color: var(--violet); box-shadow: 0 4px 0 rgb(0 0 0 / .15); margin: 0 0 4px; }
.tool-btn.on { background: var(--violet); color: #fff; }
.roster.att-mode .student:not(.all) { outline: 2px dashed #cbbcff; outline-offset: -6px; }
.roster.att-mode .student.all { opacity: .4; pointer-events: none; }
.absent-badge { display: none; position: absolute; bottom: 2.6rem; padding: .05rem .7rem; border-radius: 999px; background: var(--ink); color: #fff; font-size: .75rem; font-weight: 800; }
.student.absent .absent-badge { display: inline-block; }
.student.absent { background: #f1eff6; box-shadow: none; }
.student.absent .avatar { opacity: .35; filter: grayscale(1); }
.student.absent .nm { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; }
.student.absent[data-absent="leave"] .absent-badge { background: #946200; }
.all-note { color: var(--violet); font-weight: 700; font-size: .75rem; }
.all-note[hidden] { display: none; }
.absence-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.absence-list span { padding: .15rem .7rem; border-radius: 999px; background: #f1eff6; font-weight: 700; font-size: .85rem; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 200%); z-index: 60;
  background: var(--ink); color: #fff; padding: .65rem 1.4rem; border-radius: 999px; font-weight: 700;
  transition: transform .3s cubic-bezier(.2, 1.4, .4, 1), opacity .2s; pointer-events: none; white-space: nowrap; opacity: 0;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- motion ---------- */
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg) scale(1.05); } 75% { transform: rotate(8deg) scale(1.05); } }
@keyframes bump { 40% { transform: scale(1.6); } }
@keyframes pop { from { transform: scale(.92); } } /* no opacity: if the animation stalls the window must still be visible */
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }
@keyframes spin-in { from { transform: rotate(-180deg) scale(.3); } }
@keyframes burst { 0% { transform: scale(.2); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9) translateY(-40px); opacity: 0; } }
@keyframes burst-neg { 0% { transform: scale(.4); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 30%, 50% { transform: translateX(-10px); } 40%, 60% { transform: translateX(10px); } 75% { transform: none; opacity: 1; } 100% { opacity: 0; } }
@keyframes confetti { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- small screens: app-style bottom tab bar ---------- */
@media (max-width: 900px) {
  .split, .admin-grid { grid-template-columns: 1fr; }
  .n3, .n4, .d6 { display: none; }
  .mon { width: 110px; height: 110px; }
  .n2 { width: 130px; height: 130px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1, .banner h1, .hero-text h1 { font-size: 1.6rem; }
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgb(255 255 255 / .92); } /* a filter here would trap the fixed tab bar inside the header */
  .top-in { justify-content: center; }
  main { padding-bottom: 7rem; }
  .top nav {
    position: fixed; bottom: 0; left: 0; right: 0; justify-content: space-around; padding: .35rem .4rem calc(.35rem + env(safe-area-inset-bottom));
    background: rgb(255 255 255 / .95); backdrop-filter: blur(14px); box-shadow: 0 -1px 0 var(--line), 0 -10px 30px -20px rgb(76 48 180 / .4);
  }
  .top nav a, .top nav button { flex-direction: column; gap: 0; font-size: .72rem; padding: .3rem .7rem; border-radius: 16px; }
  .top nav form { display: contents; }
  .roster { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
  .student { padding: .8rem .3rem .7rem; border-radius: 20px; }
  .student .avatar, .all-ico { width: 66px; height: 66px; }
  .all-ico .ico { width: 54px; height: 54px; }
  .student .nm { font-size: .85rem; }
  .total { min-width: 1.7rem; height: 1.7rem; font-size: .8rem; top: .35rem; inset-inline-end: .35rem; }
  .banner { padding: 1.3rem; border-radius: 26px; }
  .banner-stats { width: 100%; }
  .banner-stats div { flex: 1; min-width: 0; }
  .behaviors { grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: 1rem; }
  .beh .ico { width: 48px; height: 48px; }
  .beh-name { font-size: .82rem; }
  .student-hero { justify-content: center; text-align: center; padding: 1.4rem; }
  .avatar.xl { width: 120px; height: 120px; }
  .stat .ico { width: 48px; height: 48px; margin-top: -1.8rem; }
  .stat b { font-size: 1.7rem; }
  .stat span { font-size: .78rem; }
  .hello { padding: 1.1rem 1.2rem; }
  .hello-ico { width: 70px; height: 70px; }
  .kids { grid-template-columns: 1fr; }
  .kid .avatar { width: 86px; height: 86px; }
  dialog { width: calc(100% - 16px); }
  #toast { bottom: 5.5rem; }
  .auth-stage { justify-content: flex-start; padding-top: 3rem; padding-bottom: 9rem; }
  .auth-card { padding: 1.8rem 1.3rem 1.3rem; border-radius: 28px; }
  .auth-decor .fl { width: 58px; height: 58px; }
  .d3, .d5 { display: none; }
}
@media print { .top, form, .btn { display: none; } }
