/* Milestones and play (/ejeler/tapgyr/): only what hubs/hub.css does not give.
   Colours come from hub.css variables only, so dark mode follows. Mobile first
   (320 / 375 px), tap targets 48 px; >= 900 px the checklist sits beside the
   WHO windows and the play cards form a grid. Print keeps only the doctor card. */

/* ---------------------------------------------------------- the child --- */
.ms-who .sect, .ms-browse .sect { margin-top: 18px; }
details.ms-browse { margin-top: 14px; }
details.ms-browse .ms-ages { padding-top: 2px; }
.ms-browse .linkbtn { margin-top: 6px; }
.ms-kids { display: flex; flex-wrap: wrap; gap: 8px; }
.ms-kid { position: relative; flex: 1 1 150px; }
.ms-kid input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ms-kid > span {
  display: flex; flex-direction: column; justify-content: center; min-height: 56px; padding: 8px 14px;
  background: var(--surface); border: 2px solid var(--line); border-radius: 16px; cursor: pointer;
}
.ms-kid b { font-size: 15.5px; line-height: 1.2; overflow-wrap: anywhere; }
.ms-kid small { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; }
.ms-kid input:checked + span { border-color: var(--terracotta); background: var(--sel-bg); }
.ms-kid input:focus-visible + span { outline: 3px solid var(--terracotta); outline-offset: 2px; }
.ms-krow { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 4px; }
.ms-del { margin-top: 8px; }
.ms-del p { margin: 0; font-weight: 700; }

.ms-form .inp { width: 100%; }
.ms-yn { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.ms-yn legend { padding: 0; font-size: 14px; font-weight: 800; color: var(--ink-mid); margin-bottom: 6px; }
.ms-ga { margin-bottom: 6px; }
.ms-gaq { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--ink-mid); }
.ms-ga .fhelp { margin-top: 0; }
.ms-form .small { margin: 12px 0 0; }

/* age chips and play-group chips (toggle buttons, aria-pressed) */
.ms-ages, .ms-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ms-age, .ms-chip {
  min-height: 48px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 800; font-size: 14.5px; cursor: pointer;
}
.ms-age { min-width: 56px; }
/* terracotta-d with solid-ink: 4.7:1 light (white on #B75833), 8:1 dark (#1B1512 on #F09B76) */
.ms-age[aria-pressed="true"], .ms-chip[aria-pressed="true"] { background: var(--terracotta-d); border-color: var(--terracotta-d); color: var(--solid-ink); }
.ms-chips { margin: 12px 0; }

/* --------------------------------------------------------- the result --- */
.ms-agecard { margin-top: 22px; }
.ms-agecard h2.vh { margin-top: 0; overflow-wrap: anywhere; }
.res p.ms-big { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.25; }

