:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --ink: #2b2d42;
  --muted: #8a8fa3;
  --line: #e7eaf3;
  --done: #37b24d;
  --prog: #f59f00;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 24px 18px 60px; }

/* ---- header ---- */
.top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.top .who { font-size: 26px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.top .who .av { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; color: #fff; }
.switch {
  margin-left: auto; border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 10px 16px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.switch:active { transform: scale(.97); }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.top-actions .switch { margin-left: 0; }

/* ---- kid picker ---- */
.picker-title { text-align: center; font-size: 30px; font-weight: 800; margin: 40px 0 6px; }
.picker-sub { text-align: center; color: var(--muted); margin-bottom: 34px; font-size: 17px; }
.kids { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 560px; margin: 0 auto; }
.kid {
  border: none; border-radius: 26px; padding: 38px 16px; cursor: pointer; color: #fff;
  font-size: 28px; font-weight: 800; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.kid .big { font-size: 64px; line-height: 1; }
.kid:active { transform: scale(.97); }

/* ---- activity grid ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card {
  position: relative;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px;
  cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 2px 8px rgba(20,30,60,.05); transition: transform .06s ease;
}
.card:active { transform: scale(.98); }
.card .row { display: flex; align-items: center; gap: 12px; }
.card .emoji { font-size: 38px; line-height: 1; }
.card .name { font-size: 19px; font-weight: 800; }
.card .subj { color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.card .meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; }

.badge { font-size: 13px; font-weight: 800; padding: 5px 11px; border-radius: 999px; }
.badge.not-started { background: #eef1f7; color: var(--muted); }
.badge.in-progress { background: #fff3bf; color: #b3811a; }
.badge.done { background: #d3f9d8; color: #2b8a3e; }
.count { color: var(--muted); font-size: 13px; font-weight: 700; }
.when { color: var(--muted); font-size: 12px; margin-top: auto; }

.bar { height: 8px; border-radius: 999px; background: #eef1f7; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--prog); }
.bar.full > i { background: var(--done); }

.stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.stats .ok { color: #2b8a3e; }
.stats .no { color: #e03131; }
.stats .practice {
  color: #5f6b7a; background: #fff4e6; border: 1px solid #ffe3bf;
  padding: 3px 9px; border-radius: 999px; font-weight: 700;
}
.reset {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: 16px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.reset:hover { color: #e03131; border-color: #ffc9c9; }
.reset:active { transform: scale(.9); }

.empty { text-align: center; color: var(--muted); padding: 50px 10px; }
.footnote { text-align: center; color: var(--muted); font-size: 12px; margin-top: 36px; }

/* link to the parent dashboard */
.parentlink { display: block; text-align: center; margin: 30px auto 0; color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; }
.parentlink:hover { color: var(--ink); }

/* ---- parent dashboard ---- */
.pk { background: var(--card); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; margin-bottom: 22px; box-shadow: 0 2px 10px rgba(20,30,60,.05); }
.pk-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; color: #fff; }
.pk-av { font-size: 30px; } .pk-name { font-size: 22px; font-weight: 800; }
.pk-sum { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.pk-sum .stat { display: flex; flex-direction: column; }
.pk-sum .stat b { font-size: 22px; } .pk-sum .stat span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.pk-sum .stat b.m { color: #2b8a3e; } .pk-sum .stat b.p { color: #b3811a; } .pk-sum .stat b.s { color: #e03131; }
.pk-week { padding: 11px 20px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 700; color: #1864ab; background: #e7f5ff; }
.pk-focus { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.pk-focus-h { font-size: 16px; font-weight: 800; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.planbtn { margin-left: auto; border: 1px solid #b2e0c6; background: #ebfbf0; color: #2b8a3e; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 800; cursor: pointer; }
.planbtn:active { transform: scale(.97); }
.planbtn.small { margin: 10px 0 0; padding: 5px 12px; }
.planhost { margin-top: 4px; }
.plan { margin-top: 12px; background: #f6fbf7; border: 1px solid #d3f0dd; border-radius: 14px; padding: 12px 14px; }
.plan-h { font-weight: 800; font-size: 13px; color: #2b8a3e; margin-bottom: 8px; }
.plan-row { font-size: 14px; margin: 4px 0; } .plan-row b { color: #5f6b7a; }
.plan-note { color: var(--muted); font-size: 11.5px; margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: flex; flex-direction: column; background: #fff4e6; border: 1px solid #ffe3bf; border-radius: 14px; padding: 8px 13px; min-width: 64px; }
.chip b { font-size: 18px; color: #b3811a; } .chip span { font-size: 11px; color: #8a6d3b; font-weight: 700; }
.pk-none { color: var(--muted); font-size: 14px; }
.pk-acts { padding: 8px 20px 18px; }
.pk-act { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.pk-act:last-child { border-bottom: none; }
.pk-act-top { display: flex; align-items: center; gap: 10px; cursor: default; }
.pk-act-top[role="button"] { cursor: pointer; }
.pk-act-top .emoji { font-size: 22px; } .pk-act-name { font-weight: 800; flex: 1; }
.pk-act-top .chev { color: var(--muted); font-size: 13px; width: 14px; text-align: center; }
.pk-act.open .pk-act-top { color: #1864ab; }
.pk-act-ins { color: #5f6b7a; font-size: 13.5px; margin: 6px 0 0 32px; }
.pk-report { margin: 8px 0 0; }
.pk-report summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.pk-report pre { white-space: pre-wrap; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 12px; color: #3a3f4b; overflow-x: auto; }

/* ---- drill-down ---- */
.pk-detail { margin: 10px 0 4px 32px; }
.trend { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.trend .spark { background: #f6f8fc; border: 1px solid var(--line); border-radius: 8px; }
.trend-l { font-size: 12.5px; font-weight: 700; color: #5f6b7a; }
.dd { margin-bottom: 6px; }
.dd-h { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }
.dd-p { font-size: 13.5px; color: #3a3f4b; }
.dd-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.dd-t th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.dd-t td { padding: 5px 8px; border-bottom: 1px solid #f0f2f8; }
.dd-t td.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; }
.dd-t td.ok { color: #2b8a3e; font-weight: 700; } .dd-t td.no { color: #e03131; font-weight: 700; }
.dd-t tr.rno td.mono { color: #e03131; } .dd-t tr.rok td:last-child { color: #2b8a3e; }
.mini { display: inline-block; width: 46px; height: 7px; border-radius: 999px; background: #eef1f7; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.mini > i { display: block; height: 100%; background: var(--prog); }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: middle; }
.dot.mastered { background: #37b24d; } .dot.practicing { background: #f59f00; } .dot.struggling { background: #e03131; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 8px; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.legend .dot { margin-right: 4px; }
.azgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.azc { border-radius: 10px; padding: 6px 2px; text-align: center; border: 1px solid var(--line); background: #f8fafc; }
.azc b { display: block; font-size: 15px; } .azc span { font-size: 9px; letter-spacing: -1px; color: #b3811a; }
.azc.mastered { background: #ebfbf0; border-color: #b2e0c6; } .azc.mastered span { color: #2b8a3e; }
.azc.practicing { background: #fff8e9; border-color: #ffe3bf; }
.azc.struggling { background: #fff0f0; border-color: #ffc9c9; } .azc.struggling span { color: #e03131; }
.lgrid { display: flex; flex-wrap: wrap; gap: 6px; }
.lcell { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.lcell.mastered { background: #d3f9d8; color: #2b8a3e; } .lcell.practicing { background: #fff3bf; color: #b3811a; } .lcell.struggling { background: #ffe3e3; color: #e03131; }

@media print {
  .switch, .top .who + div, .reset, .planbtn, .chev { display: none !important; }
  .pk, .pk-act { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
  .pk-detail { display: block !important; }
  .pk-report[open] summary { display: none; }
  .pk-report pre { border: none; padding: 4px 0; }
}
