/* Life of P Worksheets — bright, print-first */
:root {
  --ink: #2B2350; --muted: #5B5675; --ground: #F6F3FF; --card: #FFFFFF;
  --line: #E3DCF5; --line2: #CFC6EA; --sun: #FFD23F; --sun-soft: #FFF1B8; --pink: #E0457B; --red: #E5484D;
  --maths: #2F5BE7; --maths-bg: #E3EAFF; --maths-sh: #1D3BA8; --maths-top: #6E93FF;
  --english: #C2410C; --english-bg: #FFEADB; --english-sh: #7A2A08; --english-top: #FF8A4C;
  --science: #15803D; --science-bg: #DDF5E6; --science-sh: #0E5A2B; --science-top: #3CCB7F;
  --arabic: #0F766E; --arabic-bg: #D9F3EF; --arabic-sh: #0A4F4A; --arabic-top: #2DBFAE;
  --french: #6D28D9; --french-bg: #EDE4FF; --french-sh: #4A1A96; --french-top: #A07BF0;
  --arabic-font: 'Noto Naskh Arabic', 'Andika', system-ui, sans-serif;
  --display: 'Baloo 2', system-ui, sans-serif; --body: 'Nunito', system-ui, sans-serif; --sheet: 'Andika', 'Nunito', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ground); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.5; }
