/* Pupil CBT screens — big, friendly, touch-first. School orange + charcoal. */
:root { --o: #F96501; --od: #C94F00; --ink: #222326; --text: #4A4B4E; --muted: #7C7D82; --line: #EDEAE7; --bg: #FFF6EE; --ok: #18a46b; --bad: #c8264b; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.55 "Poppins", system-ui, sans-serif; color: var(--text); background: var(--bg); -webkit-tap-highlight-color: transparent; }
h1, h2 { color: var(--ink); margin: 0 0 .4em; line-height: 1.25; }
button { font: inherit; }

.cbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; background: #fff; border-bottom: 3px solid var(--o); position: sticky; top: 0; z-index: 10; }
.cbrand { display: flex; align-items: center; gap: 10px; }
.cbrand .logo { width: 40px; height: 40px; object-fit: contain; }
.cbrand b { display: block; color: var(--ink); font-size: .95rem; line-height: 1.2; }
.cbrand small { color: var(--o); font-weight: 600; font-size: .78rem; }
.cwho { display: flex; align-items: center; gap: 10px; }
.cwho b { display: block; color: var(--ink); line-height: 1.1; }
.cwho small { color: var(--muted); font-size: .78rem; }
.cav { width: 38px; height: 38px; border-radius: 50%; background: var(--o); color: #fff; font-weight: 700; display: grid; place-items: center; }
.cwho form { margin: 0; }
.cout { border: 1.5px solid var(--line); background: #fff; color: var(--text); padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: .85rem; }
.cmain { max-width: 860px; margin: 0 auto; padding: 22px 16px 60px; }

.ccard { background: #fff; border-radius: 22px; padding: 22px; box-shadow: 0 14px 30px -20px rgba(80, 45, 15, .45); margin-bottom: 16px; }
.cbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: var(--o); color: #fff; font-weight: 600; padding: 14px 24px; border-radius: 14px; cursor: pointer; text-decoration: none; font-size: 1rem; min-height: 52px; transition: transform .1s, background .2s; }
.cbtn:hover { background: var(--od); }
.cbtn:active { transform: scale(.97); }
.cbtn:disabled { opacity: .4; cursor: default; }
.cbtn-light { background: #fff; color: var(--ink); border: 2px solid var(--line); }
.cbtn-light:hover { background: #fff; border-color: var(--o); }
.cbtn-big { width: 100%; font-size: 1.15rem; min-height: 58px; }
.cbtn-finish { width: 100%; margin-top: 16px; background: var(--ok); }
.cbtn-finish:hover { background: #128a59; }
.calert { padding: 12px 16px; border-radius: 14px; margin-bottom: 14px; }
.calert-error { background: #fff0f3; color: var(--bad); }
.calert-success { background: #ecfbf4; color: #0d7a50; }
.cmeta { color: var(--muted); margin: 0 0 12px; }
.csmall { font-size: .82rem; color: var(--muted); text-align: center; margin: 0; }

/* login */
.clogin-body { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(circle at 20% 10%, #FFE3CC, transparent 50%), radial-gradient(circle at 90% 90%, #FFD9BC, transparent 45%), var(--bg); }
.clogin { width: 100%; max-width: 400px; background: #fff; border-radius: 28px; padding: 30px 26px; box-shadow: 0 30px 60px -30px rgba(80, 45, 15, .5); display: grid; gap: 14px; text-align: center; }
.ccrest { width: 86px; margin: 0 auto; }
.clogin h1 { font-size: 1.8rem; margin: 0; }
.clogin p { margin: 0; }
.clogin label { display: grid; gap: 6px; text-align: left; font-weight: 600; color: var(--ink); }
.clogin input { font: inherit; font-size: 1.2rem; padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px; background: #FFFBF7; width: 100%; }
.clogin input:focus { outline: 0; border-color: var(--o); background: #fff; }
.cpin { letter-spacing: .5em; text-align: center; font-weight: 700; }

/* test list */
.chi { font-size: 1.5rem; }
.cempty { text-align: center; font-size: 1.2rem; padding: 40px; }
.ctests { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 16px; }
.ctest { margin: 0; display: flex; flex-direction: column; }
.ctest h2 { font-size: 1.15rem; }
.ctest .cbtn { width: 100%; margin-top: auto; }
.ctest form { margin-top: auto; }
.ctag { align-self: flex-start; background: #FFF1E5; color: var(--od); font-weight: 600; font-size: .8rem; padding: 4px 12px; border-radius: 99px; margin-bottom: 10px; }
.cdone { color: var(--ok); font-weight: 700; margin: auto 0 0; }
.csoon { color: var(--muted); font-weight: 600; margin: auto 0 0; }
.ctest-done, .ctest-closed { opacity: .8; }

/* taking a test */
.ctop { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 10px; }
.ctitle b { display: block; color: var(--ink); font-size: 1.05rem; line-height: 1.3; }
.ctitle small { color: var(--muted); }
.ctimer { flex: none; font-size: 1.6rem; font-weight: 700; color: var(--ink); background: #fff; padding: 6px 16px; border-radius: 14px; font-variant-numeric: tabular-nums; box-shadow: 0 6px 16px -10px rgba(0, 0, 0, .4); }
.ctimer.warn { color: #b56b00; background: #FFF4D6; }
.ctimer.danger { color: #fff; background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.cprog { height: 8px; background: #FFE3CC; border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.cprog i { display: block; height: 100%; width: 0; background: var(--o); border-radius: 99px; transition: width .3s; }
.cinstr { background: #fff; border-radius: 14px; padding: 10px 14px; font-size: .9rem; margin: 0 0 14px; }
.cqhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cqnum { font-weight: 700; color: var(--o); }
.cflag { border: 1.5px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 99px; cursor: pointer; font-size: .82rem; color: var(--muted); }
.cflag.on { background: #FFF4D6; border-color: #f0c040; color: #8a5a00; }
.cqbody { font-size: 1.3rem; color: var(--ink); font-weight: 500; margin: 0 0 16px; white-space: pre-wrap; }
.cqimg { display: block; max-width: 100%; max-height: 300px; border-radius: 14px; margin: 0 0 16px; }
.copts { display: grid; gap: 10px; }
.copt { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; padding: 14px 16px; min-height: 60px; border: 2.5px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; font-size: 1.1rem; color: var(--ink); transition: border-color .15s, background .15s; }
.copt:hover { border-color: #FFB27A; }
.copt .cl { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: #FFF1E5; color: var(--od); }
.copt.on { border-color: var(--o); background: #FFF6EE; }
.copt.on .cl { background: var(--o); color: #fff; }
.cfill { width: 100%; font: inherit; font-size: 1.3rem; padding: 16px; border: 2.5px solid var(--line); border-radius: 16px; }
.cfill:focus { outline: 0; border-color: var(--o); }
.cnav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.csave { font-size: .85rem; color: var(--muted); text-align: center; }
.csave.ok { color: var(--ok); } .csave.bad, .csave.warn { color: var(--bad); font-weight: 600; } .csave.busy { color: var(--od); }
.cgrid-label { margin: 0 0 10px; font-weight: 600; color: var(--ink); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.clegend { font-weight: 400; font-size: .8rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.clegend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.lg-a { background: var(--o); } .lg-f { background: #FFF4D6; border: 2px solid #f0c040; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.cgrid button { height: 46px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 700; color: var(--ink); cursor: pointer; }
.cgrid button.a { background: var(--o); border-color: var(--o); color: #fff; }
.cgrid button.f { border-color: #f0c040; box-shadow: inset 0 -5px 0 #f0c040; }
.cgrid button.cur { outline: 3px solid var(--ink); outline-offset: 1px; }
.cmodal { position: fixed; inset: 0; background: rgba(34, 35, 38, .55); display: grid; place-items: center; padding: 18px; z-index: 50; }
.cmodal .ccard { max-width: 460px; width: 100%; margin: 0; }
.cmodal .cnav { margin: 18px 0 0; }

/* finished */
.cfinish { text-align: center; padding: 36px 24px; }
.cbig { font-size: 4rem; line-height: 1; margin-bottom: 10px; }
.cscore { font-size: 1.6rem; color: var(--muted); margin: 10px 0; }
.cscore span { font-size: 3.4rem; font-weight: 700; color: var(--o); }

@media (max-width: 560px) {
  .cbrand span { display: none; }
  .cqbody { font-size: 1.15rem; }
  .copt { font-size: 1rem; }
  .ctimer { font-size: 1.3rem; }
  .ccard { padding: 18px 14px; border-radius: 18px; }
  .cbtn { padding: 12px 16px; }
}

/* ---------- pupil portal ---------- */
.pnav { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 63px; z-index: 9; }
.pnav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; }
.pnav a:hover { background: var(--bg); }
.pnav a.on { background: var(--o); color: #fff; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; align-items: start; }
.pcard { display: grid; gap: 10px; }
.pcard h2 { margin: 0; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.pic { font-size: 1.3rem; }
.prow { display: grid; gap: 2px; padding: 9px 12px; border-radius: 12px; background: var(--bg); color: var(--text); text-decoration: none; }
.prow b { color: var(--ink); font-size: .95rem; }
.prow small { color: var(--muted); font-size: .8rem; }
.ptime { grid-template-columns: 54px 1fr; align-items: center; }
.ptime span { font-weight: 700; color: var(--o); font-size: .85rem; font-variant-numeric: tabular-nums; }
.plink:hover { box-shadow: inset 0 0 0 2px var(--o); }
.plate { color: #c8264b !important; font-weight: 600; }
.pmuted { color: var(--muted); margin: 0; }
.pcard .cbtn { justify-self: start; text-decoration: none; display: inline-flex; }
.pform label { display: grid; gap: 6px; font-weight: 600; color: var(--ink); }
.pform label small { font-weight: 400; color: var(--muted); }
.pform input { font: inherit; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px; }
.pform input:focus { outline: 0; border-color: var(--o); }
@media (max-width: 600px) { .pnav { top: 59px; padding: 6px 8px; } .pnav a { padding: 6px 10px; font-size: .84rem; } }
