/* Shared styles. Large text and buttons, for children from age 6. */
:root {
  --bg: #141414;
  --fg: #ffffff;
  --muted: #b3b3b3;
  font-size: 20px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, "Segoe UI", Arial, sans-serif;
}
.center {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
}
h1 { font-size: 2.5rem; margin: 0 0 .5rem; }
p { color: var(--muted); }

button { font: inherit; color: inherit; cursor: pointer; }
.link-button { background: none; border: none; color: var(--muted); padding: .5rem 1rem; font-size: 1rem; }
.link-button:hover { color: var(--fg); }

/* Sign-in: profile tiles */
.profiles { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: center; margin-top: 1.5rem; }
.profile { background: none; border: none; display: flex; flex-direction: column; align-items: center; gap: .6rem; color: var(--muted); font-size: 1.3rem; }
.profile img { width: 9rem; height: 9rem; border-radius: .5rem; border: .2rem solid transparent; transition: border-color .15s, transform .15s; }
.profile:hover img, .profile:focus-visible img { border-color: var(--fg); transform: scale(1.05); }
.profile:hover, .profile:focus-visible { color: var(--fg); }

/* Sign-in: PIN keypad */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.overlay[hidden] { display: none; }
.pin-box { text-align: center; }
.pin-box h2 { margin: .4rem 0 0; font-size: 1.6rem; }
.pin-box p { margin: .3rem 0; }
.pin-avatar { width: 5rem; height: 5rem; border-radius: .5rem; }
.pin-dots { display: flex; gap: 1rem; justify-content: center; margin: 1rem 0 .3rem; }
.pin-dots span { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: .15rem solid var(--fg); }
.pin-dots span.full { background: var(--fg); }
.pin-message { min-height: 1.4em; color: #ff8a8a !important; font-size: .95rem; }
.keypad { display: grid; grid-template-columns: repeat(3, 4.2rem); gap: .8rem; justify-content: center; margin: .5rem 0 1rem; }
.key { height: 4.2rem; border-radius: 50%; border: none; background: #333; font-size: 1.6rem; }
.key:active:not(:disabled) { background: #555; }
.key:disabled { opacity: .35; cursor: default; }
.key.blank { visibility: hidden; }
.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* Inside: top bar */
.topbar { position: sticky; top: 0; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; background: #000; }
.who { display: flex; align-items: center; gap: .5rem; font-weight: bold; }
.me-avatar { width: 2.4rem; height: 2.4rem; border-radius: .3rem; }
.menu-wrap { flex: 1; position: relative; display: flex; justify-content: center; }

a { color: inherit; text-decoration: none; }
.who { color: var(--fg); }

/* Top menu: a button that opens a list */
.menu-button { background: #e50914; color: #fff; border: none; border-radius: 1rem; padding: .4rem 1rem; font-size: .95rem; font-weight: bold; white-space: nowrap; }
.menu { position: absolute; top: calc(100% + .6rem); left: 50%; transform: translateX(-50%); width: min(20rem, 92vw); max-height: 70vh; overflow-y: auto; background: #1f1f1f; border-radius: .6rem; box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.6); padding: .4rem; z-index: 10; }
.menu[hidden] { display: none; }
.menu a { display: flex; flex-direction: column; gap: .1rem; padding: .6rem .8rem; border-radius: .4rem; color: var(--fg); }
.menu a:hover { background: #2c2c2c; }
.menu a.current { background: #3a0d10; border-inline-start: .25rem solid #e50914; }
.menu-title { font-weight: bold; text-align: right; }
.menu-sub { color: var(--muted); font-size: .8rem; margin: 0; }

/* Home: exercise cards */
.page { max-width: 46rem; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.page h1 { font-size: 1.8rem; }
.cards { display: grid; gap: 1rem; margin-top: 1rem; }
.card { display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.2rem; border-radius: .6rem; background: #262626; border: .15rem solid transparent; }
.card:hover { border-color: #e50914; }
.card-subject { color: var(--muted); font-size: .85rem; margin: 0; }
.card-title { font-size: 1.3rem; text-align: right; }
.card-status { color: #ffd166; font-size: .9rem; }

/* Exercise sheet: light, like paper, for easy reading */
.sheet { background: #fdfcf7; color: #1d1d1f; border-radius: .6rem; margin-top: 1rem; }
.sheet h1 { color: #1e3a8a; text-align: right; margin-bottom: .8rem; }
.sheet h2 { font-size: 1.15rem; color: #1e3a8a; border-inline-start: .3rem solid #1e3a8a; padding-inline-start: .6rem; margin: 1.6rem 0 .4rem; }
.sheet .card-subject { color: #666; }
.sheet p { color: #1d1d1f; }
.instructions, .example, .note { color: #555 !important; font-size: .9rem; margin: .2rem 0 .6rem; }
.reference { background: #eef3ff; border-radius: .5rem; padding: .5rem .8rem; }
.reference summary { cursor: pointer; font-weight: bold; color: #1e3a8a; }
.table-wrap { overflow-x: auto; margin-top: .5rem; }
.ref-table { border-collapse: collapse; font-size: .8rem; min-width: 100%; }
.ref-table th, .ref-table td { border: 1px solid #c9d4f0; padding: .3rem .45rem; white-space: nowrap; text-align: center; }
.ref-table th { background: #dfe8ff; }
.items { padding-right: 1.6rem; margin: 0; }
.item { margin: .9rem 0; padding: .4rem .5rem; border-radius: .4rem; }
.item::marker { color: #1e3a8a; font-weight: bold; }
.line { font-size: 1.15rem; line-height: 2.2; text-align: left; }
input.blank, input.line-input { font: inherit; font-size: 1.1rem; border: none; border-bottom: .12rem solid #888; background: #fff; padding: .15rem .3rem; color: #1d1d1f; }
input.blank { width: 4.5rem; text-align: center; }
input.line-input { width: 100%; margin-top: .3rem; border: .1rem solid #bbb; border-radius: .3rem; padding: .45rem .5rem; }
input:focus { outline: .15rem solid #1e3a8a; }
.rewrite-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.prompt { font-weight: bold; font-size: 1.1rem; }
.item > .tag { display: inline-block; margin-top: .2rem; }
.tag { font-size: .75rem; padding: .1rem .5rem; border-radius: .3rem; border: 1px solid; white-space: nowrap; }
.tag-positive { color: #1a7f37; border-color: #a8dcb5; background: #edf9f0; }
.tag-negative { color: #b42318; border-color: #f3b7b2; background: #fff1f0; }
.tag-question { color: #1e40af; border-color: #b6c8f5; background: #eef3ff; }
.tag-negative_question { color: #6b21a8; border-color: #d8b9f3; background: #f7efff; }
.feedback { font-size: .9rem; min-height: 0; margin-top: .25rem; }
.item.right { background: #e8f7ec; }
.item.right .feedback { color: #1a7f37; font-weight: bold; }
.item.wrong { background: #fdecec; }
.item.wrong .feedback { color: #b42318; }
.item.empty { background: #f1f1ef; }
.item.empty .feedback { color: #666; }
.answer { font-weight: bold; text-align: left; margin-top: .15rem; }
.reminder { color: #8a5a00; font-weight: normal; margin-top: .15rem; }
.score { background: #1e3a8a; color: #fff; border-radius: .5rem; padding: .8rem 1rem; font-size: 1.2rem; font-weight: bold; text-align: center; margin-bottom: 1rem; white-space: pre-wrap; }
.primary { display: block; width: 100%; margin-top: 1.5rem; padding: .9rem; font-size: 1.2rem; font-weight: bold; border: none; border-radius: .5rem; background: #e50914; color: #fff; }
.primary:disabled { opacity: .6; }
.primary.top { margin: .8rem 0 0; }
.score-note { font-size: .9rem; font-weight: normal; margin-top: .3rem; }

/* Start over */
.secondary { display: inline-block; border: .1rem solid currentColor; background: none; border-radius: 1.2rem; padding: .3rem .9rem; font-size: .9rem; white-space: nowrap; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; margin-bottom: .2rem; }
.sheet .secondary { color: #1e3a8a; background: #fff; font-size: .8rem; padding: .25rem .8rem; }
.sheet .secondary:active { background: #eef3ff; }
.card-wrap { display: flex; flex-direction: column; gap: .4rem; }
.card-fresh { align-self: flex-start; color: var(--muted); font-size: .8rem; }

/* Word bank */
.bank { display: flex; flex-wrap: wrap; gap: .45rem; padding: .7rem; border: .12rem dashed #1e3a8a; border-radius: .5rem; background: #fff; margin: .4rem 0 1rem; }
.chip { padding: .25rem .7rem; border-radius: 1rem; background: #eef3ff; color: #1e3a8a; font-weight: bold; font-size: 1rem; }
.chip.used { text-decoration: line-through; opacity: .45; }
.story-title { color: #1e3a8a; font-size: 1.05rem; margin: 1rem 0 .2rem; text-align: left; }
.paragraph { color: #1d1d1f; font-size: 1.15rem; line-height: 2.5; text-align: left; margin: 0; }
.gap { display: inline; margin: 0; padding: .15rem .25rem; border-radius: .4rem; }
.gap-number { color: #1e3a8a; font-weight: bold; font-size: .7rem; margin-right: .1rem; }
.gap-input { font: inherit; font-size: 1.05rem; width: 7.5rem; padding: .05rem .3rem; border: none; border-bottom: .12rem solid #1e3a8a; background: #fff; color: #1d1d1f; text-align: center; }
.gap .feedback { display: inline; font-size: .85rem; margin: 0 .2rem; }
.gap .feedback div { display: inline; }
.gap .feedback .answer { margin: 0; }

/* Dictation */
.dict-item { margin: 1.1rem 0; }
.dict-item::marker { color: #1e3a8a; font-weight: bold; }
.dict-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.sheet .play { font-size: 1rem; padding: .35rem 1rem; }
.show-word { color: #555; font-size: .85rem; padding: .2rem .4rem; text-decoration: underline; }
.dict-word { font-weight: bold; font-size: 1.15rem; color: #1e3a8a; }
.dict-fields { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .4rem; }
.field { display: block; padding: .35rem .45rem; border-radius: .4rem; margin: 0; }
.field-label { display: block; font-size: .8rem; color: #555; }
.tag-bonus { color: #8a5a00; border-color: #f3d79b; background: #fff7e0; }
@media (max-width: 26rem) { .dict-fields { grid-template-columns: 1fr; } }

/* Grid layout: short problems side by side (maths) */
.intro { background: #eef3ff; border-inline-start: .3rem solid #1e3a8a; padding: .5rem .7rem; border-radius: .3rem; }
.items.grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .3rem .6rem; }
.items.grid .item { margin: 0; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; border-bottom: 1px dashed #d5dbe8; border-radius: 0; }
.items.grid .num { color: #6b6bd6; font-size: .8rem; font-weight: bold; }
.items.grid .line { font-weight: bold; font-size: 1.15rem; white-space: nowrap; }
input.blank.number { width: 3.2rem; }
.line[dir="rtl"] { text-align: right; font-size: 1.05rem; }
.line[dir="rtl"] input.blank.number { width: 5rem; }
.compact .feedback { font-size: .85rem; margin: 0; }
.compact .feedback .answer { margin: 0; display: inline; }

/* Parent screen */
.parent-link { margin-top: 2.5rem; color: var(--muted); font-size: .85rem; text-decoration: underline; }
.spacer { flex: 1; }
.parent-login { max-width: 20rem; margin: 3rem auto; text-align: center; }
.parent-login input { width: 100%; font: inherit; padding: .7rem; border-radius: .4rem; border: none; margin-top: 1rem; }
.child-box { background: #1f1f1f; border-radius: .6rem; padding: .8rem; margin-bottom: 1rem; }
.child-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.child-head h2 { margin: 0; font-size: 1.3rem; }
.child-count { color: var(--muted); font-size: .85rem; margin-inline-start: auto; }
.muted-line { color: var(--muted); }
.ex-row { display: flex; flex-direction: column; gap: .15rem; width: 100%; text-align: right; background: #2a2a2a; border: none; border-inline-start: .3rem solid #666; border-radius: .4rem; padding: .55rem .7rem; margin-top: .45rem; }
.ex-row.good { border-inline-start-color: #2fb66a; }
.ex-row.ok { border-inline-start-color: #f0b429; }
.ex-row.low { border-inline-start-color: #e5484d; }
.ex-row.not-done { opacity: .65; }
.ex-sub { grid-column: 1 / -1; color: var(--muted); font-size: .75rem; }
.ex-title { font-weight: bold; text-align: right; }
.ex-info { color: #ddd; font-size: .85rem; }
.details-list { padding-inline-start: 1.4rem; margin: 0; }
.details-list .q { font-weight: bold; }

/* Home: new / done tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .6rem 0 .2rem; }
.tabs[hidden] { display: none; }
.tab { display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .7rem .5rem; border-radius: .6rem; border: .15rem solid #333; background: #1f1f1f; color: var(--muted); font-size: 1.05rem; font-weight: bold; }
.tab.active { color: #fff; border-color: #e50914; background: #2a1012; }
.tab-count { min-width: 1.7rem; padding: .05rem .45rem; border-radius: 1rem; background: #444; color: #fff; font-size: .95rem; }
.tab-new .tab-count { background: #e50914; }
.tab-done .tab-count { background: #2fb66a; }
.card-new { border-color: #e50914; }
.card-new .card-status { color: #ff6b72; font-weight: bold; }
.empty-group { color: var(--muted); text-align: center; margin: 1.5rem 0; }
.menu-group { color: var(--muted); font-size: .8rem; font-weight: bold; padding: .5rem .8rem .2rem; }

/* Multiple choice and short answers */
.question { font-weight: bold; font-size: 1.05rem; margin-bottom: .4rem; }
.options { display: grid; gap: .4rem; }
.option { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: .12rem solid #c9d4f0; border-radius: .5rem; background: #fff; cursor: pointer; }
.option input { width: 1.2rem; height: 1.2rem; accent-color: #1e3a8a; flex-shrink: 0; }
.option:has(input:checked) { border-color: #1e3a8a; background: #eef3ff; }

/* Picture game */
.tap-game { background: #fff; border-radius: .6rem; padding: .6rem; border: .12rem solid #c9d4f0; }
.tap-chips { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; margin-bottom: .5rem; }
.tap-chip { min-width: 2.3rem; height: 2.3rem; border-radius: 50%; border: .15rem solid #c9d4f0; background: #f3f6ff; color: #1e3a8a; font-weight: bold; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; margin: 0; }
.tap-chip.answered { background: #1e3a8a; color: #fff; }
.tap-chip.current { outline: .2rem solid #e50914; outline-offset: .1rem; }
.tap-chip.right { background: #2fb66a; color: #fff; border-color: #2fb66a; }
.tap-chip.wrong { background: #e5484d; color: #fff; border-color: #e5484d; border-radius: .6rem; height: auto; padding: .15rem .4rem; }
.tap-chip.empty { background: #ddd; color: #555; }
.tap-chip .feedback { font-size: .7rem; line-height: 1.1; color: inherit !important; }
.tap-chip .feedback .answer { color: inherit; }
.tap-bar { display: flex; align-items: center; justify-content: center; gap: .8rem; }
.tap-play { width: auto !important; margin: 0 !important; padding: .6rem 1.4rem !important; }
.tap-where { margin: 0; color: #555 !important; }
.tap-picture-box { max-width: 24rem; margin: .4rem auto 0; }
.tap-picture-box svg { width: 100%; height: auto; display: block; }
.tap-picture-box [data-part]:hover { filter: brightness(1.08); }
.read-aloud { font-size: 1.1rem; padding: 0 .3rem; }
.tap-picture-box .chosen, .tap-picture-box .chosen * { stroke: #ffb703 !important; stroke-width: 6 !important; }
.tap-picture-box .chosen line { stroke-width: 42 !important; }
.tap-hint { text-align: center; margin: .3rem 0 0; font-size: .9rem; color: #555 !important; min-height: 1.3em; }


/* Never wider than the phone screen */
html, body { overflow-x: hidden; }
body.no-scroll { overflow: hidden; }

/* Parent overview: one folded box per child */
.child-box > summary { list-style: none; cursor: pointer; }
.child-box > summary::-webkit-details-marker { display: none; }
.child-head { display: flex; align-items: center; gap: .6rem; margin: 0; }
.child-head::after { content: "▾"; color: var(--muted); margin-inline-start: .2rem; transition: transform .15s; }
.child-box[open] > .child-head::after { transform: rotate(180deg); }
.child-head .child-name { font-size: 1.3rem; }
.child-count { margin-inline-start: auto; }
.hard-badge { background: #3a1416; color: #ffb4b6; border-radius: 1rem; padding: .05rem .55rem; font-size: .85rem; }
.child-box[open] > .child-head { margin-bottom: .3rem; }
.ex-title { overflow-wrap: anywhere; }
.hard-note { color: #ffb4b6; }

/* One exercise: full screen, sticky header */
.details-screen { position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: #fdfcf7; }
.details-screen[hidden] { display: none; }
.details-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; background: #000; }
.details-top .secondary { color: #fff; flex-shrink: 0; }
.details-titles { min-width: 0; }
.details-titles .card-subject { color: var(--muted); }
.details-titles h2 { margin: 0; font-size: 1.1rem; color: #fff; overflow-wrap: anywhere; }
.details-body { max-width: 40rem; margin: 0 auto; padding: 1rem; border-radius: 0; }
.details-body .score { font-size: 1rem; }
.details-heading { color: #1e3a8a; font-size: 1.1rem; margin: .8rem 0 .1rem; }
.details-note { font-size: .8rem; color: #666 !important; margin: 0 0 .5rem; }
.no-struggles { color: #1a7f37 !important; font-weight: bold; }

/* Folding blocks */
.fold { border: 1px solid #d5dbe8; border-radius: .5rem; margin: .45rem 0; background: #fff; }
.fold > summary { list-style: none; cursor: pointer; padding: .6rem .75rem; display: flex; flex-direction: column; gap: .1rem; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "◂ "; color: #1e3a8a; float: left; }
.fold[open] > summary::before { content: "▾ "; }
.fold[open] > summary { border-bottom: 1px solid #eef0f5; }
.topic-fold { border-inline-start: .3rem solid #2fb66a; }
.topic-fold.open-issue { border-inline-start-color: #e5484d; }
.topic-name { font-weight: bold; }
.topic-count { font-size: .8rem; color: #555; }
.struggle-list { list-style: none; margin: 0; padding: .3rem .6rem .5rem; }
.struggle { padding: .5rem .55rem; border-radius: .4rem; margin: .35rem 0; }
.struggle .q { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-weight: bold; }
.status-tag { font-size: .75rem; white-space: nowrap; }
.struggle.fixed { background: #f4fbf6; }
.struggle.fixed .status-tag { color: #1a7f37; }
.struggle.wrong { background: #fdecec; }
.struggle.wrong .status-tag { color: #b42318; }
.struggle.empty { background: #f1f1ef; }
.struggle.empty .status-tag { color: #666; }
.line-wrong { color: #b42318; font-size: .9rem; margin-top: .15rem; }
.line-right { color: #1a7f37; font-size: .9rem; }
.fold .details-list { padding: .3rem .6rem .5rem 1.6rem; padding-inline-start: 1.8rem; }

/* Home: one folding block per subject */
.subject-fold { margin-top: .9rem; }
.subject-head { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .5rem .2rem; border-bottom: .12rem solid #333; font-size: 1.2rem; font-weight: bold; }
.subject-head::-webkit-details-marker { display: none; }
.subject-head::after { content: "▾"; color: var(--muted); margin-inline-start: auto; transition: transform .15s; }
.subject-fold:not([open]) > .subject-head::after { transform: rotate(90deg); }
.subject-icon { font-size: 1.4rem; }
.subject-count { min-width: 1.6rem; text-align: center; padding: 0 .45rem; border-radius: 1rem; background: #444; font-size: .9rem; }
.subject-fold .cards { margin-top: .6rem; }

/* Switch between the parent screen and the children's screen */
.switch-link { color: #fff; border: .1rem solid #555; border-radius: 1rem; padding: .3rem .8rem; font-size: .9rem; white-space: nowrap; }
.switch-link:hover { border-color: #fff; }
.parent-link { display: inline-block; border: .1rem solid #444; border-radius: 1rem; padding: .35rem .9rem; text-decoration: none !important; }

.child-who { display: flex; flex-direction: column; line-height: 1.2; }
.last-seen { color: var(--muted); font-size: .75rem; font-weight: normal; }
