/* MSP - Mobile Screen Protocol (rule 45; administrative/MSP.md), ported from Veekshaa
   veeksha-site/web/css/msp.css (PR 28, e4c466b) onto Akshara's classes.
   In force when html has class "msp": below 600 px, or anywhere Text size is Large or above (js/msp.js).
   Sizes are in rem, so the phone's own font setting and the Text size choice both scale them.
   The tokens below are the only place the MSP sizes are set. */
:root {
  --msp-base: 1.25rem;      /* 20 px body text (MSP 3.1; VKG decision 9.2 may set 22 px) */
  --msp-min: 1.125rem;      /* 18 px: nothing on screen is smaller (3.1) */
  --msp-q: 1.65rem;         /* 26-28 px question titles (3.2) */
  --msp-tap: 3.5rem;        /* 56 px tap targets (4.1) */
  --msp-gap: .75rem;        /* 12 px between tappable items (4.2) */
}

/* The step chrome exists in the form always; it shows only under MSP. */
.msp-chrome { display: none; }
html.msp .msp-chrome { display: block; }
html.msp .msp-top { display: flex; align-items: center; justify-content: space-between; gap: var(--msp-gap); }

html.msp body { font-size: var(--msp-base); line-height: 1.55; }
html.msp { --muted: #4a3a22; }                              /* 7:1 on cream (MSP 6.1) */
@media (prefers-color-scheme: dark) { html.msp:not([data-theme="light"]) { --muted: #e6d6b4; } }
html.msp h1 { font-size: var(--msp-q); }
html.msp h2 { font-size: 1.4rem; }

/* Nothing below 18 px: every class Akshara sets smaller is lifted to the floor. */
html.msp :is(.hint, .opt, .note, .lead, .kid-script, .group-name, .tiles dt, .jc-table th, .jc-table td, .roman,
  .acct-note, .acct-who, .btn-finish, .kid-row .btn, .avatar-out, .group-pick, .btn-big, .btn, .choice span,
  label, legend, .msp-count, .msp-answer-q, .chip, textarea, input, select) {
  font-size: max(var(--msp-min), 1em);
}

/* Every tappable item 56 px or taller (MSP 4.1), 12 px apart (4.2). */
html.msp :is(.btn, .choice, .group-pick, .msp-answer, .avatar, .avatar-out, .strip button, .script-chip) { min-height: var(--msp-tap); }
html.msp :is(input:not([type=radio]):not([type=checkbox]), select, textarea) { min-height: var(--msp-tap); font-size: var(--msp-base); }
html.msp .avatar.avatar-out { height: var(--msp-tap); }
html.msp :is(.row, .choices, .form) { gap: var(--msp-gap); }

/* One column, and long words wrap rather than push the page sideways (MSP 8.1). */
html.msp :is(.choices-3, .choices-2, .tiles) { grid-template-columns: 1fr 1fr; }
html.msp .row { flex-wrap: wrap; }
html.msp .row > * { flex: 1 1 auto; min-width: 0; }
html.msp :is(p, li, td, h1, h2, .card, .acct-who, .kid-name, label) { overflow-wrap: anywhere; }
html.msp .band { flex-wrap: wrap; }
html.msp .jc-table { display: block; overflow-x: auto; max-width: 100%; }

/* ── The step flow (js/msp.js) ── */
.msp-back { min-width: 7rem; }
.msp-count { color: var(--muted); }
.msp-q { font-size: var(--msp-q); line-height: 1.25; margin: 4px 0 8px; outline: none; }
.msp-foot > * + * { margin-top: var(--msp-gap); }
.msp-next { font-size: 1.3rem; min-height: 4rem; }
.msp-mic { margin-top: 8px; }
.msp-review-wrap { display: none; }
html.msp .msp-form.msp-at-review .msp-review-wrap { display: block; }
.msp-answer { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
  margin: 0 0 var(--msp-gap); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.msp-answer-q { color: var(--muted); }
.msp-answer-a { font-size: 1.35rem; overflow-wrap: anywhere; }
.msp-screen-foot { margin-top: 16px; }

/* Under MSP: only the current step's fields; Save (and Remove) only on the review; Next not there. */
html.msp .msp-form .msp-off { display: none !important; }
html.msp .msp-form:not(.msp-at-review) button[type=submit],
html.msp .msp-form:not(.msp-at-review) [data-msp-review] { display: none !important; }
html.msp .msp-form.msp-at-review .msp-next { display: none; }
html.msp .msp-form.msp-at-review .msp-read { display: none; }

/* Text size choices show each size in its own size. */
#textSizeChoices .choice span { line-height: 1.2; }

@media (prefers-reduced-motion: reduce) { html.msp * { transition: none !important; animation: none !important; } }

/* Writing screen: the board keeps its room (VKG 2026-11-01), but its four main buttons are full MSP taps. */
html.msp body.writing .controls .btn-big { min-height: var(--msp-tap); flex-shrink: 0; }
html.msp body.writing .feedback { line-height: 1.15; height: 2.3em; }   /* two lines at 18 px, board room kept */
