/* B&R Playroom: the parent site and each child's page. Ink on paper, like the drawing in the logo
   that the site is built around: dark grey lines and hand-drawn edges on off-white. Grown-ups read
   handwriting (Playwrite FR Trad for titles, Patrick Hand for everything else); wherever a child reads,
   the words are in Andika, the font made for children learning to read. The only colour is the pale
   wash behind each of a child's games, so they can find them by colour as well as by name. */
:root {
  --paper: #FBF8F3;    /* the page */
  --sheet: #FFFEFB;    /* a sheet on the page: the letter, a child's panel, a tile */
  --ink: #3A3734;      /* lines and words */
  --pencil: #6B655E;   /* quieter words */
  --tape: rgba(206, 194, 172, 0.55);
  --red-ink: #A3392C;
  --green-ink: #2F6B3A;
  --wash-meadow: #DCEBD6;
  --wash-magic: #D6E6F1;
  --wash-berry: #F3D9E2;
  --wash-village: #F6E2C8;
  --wash-woods: #D2E9E4;
  --font-title: "Playwrite FR Trad", "Segoe Script", "Apple Chancery", cursive;
  --font-hand: "Patrick Hand", "Segoe Print", "Chalkboard SE", "Comic Sans MS", sans-serif;
  --font-read: "Andika", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  /* hand-drawn edges: the same trick drawn a few different ways, so no two boxes match */
  --edge: 26px 12px 22px 14px / 12px 24px 14px 28px;
  --edge-2: 12px 24px 14px 26px / 26px 14px 24px 12px;
  --edge-btn: 40px 12px 36px 14px / 14px 34px 12px 36px;
  --edge-field: 14px 6px 12px 7px / 6px 12px 7px 14px;
  /* a second line, drawn a little to the side, as a pen does going round twice */
  --twice: 3px 4px 0 -1px var(--paper), 3px 4px 0 1px var(--ink);
  --pressed: 1px 1px 0 -1px var(--paper), 1px 1px 0 1px var(--ink);
  --rule: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 10'%3E%3Cpath d='M0 5C20 2.2 40 2.6 60 5S100 7.6 120 5 160 2.4 180 5 220 7.8 240 5' fill='none' stroke='%233A3734' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  --hatch: repeating-linear-gradient(-45deg, var(--ink) 0 1.5px, transparent 1.5px 6px);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font: 400 1.2rem/1.45 var(--font-hand); font-synthesis: none; }
a { color: var(--ink); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
b, strong { font-weight: 400; }
:focus-visible { outline: 2px dashed var(--ink); outline-offset: 4px; }
h1:focus { outline: none; }
.emo { font-family: var(--font-emoji); font-style: normal; line-height: 1; }
.booting { padding: 48px 16px; text-align: center; color: var(--pencil); font-size: 1.3rem; }
.wrap { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 580px; }
h1, h2, h3 { margin: 0; font-weight: 400; }
/* Playwrite's capitals stand 1.4 times the type size and its tails hang nearly a whole size below
   the line, so it's set smaller than usual, with more room around it, and its lines are balanced */
h1, h2 { font-family: var(--font-title); line-height: 1.9; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 6vw, 2.25rem); margin: 20px 0 30px; }
h2 { font-size: 1.55rem; margin: 0 0 10px; }
h3 { font-size: 1.4rem; line-height: 1.25; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
.hint { color: var(--pencil); font-size: 1.1rem; }
.muted { color: var(--pencil); }

/* ---------- buttons and links ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 8px 22px;
  border: 2px solid var(--ink); border-radius: var(--edge-btn); background: var(--sheet); color: var(--ink);
  font: 400 1.25rem/1.15 var(--font-hand); text-decoration: none; text-align: center; cursor: pointer; box-shadow: var(--twice); }
.btn:active:not(:disabled) { transform: translate(2px, 3px); box-shadow: var(--pressed); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-main { background: var(--ink); color: var(--paper); }
.btn-danger { color: var(--red-ink); border-color: var(--red-ink); box-shadow: none; }
.link { border: 0; background: none; padding: 8px 4px; color: var(--ink); font: 400 1.2rem var(--font-hand); text-decoration: underline;
  text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: pointer; }
.link:disabled { color: var(--pencil); }

/* ---------- the landing page: laid out like the invitation the drawing came from ---------- */
.hero { padding: 34px 0 8px; text-align: center; }
.hero-logo { display: block; width: min(100%, 500px); height: auto; margin: 0 auto 30px; }
.hero-title { max-width: 22em; margin: 0 auto 20px; font-size: clamp(1.7rem, 7.4vw, 2.3rem); line-height: 2.15; }
.lede { max-width: 31ch; margin: 0 auto 28px; font-size: 1.4rem; line-height: 1.4; color: var(--pencil); }
.lede-sm { color: var(--pencil); }
.letter { position: relative; margin: 48px 6px 46px; padding: 30px 24px 18px; background: var(--sheet); border: 2px solid var(--ink);
  border-radius: var(--edge); transform: rotate(-1deg); font-size: 1.35rem; line-height: 1.5; }
.letter::before { content: ""; position: absolute; top: -15px; left: 50%; width: 112px; height: 28px; margin-left: -56px;
  background: var(--tape); transform: rotate(2.5deg); }
.letter .sig { margin: 6px 0 4px; text-align: right; font: 400 1.1rem/2 var(--font-title); }
.promises ul { list-style: none; margin: 0; padding: 0; }
.promises li { position: relative; padding: 0 0 22px 46px; color: var(--pencil); font-size: 1.15rem; }
.promises li::before { content: ""; position: absolute; left: 2px; top: 1px; width: 30px; height: 30px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.2 2.2l2.4 6.2 6.7.7-5.1 4.1 1.9 6.8-6-3.6-6.1 3.4 1.9-6.3-5.3-4.8 6.8-.1L12.6 2.9' fill='none' stroke='%233A3734' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain; }
.promises strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 1.45rem; line-height: 1.2; }
.signin { margin: 30px 0 44px; padding: 24px 22px 26px; background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--edge-2); scroll-margin-top: 16px; }
.si-form { display: grid; gap: 10px; margin-top: 10px; }
.si-form .btn { justify-self: start; }
.si-form label, .field label { font-size: 1.2rem; color: var(--pencil); }
input[type=email], input[type=text], input[type=password], select { width: 100%; min-height: 52px; padding: 8px 14px; border: 2px solid var(--ink); border-radius: var(--edge-field);
  background: var(--sheet); color: var(--ink); font: 400 1.3rem var(--font-hand); }
/* a password, with a button to show what's typed */
.pw { position: relative; }
.pw input { padding-right: 86px; }
.pw-show { position: absolute; top: 50%; right: 8px; min-width: 64px; min-height: 40px; padding: 4px 10px; transform: translateY(-50%);
  border: 0; border-radius: 10px; background: none; color: var(--pencil); font: 400 1.1rem var(--font-hand); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.pw-show:focus-visible { outline: 2px dashed var(--ink); outline-offset: 0; }
select { appearance: none; -webkit-appearance: none; padding-right: 46px;
  background: var(--sheet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9.4l6.2 6.1 5.9-6.3' fill='none' stroke='%233A3734' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center / 22px 22px; }
input:focus-visible, select:focus-visible { outline: 2px dashed var(--ink); outline-offset: 3px; }
input.si-code { max-width: 250px; font-size: 1.7rem; letter-spacing: 0.25em; }
.form-error { margin: 0; min-height: 1.2em; color: var(--red-ink); }
.form-error:empty, .form-note:empty { display: none; }
.form-note { margin: 0; color: var(--green-ink); }
.si-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 10px 0 0; }
.si-new { margin: 4px 0 0; color: var(--pencil); }
.si-new .link { padding-left: 0; }
/* Face ID first, where the device has it; then the password, under a hand-drawn line */
.si-face { display: grid; gap: 10px; margin: 14px 0 6px; }
.si-face .form-error { text-align: center; }
.btn-face { width: 100%; }
.si-or { display: flex; align-items: center; gap: 12px; margin: 6px 0 0; color: var(--pencil); font-size: 1.1rem; }
.si-or::before, .si-or::after { content: ""; flex: 1; height: 10px; background: var(--rule) repeat-x left center / 240px 10px; }
.foot { padding-top: 22px; padding-bottom: 44px; color: var(--pencil); font-size: 1.05rem; background: var(--rule) repeat-x left top / 240px 10px; }

/* ---------- the parent's pages ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 16px;
  background: var(--rule) repeat-x left bottom / 240px 10px; }
.mark { display: block; flex: none; line-height: 0; }
.mark img { display: block; width: auto; height: 38px; }
.bar-back { padding: 8px 0; color: var(--ink); font-size: 1.25rem; text-decoration: none; white-space: nowrap; }
.bar-back::before { content: "‹"; margin-right: 8px; font-size: 1.3em; line-height: 0; }
.bar-end { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-end .link { white-space: nowrap; }
.bar-who { overflow: hidden; max-width: 40vw; color: var(--pencil); font-size: 1.05rem; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) { .bar-who { display: none; } }
.empty { padding: 28px 20px; text-align: center; border: 2px dashed var(--ink); border-radius: var(--edge-2); }
.kid-panel { margin: 0 0 30px; padding: 20px 20px 22px; background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--edge); }
.kid-panel:nth-of-type(even) { border-radius: var(--edge-2); }
.kp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.kp-head h2 { margin: 0; font-size: 1.9rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0 0 18px; }
.facts dt { color: var(--pencil); }
.facts dd { margin: 0; }
@media (max-width: 440px) { .facts { grid-template-columns: 1fr; gap: 0; } .facts dd { margin-bottom: 8px; } }
.kp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.more { margin: 8px 0 52px; }
.offer { margin: 0 0 30px; }
.notice { margin: -12px 0 26px; padding: 12px 16px; border: 2px dashed var(--ink); border-radius: var(--edge-2); }

/* ---------- the parent's account, and approving new accounts ---------- */
.acct { margin-bottom: 26px; }
main > section.acct + section.acct { margin-top: 0; }
.rows { display: grid; gap: 10px; margin: 0 0 14px; padding: 0; list-style: none; }
.rows li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; padding: 10px 14px;
  background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--edge-field); }
.rows li:nth-child(even) { border-radius: 6px 14px 7px 12px / 12px 7px 14px 6px; }
.rows li > span:first-child { display: grid; min-width: 0; }
.rows b { overflow-wrap: anywhere; }
.rows small { color: var(--pencil); font-size: 1.05rem; line-height: 1.3; }
.row-acts { display: flex; flex: none; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.row-acts .btn { min-height: 44px; padding: 6px 18px; }

/* ---------- adding a child, or changing their choices ---------- */
.kid-form { display: grid; gap: 26px; margin-bottom: 34px; }
.field { display: grid; gap: 6px; }
fieldset { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 4px; padding: 0; color: var(--ink); font-size: 1.5rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 440px) { .pair { grid-template-columns: 1fr; } }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.choice { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--sheet);
  border: 2px solid var(--ink); border-radius: var(--edge-field); cursor: pointer; }
.choice:nth-child(even) { border-radius: 6px 14px 7px 12px / 12px 7px 14px 6px; }
.choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.choice:has(input:checked) { box-shadow: var(--twice); }
.choice:has(input:focus-visible) { outline: 2px dashed var(--ink); outline-offset: 4px; }
.choice-icon { font-size: 1.9rem; }
.choice-text { display: grid; }
.choice-text b { font-size: 1.3rem; line-height: 1.2; }
.choice-text small { color: var(--pencil); font-size: 1.05rem; line-height: 1.25; }
.choice::after { content: ""; flex: none; width: 26px; height: 26px; margin-left: auto; border: 2px solid var(--ink); border-radius: 7px 4px 8px 5px / 5px 8px 4px 7px; }
.choice:has(input:checked)::after { background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.6l4.4 4.5L19.3 7' fill='none' stroke='%23FBF8F3' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 20px 20px; }
.choice.is-soon { color: var(--pencil); border-style: dashed; cursor: default; }
.choice.is-soon .choice-icon { opacity: 0.5; }
.choice.is-soon::after { display: none; }
.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.check input { flex: none; width: 24px; height: 24px; margin: 3px 0 0; accent-color: var(--ink); }
.form-end { display: flex; align-items: center; gap: 20px; }
.danger-zone { margin: 8px 0 60px; padding-top: 26px; background: var(--rule) repeat-x left top / 240px 10px; }
.danger-zone h2 { font-size: 1.35rem; }

/* ---------- the report ---------- */
.rep-time, .weekly { margin-bottom: 30px; }
main > section + section { margin-top: 34px; }
.big { margin: 0 0 16px; font-size: clamp(2.1rem, 7vw, 2.6rem); line-height: 1.1; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; margin-bottom: 22px; }
.day { display: grid; justify-items: center; gap: 4px; }
.day-bar { display: flex; align-items: flex-end; width: 100%; max-width: 40px; height: 96px; border-bottom: 2px solid var(--ink); }
.day-bar span { display: block; width: 100%; border: 2px solid var(--ink); border-bottom: 0; border-radius: 8px 6px 0 0 / 6px 8px 0 0; background: var(--hatch); }
.day-n { font-size: 1.15rem; }
.day-label { color: var(--pencil); font-size: 1rem; }
.sec-list { display: grid; gap: 10px; margin: 0 0 12px; padding: 0; list-style: none; }
.sec-list li { display: grid; grid-template-columns: 9.5em 1fr 4em; align-items: center; gap: 12px; }
.sec-n { color: var(--pencil); text-align: right; font-variant-numeric: tabular-nums; }
.meter { display: block; height: 16px; overflow: hidden; border: 2px solid var(--ink); border-radius: 10px 6px 9px 7px / 7px 9px 6px 10px; }
.meter span { display: block; height: 100%; border-right: 2px solid var(--ink); background: var(--hatch); }
.meter span[style="width:0%"] { border-right: 0; }
.paper { padding: 22px 22px 14px; background: var(--sheet); border: 2px solid var(--ink); border-radius: var(--edge-2); }
.report-card ul { margin: 0 0 8px; padding-left: 22px; }
.report-card li { margin-bottom: 6px; }
.report-card .pct { display: block; color: var(--pencil); font-size: 1.05rem; }
.prog { display: grid; gap: 18px; margin: 0; padding: 0; list-style: none; }
.pr-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.pr-n { color: var(--pencil); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pr-sub { margin: 6px 0 0; color: var(--pencil); font-size: 1.05rem; }
.moments { margin: 0 0 12px; padding-left: 22px; color: var(--pencil); }
.moments li { margin-bottom: 4px; }

/* ---------- a child's page: the drawing says hello, and every word is in Andika ---------- */
.kid { min-height: 100vh; padding: 0 16px 44px; font-family: var(--font-read); }
.kid-sky { padding: 26px 0 6px; text-align: center; }
.kid-art { display: block; width: min(340px, 72vw); height: auto; margin: 0 auto 14px; }
.kid-hello { display: inline-flex; align-items: center; justify-content: center; gap: 14px; max-width: 100%; }
.kid-buddy { display: grid; flex: none; place-items: center; width: 62px; height: 62px; font-size: 38px; background: var(--sheet);
  border: 2px solid var(--ink); border-radius: 50% 45% 52% 47% / 47% 53% 45% 50%; }
.kid h1 { margin: 0; font: 700 clamp(2rem, 7vw, 2.8rem)/1.15 var(--font-read); }
.kid-note { max-width: 30ch; margin: 12px auto 0; font: 400 1.35rem/1.45 var(--font-read); }
.kid-row { max-width: 900px; margin: 22px auto 0; }
.kid-row h2 { margin: 0 4px 12px; color: var(--pencil); text-align: center; font: 700 1.3rem/1.3 var(--font-read); }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; }
.tile { --wash: var(--wash-magic); display: grid; align-content: start; justify-items: center; gap: 10px; width: min(190px, calc(50% - 9px)); min-height: 186px; padding: 22px 10px 16px;
  background: var(--sheet); color: var(--ink); border: 2.5px solid var(--ink); border-radius: var(--edge); box-shadow: var(--twice);
  text-align: center; text-decoration: none; transform: rotate(-0.8deg); }
.tile:nth-child(even) { border-radius: var(--edge-2); transform: rotate(0.7deg); }
.tile:nth-child(3n) { transform: rotate(-0.3deg); }
.tile:active { transform: translate(2px, 3px); box-shadow: var(--pressed); }
.tile-icon { display: grid; place-items: center; width: 96px; height: 96px; font-size: 58px; background: var(--wash);
  border-radius: 46% 54% 50% 50% / 54% 46% 54% 46%; }
.tile:nth-child(even) .tile-icon { border-radius: 54% 46% 47% 53% / 46% 54% 46% 54%; }
.tile-name { font: 700 1.4rem/1.15 var(--font-read); }
.tint-meadow { --wash: var(--wash-meadow); }
.tint-village { --wash: var(--wash-village); }
.tint-woods { --wash: var(--wash-woods); }
.tint-magic { --wash: var(--wash-magic); }
.tint-berry { --wash: var(--wash-berry); }
.kid.is-over .tile { opacity: 0.35; pointer-events: none; }
.kid-grown { display: grid; justify-items: center; gap: 10px; max-width: 900px; margin: 40px auto 0; font-family: var(--font-hand); }
.kid-grown-btn { color: var(--pencil); font-size: 1.1rem; }
.gate-q { color: var(--pencil); font-size: 1.2rem; }
.gate-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.gate-input { width: 110px !important; text-align: center; font-size: 1.5rem !important; }
.kid-out { display: grid; align-content: center; justify-items: center; text-align: center; }
.kid-out .kid-sky { padding-bottom: 20px; }

/* ---------- messages ---------- */
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 10; width: max-content; max-width: calc(100% - 32px);
  padding: 12px 20px; background: var(--sheet); color: var(--ink); border: 2px solid var(--ink); border-radius: var(--edge-btn);
  box-shadow: 0 10px 28px rgba(58, 55, 52, 0.22); text-align: center; transform: translate(-50%, calc(100% + 48px)); transition: transform 0.25s ease; }
.toast.is-on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .btn:active, .tile:active { transform: none; }
}
