/* ============================================================
   Novelty Studio — portal styles
   Notebook-ruled paper + ink navy; one bold colour per subject.
   ============================================================ */

:root {
  --ink: #1E2A4A;
  --ink-soft: #5A6480;
  --paper: #F5F7FA;
  --card: #FFFFFF;
  --rule: #D9E2EC;
  --accent: #2E5AAC;
  --shelf: #C89B6C;
  --radius: 14px;
  --display: "Baloo 2", "Baloo Bhaina 2", system-ui, sans-serif;
  --body: "Nunito Sans", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--body);
  color: var(--ink);
  background:
    repeating-linear-gradient(transparent 0 31px, rgba(46, 90, 172, .05) 31px 32px),
    var(--paper);
  font-size: 16px;
  line-height: 1.5;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.mono { font-family: var(--mono); font-size: .8em; letter-spacing: .02em; }
.dim { color: var(--ink-soft); }
a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------- top bar + nav ---------------- */
.topbar { background: var(--ink); color: #fff; border-bottom: 4px solid var(--accent); }
.topbar-in {
  display: flex; align-items: center; gap: 16px;
  padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark { font-size: 26px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--display); font-weight: 800; font-size: 19px; }
.brand-text small { opacity: .7; font-size: 11px; }

.mainnav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.mainnav a {
  color: #fff; text-decoration: none; opacity: .8;
  font-family: var(--display); font-weight: 600; font-size: 15px;
  padding: 6px 12px; border-radius: 999px;
}
.mainnav a:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.mainnav a.on { opacity: 1; background: var(--accent); }

.navsearch input {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25);
  color: #fff; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 14px;
  width: 180px;
}
.navsearch input::placeholder { color: rgba(255, 255, 255, .6); }

.whoami { font-size: 13px; opacity: .9; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.signout { color: #fff; text-decoration: none; font-size: 17px; opacity: .8; }
.signout:hover { opacity: 1; }

.flash {
  background: #FFF6DE; border: 1.5px solid #EAC96B; color: #6A5313;
  border-radius: 10px; padding: 10px 16px; margin: 16px 0; font-weight: 600;
}

/* ---------------- dashboard ---------------- */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 14px; }
.greet { font-family: var(--display); font-weight: 700; font-size: 26px; margin: 0; }
.streak-chip {
  background: var(--ink); color: #fff;
  padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; white-space: nowrap;
}

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 20px 0; }
@media (max-width: 760px) { .dash-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--card); border: 1.5px solid var(--rule); border-radius: var(--radius);
  padding: 16px 20px; margin: 14px 0;
}
.card h2 { font-family: var(--display); font-size: 18px; margin: 2px 0 10px; }