a { color: var(--maths); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
[hidden] { display: none !important; }

/* top bar */
.topbar { background: var(--sun); border-bottom: 3px solid var(--ink); }
.topbar-in { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; padding-block: 14px; }
.logo { font-family: var(--display); font-weight: 800; font-size: 30px; color: var(--ink); text-decoration: none; display: flex; align-items: baseline; gap: 8px; line-height: 1; }
.logo span { color: var(--pink); }
.logo small { font-family: var(--body); font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.search { flex: 1 1 300px; min-width: 0; max-width: 100%; display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 0 18px; min-height: 48px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--ink); outline: none; padding: 12px 0; }
.grade { font-size: 14px; font-weight: 800; color: #fff; background: var(--ink); border-radius: 999px; padding: 7px 14px; }

main { padding-block: 28px 48px; display: flex; flex-direction: column; gap: 26px; }
h1, h2, h3 { text-wrap: balance; }
.hero { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px; }
.hero h1 { margin: 0; font-family: var(--display); font-size: clamp(32px, 5vw, 46px); font-weight: 800; line-height: 1.05; max-width: 640px; }
.hero h1 span { color: var(--pink); }
.hero p { margin: 8px 0 0; color: var(--muted); font-size: 18px; max-width: 640px; }
.stats { display: flex; gap: 28px; font-variant-numeric: tabular-nums; }
.stat b { display: block; font-family: var(--display); font-size: 38px; font-weight: 800; line-height: 1; }
.stat span { font-size: 14px; color: var(--muted); }

/* buttons */
.btn { font: inherit; font-weight: 800; cursor: pointer; border-radius: 12px; min-height: 44px; padding: 9px 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; border: 2px solid transparent; transition: transform .08s; }
.btn:active { transform: translateY(2px); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.btn-video { background: #fff; color: var(--ink); border-color: var(--red); }
.btn-video svg { fill: var(--red); }
.btn-video[aria-disabled="true"] { opacity: .6; cursor: default; }
.s-Maths { --c: var(--maths); --c-bg: var(--maths-bg); --c-sh: var(--maths-sh); --c-top: var(--maths-top); }
.s-English { --c: var(--english); --c-bg: var(--english-bg); --c-sh: var(--english-sh); --c-top: var(--english-top); }
.s-Science { --c: var(--science); --c-bg: var(--science-bg); --c-sh: var(--science-sh); --c-top: var(--science-top); }
.s-Arabic { --c: var(--arabic); --c-bg: var(--arabic-bg); --c-sh: var(--arabic-sh); --c-top: var(--arabic-top); }
.s-French { --c: var(--french); --c-bg: var(--french-bg); --c-sh: var(--french-sh); --c-top: var(--french-top); }
[lang="ar"] { font-family: var(--arabic-font); }
[lang="ar"] .ol-sec, .page[lang="ar"] { font-family: var(--arabic-font); }
.page[dir="rtl"] .ws-list, .page[dir="rtl"] .ol-list { text-align: right; }
.soon { grid-column: 1 / -1; background: var(--c-bg); border: 2px dashed var(--c); border-radius: 16px; padding: 22px 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.soon .chip { background: #fff; }
.soon h2 { margin: 0; font-family: var(--display); font-size: 28px; line-height: 1.15; color: var(--c); }
.soon p { margin: 0; max-width: 640px; }
.s-All { --c: var(--ink); --c-bg: #ECE7FA; --c-sh: #15102E; --c-top: var(--ink); }
.btn-main, .btn-print { background: var(--c, var(--english)); color: #fff; box-shadow: 0 4px 0 var(--c-sh, var(--english-sh)); }
.btn-soft { background: var(--c-bg); color: var(--c); border-color: var(--c); }

.tabs, .levels { display: flex; flex-wrap: wrap; gap: 10px; }
.tab { font: inherit; font-weight: 800; font-size: 17px; cursor: pointer; min-height: 46px; padding: 8px 20px; border-radius: 999px; border: 2px solid var(--c); background: var(--c-bg); color: var(--c); box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 35%, transparent); }
.tab[aria-pressed="true"] { background: var(--c); color: #fff; box-shadow: 0 4px 0 var(--c-sh); }
.tab .n { opacity: .75; font-variant-numeric: tabular-nums; }

.layout { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.grid { flex: 999 1 600px; min-width: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid .card { padding: 16px; } .grid .card .actions { gap: 8px; } .grid .card .actions .btn { font-size: 15px; padding-inline: 10px; gap: 6px; } }
@media (max-width: 700px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } }
@media (max-width: 480px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 2px solid var(--c-bg); border-top: 8px solid var(--c-top); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.chip { align-self: flex-start; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--c); background: var(--c-bg); border-radius: 6px; padding: 3px 8px; }
.card h2, .card h3 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 800; line-height: 1.15; }
.card p { margin: 0; font-size: 15px; color: var(--muted); }
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-row { display: flex; justify-content: space-between; font-size: 14px; font-variant-numeric: tabular-nums; }
.bar { height: 8px; background: #ECE7FA; border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c); border-radius: 999px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn-main { flex: 1; }
.grid .card .actions .btn { white-space: nowrap; padding-inline: 12px; }
.grid .card .actions .btn-video { flex: 1 1 auto; }
.empty { color: var(--muted); }

.side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.panel { border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.panel h2 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.panel ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.panel-agent { background: #EDE6FF; border: 2px solid #B9A8F0; }
.panel-sun { background: var(--sun-soft); border: 2px solid #F5B700; }
.panel small { color: var(--muted); display: block; }

/* topic page */
.crumbs { font-size: 15px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs b { color: var(--ink); }
.topic-head { display: flex; flex-wrap: wrap; gap: 24px; align-items: stretch; }
.topic-text { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.topic-text h1 { margin: 0; font-family: var(--display); font-size: clamp(38px, 6vw, 52px); font-weight: 800; line-height: 1; color: var(--c); }
.topic-text p { margin: 0; font-size: 18px; color: var(--muted); max-width: 600px; }
.video-card { flex: 1 1 320px; min-width: 0; text-decoration: none; color: var(--ink); background: #fff; border: 2px solid var(--red); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.video-thumb { aspect-ratio: 16 / 9; max-width: 100%; background: #3B2F7A; border-radius: 12px; position: relative; display: flex; align-items: center; justify-content: center; }
.video-thumb b { position: absolute; left: 16px; top: 12px; font-family: var(--display); font-size: 26px; font-weight: 800; color: #fff; line-height: 1.1; }
.video-thumb .play { width: 64px; height: 64px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; }
.video-thumb .play svg { fill: var(--red); }
.video-card .vrow { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; }
.video-card .vrow span { font-weight: 600; color: var(--muted); font-size: 14px; }
.sheets-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.sheets-head h2 { margin: 0; font-family: var(--display); font-size: 26px; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.sheet-card { padding: 14px; gap: 12px; }
.thumb { position: relative; display: block; width: 100%; aspect-ratio: 210 / 297; padding: 0; border: 1px solid var(--line2); border-radius: 10px; background: #fff; overflow: hidden; cursor: zoom-in; font: inherit; color: inherit; text-align: left; }
.thumb:hover, .thumb:focus-visible { border-color: var(--ink); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.thumb-lines { position: absolute; inset: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; background: #FFF7F0; }
.thumb-lines i { height: 6px; background: var(--line2); border-radius: 2px; display: block; }
.thumb-lines i:first-child { height: 10px; width: 46%; background: var(--ink); }
.thumb-page { position: absolute; top: 0; left: 0; width: 794px; transform-origin: top left; transform: scale(var(--ts, .3)); pointer-events: none; }
.thumb-page .page { width: 794px; box-shadow: none; }
.sheet-card .meta { display: flex; justify-content: space-between; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sheet-card .actions { flex-wrap: wrap; }
.sheet-actions .btn-online { flex: 1 1 100%; }
.sheet-actions .btn-soft { flex: 1 1 0; }
.sheet-actions .btn-print { flex: 0 0 auto; }
.sheet-card .actions .btn { padding-inline: 12px; }
.sheet-card h3 { font-size: 19px; font-family: var(--body); }
.pending { border: 2px dashed #F5B700; background: #FFF9E0; border-radius: 16px; padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 200px; color: var(--muted); }
.pending b { color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; min-height: 44px; }
.switch input { width: 20px; height: 20px; accent-color: var(--ink); }

/* preview overlay */
.preview { position: fixed; inset: 0; z-index: 50; background: rgba(43,35,80,.55); display: flex; flex-direction: column; }
.preview-bar { background: var(--sun); border-bottom: 3px solid var(--ink); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 10px max(16px, env(safe-area-inset-left)); padding-top: calc(10px + env(safe-area-inset-top)); }
.preview-bar strong { font-family: var(--display); font-size: 22px; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.preview-body { flex: 1; overflow: auto; padding: 24px 16px 48px; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.preview-body .page { box-shadow: 0 10px 30px rgba(0,0,0,.25); zoom: var(--z, 1); }

/* ===== the A4 worksheet ===== */
.page { width: 210mm; min-height: 297mm; background: #fff; color: var(--ink); padding: 11mm 14mm 10mm; font-family: var(--sheet); font-size: 12pt; line-height: 1.4; display: flex; flex-direction: column; gap: 3.8mm; }
.ws-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 6mm; background: var(--sun-soft); border: 2px solid #F5B700; border-radius: 14px; padding: 3.5mm 5mm; }
.ws-tag { font-family: var(--body); font-size: 9pt; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--english); }
.ws-head h1 { margin: 0; font-family: var(--display); font-size: 24pt; font-weight: 800; line-height: 1.05; }
.ws-intro { font-size: 10.5pt; color: var(--muted); }
.ws-fields { flex: 0 0 55mm; display: flex; flex-direction: column; gap: 2.6mm; font-size: 10.5pt; }
.pic { display: inline-block; width: .82em; height: .82em; vertical-align: -.1em; margin: 0 .05em; }
/* QR code to the lesson video, beside Date and Score (Name keeps the full width) */
.ws-fields:has(.ws-qr) { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 14mm; column-gap: 2.5mm; }
.ws-fields:has(.ws-qr) .field.name { grid-column: 1 / -1; }
.ws-fields:has(.ws-qr) .field:not(.name) { grid-column: 1; }
.ws-qr { position: absolute; right: 0; bottom: 0; } /* never sets the header's height */
.ws-qr svg { display: block; width: 14mm; height: 14mm; border-radius: 1mm; }
.field { display: flex; gap: 6px; align-items: flex-end; }
.field i { flex: 1; border-bottom: 1.5px solid var(--ink); height: 18px; }
.field.score { font-weight: 700; }
.field.score i { flex: 0 0 12mm; }
.ws-sec { display: flex; flex-direction: column; gap: 1.5mm; }
.ws-sec-h { display: flex; align-items: center; gap: 10px; }
.badge { flex: 0 0 28px; height: 28px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--body), system-ui, sans-serif; font-weight: 800; font-size: 12pt; line-height: 1; }
.ws-sec-h b { flex: 1; font-family: var(--body); font-weight: 800; font-size: 12.5pt; }
.ws-sec-h > span:last-child { font-family: var(--body); font-size: 10.5pt; color: var(--muted); }
.pairs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.6mm 3.6mm; padding-left: 38px; }
.pair { display: flex; align-items: flex-end; gap: 6px; height: 10.5mm; border: 2px solid #C9D6FF; background: #F3F6FF; border-radius: 10px; padding: 0 2.6mm 2mm; }
.pair b { white-space: nowrap; }
.blankline { flex: 1; border-bottom: 1.5px dotted var(--ink); height: 18px; position: relative; }
.ws-list { margin: 0; padding-left: 38px; list-style: none; display: flex; flex-direction: column; }
.num { font-weight: 700; min-width: 22px; display: inline-block; }
.ws-list li { min-height: 8.6mm; display: flex; align-items: flex-end; flex-wrap: wrap; gap: 0 6px; }
.blank { display: inline-block; width: 30mm; border-bottom: 1.5px solid var(--ink); height: 18px; position: relative; }
.opt { border: 1.5px solid var(--science); border-radius: 999px; padding: 0 10px; }
.slash { color: var(--muted); }
.ws-list.fill li { display: block; padding-top: 2.6mm; }
.rewrite li { flex-direction: column; align-items: stretch; min-height: 0; }
.rule { display: block; height: 8.5mm; border-bottom: 1.5px solid var(--ink); position: relative; }
.ws-lines { padding-left: 38px; display: flex; flex-direction: column; }
.ws-lines .rule { height: 10mm; }
.ws-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 4mm; border-top: 1px solid var(--line2); padding-top: 2.6mm; font-family: var(--body); font-size: 9pt; color: var(--muted); }
.ws-foot b { color: var(--ink); }
/* answer key text, shown only with the key switched on */
.ans { display: none; position: absolute; left: 4px; bottom: 1px; font-family: var(--body); font-weight: 800; color: #C8336B; font-size: 11pt; white-space: nowrap; }
.with-key .ans { display: block; }
.with-key .opt.correct { background: #FDE2EC; border-color: #C8336B; font-weight: 700; }
.key-page { gap: 5mm; }
.key-page h2 { margin: 0; font-family: var(--display); font-size: 20pt; }
.key-page ol { margin: 0; padding-left: 7mm; display: flex; flex-direction: column; gap: 2mm; }

.foot { padding-block: 0 32px; color: var(--muted); font-size: 14px; }

/* subscribe + video */
.btn-sub { background: var(--red); color: #fff; box-shadow: 0 4px 0 #9B1C20; }
.panel-sub { background: #FFE4E5; border: 2px solid var(--red); }
.panel-sub .btn-sub { align-self: flex-start; }
.agent-line { margin: 0; font-size: 15px; }
.video-thumb { text-decoration: none; overflow: hidden; }
.video-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-thumb .play { position: relative; box-shadow: 0 4px 14px rgba(0,0,0,.3); }
.video-card .vrow { flex-wrap: wrap; align-items: center; }
.vbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.hits h2 { margin: 0 0 12px; font-family: var(--display); font-size: 24px; }
.sheets-wrap { display: flex; flex-direction: column; gap: 14px; }

/* extra worksheet formats */
.tf-q { flex: 1 1 60%; }
.match { padding-left: 38px; display: flex; flex-direction: column; }
.m-row { display: grid; grid-template-columns: minmax(0, 1fr) 10px 10px minmax(0, 1fr); align-items: center; gap: 0 18mm; min-height: 9mm; }
.m-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ink); }
.m-row .m-dot:nth-of-type(3) { justify-self: end; }
.wordbox { margin-left: 38px; display: flex; flex-wrap: wrap; gap: 2mm 3mm; border: 2px dashed var(--line2); border-radius: 10px; padding: 2.4mm 3mm; }
.wordbox span { border: 1.5px solid var(--maths); background: #F3F6FF; border-radius: 999px; padding: 0 10px; }
.sort { margin-left: 38px; display: grid; gap: 4mm; }
.sort-col { display: flex; flex-direction: column; border: 2px solid var(--line); border-radius: 10px; padding: 2mm 3mm; }
.sort-col b { font-family: var(--body); font-weight: 800; text-align: center; }
.sort-col .rule { height: 8mm; }
.columns { padding-left: 38px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3mm 5mm; }
.col-sum { display: flex; flex-direction: column; align-items: flex-end; font-size: 14pt; letter-spacing: .25em; font-variant-numeric: tabular-nums; border: 2px solid #C9D6FF; background: #F3F6FF; border-radius: 10px; padding: 2mm 5mm 2mm 3mm; }
.col-sum i { font-style: normal; margin-right: 2mm; letter-spacing: 0; }
.col-ans { align-self: stretch; border-top: 2px solid var(--ink); height: 7mm; margin-top: 1mm; }

/* ===== printing ===== */
.print-area { display: none; }
@page { size: A4; margin: 0; }
/* online worksheet */
.online { display: flex; flex-direction: column; gap: 18px; max-width: 900px; width: 100%; margin: 0 auto; }
.ol-head { background: var(--sun-soft); border: 2px solid var(--sun); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.ol-head .ws-tag { font-size: 13px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--c); }
.ol-head h1 { margin: 0; font-family: var(--display); font-size: clamp(28px, 5vw, 40px); line-height: 1.05; }
.ol-head .ws-intro { margin: 0; font-size: 17px; color: var(--muted); }
.ol-name { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 800; margin-top: 6px; }
.ol-name input { font: inherit; font-weight: 400; min-height: 44px; padding: 8px 12px; border: 2px solid var(--line2); border-radius: 10px; flex: 1 1 200px; max-width: 320px; background: #fff; }
.ol-form { display: flex; flex-direction: column; gap: 14px; }
.ol-sec { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 16px 18px; font-family: var(--sheet); font-size: 18px; }
.ol-sec .ws-sec-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-family: var(--body); }
.ol-sec .ws-sec-h b { flex: 1; font-size: 17px; }
.ol-sec .ws-sec-h > span:last-child { font-size: 13px; color: var(--muted); white-space: nowrap; }
.ol-sec .badge { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.ol-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; counter-reset: ol; }
.ol-item { border: 2px solid transparent; border-radius: 12px; padding: 8px 10px; line-height: 2.1; }
.ol-list > .ol-item { counter-increment: ol; }
.ol-list > .ol-item::before { content: counter(ol) ". "; font-weight: 800; color: var(--muted); }
.ol-in { font: inherit; font-size: 18px; min-height: 44px; padding: 6px 10px; border: 2px solid var(--line2); border-bottom-color: var(--ink); border-radius: 8px; background: #FFFDF5; color: var(--ink); max-width: 100%; }
.ol-in:focus { outline: 3px solid var(--sun); border-color: var(--ink); }
.ol-in.inline { width: 9em; margin: 0 4px; }
textarea.ol-in { display: block; width: 100%; resize: vertical; line-height: 1.5; margin-top: 6px; }
select.ol-in { min-width: 9em; }
.ol-block > span { display: block; }
.ol-pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.ol-pair { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: #FAF8FF; }
.ol-pair .ol-in { width: 8em; flex: 1 1 6em; }
.ol-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.ol-col { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; font-size: 22px; line-height: 1.4; background: #FAF8FF; letter-spacing: .12em; }
.ol-col i { font-style: normal; margin-right: 10px; }
.ol-col .ol-in { width: 100%; text-align: right; border-top: 3px solid var(--ink); margin-top: 4px; font-size: 22px; letter-spacing: .12em; }
.ol-opts { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.ol-opt { font: inherit; font-size: 16px; font-weight: 700; min-height: 40px; padding: 4px 14px; border-radius: 999px; border: 2px solid var(--line2); background: #fff; color: var(--ink); cursor: pointer; line-height: 1.2; }
.ol-opt[aria-checked="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.ol-fb { display: block; font-family: var(--body); font-size: 15px; line-height: 1.4; }
.ol-fb:empty { display: none; }
.ol-tag { display: inline-block; font-weight: 800; font-size: 13px; padding: 1px 10px; border-radius: 999px; margin-right: 6px; }
.ol-pair .ol-fb, .ol-col .ol-fb { flex-basis: 100%; text-align: left; letter-spacing: 0; font-size: 14px; }
.is-right { border-color: #3CCB7F; background: #EEFBF3; }
.is-right .ol-tag { background: #15803D; color: #fff; }
.is-wrong { border-color: #E5484D; background: #FFF0F0; }
.is-wrong .ol-tag { background: #C62828; color: #fff; }
.is-wrong .ol-fb b { color: #15803D; }
.is-open { border-color: var(--sun); background: #FFFBEA; }
.is-open .ol-tag { background: var(--ink); color: #fff; }
.is-wrong .ol-opt[aria-checked="true"] { background: #C62828; border-color: #C62828; }
.checked .ol-opt.is-answer { border-color: #15803D; box-shadow: 0 0 0 2px #15803D; }
.is-right .ol-opt[aria-checked="true"] { background: #15803D; border-color: #15803D; }
.checked .ol-opt { cursor: default; }
.ol-bar { display: flex; flex-wrap: wrap; gap: 12px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--ground) 30%); }
.ol-bar .ol-submit { flex: 1 1 240px; font-size: 18px; min-height: 52px; }
.ol-bar .btn:disabled { opacity: .7; cursor: default; }
.ol-result { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; background: #fff; border: 3px solid var(--c); border-radius: 16px; padding: 18px 20px; scroll-margin-top: 16px; }
.ol-result h2 { margin: 0; font-family: var(--display); font-size: 26px; line-height: 1.15; }
.ol-result p { margin: 4px 0 0; color: var(--muted); }
.ol-score { width: 110px; height: 110px; border-radius: 50%; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; gap: 4px; font-family: var(--display); flex: none; }
.ol-score b { font-size: 44px; line-height: 1; }
.ol-score span { font-size: 20px; }
.ol-result > div:last-child { flex: 1 1 260px; }
.ol-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px !important; }
.ol-key { font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 999px; border: 2px solid; }
.ol-key.r { border-color: #3CCB7F; background: #EEFBF3; color: #15803D; }
.ol-key.w { border-color: #E5484D; background: #FFF0F0; color: #C62828; }
.ol-key.o { border-color: var(--sun); background: #FFFBEA; color: var(--ink); }
.ol-after { display: flex; flex-wrap: wrap; gap: 12px; }
.ol-result .ol-after { flex-basis: 100%; }

/* progress */
.top-progress, .top-ask, .top-install { min-height: 44px; white-space: nowrap; }
.top-install[hidden] { display: none; }
.top-ask { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: 0 4px 0 #15102E; }
.top-actions .lbl-short { display: none; }
.top-actions { display: flex; gap: 10px; margin-left: auto; flex: none; }
.topbar-in .search { order: 2; flex: 1 1 260px; }
.topbar-in .grade { order: 3; }
.top-actions { order: 4; }
.topbar-in .grade { display: none; }
@media (max-width: 1100px) {
  .top-ask .lbl-long { display: none; } .top-ask .lbl-short { display: inline; }
  .topbar-in .search { order: 5; flex: 1 1 100%; }
}
@media (max-width: 600px) {
  .top-actions { flex: 1 1 100%; margin-left: 0; }
  .top-actions .btn { flex: 1 1 0; min-width: 0; padding-inline: 6px; font-size: 15px; gap: 6px; }
  .top-actions .lbl-long { display: none; } .top-actions .lbl-short { display: inline; }
  .topbar-in { gap: 10px; }
}
.done-badge { display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 999px; border: 2px solid; }
.done-badge.good, .pg-chip.good { border-color: #3CCB7F; background: #EEFBF3; color: #15803D; }
.done-badge.ok, .pg-chip.ok { border-color: #F5B400; background: #FFF7D6; color: #7A5300; }
.done-badge.low, .pg-chip.low { border-color: #E5484D; background: #FFF0F0; color: #C62828; }
.pg-head { display: flex; flex-direction: column; gap: 12px; }
.pg-head h1 { margin: 0; font-family: var(--display); font-size: clamp(32px, 5vw, 46px); line-height: 1.05; }
.pg-head p { margin: 0; color: var(--muted); max-width: 680px; }
.kids, .pg-kid-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pg-kid-actions .btn { min-height: 40px; padding: 6px 14px; font-size: 15px; box-shadow: none; }
.pg-empty, .pg-weak, .pg-recent, .pg-tools, .pg-subject { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.pg-empty h2, .pg-weak h2, .pg-recent h2, .pg-tools h2, .pg-subject h2 { margin: 0 0 8px; font-family: var(--display); font-size: 24px; line-height: 1.2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pg-empty p, .pg-weak p { margin: 0 0 12px; color: var(--muted); }
.pg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pg-stats .stat { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.pg-weak { border-color: #F5B400; background: #FFFBEA; }
.pg-weak ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pg-weak li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pg-weak li b { flex: 1 1 160px; font-size: 18px; }
.pg-weak li > span { font-weight: 800; color: #C62828; }
.pg-subject .chip { font-size: 13px; }
.pg-rows { display: flex; flex-direction: column; gap: 10px; }
.pg-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(120px, .8fr) minmax(160px, 1.6fr) auto; gap: 10px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.pg-row:first-child { border-top: 0; }
.pg-name a { font-weight: 800; font-size: 18px; color: var(--ink); }
.pg-name small { display: block; color: var(--muted); font-size: 14px; }
.pg-score { display: flex; flex-direction: column; gap: 4px; }
.pg-score b { font-family: var(--display); font-size: 22px; line-height: 1; color: var(--c); }
.pg-sheets { display: flex; flex-wrap: wrap; gap: 6px; }
.pg-chip { font-size: 13px; font-weight: 800; padding: 3px 10px; border-radius: 999px; border: 2px solid; text-decoration: none; white-space: nowrap; }
.pg-next .btn { min-height: 40px; padding: 6px 14px; font-size: 15px; }
.pg-done { font-weight: 800; color: #15803D; }
.pg-recent ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.pg-recent li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.pg-recent li a { color: var(--ink); }
.pg-recent li span { color: var(--muted); font-size: 14px; }
.pg-tools label.btn { cursor: pointer; }
.ol-name select { font: inherit; min-height: 44px; padding: 6px 10px; border: 2px solid var(--line2); border-radius: 10px; background: #fff; }
.ol-name a { font-weight: 800; font-size: 15px; }
@media (max-width: 760px) {
  .pg-row { grid-template-columns: 1fr auto; }
  .pg-sheets { grid-column: 1 / -1; }
  .pg-next { grid-column: 1 / -1; }
}
.report h1 { font-family: var(--display); font-size: 30pt; margin: 2mm 0 0; line-height: 1; }
.report > p { margin: 0; color: var(--muted); font-family: var(--body); }
.rep-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4mm; font-family: var(--body); }
.rep-stats div { border: 1px solid var(--line2); border-radius: 3mm; padding: 3mm; font-size: 10pt; color: var(--muted); }
.rep-stats b { display: block; font-family: var(--display); font-size: 20pt; color: var(--ink); line-height: 1.1; }
table.rep { width: 100%; border-collapse: collapse; font-family: var(--body); font-size: 10pt; }
table.rep th, table.rep td { text-align: left; padding: 2mm 2.4mm; border-bottom: 1px solid var(--line2); vertical-align: top; }
table.rep th { background: #F6F3FF; }

@media (max-width: 360px) {
  .top-actions { gap: 6px; }
  .top-actions .btn { font-size: 13.5px; padding-inline: 4px; gap: 4px; }
  .top-actions .btn svg { width: 15px; height: 15px; }
}
/* parent requests */
.hero-ask, .ask-more { margin: 10px 0 0; font-weight: 700; }
.ask-more { margin: 0; color: var(--muted); }
.rq { display: flex; flex-direction: column; gap: 18px; max-width: 860px; width: 100%; }
.rq-intro h1 { margin: 0 0 6px; font-family: var(--display); font-size: clamp(30px, 5vw, 44px); line-height: 1.05; }
.rq-intro p { margin: 0; color: var(--muted); font-size: 17px; }
.rq-points { margin: 10px 0 0; padding-left: 20px; color: var(--ink); display: flex; flex-direction: column; gap: 4px; }
.rq-form { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.rq-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; }
.rq-form label small { font-weight: 400; color: var(--muted); }
.rq-form input:not([type="radio"]):not([type="file"]), .rq-form select, .rq-form textarea { font: inherit; font-weight: 400; min-height: 46px; padding: 9px 12px; border: 2px solid var(--line2); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; }
.rq-form textarea { resize: vertical; }
.rq-form input:focus, .rq-form select:focus, .rq-form textarea:focus { outline: 3px solid var(--sun); border-color: var(--ink); }
.rq-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.rq-wants { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rq-wants legend { font-weight: 800; margin-bottom: 6px; padding: 0; }
.rq-form .rq-pill { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; padding: 6px 16px; border: 2px solid var(--line2); border-radius: 999px; font-weight: 700; cursor: pointer; }
.rq-pill:has(input:checked) { border-color: var(--ink); background: #ECE7FA; }
.rq-pill input { width: 18px; height: 18px; accent-color: var(--ink); }
.rq-files { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rq-files small { color: var(--muted); }
.rq-files label.btn { flex-direction: row; cursor: pointer; }
.rq-list { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.rq-list li { display: flex; align-items: center; gap: 10px; background: #FAF8FF; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.rq-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rq-list small { color: var(--muted); }
.rq-x { font: inherit; font-size: 14px; font-weight: 800; border: 0; background: none; color: #C62828; cursor: pointer; min-height: 36px; }
.rq-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.rq-error { margin: 0; color: #C62828; font-weight: 800; }
.rq-send { align-self: flex-start; min-width: 200px; font-size: 18px; min-height: 52px; }
.rq-send:disabled { opacity: .75; cursor: progress; }
.rq-done { background: #EEFBF3; border: 3px solid #3CCB7F; border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 16px; }
.rq-done h2 { margin: 0; font-family: var(--display); font-size: 28px; line-height: 1.15; }
.rq-done p { margin: 0; font-size: 17px; }
.rq-ref { color: var(--muted); }
.rq-mine { background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 16px 20px; }
.rq-mine h2 { margin: 0 0 8px; font-family: var(--display); font-size: 22px; }
.rq-mine ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.rq-mine span { color: var(--muted); font-size: 14px; }

/* Phones and tablets: keep cards lined up and the header tidy */
.card > div:not([class]) { flex: 1 1 auto; }
.card > .actions { margin-top: auto; }



@media print {
  body { background: #fff; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .print-area .page { break-after: page; box-shadow: none; zoom: 1; min-height: 296mm; }
  .print-area .page:last-child { break-after: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

/* install the app */
.inst { display: flex; flex-direction: column; gap: 16px; margin: 8px 0 40px; }
.inst-top { display: flex; gap: 18px; align-items: center; }
.inst-top img { border-radius: 20px; border: 3px solid var(--ink); flex: none; }
.inst-top h1 { margin: 0 0 6px; font-family: var(--display); font-size: clamp(26px, 5vw, 36px); line-height: 1.1; }
.inst-top p { margin: 0; color: var(--muted); max-width: 62ch; }
.inst-btn { align-self: flex-start; font-size: 18px; padding: 12px 22px; }
.inst-done { margin: 0; font-weight: 800; color: #15803D; }
.inst-warn { margin: 0; padding: 10px 14px; border-radius: 12px; background: #FFF0F0; border: 2px solid #E5484D; font-weight: 700; }
.inst-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.inst-card { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 14px 18px; }
.inst-card.is-here { border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.inst-card h2 { margin: 0 0 6px; font-family: var(--display); font-size: 20px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inst-card ol { margin: 0; padding-left: 20px; }
.inst-card li { margin: 4px 0; }
.inst-card p { margin: 0 0 10px; color: var(--muted); }
.inst-here { font-family: var(--body); font-size: 12px; font-weight: 800; background: var(--sun); border-radius: 999px; padding: 2px 10px; }
.inst-link { display: flex; gap: 10px; flex-wrap: wrap; }
.inst-link input { flex: 1 1 240px; min-width: 0; font: inherit; padding: 10px 12px; border: 2px solid var(--line2); border-radius: 12px; background: #fff; color: var(--ink); }
.inst-small { margin: 0; font-size: 14px; }
/* four header buttons on narrow phones: text only so all four fit */
@media (max-width: 480px) {
  .top-actions { gap: 6px; }
  .top-actions .btn { font-size: 14px; padding-inline: 4px; gap: 0; }
  .top-actions .btn svg { display: none; }
  .inst-top { flex-direction: column; align-items: flex-start; gap: 12px; }
  .inst-top img { width: 64px; height: 64px; border-radius: 16px; }
}
@media (max-width: 340px) { .top-actions .btn { font-size: 12.5px; padding-inline: 2px; } }
