/* After tja-web: a paper ground, heavy rules, flat blocks of colour, geometric type, no rounded corners.
   Bigger type and bigger targets than tja, because the reader is twelve. */
:root {
  --paper: #edeae1;
  --paper-2: #e2ded3;
  --ink: #1d1c19;
  --dim: #6f6a61;
  --red: #ab5340;
  --blue: #46617a;
  --yellow: #c2a04e;
  --rule: 3px solid var(--ink);
  --pad: clamp(16px, 3vw, 32px);
  /* Not Futura, as tja has it: Futura has no Cyrillic, so the Russian lines fell back to another face.
     Avenir Next is the nearest geometric sans that covers all three; Segoe UI and Roboto do on Windows and Android. */
  --sans: "Avenir Next", "Segoe UI", Roboto, ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15151a;
    --paper-2: #1d1d23;
    --ink: #e9e6dd;
    --dim: #8b867c;
    --red: #cd7357;
    --blue: #7fa6c6;
    --yellow: #cfa955;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.45 var(--sans);
  -webkit-text-size-adjust: 100%;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
header { padding: 12px var(--pad); border-bottom: var(--rule); }
.home { color: inherit; text-decoration: none; font-size: 26px; font-weight: 700; letter-spacing: .02em; }
main { max-width: 760px; margin: 0 auto; padding: var(--pad); }
button, .go { font: inherit; color: inherit; cursor: pointer; }

/* Three languages, one under the other. German leads; the other two are there to lean on. */
.trio p { margin: 0; }
.trio [lang="de"] { font-weight: 700; }
.trio [lang="en"], .trio [lang="ru"] { color: var(--dim); }
.trio p + p { margin-top: .35em; }
.big { font-size: clamp(24px, 5vw, 32px); line-height: 1.25; }

/* Picker */
.pick ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 16px; }
.pick a { display: grid; gap: 12px; padding: 20px; border: var(--rule); background: var(--paper-2); color: inherit; text-decoration: none; font-size: 22px; box-shadow: 6px 6px 0 var(--blue); }
.pick .title { font-size: 24px; }
.pick .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 15px; color: var(--dim); }
.pick .start { justify-self: start; padding: 8px 16px; background: var(--yellow); color: #1d1c19; border: var(--rule); font-weight: 700; }
.pick a:active { transform: translate(3px, 3px); box-shadow: 3px 3px 0 var(--blue); }

/* Intro and the big call-to-action */
.intro .trio { font-size: 21px; }
.go { display: inline-block; margin-top: 28px; padding: 16px 26px; border: var(--rule); background: var(--yellow); color: #1d1c19; font-weight: 700; text-decoration: none; font-size: 20px; }

/* One question */
.progress { display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; color: var(--dim); }
progress { flex: 1; height: 14px; appearance: none; border: 2px solid var(--ink); background: var(--paper-2); }
progress::-webkit-progress-bar { background: var(--paper-2); }
progress::-webkit-progress-value { background: var(--blue); }
progress::-moz-progress-bar { background: var(--blue); }
.item { margin: 28px 0; min-height: 7.5em; font-size: clamp(21px, 4.4vw, 27px); line-height: 1.3; }
.item p + p { font-size: .82em; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.options button:last-child:nth-child(odd) { grid-column: span 2; } /* three answers: the last one spans the row */
.options button { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 14px; padding: 14px 16px; min-height: 96px; border: var(--rule); background: var(--paper-2); text-align: left; }
.options button span[lang] { grid-column: 2; line-height: 1.2; }
.options button span[lang="de"] { font-weight: 700; font-size: 20px; }
.options button span[lang="en"], .options button span[lang="ru"] { color: var(--dim); font-size: 16px; }
.dot { grid-row: span 3; font-size: 34px; color: var(--blue); }
.options button.chosen { background: var(--blue); color: #fff; }
.options button.chosen span, .options button.chosen .dot { color: #fff; }
.text textarea { display: block; width: 100%; padding: 12px; border: var(--rule); border-radius: 0; background: var(--paper-2); color: inherit; font: 18px/1.4 var(--sans); resize: vertical; }
.text .note { margin-top: 10px; font-size: 15px; }
.text .go { margin-top: 18px; }
.back { margin-top: 22px; padding: 10px 0; border: 0; background: none; color: var(--dim); font-size: 17px; }

/* Thank you */
.thanks { text-align: center; position: relative; overflow: hidden; padding-top: 48px; }
.fox { font-size: 110px; line-height: 1; animation: hop 1s ease-in-out infinite alternate; }
@keyframes hop { to { transform: translateY(-18px) rotate(-6deg); } }
.thanks .trio { margin-top: 24px; }
.thanks > :not(.confetti) { position: relative; z-index: 1; } /* confetti falls behind the words */
.confetti { position: absolute; inset: 0; pointer-events: none; display: flex; justify-content: space-around; }
.confetti i { margin-top: -20px; width: 12px; height: 12px; background: var(--red); animation: fall 3.2s linear infinite; }
.confetti i:nth-child(3n) { background: var(--blue); }
.confetti i:nth-child(3n+1) { background: var(--yellow); }
.confetti i:nth-child(odd) { animation-duration: 4.1s; width: 9px; }
/* ponytail: 24 pieces spread by nth-child steps rather than random JS; good enough to look scattered */
.confetti i:nth-child(4n) { animation-delay: -1s; }
.confetti i:nth-child(5n) { animation-delay: -2.2s; }
.confetti i:nth-child(7n) { animation-delay: -.6s; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
@media (prefers-reduced-motion: reduce) { .fox, .confetti i { animation: none; } .confetti { display: none; } }

/* Parents */
.parents h1 { margin: 0 0 8px; font-size: 28px; }
.parents .profile { display: flex; flex-wrap: wrap; gap: 16px; margin: 18px 0 28px; padding: 14px; border: var(--rule); background: var(--paper-2); }
.parents label { display: flex; gap: 8px; align-items: center; }
.parents input, .parents select { font: inherit; padding: 4px 8px; border: 2px solid var(--ink); background: var(--paper); color: inherit; border-radius: 0; }
.parents section { margin: 0 0 32px; border-top: var(--rule); padding-top: 12px; }
.parents table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.parents th, .parents td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--dim); }
.parents .num { text-align: right; }
.parents tr.total td { font-weight: 700; }
.parents .borderline { background: color-mix(in srgb, var(--yellow) 35%, transparent); }
.parents .clinical { background: color-mix(in srgb, var(--red) 35%, transparent); }
.parents .unfinished progress { width: 160px; vertical-align: middle; margin-left: 8px; }
.parents .flag { margin: 0 0 12px; padding: 8px 10px; border-left: 6px solid var(--red); }
.parents .flag.normal { border-left-color: var(--blue); }
.parents .said { margin: 0 0 12px; padding: 8px 12px; border-left: 6px solid var(--blue); background: var(--paper-2); }
.parents .said p { margin: 0; }
.parents .said p:last-child { white-space: pre-wrap; } /* the kid's own line breaks, not the template's */
.parents .delete { margin-top: 10px; padding: 4px 10px; border: 2px solid var(--ink); background: none; font-size: 15px; }
.parents .notes { color: var(--dim); font-size: 16px; }
.parents .notes li + li { margin-top: .4em; }

@media (max-width: 480px) {
  /* Still 2×2, so all four answers stay on screen under a long question. */
  .options { gap: 8px; }
  .options button { min-height: 0; padding: 10px; gap: 2px 8px; }
  .options button span[lang="de"] { font-size: 18px; }
  .options button span[lang="en"], .options button span[lang="ru"] { font-size: 14px; }
  .dot { font-size: 26px; }
  .item { margin: 20px 0; min-height: 0; }
}
