/* ============================================================================
   Cambridge Group of Schools — Practice Exam page (practice.html)
   Phone first. School navy and gold; the one loud thing is the sign-in,
   drawn like the roll-number grid of an OMR answer sheet (red print,
   pencil-dark bubbles).
   ============================================================================ */
:root {
  --ink: #1a365d;         /* school navy */
  --ink-soft: #52627c;
  --desk: #edf1f6;        /* page */
  --paper: #ffffff;
  --rule: #d8e0eb;
  --gold: #d69e2e;        /* school gold — the main action */
  --gold-dk: #a86f13;
  --grow: #12805a;        /* good scores, progress */
  --low: #c2410c;         /* low scores */
  --omr: #d23f63;         /* OMR sheet print */
  --omr-tint: #fdf0f3;
  --pencil: #232a35;      /* a filled bubble */
  --r-lg: 22px; --r-md: 14px; --r-sm: 10px;
  --display: "Playfair Display", Georgia, serif;
  --body: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--desk); min-height: 100vh; display: flex; flex-direction: column; }
body.pz-locked { overflow: hidden; }
button { font-family: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ── top bar ──────────────────────────────────────────────────────────── */
.pz-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: var(--ink); color: #fff; }
.pz-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.pz-brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 3px; object-fit: contain; flex-shrink: 0; }
.pz-brand span { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pz-brand strong { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-brand em { font-style: normal; font-size: .8rem; color: #f3d48e; }
.pz-chipbtn, .pz-avatar { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08);
  color: #fff; border-radius: 999px; padding: 4px 14px 4px 4px; font-size: .88rem; font-weight: 600; cursor: pointer; flex-shrink: 0; }
.pz-chipbtn { padding: 6px 14px; white-space: nowrap; }
.pz-avatar-i { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: var(--ink); display: grid; place-items: center; font-weight: 700; }
.pz-avatar-n { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── layout ───────────────────────────────────────────────────────────── */
.pz-main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 18px 14px 40px; }
.pz-block { margin-top: 26px; }
.pz-h2 { font-size: 1.08rem; font-weight: 700; margin: 0 0 10px; color: var(--ink); }
.pz-h3 { font-size: .95rem; font-weight: 700; margin: 18px 0 8px; }
.pz-loading { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 80px 0; color: var(--ink-soft); }
.pz-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--rule); border-top-color: var(--gold); animation: pz-spin .8s linear infinite; display: inline-block; vertical-align: middle; }
.pz-spin.sm { width: 16px; height: 16px; border-width: 2px; }
.pz-spin.light { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes pz-spin { to { transform: rotate(360deg); } }
.pz-alert { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: var(--r-md); padding: 12px 14px; margin-top: 16px; font-size: .92rem; }
.pz-small { font-size: .86rem; color: var(--ink-soft); margin: 10px 0 0; }
.pz-small i { color: var(--gold-dk); margin-right: 4px; }
.pz-link { background: none; border: none; color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 8px 4px; font-size: .88rem; min-height: 40px; }

/* ── buttons ──────────────────────────────────────────────────────────── */
.pz-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 20px; border-radius: var(--r-md);
  font-size: 1rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: background .15s, transform .1s; }
.pz-btn:active { transform: scale(.98); }
.pz-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.pz-btn-gold { background: var(--gold); color: #1d1404; }
.pz-btn-gold:hover:not(:disabled) { background: #c98f22; }
.pz-btn-ghost { background: var(--paper); color: var(--ink); border-color: var(--rule); }
.pz-btn-lg { min-height: 56px; font-size: 1.05rem; width: 100%; }

/* ── welcome ──────────────────────────────────────────────────────────── */
.pz-hero { background: var(--paper); border-radius: var(--r-lg); padding: 26px 20px 22px; position: relative; overflow: hidden; }
.pz-hero h1 { font-family: var(--display); font-weight: 800; font-size: clamp(1.75rem, 7vw, 2.5rem); line-height: 1.12; margin: 0 0 12px; max-width: 15ch; letter-spacing: -.01em; }
.pz-hero p { margin: 0 0 20px; color: var(--ink-soft); max-width: 42ch; position: relative; z-index: 1; }
.pz-hero .pz-hint { margin: 12px 0 0; font-size: .86rem; }
.pz-hero .pz-hint i { color: var(--omr); margin-right: 4px; }
/* a corner of an OMR sheet, as a hint of what signing in looks like */
.pz-hero::after {
  content: ""; position: absolute; right: -14px; top: 16px; width: 112px; height: 108px; opacity: .9; pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, var(--pencil) 0 5.5px, transparent 6px) 6px 42px / 26px 22px no-repeat,
    radial-gradient(circle at 50% 50%, var(--pencil) 0 5.5px, transparent 6px) 32px 108px / 26px 22px no-repeat,
    radial-gradient(circle at 50% 50%, var(--pencil) 0 5.5px, transparent 6px) 58px 20px / 26px 22px no-repeat,
    radial-gradient(circle at 50% 50%, var(--pencil) 0 5.5px, transparent 6px) 84px 86px / 26px 22px no-repeat,
    radial-gradient(circle at 50% 50%, transparent 0 5.5px, var(--omr) 6px 7px, transparent 7.5px) 6px 20px / 26px 22px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 40%); mask: linear-gradient(90deg, transparent, #000 40%);
}
@media (max-width: 420px) { .pz-hero::after { opacity: .5; width: 86px; } .pz-hero h1 { max-width: 14ch; } }

.pz-filter { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.pz-filter::-webkit-scrollbar { display: none; }
.pz-filter button { flex-shrink: 0; min-height: 40px; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-size: .88rem; font-weight: 500; cursor: pointer; }
.pz-filter button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── exam list: lines on one sheet of paper, not a pile of cards ──────── */
.pz-exams { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--r-lg); overflow: hidden; }
.pz-exams li + li { border-top: 1px solid var(--rule); }
.pz-ex { width: 100%; display: flex; align-items: center; gap: 14px; text-align: left; background: none; border: none; padding: 16px 16px; cursor: pointer; color: inherit; min-height: 76px; }
.pz-ex:hover { background: #f7f9fc; }
.pz-ex-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pz-ex-subj { font-size: .8rem; font-weight: 600; color: var(--gold-dk); }
.pz-ex-title { font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
.pz-ex-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--ink-soft); }
.pz-ex-meta i { color: #8a9ab3; margin-right: 3px; }
.pz-ex-open { font-size: .8rem; color: #9a3412; font-weight: 600; margin-top: 2px; }
.pz-ex-right { display: flex; flex-direction: column; align-items: center; gap: 2px; flex-shrink: 0; }
.pz-ex-best { font-size: .7rem; color: var(--ink-soft); white-space: nowrap; }
.pz-ex-go { width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: #1d1404; display: grid; place-items: center; font-size: .95rem; }

/* a score: a ring filled to the percentage */
.pz-score { --p: 0; --c: var(--grow); width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #e6ebf2 0); }
.pz-score span { width: 36px; height: 36px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-size: .78rem; font-weight: 700; }

.pz-empty { background: var(--paper); border-radius: var(--r-lg); padding: 30px 20px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; color: var(--ink-soft); }
.pz-empty i { font-size: 1.8rem; color: var(--gold); margin-bottom: 4px; }
.pz-empty strong { color: var(--ink); }

/* ── signed in ────────────────────────────────────────────────────────── */
.pz-hello { background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 22px 18px 18px; }
.pz-hello h1 { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 7vw, 2.2rem); margin: 0; line-height: 1.15; }
.pz-hello-t p { margin: 2px 0 0; color: #c8d3e6; font-size: .92rem; }
.pz-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 0; }
.pz-stats div { background: rgba(255,255,255,.08); border-radius: var(--r-sm); padding: 10px 8px; text-align: center; }
.pz-stats dt { font-size: .72rem; color: #c8d3e6; line-height: 1.25; }
.pz-stats dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 700; color: #fff; }
.pz-first { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; background: rgba(255,255,255,.08); border-radius: var(--r-sm); padding: 12px 14px; font-size: .92rem; color: #e5ecf7; }
.pz-first i { color: var(--gold); margin-top: 4px; }
.pz-spark { margin: 14px 0 0; }
.pz-spark svg { width: 100%; height: 64px; display: block; }
.pz-spark-mid { stroke: rgba(255,255,255,.18); stroke-dasharray: 3 4; }
.pz-spark-area { fill: rgba(214,158,46,.18); }
.pz-spark-line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.pz-spark circle { fill: var(--gold); }
.pz-spark figcaption { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .78rem; color: #c8d3e6; margin-top: 4px; }
.pz-spark .up { color: #86efac; } .pz-spark .down { color: #fdba74; }

.pz-bars { list-style: none; margin: 0; padding: 14px 16px; background: var(--paper); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 12px; }
.pz-bars li { display: grid; grid-template-columns: 1fr 48px; grid-template-areas: "l v" "b b"; gap: 4px 10px; align-items: center; }
.pz-bar-l { grid-area: l; font-size: .9rem; font-weight: 500; }
.pz-bar-l i { color: #8a9ab3; width: 20px; }
.pz-bar-v { grid-area: v; text-align: right; font-weight: 700; font-size: .92rem; }
.pz-bar { grid-area: b; height: 10px; border-radius: 999px; background: #e6ebf2; overflow: hidden; }
.pz-bar span { display: block; height: 100%; border-radius: 999px; }
.pz-tip { margin: 10px 2px 0; font-size: .88rem; color: var(--ink-soft); }
.pz-tip i { color: var(--gold); margin-right: 6px; }

.pz-recent { list-style: none; margin: 0; padding: 0; background: var(--paper); border-radius: var(--r-lg); overflow: hidden; }
.pz-recent li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.pz-recent li + li { border-top: 1px solid var(--rule); }
.pz-recent-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pz-recent-t strong { font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-recent-t small { font-size: .78rem; color: var(--ink-soft); }

/* ── sheets ───────────────────────────────────────────────────────────── */
.pz-scrim { position: fixed; inset: 0; background: rgba(12, 22, 40, .55); z-index: 40; animation: pz-fade .2s ease; }
.pz-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--paper); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.2); animation: pz-up .25s cubic-bezier(.2,.8,.2,1); }
.pz-sheet::before { content: ""; width: 44px; height: 5px; border-radius: 99px; background: var(--rule); margin: 8px auto 0; flex-shrink: 0; }
@keyframes pz-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pz-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pz-sheet, .pz-scrim { animation: none; } .pz-pinwrap.shake { animation: none !important; } }
.pz-sheet:focus { outline: none; }
.pz-x { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--desk); color: var(--ink); font-size: 1.1rem; cursor: pointer; z-index: 2; }
.pz-sheet-head { padding: 12px 64px 4px 20px; flex-shrink: 0; }
.pz-sheet-head h2 { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; margin: 2px 0 6px; }
.pz-sheet-head.pz-center { text-align: center; padding: 16px 20px 4px; }
.pz-sub { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.pz-sheet-body { padding: 4px 20px 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.pz-sheet-foot { padding: 12px 20px; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.pz-sheet-foot.pz-row { flex-direction: row; }
.pz-sheet-foot.pz-row .pz-btn { flex: 1; }
.pz-facts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pz-facts span { display: inline-flex; align-items: center; gap: 6px; background: var(--desk); border-radius: 999px; padding: 5px 12px; font-size: .82rem; font-weight: 500; }
.pz-facts i { color: var(--gold-dk); }
.pz-new { background: #ecfdf5; color: #065f46; border-radius: var(--r-sm); padding: 10px 12px; font-size: .88rem; margin: 10px 0 0; }
.pz-new i { margin-right: 6px; }
.pz-inside { list-style: none; margin: 0; padding: 0; border: 1px solid var(--rule); border-radius: var(--r-md); }
.pz-inside li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: .92rem; }
.pz-inside li + li { border-top: 1px solid var(--rule); }
.pz-inside i { color: #8a9ab3; width: 20px; text-align: center; }
.pz-inside span { flex: 1; }
.pz-inside b { font-weight: 700; }
.pz-tries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.pz-tries li { display: grid; grid-template-columns: 26px 1fr 64px auto; grid-template-areas: "n bar v a" "n d d a"; align-items: center; gap: 0 10px; padding: 8px 0; border-bottom: 1px dashed var(--rule); }
.pz-try-n { grid-area: n; width: 26px; height: 26px; border-radius: 50%; background: var(--desk); display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--ink-soft); }
.pz-tries li.best .pz-try-n { background: #fef3c7; color: var(--gold-dk); }
.pz-try-bar { grid-area: bar; height: 8px; background: #e6ebf2; border-radius: 99px; overflow: hidden; }
.pz-try-bar span { display: block; height: 100%; border-radius: 99px; }
.pz-try-v { grid-area: v; font-weight: 700; font-size: .9rem; text-align: right; }
.pz-try-v i { color: var(--gold); }
.pz-try-d { grid-area: d; font-size: .75rem; color: var(--ink-soft); }
.pz-tries .pz-link { grid-area: a; }
.pz-open { margin: 0; font-size: .88rem; color: #9a3412; }

/* ── sign in: the OMR grid ────────────────────────────────────────────── */
.pz-seg { display: flex; background: var(--desk); border-radius: var(--r-md); padding: 4px; gap: 4px; margin: 8px 0 14px; }
.pz-seg button { flex: 1; min-height: 44px; border: none; background: none; border-radius: var(--r-sm); font-weight: 600; font-size: .92rem; color: var(--ink-soft); cursor: pointer; }
.pz-seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(15,23,42,.15); }
.pz-label { display: block; font-weight: 600; font-size: .92rem; margin: 6px 0 10px; }
.pz-pinwrap { position: relative; background: var(--omr-tint); border: 1.5px solid var(--omr); border-radius: var(--r-md); padding: 12px 10px 10px; }
.pz-pinwrap.text { background: none; border: none; padding: 0; }
.pz-pinwrap.shake { animation: pz-shake .4s; }
@keyframes pz-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pz-hidpin { position: absolute; left: 10px; right: 10px; top: 12px; height: 58px; opacity: 0; z-index: 2; font-size: 16px; caret-color: transparent; cursor: text; }
.pz-omr { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pz-omr-col { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pz-omr-box { width: 100%; height: 58px; border: 1.5px solid var(--omr); background: var(--paper); border-radius: 8px; display: grid; place-items: center;
  font-size: 1.8rem; font-weight: 700; color: var(--pencil); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.pz-omr-col.cur .pz-omr-box { box-shadow: 0 0 0 3px rgba(210,63,99,.25); }
.pz-bub { width: 100%; max-width: 64px; height: 26px; border: none; background: none; cursor: pointer; display: grid; place-items: center; position: relative;
  font-size: .68rem; font-weight: 600; color: var(--omr); padding: 0; }
.pz-bub::before { content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--omr); left: 50%; top: 50%; transform: translate(-50%, -50%); }
.pz-bub.on { color: #fff; }
.pz-bub.on::before { background: var(--pencil); border-color: var(--pencil); }
.pz-bub > * { position: relative; }
.pz-bub { z-index: 0; }
.pz-bub.on { text-shadow: none; }
.pz-bub:focus-visible { outline-offset: -2px; }
.pz-howto { text-align: center; }
.pz-textpin { width: 100%; min-height: 56px; font-size: 1.4rem; font-weight: 700; text-align: center; letter-spacing: .08em; border: 1.5px solid var(--omr); border-radius: var(--r-md); padding: 8px 12px; color: var(--pencil); font-family: inherit; }
.pz-err { margin-top: 12px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: var(--r-sm); padding: 10px 12px; font-size: .9rem; }
.pz-alt { align-self: center; font-weight: 500; color: var(--ink-soft); }
.pz-check { width: 56px; height: 56px; border-radius: 50%; background: #ecfdf5; color: var(--grow); display: inline-grid; place-items: center; font-size: 1.4rem; margin-bottom: 4px; }
.pz-idcard { border: 1.5px solid var(--rule); border-radius: var(--r-md); padding: 16px; text-align: center; }
.pz-idname { display: block; font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
.pz-idcard dl { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.pz-idcard dl div { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; border-top: 1px dashed var(--rule); padding-top: 6px; }
.pz-idcard dt { color: var(--ink-soft); }
.pz-idcard dd { margin: 0; font-weight: 600; }

/* ── footer, toast ────────────────────────────────────────────────────── */
.pz-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; padding: 18px 16px; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  max-width: 760px; width: 100%; margin: 0 auto; font-size: .82rem; color: var(--ink-soft); }
.pz-foot a { color: var(--ink); font-weight: 600; text-decoration: none; }
.pz-toast { position: fixed; left: 16px; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); max-width: 440px; margin: 0 auto; z-index: 60;
  background: var(--pencil); color: #fff; border-radius: var(--r-md); padding: 12px 16px; font-size: .92rem; transform: translateY(160%); transition: transform .25s; }
.pz-toast.show { transform: none; }

/* ── bigger screens ───────────────────────────────────────────────────── */
@media (min-width: 640px) {
  .pz-main { padding: 28px 20px 56px; }
  .pz-hero { padding: 40px 36px 32px; }
  .pz-hero::after { right: 24px; top: 34px; width: 112px; transform: scale(1.25); transform-origin: top right; }
  .pz-hello { padding: 28px 28px 22px; }
  .pz-sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: 88vh; border-radius: var(--r-lg); animation: pz-fade .2s ease; }
  .pz-sheet::before { display: none; }
  .pz-sheet-head { padding-top: 22px; }
  .pz-bub { height: 28px; }
}
@media (max-width: 420px) {
  .pz-brand strong { font-size: .84rem; }
  .pz-top { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 359px) {
  .pz-stats { grid-template-columns: repeat(2, 1fr); }
  .pz-omr { gap: 4px; }
  .pz-brand strong { font-size: .82rem; }
}