.attn {
  border-left: 5px solid var(--rule); background: #FAFBFD;
  padding: 7px 12px; border-radius: 6px; margin: 6px 0; font-size: 14.5px;
}
.attn.amber { border-left-color: #F2B23A; background: #FFF9EC; }
.attn.red { border-left-color: #E4573D; background: #FDF1EE; }
.attn.over { border-left-color: #B3261E; background: #FBEAE9; }
tr.amber td { background: #FFF9EC; }
tr.red td { background: #FDF1EE; }
tr.over td { background: #FBEAE9; }
.mini {
  font-family: var(--display); font-weight: 600; font-size: 12.5px;
  background: #EDF2FA; border: 1px solid var(--rule); color: var(--accent);
  border-radius: 999px; padding: 2px 10px; text-decoration: none; cursor: pointer;
}
.mini:hover { background: #E0E9F7; }
.mini.danger { color: #B3261E; }

.shelfline {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  padding: 7px 4px; border-radius: 8px;
}
.shelfline:hover { background: #F3F6FB; }
.shelf-dot { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.shelf-dot.big { display: inline-block; width: 20px; height: 20px; margin-right: 10px; border-radius: 6px; }
.shelfline-name { font-family: var(--display); font-weight: 700; min-width: 150px; }
.shelfline-bar, .shelfline-bar.wide {
  flex: 1; height: 9px; background: var(--rule); border-radius: 999px; overflow: hidden;
  display: inline-block; vertical-align: middle;
}
.shelfline-bar.wide { width: 180px; flex: none; margin-right: 8px; }
.shelfline-bar i { display: block; height: 100%; }

.listline {
  display: block; text-decoration: none; color: var(--ink);
  padding: 7px 10px; border-radius: 8px; margin: 3px 0;
}
.listline:hover { background: #F3F6FB; }
.listline small { display: block; }

/* ---------------- resume card ---------------- */
.resume-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border: 2px solid var(--subject, var(--accent));
  border-radius: var(--radius); padding: 14px 18px;
  text-decoration: none; color: var(--ink);
  box-shadow: 0 6px 18px rgba(30, 42, 74, .1);
  transition: transform .15s ease, box-shadow .15s ease;
}
.resume-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(30, 42, 74, .16); }
.resume-card img { width: 74px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--rule); }
.resume-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.eyebrow {
  font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--subject, var(--accent));
}
.resume-info strong { font-family: var(--display); font-size: 19px; }
.resume-pg { color: var(--ink-soft); }
.resume-bar { height: 8px; background: var(--rule); border-radius: 999px; overflow: hidden; margin-top: 5px; max-width: 340px; }
.resume-bar i { display: block; height: 100%; background: var(--subject, var(--accent)); }
.resume-go {
  font-family: var(--display); font-weight: 700;
  background: var(--subject, var(--accent)); color: #fff;
  padding: 10px 18px; border-radius: 999px; white-space: nowrap;
}
.resume-empty { background: var(--card); border: 1.5px dashed var(--rule); border-radius: var(--radius); padding: 20px 24px; }
.resume-empty h2 { font-family: var(--display); margin: 0 0 6px; font-size: 21px; }
.resume-empty p { margin: 0; color: var(--ink-soft); }

/* ---------------- library shelves ---------------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 8px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-size: 26px; margin: 0; }
.native-lg { font-family: var(--display); color: var(--ink-soft); font-size: 20px; }

#shelves { margin: 18px 0 10px; }
.shelf { margin-bottom: 40px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.shelf-tab {
  font-family: var(--display); font-weight: 800; font-size: 20px;
  color: #fff; background: var(--subject);
  padding: 4px 18px 6px; border-radius: 8px 18px 18px 8px;
  box-shadow: 2px 3px 0 rgba(30, 42, 74, .18); text-decoration: none;
}
.shelf-tab .native { font-family: var(--display); font-weight: 600; opacity: .9; font-size: 17px; }
.shelf-count { color: var(--ink-soft); }

.shelf-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px; padding: 0 6px 16px;
  border-bottom: 8px solid var(--shelf); border-radius: 0 0 3px 3px;
}

.book { color: var(--ink); display: flex; flex-direction: column; gap: 8px; }
.book-cover {
  position: relative; display: block; text-decoration: none;
  border-radius: 6px 10px 10px 6px; border-left: 7px solid var(--spine);
  background: var(--card); box-shadow: 0 5px 14px rgba(30, 42, 74, .14);
  overflow: hidden; aspect-ratio: 3 / 4.1;
  transition: transform .16s ease, box-shadow .16s ease;
}
.book-cover:hover, .book-cover:focus-visible {
  transform: translateY(-5px) rotate(-.6deg);
  box-shadow: 0 12px 22px rgba(30, 42, 74, .22);
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ribbon {
  position: absolute; top: -2px; right: 12px;
  width: 16px; height: var(--p); min-height: 12%; max-height: 96%;
  background: var(--spine); filter: brightness(1.08);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
}
.ribbon i {
  position: absolute; bottom: -8px; left: 0;
  border-left: 8px solid transparent; border-right: 8px solid transparent;
  border-top: 8px solid var(--spine); filter: brightness(1.08);
}
.ribbon-done { background: #22A55E; }
.ribbon-done i { border-top-color: #22A55E; }
.done-stamp {
  position: absolute; left: 8px; bottom: 8px;
  background: #22A55E; color: #fff;
  font-family: var(--display); font-weight: 700; font-size: 12px;
  padding: 3px 10px; border-radius: 999px; transform: rotate(-3deg);
}
.book-title { font-family: var(--display); font-weight: 700; font-size: 15.5px; line-height: 1.25; }
.book-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); }
.kind {
  font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--spine); border: 1.5px solid var(--spine);
  padding: 1px 8px; border-radius: 999px;
}
.pdf-dl { font-size: 12.5px; color: var(--ink-soft); text-decoration: none; }
.pdf-dl:hover { color: var(--accent); }

/* ---------------- forms & tables ---------------- */
.upbox {
  background: var(--card); border: 1.5px dashed var(--rule); border-radius: var(--radius);
  padding: 10px 16px; margin: 12px 0;
}
.upbox summary { font-family: var(--display); font-weight: 700; cursor: pointer; }
.upbox form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.grid-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

input, select, textarea {
  font: inherit; color: var(--ink);
  border: 1.5px solid var(--rule); border-radius: 8px; padding: 7px 10px; background: #fff;
}
label.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

.btn {
  display: inline-block; appearance: none; border: 0; cursor: pointer;
  background: var(--subject, var(--accent)); color: #fff;
  font-family: var(--display); font-weight: 700; font-size: 16px;
  padding: 9px 22px; border-radius: 999px; text-decoration: none;
}
.btn:hover { filter: brightness(1.07); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th {
  text-align: left; font-family: var(--display); font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft);
  border-bottom: 2px solid var(--rule); padding: 6px 8px;
}
.tbl td { border-bottom: 1px solid var(--rule); padding: 8px; vertical-align: top; }
.rowform { display: inline-flex; gap: 6px; align-items: center; margin: 2px 0; flex-wrap: wrap; }
.rowform input, .rowform select { padding: 4px 8px; font-size: 13px; }

.status-chip {
  font-size: 11.5px; font-weight: 800; letter-spacing: .04em;
  border-radius: 999px; padding: 2px 10px; background: #EDF2FA; color: var(--accent);
}
.st-pending { background: #FFF3E2; color: #9A6215; }
.st-done { background: #E5F5EC; color: #1B7A46; }
.st-checked { background: #E8EAF9; color: #3B4CB8; }

.bigsearch { display: flex; gap: 10px; margin: 10px 0 20px; }
.bigsearch input { flex: 1; font-size: 17px; padding: 10px 16px; border-radius: 999px; }

/* ---------------- login ---------------- */
body.login {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; min-height: 100vh;
}
body.login .foot { display: none; }
.login-card {
  background: var(--card); border: 2px solid var(--ink); border-radius: 20px;
  box-shadow: 0 16px 40px rgba(30, 42, 74, .18);
  padding: 34px 40px; max-width: 380px; width: 92vw; text-align: center;
}
.login-emoji { font-size: 46px; }
.login-card h1 { font-family: var(--display); font-size: 24px; margin: 8px 0 2px; }
.login-sub { color: var(--ink-soft); margin: 0 0 18px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-card label { font-weight: 700; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.login-hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 16px; }

/* ---------------- footer ---------------- */
.foot { margin-top: 30px; padding: 22px 0 30px; color: var(--ink-soft); text-align: center; }
.foot p { margin: 4px 0; font-size: 13.5px; }

/* ============================================================
   READER
   ============================================================ */
body.reader {
  background: #17203A; color: #EDF1F7;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
}

#progress-track { height: 4px; background: rgba(255, 255, 255, .12); flex: none; }
#progress-fill {
  display: block; height: 100%; width: 0;
  background: var(--subject, var(--accent)); transition: width .3s ease;
}

.rtop, .rbottom { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.rtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.rtitle strong {
  font-family: var(--display); font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rtitle small { opacity: .65; font-size: 12px; }
.rtools { display: flex; gap: 6px; }

.rbtn {
  appearance: none; border: 1.5px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .07); color: #EDF1F7;
  width: 40px; height: 40px; border-radius: 10px;
  font-size: 17px; cursor: pointer; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.rbtn:hover { background: rgba(255, 255, 255, .16); }
.rbtn.on { background: var(--subject, var(--accent)); border-color: transparent; }
.rbtn.big { width: 52px; height: 44px; font-size: 20px; }
.rbtn:disabled { opacity: .3; cursor: default; }

#stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: auto; padding: 6px;
}
#spread { border-radius: 4px; box-shadow: 0 12px 40px rgba(0, 0, 0, .5); background: #fff; cursor: pointer; }
#stage[data-zoom="fit"] #spread { max-width: 100%; max-height: 100%; width: auto; height: auto; }
#stage[data-zoom="wide"] { align-items: flex-start; justify-content: flex-start; }
#stage[data-zoom="wide"] #spread { width: 100%; height: auto; max-width: none; max-height: none; cursor: grab; }
#stage[data-zoom="big"] { align-items: flex-start; justify-content: flex-start; }
#stage[data-zoom="big"] #spread { width: 170%; height: auto; max-width: none; max-height: none; cursor: grab; }

.rbottom { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
#slider { flex: 1; accent-color: var(--subject, var(--accent)); }
#counter { opacity: .8; min-width: 70px; text-align: center; }

#drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(360px, 92vw); background: #212D4E;
  border-left: 1px solid rgba(255, 255, 255, .15);
  box-shadow: -10px 0 30px rgba(0, 0, 0, .4);
  transform: translateX(105%); transition: transform .22s ease;
  display: flex; flex-direction: column; z-index: 20;
}
#drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .12);
  font-family: var(--display); font-size: 17px;
}
#drawer-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.drawer-empty { opacity: .75; line-height: 1.6; }

.bm-item {
  display: flex; gap: 12px; width: 100%; text-align: left;
  background: rgba(255, 255, 255, .06); color: inherit;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px;
  padding: 8px; margin-bottom: 10px; cursor: pointer; font: inherit;
}
.bm-item:hover { background: rgba(255, 255, 255, .13); }
.bm-item img { width: 84px; height: 58px; object-fit: cover; border-radius: 5px; flex: none; }
.bm-item span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bm-item small { opacity: .7; overflow: hidden; text-overflow: ellipsis; }
.bm-flag { font-size: 13px; }

#note-text {
  width: 100%; min-height: 120px; resize: vertical;
  background: rgba(255, 255, 255, .08); color: #EDF1F7;
  border: 1.5px solid rgba(255, 255, 255, .2); border-radius: 10px;
  padding: 12px; font: inherit; margin-bottom: 12px;
}

/* chapter notes (parents + students, appended per chapter) */
.bm-item.here { border-color: var(--subject, var(--accent)); }
.note-card {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px;
}
.note-card p { margin: 6px 0 0; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.note-meta { font-size: 12.5px; opacity: .85; display: flex; align-items: center; gap: 6px; }
.note-meta b { opacity: 1; }
.note-del {
  margin-left: auto; appearance: none; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .1); color: #EDF1F7;
  border-radius: 7px; width: 24px; height: 24px; font: inherit; font-size: 12px;
}
.note-del:hover { background: #E4573D; }
.note-attach {
  display: inline-block; margin-top: 8px; padding: 5px 10px;
  background: rgba(255, 255, 255, .1); border-radius: 999px;
  color: #EDF1F7; text-decoration: none; font-size: 13px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-attach:hover { background: rgba(255, 255, 255, .2); }
.note-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.note-filelab { display: block; font-size: 13px; opacity: .9; margin-bottom: 12px; cursor: pointer; }
.note-filelab input { font: inherit; font-size: 12.5px; max-width: 100%; }
.note-hint { font-size: 13px; opacity: .85; margin: 8px 0 0; min-height: 1em; }

/* type-a-page-number jump */
.goto { display: flex; gap: 6px; align-items: center; flex: none; }
.goto input {
  width: 62px; height: 40px; text-align: center;
  background: rgba(255, 255, 255, .08); color: #EDF1F7;
  border: 1.5px solid rgba(255, 255, 255, .22); border-radius: 10px;
  font: inherit; -moz-appearance: textfield;
}
.goto input::-webkit-outer-spin-button, .goto input::-webkit-inner-spin-button { -webkit-appearance: none; }
#goto-btn { width: auto; padding: 0 12px; font-size: 14px; font-weight: 700; }

.finish {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  background: rgba(13, 18, 35, .75); z-index: 30;
}
.finish.show { display: flex; }
.finish-card {
  background: #fff; color: var(--ink); border-radius: 18px; padding: 34px 42px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; max-width: 90vw; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.finish-emoji { font-size: 54px; }
.finish-card strong { font-family: var(--display); font-size: 22px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }

/* ---------------- parent portal & alerts ---------------- */
.bell { position: relative; color: #fff; text-decoration: none; font-size: 19px; }
.bell i {
  position: absolute; top: -6px; right: -10px; font-style: normal;
  background: #E4573D; color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 1px 6px; font-family: var(--display);
}
.kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin: 16px 0;
}
.kpi {
  background: var(--card); border: 1.5px solid var(--rule); border-radius: var(--radius);
  padding: 12px 14px; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; gap: 2px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(30, 42, 74, .12); }
.kpi b { font-family: var(--display); font-size: 26px; }
.kpi span { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }
.kpi-warn { border-color: #E4573D; }
.kpi-warn b { color: #B3261E; }
.n-unread { background: #FFF9EC; border-left: 4px solid #F2B23A; }
.notice-kind { margin-right: 4px; }
.parent-note {
  background: #FFF3E2; border: 2px solid #E5A93C; border-radius: 12px;
  padding: 12px 16px; margin: 12px 0; font-size: 15.5px;
}

/* ---------------- gamification ---------------- */
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.badge {
  font-family: var(--display); font-weight: 700; font-size: 13px;
  border: 1.5px solid var(--rule); border-radius: 999px; padding: 3px 12px;
  color: var(--ink-soft); background: #fff; opacity: .45; filter: grayscale(1);
}
.badge.got { opacity: 1; filter: none; border-color: #E5B93C; background: #FFFAE8; color: var(--ink); }

.good { color: #1B7A46; }
.bad { color: #B3261E; }

/* ---------------- practice / quizzes ---------------- */
.quizform .btn { margin: 6px 0 20px; }
.qcard h2 { display: flex; gap: 10px; align-items: baseline; }
.qno {
  font-family: var(--display); background: var(--ink); color: #fff;
  border-radius: 999px; min-width: 26px; height: 26px; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.opt { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.opt:hover { background: #F3F6FB; }
.opt-r { padding: 5px 10px; border-radius: 8px; margin: 3px 0; }
.opt-r.correct { background: #E5F5EC; font-weight: 700; }
.opt-r.wrong { background: #FDF1EE; text-decoration: line-through; }
.explain { background: #FFF9EC; border-left: 4px solid #F2B23A; padding: 8px 12px; border-radius: 6px; }
.q-wrong { border-left: 5px solid #E4573D; }
.q-right { border-left: 5px solid #22A55E; }
.score-chip {
  font-family: var(--display); font-size: 16px; background: #EDF2FA;
  border-radius: 999px; padding: 3px 14px; vertical-align: middle;
}

/* ---------------- doubts ---------------- */
.doubt { border: 1.5px solid var(--rule); border-radius: 10px; padding: 10px 14px; margin: 10px 0; }
.doubt.open { border-left: 5px solid #F2B23A; }
.doubt.answered { border-left: 5px solid var(--accent); }
.doubt.understood { border-left: 5px solid #22A55E; opacity: .75; }
.doubt-q { margin: 0 0 6px; }
.doubt-a { background: #F3F6FB; border-radius: 8px; padding: 8px 12px; margin: 6px 0; }
.st-open { background: #FFF3E2; color: #9A6215; }
.st-answered { background: #E8EAF9; color: #3B4CB8; }
.st-understood { background: #E5F5EC; color: #1B7A46; }

/* ---------------- career corner ---------------- */
.career-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.career-card { margin: 0; }
.career-card.explored { border-color: #9BD6B4; }
.career-emoji { font-size: 26px; }
.activity { background: #F3F6FB; border-radius: 8px; padding: 8px 12px; font-size: 14.5px; }

/* ---------------- parent dashboard ---------------- */
.daychart { display: flex; gap: 5px; align-items: flex-end; height: 130px; padding-top: 8px; }
.daybar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.daybar i {
  display: block; width: 100%; min-height: 3px;
  background: var(--accent); border-radius: 4px 4px 0 0; opacity: .85;
}
.daybar small { font-size: 10px; color: var(--ink-soft); margin-top: 3px; }

.heat { font-family: var(--mono); font-size: 13px; border-radius: 6px; padding: 3px 10px; color: #fff; }
.heat.h0 { background: #C94F3D; }
.heat.h1 { background: #DC8A3B; }
.heat.h2 { background: #D9B23A; color: #4a3b00; }
.heat.h3 { background: #8FBF4D; color: #23400d; }
.heat.h4, .heat.h5 { background: #22A55E; }

.drawer-sec {
  font-family: var(--display); font-size: 13px; letter-spacing: .06em;
  text-transform: uppercase; opacity: .6; margin: 6px 0 8px;
}

/* ---------------- exam worksheet (school format) ---------------- */
.worksheet {
  background: #fff; border: 2px solid var(--ink); border-radius: 6px;
  padding: 22px 28px; margin: 20px 0;
  max-width: 860px;
}
.ws-school {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 2px solid var(--ink); border-radius: 6px;
  padding: 8px 14px; margin-bottom: 12px; text-align: center;
}
.ws-school strong { font-family: Georgia, "Times New Roman", serif; font-size: 17px; letter-spacing: .03em; }
.ws-school span { font-size: 13px; font-weight: 700; }
.ws-head { border: 2px solid var(--ink); border-radius: 6px; padding: 8px 14px; margin-bottom: 14px; }
.ws-row { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 3px 0; }
.ws-score {
  font-family: var(--display); font-size: 26px; font-weight: 800; color: #C22;
  border: 2.5px solid #C22; border-radius: 50%; padding: 4px 14px; transform: rotate(6deg);
}
.ws-score small { font-size: 15px; }
.ws-section {
  font-family: Georgia, "Times New Roman", serif; font-size: 16px; letter-spacing: .06em;
  text-decoration: underline; margin: 20px 0 8px;
}
.ws-q { padding: 8px 0 6px; border-bottom: 1px dashed var(--rule); }
.ws-q.q-right { border-left: 4px solid #22A55E; padding-left: 10px; }
.ws-q.q-wrong { border-left: 4px solid #E4573D; padding-left: 10px; }
.ws-q.q-partial { border-left: 4px solid #F0A020; padding-left: 10px; }
.ws-essay { width: 100%; min-height: 64px; border: 1.5px solid var(--rule); border-radius: 10px;
  padding: 8px 10px; font: inherit; resize: vertical; }
.ws-essaynote { margin: 3px 0 0; font-size: 12px; }
.ws-qtext { margin: 0 0 6px; }
.ws-marks { float: right; font-weight: 700; color: var(--ink-soft); }
.ws-fill { width: min(420px, 100%); border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 4px 6px; }
.ws-line { border-bottom: 1.5px solid var(--ink); height: 26px; margin: 6px 0; }
.ws-opts { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.ws-opt { padding: 3px 0; margin-right: 20px; }
.ws-pic { margin: 6px 0 2px; }
.ws-pic > summary { cursor: pointer; display: inline-block; font-size: 13px; font-weight: 600;
  color: #2E5AAC; background: #EEF3FC; border: 1px solid #CFDDF6; border-radius: 8px; padding: 3px 10px; }
.ws-pic[open] > summary { margin-bottom: 6px; }
.ws-pic img { display: block; max-width: min(560px, 100%); width: 100%; height: auto;
  border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 4px 14px rgba(30,50,90,.12); }
.chap-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 8px 0; }
.chap-line { display: flex; align-items: center; gap: 6px; font-size: 14px; padding: 1px 0; }

@media print {
  body.worksheet-print { background: #fff; }
  .worksheet { border: none; margin: 0; padding: 0; max-width: none; }
  .noprint { display: none !important; }
  .ws-line { height: 30px; }
}

/* ---------------- fun zone ---------------- */
.daily-strip {
  background: #FFF3E2; border: 2px solid #E5A93C; border-radius: 12px;
  padding: 10px 16px; margin: 12px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.daily-strip.done { background: #E5F5EC; border-color: #9BD6B4; }
.speed-timer {
  background: #FDF1EE; border: 2px solid #E4573D; border-radius: 10px;
  padding: 8px 14px; margin: 8px 0; font-size: 17px;
}
.gamebox { min-height: 120px; }
.scramble-letters { font-family: var(--display); font-size: 26px; letter-spacing: .05em; }
.match-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; }
.match-card {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 13.5px;
  background: #F3F6FB; border: 1.5px solid var(--rule); border-radius: 8px;
  padding: 7px 10px; margin: 5px 0; cursor: pointer;
}
.match-card.ans { font-weight: 700; }
.match-card.sel { border-color: var(--accent); background: #E0E9F7; }
.match-card.ok { background: #E5F5EC; border-color: #9BD6B4; opacity: .7; }
.reward-off { opacity: .55; }
.say {
  appearance: none; border: 1px solid var(--rule); background: #fff; border-radius: 999px;
  cursor: pointer; font-size: 13px; padding: 1px 7px; vertical-align: middle;
}

/* railway */
.rway {
  display: flex; align-items: flex-start; gap: 0; overflow-x: auto;
  padding: 18px 6px 8px; position: relative;
}
.rway::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 32px;
  border-top: 4px dashed var(--line, var(--rule));
  opacity: .5;
}
.rway-loco, .rway-end { font-size: 24px; margin-top: 14px; flex: none; z-index: 1; }
.rway-station {
  flex: none; width: 92px; text-align: center; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 3px; z-index: 1;
}
.rway-station i {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--rule); margin-top: 8px;
}
.rway-station.lit i { background: var(--line); border-color: var(--line); box-shadow: 0 0 8px var(--line); }
.rway-station small { font-family: var(--display); font-weight: 700; }
.rway-station span { font-size: 10.5px; line-height: 1.25; color: var(--ink-soft); }
.rway-station.lit span b { color: #1B7A46; }

/* heat calendar */
.heatcal { display: flex; gap: 3px; }
.heat-week { display: flex; flex-direction: column; gap: 3px; }
.heat-cell { width: 13px; height: 13px; border-radius: 3px; background: #E7EDF4; display: block; }
.heat-cell.l1 { background: #BFE3CD; }
.heat-cell.l2 { background: #7ECD9E; }
.heat-cell.l3 { background: #3CAE6C; }
.heat-cell.l4 { background: #1B7A46; }
.heat-cell.future { background: transparent; border: 1px dashed var(--rule); }

/* certificate */
.cert {
  background: #fff; border: 6px double #C9A227; border-radius: 8px;
  max-width: 760px; margin: 20px auto; padding: 14px;
}
.cert-inner { border: 2px solid #C9A227; border-radius: 4px; padding: 34px 30px; text-align: center; }
.cert-school { letter-spacing: .25em; font-size: 12px; color: var(--ink-soft); }
.cert-title { font-family: Georgia, "Times New Roman", serif; font-size: 30px; margin: 12px 0 4px; }
.cert-award { color: var(--ink-soft); margin: 4px 0; }
.cert-name {
  font-family: var(--display); font-size: 34px; font-weight: 800; margin: 6px 0;
  border-bottom: 2px solid #C9A227; display: inline-block; padding: 0 30px 4px;
}
.cert-for { font-size: 17px; margin: 10px 0 2px; }
.cert-detail { color: var(--ink-soft); }
.cert-foot { display: flex; justify-content: space-between; margin-top: 34px; color: var(--ink-soft); }

/* doodle overlay */
#doodle-wrap { position: absolute; display: none; z-index: 15; }
#doodle-wrap canvas { position: absolute; inset: 0; cursor: crosshair; touch-action: none; }
#doodle-bar {
  position: absolute; top: -46px; left: 0; display: flex; gap: 6px;
  background: #212D4E; border-radius: 10px; padding: 6px 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.dcol { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff3; cursor: pointer; }
.dcol.on { border-color: #fff; }
.dbtn {
  font: inherit; font-size: 12.5px; color: #fff; background: #ffffff22;
  border: 1px solid #ffffff33; border-radius: 8px; cursor: pointer; padding: 2px 8px;
}
.ws-sheet { page-break-after: always; }

/* ---------------- print ---------------- */
@media print {
  .topbar, .foot, .mini, .upbox, .navsearch { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #bbb; break-inside: avoid; }
}

/* ---------------- small screens ---------------- */
@media (max-width: 620px) {
  .greet { font-size: 22px; }
  .resume-card { flex-wrap: wrap; }
  .resume-go { width: 100%; text-align: center; }
  .shelf-row { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .rtitle strong { font-size: 15px; }
  .rtools .rbtn { width: 36px; height: 36px; }
  .navsearch input { width: 130px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================
   CLASS-5 CHROME (2026-07-05): left rail like the ED-Platform,
   greeting banner with live clock, bright kid palette, and a
   fluid layout that auto-fills any display size.
   ============================================================ */

body {
  background:
    repeating-linear-gradient(transparent 0 31px, rgba(46, 90, 172, .05) 31px 32px),
    linear-gradient(180deg, #F2F8FF 0%, #FDF9F0 100%);
}

/* topbar: friendly sky gradient, full width */
.topbar { background: linear-gradient(90deg, #2E63C9, #4E9AE8); border-bottom: 4px solid #FFC53D; }
.topbar .topbar-in { max-width: none; padding: 10px 22px; }
.brand-mark { font-size: 30px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.25)); }
.navsearch { flex: 1; display: flex; justify-content: center; }
.navsearch input { width: min(420px, 90%); background: rgba(255,255,255,.92); color: var(--ink); }
.navsearch input::placeholder { color: #7c89a6; }

/* greeting banner: sunshine strip with live clock, day & date */
.banner {
  display: flex; align-items: center; gap: 18px;
  background: linear-gradient(90deg, #FFF3C4, #FFE0B8 55%, #FFD1DC);
  border-bottom: 3px solid #F2B23A;
  padding: 10px 26px;
}
.bn-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.bn-emoji { font-size: 42px; }
.bn-text { display: flex; flex-direction: column; line-height: 1.15; }
.bn-text b { font-family: var(--display); font-size: 24px; color: var(--ink); }
.bn-text small { color: #7A5B14; font-weight: 700; letter-spacing: .04em; }
.bn-clockwrap { flex: none; }
.bn-right { display: flex; flex-direction: column; text-align: right; line-height: 1.25; flex: none; }
.bn-right b { font-family: var(--display); font-size: 20px; color: var(--ink); }
.bn-right span { color: #6b5310; font-weight: 700; }
.bn-right .mono { font-size: 15px; }

/* fluid layout: rail + content auto-fill the whole display */
.layout {
  display: flex; gap: 20px; align-items: flex-start;
  width: 100%; max-width: 1900px; margin: 0 auto;
  padding: 16px 22px 0;
}
.content { flex: 1; min-width: 0; }
.content > .page-head:first-child, .content > .dash-head:first-child { margin-top: 4px; }
main.content .wrap { max-width: none; padding: 0; }

/* left rail: chunky, colourful, sticky */
.rail {
  width: 208px; flex: none; position: sticky; top: 12px;
  background: #fff; border: 2px solid #D9E2EC; border-radius: 18px;
  padding: 10px; box-shadow: 0 6px 16px rgba(30, 42, 74, .08);
  max-height: calc(100vh - 24px); overflow-y: auto;
}
.rail-band {
  display: block; font-family: var(--display); font-weight: 800; font-size: 12px;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-soft);
  margin: 10px 6px 4px;
}
.rail-band:first-child { margin-top: 2px; }
.raillink {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display); font-weight: 700; font-size: 14.5px;
  color: var(--ink); text-decoration: none;
  padding: 6px 9px; border-radius: 12px; margin: 2px 0;
  transition: transform .1s ease, background .1s ease;
}
.raillink i { font-style: normal; font-size: 17px; width: 22px; text-align: center; }
.raillink:hover { transform: translateX(3px); background: #F0F6FF; }
.raillink.on { color: #fff; }
.r-parent.on, .r-parent:hover { background: #6D5BD0; } .r-parent:hover { background: #EDE9FB; }
.r-dash.on { background: #2E63C9; } .r-lib.on { background: #E63950; }
.r-hw.on { background: #F29D35; } .r-pr.on { background: #8B5CF6; }
.r-db.on { background: #0FA3A3; } .r-eh.on { background: #D14A8F; }
.r-ex.on { background: #B3261E; } .r-rep.on { background: #5A6480; }
.r-ch.on { background: #E8890C; } .r-rw.on { background: #C9A227; }
.r-sc.on { background: #1FA05A; } .r-fn.on { background: #FF6B9D; }
.r-gm.on { background: #7C4DFF; } .r-ai.on { background: #00A0B0; }
.r-ca.on { background: #FF7043; } .r-ac.on { background: #455A75; }
.r-se.on { background: #0B7285; } .r-tc.on { background: #6741D9; }
.r-ga.on { background: #D6336C; } .r-pf.on { background: #0CA678; }
.r-pc.on { background: #2F6F8F; }
.r-aaa.on { background: #0B6E4F; }
.r-parent.on { background: #6D5BD0; }

/* cards & chips: rounder, friendlier */
.card { border-radius: 18px; border-width: 2px; }
.mini { border-radius: 999px; }
.btn { box-shadow: 0 3px 0 rgba(30, 42, 74, .18); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.foot { padding-bottom: 20px; }

/* login: credentials card dead-centre of the page */
body.login {
  display: flex; flex-direction: column;
  min-height: 100vh; min-height: 100dvh;
}
body.login .layout {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 0; width: 100%;
}
body.login .content { flex: 0 1 auto; display: flex; align-items: center; justify-content: center; }
body.login .login-card { margin: 0 auto; }

/* auto-fit any display: tablets & small screens */
@media (max-width: 980px) {
  .layout { flex-direction: column; padding: 10px 12px 0; }
  .rail {
    position: static; width: 100%; max-height: none; overflow-x: auto;
    display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center;
    padding: 8px;
  }
  .rail-band { width: 100%; margin: 6px 4px 2px; }
  .raillink { padding: 5px 10px; }
  .banner { padding: 8px 14px; gap: 10px; }
  .bn-clockwrap { display: none; }
  .bn-emoji { font-size: 30px; }
  .bn-text b { font-size: 19px; }
}
@media (max-width: 620px) {
  .bn-right { display: none; }
  .navsearch input { width: 130px; }
}
/* logout: obvious in both the rail and the top bar */
.r-out { color: #B3261E; border: 1.5px dashed #E8B4B0; }
.r-out:hover { background: #FDF1EE; transform: translateX(3px); }
.r-out i { filter: none; }
.signout {
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 999px; padding: 3px 12px; font-weight: 700; font-size: 13px;
}
.signout:hover { background: rgba(255, 255, 255, .3); }

/* sibling switcher in the banner (parents only) */
.bn-switch {
  display: flex; align-items: center; gap: 7px; flex: none; flex-wrap: wrap;
  background: rgba(255, 255, 255, .55); border: 1.5px solid #E5A93C;
  border-radius: 999px; padding: 4px 12px; margin-right: 10px;
}
.bn-switch small { font-weight: 800; color: #7A5B14; letter-spacing: .04em; }
.kid-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--display); font-weight: 700; font-size: 13.5px;
  color: var(--ink); text-decoration: none;
  background: #fff; border: 2px solid var(--rule); border-radius: 999px;
  padding: 2px 10px 2px 4px;
}
.kid-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.kid-chip.on { border-color: #2E63C9; background: #E3EEFF; box-shadow: 0 2px 6px rgba(46, 99, 201, .25); }
.kid-chip:hover { border-color: #2E63C9; }

/* banner passport photo */
.bn-photo {
  width: 54px; height: 54px; object-fit: cover; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(30, 42, 74, .3);
}
.bn-emoji-link { text-decoration: none; }

/* personal gallery */
.gal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.gal-item {
  margin: 0; background: #fff; border: 2px solid var(--rule); border-radius: 14px;
  overflow: hidden; box-shadow: 0 4px 10px rgba(30, 42, 74, .08);
}
.gal-item img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gal-pdf { display: flex; align-items: center; justify-content: center; height: 150px; font-size: 52px; background: #F3F6FB; }
.gal-item figcaption { padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }

/* teachers zone on the dashboard */
.teach-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .teach-cols { grid-template-columns: 1fr; } }

/* student registration card */
.profile-form { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.profile-photo img, .profile-blank {
  width: 130px; height: 160px; object-fit: cover; border-radius: 10px;
  border: 2.5px solid var(--ink); background: #F3F6FB;
  display: flex; align-items: center; justify-content: center; font-size: 60px;
}
.profile-form label { font-weight: 700; font-size: 14px; display: flex; flex-direction: column; gap: 3px; }
.profile-form > div:last-child { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 10px; }

/* big displays: let it breathe and use the space */
@media (min-width: 1500px) {
  .rail { width: 232px; }
  .layout { gap: 26px; }
  body { font-size: 17px; }
}
