/* myMochila: one app shell (top bar, centred column, one-line footer).
   Subjects keep the look of their study pages: Natural Science = night sky, Matemáticas = grid paper. */
:root {
  --bg: #f2f4f9; --surface: #ffffff; --sunk: #e9edf5; --ink: #161d33; --muted: #5a6380; --line: #dbe0ec;
  --brand: #1a56ff; --brand-ink: #ffffff; --brand-soft: #e5ecff;
  --pencil: #ffc23d; --pencil-ink: #3b2a00;
  --ok: #177a47; --ok-soft: #e1f4e9; --bad: #c2372d; --bad-soft: #fde7e4;
  --info-soft: #fff6dc; --info-line: #f1d98c; --info-icon: #3b2a00;
  --sky: #191d4a; --sky-2: #2b2f6e; --star: #fff7d6; --sun: #ffb23d;
  --gridline: #dfe6f3; --paperw: #ffffff;
  --cm: #c85a17; --dm: #f0a51e; --um: #ecc515; --c: #23803c; --d: #c93434; --u: #2a62c4;
  --shadow: 0 1px 2px rgb(22 29 51 / .06), 0 8px 24px -12px rgb(22 29 51 / .18);
  --display: "Gabarito", "Trebuchet MS", system-ui, sans-serif;
  --body: "Lexend", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
/* Dark: follows the device unless the kid picked a theme with the sun/moon switch (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1221; --surface: #161b2e; --sunk: #1c2238; --ink: #e8ebf7; --muted: #a1a9c4; --line: #2a3150;
    --brand: #5b8cff; --brand-ink: #0e1221; --brand-soft: #1f2a55; --pencil: #ffcf5c; --pencil-ink: #2b1f00;
    --ok: #62d091; --ok-soft: #14321f; --bad: #ff8d82; --bad-soft: #3b1c20; --info-soft: #2a2614; --info-line: #5a4d1c; --info-icon: #ffcf5c;
    --sky: #11143a; --sky-2: #23286a; --gridline: #262d48; --paperw: #1a2036; --count-ink: #8fb0ff;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px -14px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1221; --surface: #161b2e; --sunk: #1c2238; --ink: #e8ebf7; --muted: #a1a9c4; --line: #2a3150;
  --brand: #5b8cff; --brand-ink: #0e1221; --brand-soft: #1f2a55; --pencil: #ffcf5c; --pencil-ink: #2b1f00;
  --ok: #62d091; --ok-soft: #14321f; --bad: #ff8d82; --bad-soft: #3b1c20; --info-soft: #2a2614; --info-line: #5a4d1c; --info-icon: #ffcf5c;
  --sky: #11143a; --sky-2: #23286a; --gridline: #262d48; --paperw: #1a2036; --count-ink: #8fb0ff;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px -14px rgb(0 0 0 / .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--body); margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.eyebrow { font: 600 .74rem var(--body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.spacer { flex: 1; }

/* buttons, fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border-radius: 11px; border: 1.5px solid var(--brand); background: var(--brand); color: var(--brand-ink); font-weight: 500; padding: .62rem 1.05rem; cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px -8px var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.quiet { background: var(--sunk); border-color: transparent; color: var(--ink); }
.btn.small { padding: .32rem .7rem; font-size: .85rem; border-radius: 9px; }
.btn.danger, .btn[data-armed] { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }
.field { display: grid; gap: .3rem; }
.field label { font-weight: 500; font-size: .9rem; }
.field input, .field textarea { border: 1.5px solid var(--line); background: var(--surface); border-radius: 11px; padding: .65rem .8rem; width: 100%; }
.field input:focus, .field textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.hint { font-size: .82rem; color: var(--muted); }
.err { font-size: .86rem; color: var(--bad); font-weight: 500; }
.formerr { background: var(--bad-soft); color: var(--bad); border-radius: 11px; padding: .6rem .8rem; font-weight: 500; font-size: .9rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
form.inline { display: inline; margin: 0; }

/* top bar */
.top { background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: .8rem; min-height: 60px; }
.brand { display: flex; align-items: center; gap: .55rem; font: 800 1.3rem var(--display); color: var(--ink); text-decoration: none; }
.brand .lt { font-weight: 500; color: var(--brand); }
.mark { width: 34px; height: 34px; flex: none; }
.lang { display: inline-flex; border: 1.5px solid var(--line); border-radius: 99px; padding: 2px; background: var(--surface); }
.lang a { border-radius: 99px; padding: .2rem .6rem; font-weight: 600; font-size: .8rem; color: var(--muted); text-decoration: none; }
.lang a[aria-current="true"] { background: var(--ink); color: var(--surface); }
.theme a { display: grid; place-items: center; padding: .2rem .5rem; min-height: 26px; min-width: 32px; }
.theme svg { width: 18px; height: 18px; display: block; }
/* No theme picked yet: the switch shows the one the device is using. */
:root:not([data-theme]) .theme a[data-theme-to="light"] { background: var(--ink); color: var(--surface); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme a[data-theme-to="light"] { background: none; color: var(--muted); }
  :root:not([data-theme]) .theme a[data-theme-to="dark"] { background: var(--ink); color: var(--surface); }
}
.who { display: flex; align-items: center; gap: .5rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--pencil); color: var(--pencil-ink); display: grid; place-items: center; font: 700 .95rem var(--display); flex: none; }
.badge { background: var(--bad); color: #fff; font-size: .7rem; font-weight: 600; border-radius: 99px; padding: 0 .4rem; margin-left: .2rem; }
@media (max-width: 640px) { .who .name, .hide-sm { display: none; } .top .wrap { gap: .5rem; } .brand { font-size: 1.15rem; } }
@media (max-width: 400px) { .who .avatar { display: none; } .brand { font-size: 1.05rem; gap: .35rem; } .mark { width: 28px; height: 28px; } .lang a { padding: .2rem .45rem; } .theme a { padding: .2rem .4rem; min-width: 30px; } .who .btn.small { padding: .3rem .5rem; } }
@media (max-width: 359px) { .top:has(.who) .brand > span { display: none; } }
@media (max-width: 420px) { .top:has(.who > a.btn) .brand > span { display: none; } } /* admin: one more button */
@media (max-width: 359px) { .top:has(.who > a.btn) .wrap { gap: .3rem; } .top:has(.who > a.btn) .who { gap: .3rem; } }
.logout svg { display: none; width: 18px; height: 18px; }
@media (max-width: 480px) { .logout .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .logout svg { display: block; } .who .btn.small.logout { padding: .3rem .45rem; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.screen { padding-block: 24px 48px; display: grid; gap: 22px; align-content: start; flex: 1; }
.screen > * { min-width: 0; }

/* login */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line); }
.auth-art { background: radial-gradient(1.5px 1.5px at 12% 22%, var(--star) 50%, transparent 52%), radial-gradient(1px 1px at 30% 70%, var(--star) 50%, transparent 52%), radial-gradient(1.5px 1.5px at 78% 18%, var(--star) 50%, transparent 52%), radial-gradient(1px 1px at 62% 42%, var(--star) 50%, transparent 52%), radial-gradient(1px 1px at 88% 66%, var(--star) 50%, transparent 52%), radial-gradient(1.5px 1.5px at 45% 88%, var(--star) 50%, transparent 52%), linear-gradient(160deg, var(--sky-2), var(--sky)); color: #eef0ff; padding: 34px; display: grid; align-content: space-between; gap: 28px; min-height: 460px; position: relative; overflow: hidden; }
.auth-art h1 { font-size: clamp(1.7rem, 3.4vw, 2.45rem); color: #fff; max-width: 15ch; }
.auth-art .lead { color: #c9cdf3; max-width: 34ch; }
.auth-art .bigmark { position: absolute; right: -40px; top: 26px; width: 210px; height: 210px; opacity: .9; }
.tag { font: 700 .68rem var(--body); letter-spacing: .06em; border-radius: 6px; padding: .12rem .4rem; }
.tag.en { background: #e8ecff; color: #22307a; }
.tag.es { background: #ffe9c2; color: #6b3d00; }
.auth-form { padding: 34px; display: grid; gap: 18px; align-content: start; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--sunk); border-radius: 12px; padding: 4px; }
.seg a { border-radius: 9px; padding: .5rem; font-weight: 500; text-align: center; text-decoration: none; color: var(--muted); }
.seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
form.stack { display: grid; gap: 14px; }
.nick-hint { background: var(--brand-soft); border-radius: 11px; padding: .6rem .75rem; font-size: .84rem; color: var(--ink); }
.nick-hint b { font-family: var(--display); font-size: .98rem; }
@media (max-width: 760px) { .auth { grid-template-columns: 1fr; } .auth-art { min-height: 0; padding: 24px; } .auth-art .bigmark { width: 150px; height: 150px; right: -36px; top: 6px; } .auth-form { padding: 22px; } }

/* slim disclaimer bar on every page */
.bar { background: var(--info-soft); border-bottom: 1px solid var(--info-line); color: var(--ink); font-size: .78rem; line-height: 1.35; }
.bar .wrap { display: flex; align-items: center; gap: .35rem .6rem; flex-wrap: wrap; padding-block: 5px; }
.bar svg { width: 14px; height: 14px; color: var(--info-icon); flex: none; }
.bar span { flex: 1 1 260px; min-width: 0; }
.bar .linkbtn { font-size: .78rem; }
.bar-short { display: none; }
.bar .linkbtn { white-space: nowrap; }
@media (max-width: 640px) { .unitbar .c-course { display: none; } }
@media (max-width: 640px) { .bar-long { display: none; } .bar-short { display: inline; } .bar { font-size: .72rem; } .bar .linkbtn { font-size: .72rem; } .bar .wrap { flex-wrap: nowrap; } .bar span { flex: 1 1 auto; } }

/* course home */
.hello { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.hello h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); }
.hello h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--pencil) 62%); padding-inline: .1em; }
.resume-link { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 14px; background: var(--ink); color: var(--surface); text-decoration: none; border-radius: 14px; padding: 10px 16px; min-width: 0; }
.resume-link .eyebrow { color: color-mix(in srgb, var(--surface) 65%, transparent); grid-column: 1; }
.resume-link b { grid-column: 1; font-family: var(--display); font-size: 1.05rem; }
.resume-link svg { grid-column: 2; grid-row: 1 / 3; width: 22px; height: 22px; color: var(--pencil); }
.course-block { display: grid; gap: 14px; }
.course-h { display: flex; align-items: baseline; gap: .4rem .8rem; flex-wrap: wrap; }
.course-h h2 { font-size: 1.5rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.tile { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; min-width: 0; }
.tile:hover { transform: translateY(-2px); border-color: var(--brand); }
.tile-art { aspect-ratio: 12 / 5; display: grid; place-items: center; padding: 8px 10px; }
.tile-b { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: 14px 16px 4px; }
.tile-b b { font: 700 1.25rem var(--display); }
.tile-meta { display: grid; gap: 8px; padding: 4px 16px 16px; font-size: .85rem; color: var(--muted); }
.art-svg { width: 100%; height: auto; max-height: 100%; display: block; }
.ns { background: radial-gradient(1.5px 1.5px at 10% 30%, var(--star) 50%, transparent 52%), radial-gradient(1px 1px at 35% 80%, var(--star) 50%, transparent 52%), radial-gradient(1.5px 1.5px at 55% 12%, var(--star) 50%, transparent 52%), radial-gradient(1px 1px at 82% 60%, var(--star) 50%, transparent 52%), linear-gradient(150deg, var(--sky-2), var(--sky)); color: #fff; }
.ma { background-color: var(--paperw); background-image: linear-gradient(var(--gridline) 1px, transparent 1px), linear-gradient(90deg, var(--gridline) 1px, transparent 1px); background-size: 18px 18px; }
.tile-art.ma { border-bottom: 1px solid var(--line); }
.tag { font: 700 .68rem var(--body); letter-spacing: .06em; border-radius: 6px; padding: .12rem .4rem; }
.tag.en { background: #e8ecff; color: #22307a; }
.tag.es { background: #ffe9c2; color: #6b3d00; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); display: grid; gap: 12px; min-width: 0; align-content: start; }

/* class page */
.crumbs { display: flex; gap: .4rem; align-items: center; font-size: .88rem; color: var(--muted); flex-wrap: wrap; min-width: 0; }
.crumbs a { color: var(--brand); font-weight: 500; text-decoration: none; }
.subject-cover { display: grid; grid-template-columns: 1fr minmax(0, 360px); align-items: center; gap: 12px 24px; border-radius: 22px; padding: 24px 26px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.subject-cover h1 { font-size: clamp(2rem, 5vw, 2.8rem); }
.subject-cover .cover-text { display: grid; gap: 10px; }
.subject-cover.ns .eyebrow { color: #c9cdf3; }
@media (max-width: 640px) { .subject-cover { grid-template-columns: 1fr; padding: 20px; } }
.units { display: grid; gap: 14px; }
.unit { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .12s; }
.unit:hover { border-color: var(--brand); transform: translateY(-1px); }
.unit-h { display: flex; justify-content: space-between; gap: .6rem; align-items: start; }
.unit-h b { font: 700 1.1rem var(--display); }
.unit-h .go { color: var(--brand); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.meter { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--ok); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { font-size: .78rem; border-radius: 99px; padding: .15rem .55rem; background: var(--sunk); color: var(--ink); font-variant-numeric: tabular-nums; }
.chip.best { background: var(--ok-soft); color: var(--ok); font-weight: 600; }

/* unit page: the study page fills the screen under a slim bar */
body.unit-page { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.unitbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.unitbar .wrap { display: flex; align-items: center; gap: .5rem .8rem; flex-wrap: wrap; padding-block: 8px; max-width: none; }
.saved { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; font-weight: 500; color: var(--muted); }
.saved[data-status="saved"] { color: var(--ok); }
.saved[data-status="error"], .saved[data-status="logged-out"] { color: var(--bad); }
.saved svg { width: 16px; height: 16px; }
.studyframe { flex: 1; width: 100%; border: 0; display: block; background: var(--surface); min-height: 0; }
@media (max-width: 640px) { .unitbar .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } .unitbar .wrap { flex-wrap: nowrap; } .unitbar .crumbs { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; } }
/* admin */
.admin-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.admin { display: grid; gap: 18px; }
.segtabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--sunk); border-radius: 14px; justify-self: start; max-width: 100%; }
.segtabs a { padding: .5rem .95rem; border-radius: 10px; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; }
.segtabs a:hover { color: var(--ink); }
.segtabs a[aria-current="page"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.segtabs .count { font-size: .72rem; font-weight: 600; background: var(--brand-soft); color: var(--count-ink, var(--brand)); border-radius: 99px; padding: 0 .45rem; }
.input { font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 11px; padding: .5rem .75rem; min-width: 0; }
.input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; }
.filters label { display: grid; gap: 4px; }
.filters input[type=search] { flex: 1 1 220px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: none; display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.kidlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.kidrow { display: grid; grid-template-columns: auto auto 1fr auto auto; align-items: center; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s; }
.kidrow:hover { border-color: var(--brand); }
.kr-main { display: grid; gap: 2px; min-width: 0; }
.kr-main b { font-size: 1.02rem; }
.kr-where { font-size: .85rem; color: var(--brand); font-weight: 500; }
.pwpending { justify-self: start; display: inline-block; font-size: .78rem; font-weight: 600; color: var(--bad); background: var(--bad-soft); border: 1px solid var(--bad); border-radius: 99px; padding: .05rem .55rem; }
.notice { background: var(--info-soft); border: 1px solid var(--info-line); border-radius: 11px; padding: .6rem .8rem; font-weight: 500; font-size: .9rem; }
.kr-last { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.kr-pct { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); min-width: 120px; }
.chev { font-size: 1.5rem; color: var(--muted); }
@media (max-width: 640px) { .kidrow { grid-template-columns: auto auto 1fr; } .kr-pct { grid-column: 3; } .chev { display: none; } }
.feed { list-style: none; margin: 0; padding: 0; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.ev { display: grid; grid-template-columns: 8.5rem 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); align-items: baseline; }
.ev:last-child { border-bottom: 0; }
.ev .when { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev-body { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; min-width: 0; }
a.nick { color: var(--ink); text-decoration: none; }
a.nick:hover { color: var(--brand); }
.ev-text { font-weight: 500; }
.ev.handin .ev-text { color: var(--brand); }
.ev-where { font-size: .8rem; color: var(--muted); background: var(--sunk); border-radius: 8px; padding: .1rem .5rem; }
@media (max-width: 640px) { .ev { grid-template-columns: 1fr; gap: 4px; } }
.back { font-weight: 500; text-decoration: none; justify-self: start; }
.kidhead { grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.avatar.big { width: 56px; height: 56px; font-size: 1.5rem; }
.kh-main { display: grid; gap: 4px; min-width: 0; }
.kh-main h2 { display: flex; align-items: center; gap: .5rem; font-size: 1.6rem; }
.kh-side { display: grid; gap: 10px; justify-items: end; }
@media (max-width: 640px) { .kidhead { grid-template-columns: auto 1fr; } .kh-side { grid-column: 1 / -1; justify-items: start; } }
.kidclasses { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.kidclasses h3 { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.unitline { display: grid; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.pctline { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.pctline .meter { flex: 1; min-width: 60px; }
.sechead { font-size: 1.2rem; }
table.grid { min-width: 0; }
table.grid td .mini { min-width: 200px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 760px; font-size: .9rem; }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--sunk); }
tr:last-child td { border-bottom: 0; }
td .mini { display: grid; gap: 5px; min-width: 170px; }
.nick { display: flex; align-items: center; gap: .55rem; font-weight: 600; }
.nick .avatar { width: 28px; height: 28px; font-size: .8rem; }
.flash { background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: .75rem .9rem; font-weight: 500; }
.flash code { font: 700 1.05rem ui-monospace, monospace; background: var(--surface); padding: .1rem .45rem; border-radius: 6px; }
.empty { color: var(--muted); padding: 18px; }
.msgs { display: grid; gap: 12px; }
.msg.new { border-color: var(--brand); }
.msg-h { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.msg-h b { color: var(--ink); }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.pill { font-size: .72rem; font-weight: 600; border-radius: 99px; padding: .1rem .5rem; }
.pill.new { background: var(--brand); color: var(--brand-ink); }
.pill.read { background: var(--sunk); color: var(--muted); }
.where { font-size: .8rem; background: var(--sunk); border-radius: 8px; padding: .25rem .5rem; justify-self: start; overflow-wrap: anywhere; }
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.codebox { display: grid; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.code { font: 700 1.7rem ui-monospace, "SFMono-Regular", monospace; letter-spacing: .12em; background: var(--sunk); border-radius: 12px; padding: .5rem .8rem; justify-self: start; }
.state { font-weight: 600; }
.state.on { color: var(--ok); } .state.off { color: var(--bad); }

/* report dialog */
.overlay { position: fixed; inset: 0; background: rgb(10 14 30 / .5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.dialog { background: var(--surface); border-radius: 18px; padding: 22px; width: min(480px, 100%); display: grid; gap: 14px; box-shadow: 0 30px 60px -20px rgb(0 0 0 / .45); }
.dialog h2 { font-size: 1.35rem; }
.dialog .actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.thanks { background: var(--ok-soft); color: var(--ok); border-radius: 11px; padding: .7rem .85rem; font-weight: 500; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.studyframe.frame-ns { background: #0f1638; } /* the night-sky page is dark-only: no white flash while it loads */