/* checklist: one fieldset per CDC domain */
.ms-cl .h2 { margin-bottom: 6px; }
.ms-cl > .small { margin: 0; color: var(--ink-mid); font-size: 14px; }
.ms-cl > .note { margin-top: 10px; }
.ms-dom { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.ms-dom legend {
  padding: 4px 12px; margin-bottom: 8px; border-radius: 999px; font-size: 13px; font-weight: 800;
  letter-spacing: .02em; color: var(--ink); background: var(--tint-t);
}
.ms-dom-l legend { background: var(--tint-o); }
.ms-dom-c legend { background: var(--amber-bg); }
.ms-dom-m legend { background: var(--tint-b); }
.ms-dom .chk { align-items: flex-start; font-weight: 600; line-height: 1.35; }
.ms-dom .chk input { margin-top: 1px; }
.ms-dom .chk input:checked + span { color: var(--ink); }
/* a tick is the mother's note, not a pass: the neutral "selected" look, never green (dossier H1) */
.ms-dom .chk:has(input:checked) { border-color: var(--terracotta); background: var(--sel-bg); }
.ms-plain { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ms-plain li {
  padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  font-size: 15px; line-height: 1.35;
}
.ms-cdc { display: inline-flex; align-items: center; min-height: 48px; margin-top: 6px; font-weight: 800; font-size: 14px; color: var(--terracotta-d); text-underline-offset: 3px; }
.ms-ae p { margin: 10px 0 0; }
.ms-ae .ms-know { font-weight: 800; }
.ms-lost { margin-top: 18px; }
.ms-next { margin-top: 18px; }
.ms-next .ms-dom:first-child { margin-top: 4px; }
.ms-next .ms-plain li { background: var(--band); }

/* WHO windows: one row per movement, a bar from the 1st to the 99th percentile */
.ms-winlist { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ms-win { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.ms-win-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.ms-win-h b { font-size: 15px; }
.ms-range { font-size: 13.5px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ms-bar { width: 100%; height: auto; margin-top: 8px; overflow: visible; }
.ms-track { fill: var(--band); }
.ms-tick { stroke: var(--line); stroke-width: 1.5; }
/* solid fills: the month ticks never show inside a window (WHO: "without internal
   demarcations"). One neutral look for every row: the page cannot know what the
   child does, so no green "open" and no amber "closed" (dossier A7, H3). */
.ms-win-plain, .ms-win-before, .ms-win-in, .ms-win-after { fill: var(--olive); }
.ms-now { stroke: var(--terracotta); stroke-width: 3; stroke-linecap: round; }
.ms-win-s { margin: 6px 0 0; font-size: 14px; color: var(--ink-mid); }
.ms-axisrow { padding: 2px 15px 0; }
.ms-axis { margin-top: 0; }
.ms-axis text { fill: var(--ink-soft); font-size: 12px; font-weight: 700; font-family: inherit; }
.ms-axislab { display: block; text-align: right; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.ms-key { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; color: var(--ink-soft); }
.ms-key-now { display: inline-block; width: 3px; height: 16px; border-radius: 2px; background: var(--terracotta); }
.ms-rule { margin: 14px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--tint-o); font-size: 14.5px; font-weight: 700; color: var(--ink); }
.ms-wins > .small { margin: 0; color: var(--ink-mid); font-size: 14px; }
.ms-wins > .small + .small { margin-top: 6px; }
.ms-defs { margin: 0; }
.ms-defs dt { font-weight: 800; margin-top: 12px; }
.ms-defs dt:first-child { margin-top: 0; }
.ms-defs dd { margin: 2px 0 0; font-size: 14.5px; color: var(--ink-mid); }

/* play and talk */
.ms-play > .small { margin: 0; color: var(--ink-mid); font-size: 14px; }
.ms-pgrid { display: grid; gap: 12px; }
.ms-band h3, .ms-tips h3, .ms-always h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.25; }
.ms-ptgrid { display: grid; gap: 12px; }
.ms-pt { display: flex; gap: 12px; margin-top: 8px; }
.ms-pt b { display: block; font-size: 15px; }
.ms-pt p { margin: 2px 0 0; color: var(--ink-mid); font-size: 15px; }
.ms-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--tint-t); color: var(--terracotta-d); display: grid; place-items: center; }
.ms-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ms-toys { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ms-toys b { font-size: 15px; }
.ms-toys ul, .ms-tips ul, .ms-always ul { margin: 6px 0 0; padding-left: 20px; }
.ms-toys li, .ms-tips li, .ms-always li { margin: 4px 0; font-size: 15px; }
.ms-toys p { margin: 6px 0 0; }
.ms-toys p.small { font-size: 13px; color: var(--ink-soft); }
.ms-toys p.ms-cord { margin-top: 8px; padding: 8px 12px; border-radius: 12px; background: var(--amber-bg); color: var(--amber-ink); font-size: 14px; font-weight: 700; }
.ms-always p { margin: 10px 0 0; font-size: 15px; color: var(--ink-mid); }
.ms-always p.ms-gran { padding: 10px 12px; border-radius: 14px; background: var(--tint-b); color: var(--ink); font-weight: 700; }

/* the doctor card */
.ms-print { margin-top: 26px; }
.ms-pc h4 { margin: 14px 0 4px; font-size: 15.5px; }
.ms-pc-who { margin: 8px 0 0; font-weight: 800; }
.ms-pc .small { margin: 4px 0 0; color: var(--ink-soft); font-size: 13px; }
.ms-pc-doms { display: grid; gap: 4px 24px; }
.ms-pc-dom { margin: 10px 0 2px; font-size: 12.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.ms-pc-list { list-style: none; margin: 0; padding: 0; }
.ms-pc-list li { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px dotted var(--line); font-size: 14px; line-height: 1.35; }
.ms-mark { flex: none; width: 16px; font-weight: 900; color: var(--ink-soft); }
.ms-pc-list li.on .ms-mark { color: var(--ink); }
.ms-pc-ae { margin: 14px 0 0; padding: 10px 12px; border-radius: 14px; background: var(--red-bg); color: var(--red-ink); font-size: 14px; }
.ms-pc-ae b { color: var(--red); }
.ms-pc-q { margin: 4px 0 0; padding-left: 22px; font-size: 14px; }
.ms-pc-q li { margin: 4px 0; }

/* emergency, keep, footer */
.ms-em { margin-top: 26px; }
.ms-checker { display: flex; margin-top: 10px; }
.ms-keep .btn2:disabled { opacity: .45; cursor: default; }
.ms-msg { margin: 10px 0 0; font-weight: 700; color: var(--ink-mid); }
.ms-msg:empty { display: none; }

@media (max-width: 340px) {
  .ms-win { padding: 10px 12px; }
  .ms-axisrow { padding: 2px 13px 0; }
  .ms-age, .ms-chip { padding: 0 12px; font-size: 14px; }
}

/* -------------------------------------------------------- desktop --- */
@media (min-width: 760px) {
  .ms-who, .ms-browse { max-width: 760px; }
  .ms-form { padding: 22px 24px; }
  .ms-pgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .ms-pgrid > .ms-band { grid-row: span 2; }
  .ms-ptgrid { gap: 14px; }
  .ms-pc-doms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ms-pc { padding: 26px 28px; }
}
@media (min-width: 900px) {
  .ms-res.has-wins { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .ms-res.has-wins > * { grid-column: 1 / -1; }
  .ms-res.has-wins > .ms-cl { grid-column: 1; }
  .ms-res.has-wins > .ms-wins { grid-column: 2; }
  .ms-res:not(.has-wins) .ms-cl .ms-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; align-items: start; }
  .ms-res:not(.has-wins) .ms-next .ms-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; align-items: start; }
  .ms-pgrid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .ms-age, .ms-chip, .ms-kid > span { transition: background-color .15s ease, border-color .15s ease; }
}

/* ---------------------------------------------------------- print --- */
@media print {
  #app.ms-printmode > :not(.ms-res), #app.ms-printmode .ms-res > :not(.ms-print) { display: none !important; }
  .ms-print { margin: 0; }
  .ms-pc { border: 0; padding: 0; margin: 0; }
  .ms-pc-doms { grid-template-columns: 1fr 1fr; }
  .ms-pc-list li { border-bottom-color: #bbb; }
  .ms-mark, .ms-pc-list li.on .ms-mark { color: #000; }
  .ms-pc-ae { background: #fff; border: 1px solid #999; color: #000; }
  .ms-pc-ae b { color: #000; }
  .ms-pc-dom, .ms-pc .small { color: #333; }
  .ms-res.has-wins { display: block; }
}
