/* Jack's Handwriting — the skin.
 *
 * Layered on top of /projects/jack/game.css exactly the way morphology.css is,
 * and for the same reason: game.css is worn by five pages and a theme belongs
 * in a skin. Nothing here changes what any control does.
 *
 * The rule from jack.css still governs: he is seven and reading years ahead,
 * and software that looks like it is for little kids is itself a way of
 * talking down to him. So this is ruled paper and a pencil, not a cartoon.
 * Warm paper, graphite, and one red pencil that is allowed to touch exactly
 * two things — the midline on the sheet, and the score. The belt colour is a
 * custom property set by app.js, so the page changes colour as he climbs and
 * the belt is the only decoration on it.
 */

:root {
  --paper:       #faf7f0;
  --ink:         #2b2b2b;
  --accent:      #c0392b;   /* the red pencil */
  --accent-soft: #f7e7e4;
  --line:        #ddd6c7;
  --rule:        #c9c2b4;
  --muted:       #6f685c;
  --warn:        #9a4a2f;
  --warn-soft:   #f6e3da;
  --belt:        #e8e4d9;   /* overwritten by app.js each render */
  --card:        #fffdf8;
}

body {
  font: 400 17px/1.55 ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
}

.wrap { max-width: 760px; }

/* A pencil line under the masthead, and nothing else. */
.masthead {
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.masthead h1 { font-size: 22px; }
.masthead .sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.masthead .links { display: flex; gap: 16px; align-items: baseline; }
.masthead a { font-size: 14px; color: var(--muted); text-decoration: none; }
.masthead a:hover { color: var(--accent); text-decoration: underline; }

/* ---- the two faces ---- */
body[data-face="kid"] #dad,
body[data-face="dad"] #kid { display: none; }
body[data-face="kid"] #paper { display: none; }

/* ---- Jack's face ---- */
.belt-card {
  display: flex; align-items: center; gap: 18px;
  margin: 24px 0 20px; padding: 18px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.belt-swatch {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 12px;
  background: var(--belt); border: 1px solid rgb(0 0 0 / .22);
  box-shadow: inset 0 -8px 14px rgb(0 0 0 / .12);
}
.belt-eyebrow {
  margin: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.belt-name { margin: 2px 0 0; font-size: 27px; letter-spacing: -.015em; }
.belt-ask { margin: 4px 0 0; font-size: 14px; color: var(--muted); }

.kid-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.stat {
  flex: 1 1 130px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.stat-label {
  display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 4px;
}
.stat b { font-size: 24px; font-variant-numeric: tabular-nums; }
.stars { letter-spacing: .06em; color: var(--muted); }
.stars.gold, .bd-score .stars { color: #c8931f; }
.kid-stats .stars { color: var(--accent); font-size: 22px; }

.big-print {
  width: 100%; min-height: 68px; font-size: 21px; font-weight: 700;
  background: var(--ink); border-radius: 14px;
  box-shadow: 0 3px 0 rgb(0 0 0 / .3);
}
.big-print:hover { filter: none; background: #1b1b1b; }
.big-print:active { transform: translateY(2px); box-shadow: 0 1px 0 rgb(0 0 0 / .3); }

/* ---- charts ---- */
.chart-block { margin: 30px 0 8px; }
.chart-block h3 { margin: 0 0 2px; font-size: 16px; }
.chart-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.chart-sub b { color: var(--ink); font-variant-numeric: tabular-nums; }
.chart {
  display: block; width: 100%; max-width: 420px; height: auto; margin-top: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.chart-empty { margin: 8px 0 0; font-size: 14px; color: var(--muted); }

/* ---- Dad's face ---- */
.dad-top {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: end;
  justify-content: space-between; margin: 22px 0 18px;
}
.level-pick { display: grid; gap: 5px; flex: 1 1 260px; }
.level-pick label,
.file-field span {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
#level-sel {
  min-height: 46px; padding: 8px 10px; font: inherit; font-size: 15px;
  background: var(--card); color: inherit;
  border: 1px solid var(--line); border-radius: 10px;
}
.clock { display: flex; align-items: center; gap: 10px; }
.clock b {
  min-width: 84px; font-size: 30px; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.clock .ghost { min-height: 46px; padding: 10px 16px; font-size: 15px; }

.judge {
  display: grid; gap: 12px; padding: 16px 18px; margin-bottom: 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.file-field { display: grid; gap: 6px; }
.file-field input { font: inherit; font-size: 14px; }
.judge-note { margin: 0; font-size: 14px; color: var(--muted); min-height: 1.3em; }

/* ---- the rubric pad ---- */
.pad h3, .history h3 { margin: 0 0 12px; font-size: 16px; }
.pad-row {
  padding: 13px 0; border-top: 1px solid var(--line);
}
.pad-head { display: flex; align-items: baseline; gap: 9px; }
.pad-head b { font-size: 16px; }
.pad-weight { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* The model's opinion is labelled, never silent. Any tap replaces it. */
.pad-model {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 800;
  color: var(--accent); background: var(--accent-soft);
  padding: 2px 6px; border-radius: 5px;
}
.pad-hint { margin: 3px 0 9px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.pad-buttons { display: flex; gap: 8px; }
.pad-buttons button {
  flex: 1 1 0; min-height: 52px; font: inherit; font-weight: 700; font-size: 18px;
  font-variant-numeric: tabular-nums;
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.pad-buttons button:hover { border-color: var(--accent); }
.pad-buttons button[aria-pressed="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.pad-row:has(.pad-model:not([hidden])) .pad-buttons button[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent);
}

/* ---- the arithmetic ---- */
.breakdown { margin: 20px 0 6px; }
.bd {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden;
}
.bd > div { background: var(--card); padding: 12px 12px 11px; }
.bd span {
  display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.bd b { display: block; font-size: 27px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.bd i { display: block; font-size: 11px; font-style: normal; color: var(--muted); }
.bd-score b { color: var(--accent); }

.promote-note {
  margin: 16px 0 0; font-size: 14px; color: var(--muted);
  padding-left: 12px; border-left: 2px solid var(--line);
}
.save-row { margin: 14px 0 0; }
.save-row .primary { background: var(--ink); flex: 1 1 auto; }
.feedback-line {
  margin: 12px 0 0; padding: 12px 14px; font-size: 15px;
  background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0;
}

/* ---- history ---- */
.history { margin-top: 30px; }
.history table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th {
  text-align: left; font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding: 0 8px 6px 0; border-bottom: 1px solid var(--line);
}
.history td {
  padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.history td:last-child, .history th:last-child { padding-right: 0; text-align: right; }

/* ---- the sheet on screen ---- */
#paper { margin: 30px 0 0; }
.sheet-preview > summary {
  min-height: 46px; display: flex; align-items: center; cursor: pointer;
  font-size: 15px; font-weight: 700; color: var(--muted);
}
.sheet-preview > summary:hover { color: var(--accent); }
#sheet-mount { overflow-x: auto; padding: 12px 0 4px; }

.sheet {
  position: relative;
  width: var(--sheet-w, 192mm);
  height: var(--sheet-h, 254mm);
  padding: 0; margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 18px rgb(43 43 43 / .16);
}
.sheet .bands { display: block; }
.sheet .band { display: block; }
/* Bands past the level's ask still print, faintly, with their own note. */
.sheet .band.extra { opacity: .38; }
.sheet .crop { position: absolute; }
.sheet .crop.tl { top: 0; left: 0; }
.sheet .crop.tr { top: 0; right: 0; }
.sheet .crop.bl { bottom: 0; left: 0; }
.sheet .crop.br { bottom: 0; right: 0; }

@media (max-width: 620px) {
  .bd { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock b { min-width: 68px; font-size: 25px; }
  .pad-buttons button { min-height: 48px; font-size: 16px; }
}

/* ---- print: the sheet, alone, on exactly one page ------------------------
 * Everything on the sheet is a stroked <line> or <path>, never a background,
 * because Chrome throws backgrounds away unless the user ticks "Background
 * graphics" and this has to come out right on a default Cmd-P.
 */
@media print {
  @page { size: letter; margin: 12mm; }
  html, body { background: #fff; margin: 0; padding: 0; }
  .wrap { max-width: none; margin: 0; padding: 0; }
  .masthead, #kid, #dad, .sheet-preview > summary, noscript { display: none !important; }
  #paper { display: block !important; margin: 0; padding: 0; }
  #sheet-mount { overflow: visible; padding: 0; }
  .sheet {
    width: 192mm; height: 254mm; margin: 0; box-shadow: none;
    overflow: hidden; break-inside: avoid; page-break-inside: avoid;
  }
  .sheet .band.extra { opacity: .45; }
}
