/* Setup (first run / redo). Owner: Setup, Sparks, FX. Prefix: .su- */

/* ---------- layout (phone): header (back + small ring) / step / button at the bottom ---------- */
[data-screen="setup"].screen { padding-bottom: 0; }
[data-screen="setup"] .su {
  --su-h: calc(100dvh - var(--safe-t) - 18px);
  min-height: var(--su-h);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto 1fr auto;
  align-content: start;
}
[data-screen="setup"] .su-form { display: contents; }
[data-screen="setup"] .su-top { grid-column: 1; grid-row: 1; display: flex; align-items: center; min-height: 52px; }
[data-screen="setup"] .su-art { grid-column: 2; grid-row: 1; display: flex; align-items: center; justify-content: flex-end; min-width: 0; }
[data-screen="setup"] .su-step-host { grid-column: 1 / -1; grid-row: 2; min-width: 0; padding-top: 18px; padding-bottom: 8px; }
[data-screen="setup"] .su-actions { grid-column: 1 / -1; grid-row: 4; }
[data-screen="setup"] .su-top[hidden], [data-screen="setup"] .su-actions[hidden], [data-screen="setup"] .su-actions.is-idle .su-next { display: none; }

/* the ring: one drawing, sized by CSS (small in the corner of a step, large on the welcome);
   it keeps its size on every step, so the header never jumps (it splits live where it is).
   Between the welcome and a step it takes its new place at once and glides there with a transform (setup.js flipRing),
   so the layout around it never animates */
[data-screen="setup"] .su-ring { display: grid; place-items: center; }
[data-screen="setup"] .su-ring > svg { width: 52px; height: 52px; }
[data-screen="setup"] .su-ring > svg.is-lit { animation: su-lit var(--spring-bouncy-dur) var(--spring-bouncy); }
@keyframes su-lit { 0% { transform: scale(0.94); } 100% { transform: none; } }

/* welcome: title top-left, the empty ring in the middle, two buttons at the bottom */
[data-screen="setup"] .su[data-step="0"] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
[data-screen="setup"] .su[data-step="0"] .su-step-host { grid-row: 1; padding-top: 0; display: contents; }
[data-screen="setup"] .su[data-step="0"] .su-art { grid-column: 1; grid-row: 2; justify-content: center; padding: 24px 0 156px; }
[data-screen="setup"] .su[data-step="0"] .su-ring > svg { width: min(240px, 62vw); height: min(240px, 62vw); }
[data-screen="setup"] .su-welcome { display: contents; }
[data-screen="setup"] .su-welcome > .su-h { grid-row: 1; padding-top: 34px; }
[data-screen="setup"] .su-welcome__actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; flex-direction: column; gap: 10px;
  padding: 0 var(--pad) calc(22px + var(--safe-b)); max-width: var(--content-max); margin: 0 auto;
}
[data-screen="setup"] .su-cta { min-height: 54px; font-size: 16px; width: 100%; }

/* finishing: the ring grows a little (a transform from its own edge, so nothing else moves), everything else steps back */
@media (max-width: 899.98px) {
  [data-screen="setup"] .su-art { transform-origin: 100% 50%; transition: transform var(--spring-bouncy-dur) var(--spring-bouncy); }
  [data-screen="setup"] .su.is-done .su-art { transform: scale(1.6); }
  [dir="rtl"] [data-screen="setup"] .su-art { transform-origin: 0% 50%; }
}
[data-screen="setup"] .su.is-done .su-step-host, [data-screen="setup"] .su.is-done .su-actions { opacity: 0.4; transition: opacity 300ms var(--ease-out); }
/* leaving: the whole setup fades out (the ring last), then Today fades in on the spot: opacity only, nothing moves
   (setup.js finish; html.su-arrive lasts for Today's first moment) */
[data-screen="setup"] .su.is-leaving { opacity: 0; transition: opacity 300ms var(--ease-out); }
html.su-arrive #screen[data-screen="today"] { animation: su-arrive 520ms var(--ease-out) both; }
@keyframes su-arrive { from { opacity: 0; } }
/* reduced motion: base.css makes both instant */

/* ---------- titles ---------- */
[data-screen="setup"] .su-h { outline: none; overflow-wrap: break-word; hyphens: manual; margin-bottom: 22px; }
[data-screen="setup"] .su-welcome .su-h { margin-bottom: 0; max-width: 12ch; }

/* step transitions: one short slide (phone: the step under the header; desktop: the whole column) */
@keyframes su-in-fwd { from { opacity: 0; transform: translateX(22px); } }
@keyframes su-in-back { from { opacity: 0; transform: translateX(-22px); } }
@media (max-width: 899.98px) {
  [data-screen="setup"] .su-form.is-fwd .su-step { animation: su-in-fwd 280ms var(--ease-out) both; }
  [data-screen="setup"] .su-form.is-back .su-step { animation: su-in-back 280ms var(--ease-out) both; }
}

/* ---------- back ---------- */
[data-screen="setup"] .su-back {
  width: 44px; height: 44px; margin-left: -10px; border: 0; border-radius: 50%; background: none; color: var(--fg);
  display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
@media (hover: hover) { [data-screen="setup"] .su-back:hover { background: var(--hover); } }
[data-screen="setup"] .su-back:active { transform: scale(0.94); }
[data-screen="setup"] .su-back svg { width: 22px; height: 22px; }

/* ---------- bottom action ---------- */
[data-screen="setup"] .su-actions {
  position: sticky; bottom: 0; z-index: 3; isolation: isolate;
  padding: 20px 0 calc(18px + var(--safe-b));
}
[data-screen="setup"] .su-actions::before {
  content: ''; position: absolute; z-index: -1; inset: 0 calc(-1 * var(--pad, 16px));
  background: linear-gradient(to bottom, rgb(var(--bg-rgb) / 0), rgb(var(--bg-rgb) / 0.85) 45%);
  pointer-events: none;
}
[data-screen="setup"] .su-next { width: 100%; min-height: 54px; font-size: 16px; }
[data-screen="setup"] .su-next, [data-screen="setup"] .su-cta { white-space: nowrap; }
/* v6: no "Enter" chip in the main button (Enter still works) */

/* one short line under a control */
[data-screen="setup"] .su-line { margin-top: 14px; min-height: 20px; color: var(--muted); font-size: 14px; line-height: 1.4; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
[data-screen="setup"] .su-line:empty { visibility: hidden; }
[data-screen="setup"] .su-line.is-warn { color: var(--orange); animation: su-shake 320ms var(--ease-out); }
[data-screen="setup"] .su-err:empty { display: none; }
[data-screen="setup"] .su-err { margin-top: 10px; }
@keyframes su-shake { 20% { transform: translateX(-5px); } 45% { transform: translateX(4px); } 70% { transform: translateX(-2px); } }

/* ---------- man / woman, count calories?, goal: rows with hairlines ---------- */
/* the rows reach 12px past the text on each side, so a hover or focus shape has room around the words;
   the hairlines stay at the text's width */
[data-screen="setup"] .su-opts { position: relative; margin: 0 -12px; }
[data-screen="setup"] .su-opts::before, [data-screen="setup"] .su-opt::after { content: ''; position: absolute; left: 12px; right: 12px; height: 1px; background: var(--line); pointer-events: none; }
[data-screen="setup"] .su-opts::before { top: 0; }
[data-screen="setup"] .su-opt::after { bottom: 0; }
[data-screen="setup"] .su-opt {
  position: relative; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 64px; padding: 12px 14px 12px 12px; border: 0; border-radius: var(--r-s); background: none;
  text-align: left; cursor: pointer; color: var(--fg); font: inherit; -webkit-tap-highlight-color: transparent;
  transition: background var(--dur) var(--ease-out);
}
@media (hover: hover) { [data-screen="setup"] .su-opt:hover { background: var(--hover); } }
[data-screen="setup"] .su-opt:active .su-opt__title { transform: scale(0.985); }
[data-screen="setup"] .su-opt__title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; min-width: 0; overflow-wrap: anywhere; transform-origin: left center; transition: transform var(--dur-fast) var(--ease-out); }
[data-screen="setup"] .su-opt__radio {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--line-strong); color: transparent;
  transition: background var(--dur) var(--ease-out), box-shadow var(--dur), color var(--dur), transform var(--spring-bouncy-dur) var(--spring-bouncy);
}
[data-screen="setup"] .su-opt__radio svg { width: 15px; height: 15px; stroke-width: 2.4; }
[data-screen="setup"] .su-opt[aria-checked="true"] .su-opt__radio { background: var(--accent); box-shadow: none; color: var(--on-accent); transform: scale(1.06); }

/* ---------- Sleep: wake-up (now -> goal) and hours of sleep ---------- */
[data-screen="setup"] .su-block + .su-block { margin-top: 26px; }
[data-screen="setup"] .su-label { margin: 0 0 12px; font-size: 16px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; color: var(--fg); }
[data-screen="setup"] .su-times { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 10px; }
[data-screen="setup"] .su-tfield { min-width: 0; }
[data-screen="setup"] .su-time {
  min-height: 64px; padding: 8px 6px; text-align: center; cursor: pointer;
  font-size: clamp(20px, 6vw, 26px); font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
[data-screen="setup"] .su-time::-webkit-date-and-time-value { text-align: center; }
[data-screen="setup"] .su-time::-webkit-calendar-picker-indicator { display: none; }
[data-screen="setup"] .su-time::-webkit-datetime-edit { padding: 0; margin: 0 auto; flex: 0 0 auto; }
[data-screen="setup"] .su-times__arrow { height: 64px; display: grid; place-items: center; color: var(--faint); }
[data-screen="setup"] .su-times__arrow svg { width: 18px; height: 18px; }
[data-screen="setup"] .su-stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
[data-screen="setup"] .su-round { width: 52px; min-height: 52px; padding: 0; flex: none; }
[data-screen="setup"] .su-round svg { width: 20px; height: 20px; }
[data-screen="setup"] .su-stepper__val { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; text-align: center; min-width: 0; }

/* ---------- habits ---------- */
[data-screen="setup"] .su-chips { display: flex; flex-wrap: wrap; gap: 8px; }
[data-screen="setup"] .su-chip { min-height: 40px; white-space: normal; text-align: left; line-height: 1.25; padding: 8px 14px; max-width: 100%; overflow-wrap: anywhere; transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
[data-screen="setup"] .su-chip svg { stroke-width: 2.2; flex: none; }
[data-screen="setup"] .su-chip[aria-pressed="true"] { animation: su-pop var(--spring-bouncy-dur) var(--spring-bouncy); }
@keyframes su-pop { 0% { transform: scale(0.92); } 100% { transform: none; } }
[data-screen="setup"] .su-custom-row { display: flex; gap: 8px; align-items: center; margin-top: 18px; }
[data-screen="setup"] .su-custom { flex: 1; min-width: 0; }
[data-screen="setup"] .su-add { flex: none; width: 48px; min-height: 48px; padding: 0; }

/* ---------- sections: a small table, two switches per section ("Bottom", "On Today") ---------- */
[data-screen="setup"] .su-sec { --col: clamp(80px, 12vw, 100px); }
[data-screen="setup"] .su-sec__head,
[data-screen="setup"] .su-sec__row { display: grid; grid-template-columns: 24px minmax(0, 1fr) var(--col) var(--col); column-gap: 8px; align-items: center; }
[data-screen="setup"] .su-sec__head { padding-bottom: 8px; align-items: end; }
[data-screen="setup"] .su-sec__head .su-sec__name { grid-column: 1 / 3; }
[data-screen="setup"] .su-sec__col { text-align: center; font-size: 12px; font-weight: 600; line-height: 1.2; letter-spacing: 0.01em; color: var(--muted); text-wrap: balance; overflow-wrap: break-word; hyphens: manual; }
[data-screen="setup"] .su-sec__row { min-height: 54px; padding: 8px 0; border-top: 1px solid var(--line); }
[data-screen="setup"] .su-sec__row:last-child { border-bottom: 1px solid var(--line); }
[data-screen="setup"] .su-sec__icon { display: grid; place-items: center; color: var(--muted); transition: color var(--dur) var(--ease-out); }
[data-screen="setup"] .su-sec__icon svg { width: 22px; height: 22px; }
[data-screen="setup"] .su-sec__title { min-width: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; overflow-wrap: break-word; hyphens: manual; transition: color var(--dur) var(--ease-out); }
[data-screen="setup"] .su-sec__name { min-width: 0; display: flex; flex-direction: column; }
[data-screen="setup"] .su-sec__cell { display: grid; place-items: center; min-width: 0; }
[data-screen="setup"] .su-sec__row.is-off .su-sec__title, [data-screen="setup"] .su-sec__row.is-off .su-sec__icon { color: var(--faint); }
/* two lines are always kept for the note, so the hint (with every scored section off) never moves what is below it */
[data-screen="setup"] .su-sec__note { margin-top: 12px; font-size: 13px; line-height: 1.4; min-height: calc(2 * 1.4em); transition: color var(--dur) var(--ease-out); }
[data-screen="setup"] .su-sec__note.is-hint { color: var(--fg); }

/* ---------- about you ---------- */
[data-screen="setup"] .su-fields { display: flex; flex-direction: column; gap: 18px; }
[data-screen="setup"] .su-field { min-width: 0; }
[data-screen="setup"] .su-field__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; min-height: 34px; margin-bottom: 8px; }
[data-screen="setup"] .su-field__label { font-size: 13px; font-weight: 500; color: var(--muted); min-width: 0; }
[data-screen="setup"] .su-field__head .segmented button { min-height: 30px; padding: 0 12px; font-size: 13px; }
[data-screen="setup"] .su-unit { position: relative; display: block; min-width: 0; }
[data-screen="setup"] .su-num { padding-left: 14px; padding-right: 64px; min-height: 52px; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
[data-screen="setup"] .su-unit__suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; font-weight: 500; color: var(--faint); pointer-events: none; }
[data-screen="setup"] .su-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
[data-screen="setup"] .su-num[aria-invalid="true"] { animation: su-shake 320ms var(--ease-out); }
[data-screen="setup"] .su-msg { margin-top: 6px; font-size: 13px; color: var(--muted); }
[data-screen="setup"] .su-msg:empty { display: none; }
[data-screen="setup"] .su-msg.is-err { color: var(--red); }
[data-screen="setup"] .su-act { margin-top: 22px; }
[data-screen="setup"] .su-act .su-chip { min-height: 38px; }
[data-screen="setup"] .su-act .su-chip[aria-checked="true"] { animation: none; }
/* the result: calories and the three macros, 2 x 2 */
[data-screen="setup"] .su-res { margin-top: 26px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
[data-screen="setup"] .su-res__cell { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); min-width: 0; }
[data-screen="setup"] .su-res__label { font-size: 13px; color: var(--muted); overflow-wrap: break-word; }
[data-screen="setup"] .su-res__val { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
[data-screen="setup"] .su-res__n { font-weight: inherit; }
[data-screen="setup"] .su-res__unit { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
[data-screen="setup"] .su-res.is-empty .su-res__val { color: var(--faint); }

/* ---------- language (welcome) ---------- */
[data-screen="setup"] .su-lang {
  position: relative; display: flex; align-items: center; gap: 10px; align-self: center;
  min-height: 44px; padding: 0 14px; border-radius: 999px; color: var(--muted); cursor: pointer;
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
@media (hover: hover) { [data-screen="setup"] .su-lang:hover { color: var(--fg); background: var(--hover); } }
[data-screen="setup"] .su-lang__icon, [data-screen="setup"] .su-lang__chev { display: grid; place-items: center; pointer-events: none; }
[data-screen="setup"] .su-lang__icon svg { width: 18px; height: 18px; }
[data-screen="setup"] .su-lang__chev svg { width: 14px; height: 14px; }
[data-screen="setup"] .su-lang__name { font-size: 14px; font-weight: 500; }
[data-screen="setup"] .su-lang__select {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
  appearance: none; -webkit-appearance: none; border: 0; font-size: 16px;
}
[data-screen="setup"] .su-lang__select option { color: var(--fg); background: rgb(var(--bg-rgb)); }
[data-screen="setup"] .su-lang:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
[data-screen="setup"] .su-lang__select:focus-visible { outline: none; }

/* ---------- focus rings: inside the element, following its own rounding ---------- */
[data-screen="setup"] .su-back:focus-visible,
[data-screen="setup"] .su-opt:focus-visible,
[data-screen="setup"] .btn:focus-visible,
[data-screen="setup"] .chip:focus-visible,
[data-screen="setup"] .segmented button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
[data-screen="setup"] .su-back:focus-visible { border-radius: 50%; }
[data-screen="setup"] .su-opt:focus-visible { border-radius: var(--r-s); }
[data-screen="setup"] .btn:focus-visible, [data-screen="setup"] .chip:focus-visible, [data-screen="setup"] .segmented button:focus-visible { border-radius: var(--r-pill); }
[data-screen="setup"] .btn--accent:focus-visible, [data-screen="setup"] .chip[aria-pressed="true"]:focus-visible { outline-color: rgb(var(--bg-rgb) / 0.9); outline-offset: -4px; }
[data-screen="setup"] .btn--accent:focus-visible { outline-color: rgb(255 255 255 / 0.92); }
[data-screen="setup"] .input:focus-visible { outline: none; }   /* fields draw their own inset ring */
[data-screen="setup"] .switch input:focus-visible ~ .switch__track { outline: 2px solid var(--accent); outline-offset: -2px; }
[data-screen="setup"] .switch input:checked:focus-visible ~ .switch__track { outline-color: rgb(255 255 255 / 0.85); }

/* ---------- desktop: the ring on the left (with part names), the step on the right, vertically centred ---------- */
@media (min-width: 900px) {
  /* (the screen's top padding, safe area + 18px, comes from base.css; --su-h is the rest of the window) */
  [data-screen="setup"] .su,
  [data-screen="setup"] .su[data-step="0"] {
    grid-template-columns: minmax(0, 1fr) minmax(0, 520px); grid-template-rows: none;
    column-gap: clamp(40px, 6vw, 96px); align-items: start;
  }
  [data-screen="setup"] .su-art,
  [data-screen="setup"] .su[data-step="0"] .su-art {
    grid-column: 1; grid-row: 1; padding: 0; justify-content: center;
    position: sticky; top: 0; height: var(--su-h);
  }
  /* one size on every step, so the ring never jumps; with names around it the drawing is wider than tall */
  [data-screen="setup"] .su-ring { width: 100%; }
  [data-screen="setup"] .su-ring > svg,
  [data-screen="setup"] .su[data-step="0"] .su-ring > svg,
  [data-screen="setup"] .su.is-done .su-ring > svg { width: 320px; height: 320px; max-width: 100%; }
  [data-screen="setup"] .su-ring > svg.su-ring__svg--labels,
  [data-screen="setup"] .su[data-step="0"] .su-ring > svg.su-ring__svg--labels,
  [data-screen="setup"] .su.is-done .su-ring > svg.su-ring__svg--labels { width: 560px; height: auto; aspect-ratio: 4 / 3; }

  /* the whole step is one centred column: back, title, content, button */
  [data-screen="setup"] .su-form,
  [data-screen="setup"] .su[data-step="0"] .su-step-host { display: flex; flex-direction: column; }
  /* every step starts on the same line, so nothing jumps from step to step: the line is where the tallest common step
     (Sections) sits when centred; a short step simply ends higher, a longer one (About you) runs on below */
  [data-screen="setup"] .su-form {
    grid-column: 2; grid-row: 1; min-height: var(--su-h); justify-content: flex-start;
    --su-tall: 740px; --su-top: 32px;
    padding: max(var(--su-top), calc((var(--su-h) - var(--su-tall)) / 2)) 0 32px;
  }
  [data-screen="setup"] .su[data-step="0"] .su-form { justify-content: center; padding-top: 32px; }
  [data-screen="setup"] .su-form.is-fwd { animation: su-in-fwd 280ms var(--ease-out) both; }
  [data-screen="setup"] .su-form.is-back { animation: su-in-back 280ms var(--ease-out) both; }
  [data-screen="setup"] .su-top { min-height: 44px; margin-bottom: 14px; }
  /* every step gets the same room, so short steps share one title line and one button line;
     only the long ones (sections, about you) start higher */
  [data-screen="setup"] .su-step-host,
  [data-screen="setup"] .su[data-step="0"] .su-step-host { padding: 0; min-height: 0; }
  [data-screen="setup"] .su-welcome { display: flex; flex-direction: column; gap: 32px; }
  [data-screen="setup"] .su-welcome > .su-h { padding-top: 0; font-size: 48px; }
  [data-screen="setup"] .su-welcome__actions { position: static; display: grid; grid-template-columns: auto auto; justify-content: start; gap: 12px; padding: 0; margin: 0; max-width: none; }
  [data-screen="setup"] .su-lang { grid-column: 1 / -1; justify-self: start; margin-left: -14px; }
  [data-screen="setup"] .su-cta, [data-screen="setup"] .su-next { width: auto; min-width: 180px; padding: 0 28px; }
  /* the button follows the step; on a short window (a long step runs past the bottom) it stays at the bottom edge,
     as on the phone, so it is always in view */
  [data-screen="setup"] .su-actions { position: sticky; bottom: 0; padding: 28px 0 24px; margin-bottom: -24px; }
  [data-screen="setup"] .su-actions::before {
    inset: 0 -24px;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 24px, #000 calc(100% - 24px), transparent);
    opacity: 0; transition: opacity var(--dur) var(--ease-out);
  }
  [data-screen="setup"] .su-actions.is-stuck::before { opacity: 1; }   /* only while it really sits over the step (setup.js paintStuck) */
  [data-screen="setup"] .su.is-done .su-step-host, [data-screen="setup"] .su.is-done .su-actions { opacity: 0.4; }
  [data-screen="setup"] .su-sec { --col: 100px; }
  /* About you: the result in one row (calories and the three macros), so the step fits a laptop screen */
  [data-screen="setup"] .su-res { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  [data-screen="setup"] .su-res__cell { padding-inline-end: 12px; }   /* the hairline under the row stays unbroken */
  [data-screen="setup"] .su-fields { gap: 12px; }
  [data-screen="setup"] .su-field__head { min-height: 30px; margin-bottom: 6px; }
  [data-screen="setup"] .su-act { margin-top: 18px; }
  [data-screen="setup"] .su-res { margin-top: 20px; }
  [data-screen="setup"] .su-sec__title { font-size: 17px; }
}
/* a short desktop window (a laptop browser, 650-860 px tall): the same layout, tighter, so the tallest steps
   (Sections, About you) still fit with the button in view */
@media (min-width: 900px) and (max-height: 860px) {
  [data-screen="setup"] .su-form { --su-tall: 650px; --su-top: 8px; padding-bottom: 24px; }
  [data-screen="setup"] .su-top { margin-bottom: 4px; }
  [data-screen="setup"] .su-h { margin-bottom: 14px; }
  [data-screen="setup"] .su-sec__row { min-height: 46px; padding: 4px 0; }
  [data-screen="setup"] .su-sec__head { padding-bottom: 6px; }
  [data-screen="setup"] .su-sec__note { margin-top: 8px; }
  /* height and weight side by side (age keeps the whole row): one row of fields less */
  [data-screen="setup"] .su-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; align-items: start; }
  [data-screen="setup"] .su-fields > :first-child { grid-column: 1 / -1; }
  [data-screen="setup"] .su-act { margin-top: 12px; }
  [data-screen="setup"] .su-act .su-field__head { min-height: 0; }
  [data-screen="setup"] .su-res { margin-top: 14px; }
  [data-screen="setup"] .su-res__cell { padding-block: 10px; }
  [data-screen="setup"] .su-actions { padding-top: 20px; }
}
@media (min-width: 900px) and (max-height: 700px) {
  [data-screen="setup"] .su-form { --su-tall: 614px; }
  [data-screen="setup"] .su-sec__row { min-height: 42px; padding: 3px 0; }
}

/* right-to-left languages: the arrows point the way the text reads, the slide comes from the reading side */
[dir="rtl"] [data-screen="setup"] .su-back svg, [dir="rtl"] [data-screen="setup"] .su-times__arrow svg { transform: scaleX(-1); }
[dir="rtl"] [data-screen="setup"] .su-back { margin-left: 0; margin-right: -10px; }
[dir="rtl"] [data-screen="setup"] .su-opt { text-align: right; }
[dir="rtl"] [data-screen="setup"] .su-opt__title { transform-origin: right center; }
[dir="rtl"] [data-screen="setup"] .su-chip { text-align: right; }
[dir="rtl"] [data-screen="setup"] .su-unit__suffix { right: auto; left: 14px; }
[dir="rtl"] [data-screen="setup"] .su-num { padding-left: 64px; padding-right: 14px; }
@keyframes su-in-fwd-rtl { from { opacity: 0; transform: translateX(-22px); } }
@keyframes su-in-back-rtl { from { opacity: 0; transform: translateX(22px); } }
@media (max-width: 899.98px) {
  [dir="rtl"] [data-screen="setup"] .su-form.is-fwd .su-step { animation-name: su-in-fwd-rtl; }
  [dir="rtl"] [data-screen="setup"] .su-form.is-back .su-step { animation-name: su-in-back-rtl; }
}
@media (min-width: 900px) {
  [dir="rtl"] [data-screen="setup"] .su-form.is-fwd { animation-name: su-in-fwd-rtl; }
  [dir="rtl"] [data-screen="setup"] .su-form.is-back { animation-name: su-in-back-rtl; }
  [dir="rtl"] [data-screen="setup"] .su-lang { margin-left: 0; margin-right: -14px; }
}

@media (prefers-reduced-motion: reduce) {
  [data-screen="setup"] .su-ring > svg, [data-screen="setup"] .su-step, [data-screen="setup"] .su-form,
  [data-screen="setup"] .su-chip, [data-screen="setup"] .su-opt__radio, [data-screen="setup"] .su-art { animation: none !important; transition: none !important; }
}
/* 320: narrower switch columns, so section names keep whole words */
@media (max-width: 340px) { [data-screen="setup"] .su-sec { --col: 64px; } [data-screen="setup"] .su-sec__col { font-size: 11px; } }
/* the column names are single words: never split ("Сегодн-я"), a little smaller on a phone */
[data-screen="setup"] .su-sec__col { overflow-wrap: normal; white-space: nowrap; }
@media (max-width: 400px) { [data-screen="setup"] .su-sec__col { font-size: 11px; letter-spacing: -0.01em; } }
@media (max-width: 340px) { [data-screen="setup"] .su-sec__col { font-size: 9.5px; } }
/* a habit typed again: its chip pulses once, and a line under the field says it is there */
[data-screen="setup"] .su-chip.is-flash { animation: su-chip-flash 700ms var(--ease-out); }
@keyframes su-chip-flash { 30% { transform: scale(1.06); box-shadow: 0 0 0 3px rgb(var(--fg-rgb) / 0.35); } }
[data-screen="setup"] .su-custom-hint:empty { display: none; }
[data-screen="setup"] .su-custom-hint { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { [data-screen="setup"] .su-chip.is-flash { animation: none; } }

/* "Skip" beside "Next" on every step (on a one-tap step it stands alone) */
[data-screen="setup"] .su-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
[data-screen="setup"] .su-skip { min-height: 48px; padding: 0 22px; color: var(--muted); }
@media (hover: hover) { [data-screen="setup"] .su-skip:hover { color: var(--fg); } }

/* a large monitor: the start screen grows with it (the title, the buttons, the language and the ring), set by size,
   not by zooming the page (zoom upset the ring's own measuring) */
@media (min-width: 1500px) and (min-height: 800px) {
  body[data-screen="setup"] .screen { max-width: min(1720px, 92vw); }
  [data-screen="setup"] .su { max-width: none; }
  [data-screen="setup"] .su[data-step="0"] .su-welcome .title { font-size: clamp(52px, 3.3vw, 84px); line-height: 1.04; }
  [data-screen="setup"] .su[data-step="0"] .su-cta { min-height: 64px; padding: 0 34px; font-size: 20px; }
  [data-screen="setup"] .su[data-step="0"] .su-lang { font-size: 19px; }
  [data-screen="setup"] .su[data-step="0"] .su-ring > svg.su-ring__svg--labels { width: min(720px, 40vw); }
  [data-screen="setup"] .su, [data-screen="setup"] .su[data-step="0"] { grid-template-columns: minmax(0, 1fr) minmax(0, 720px); }
  [data-screen="setup"] .su-form { font-size: 17px; }
}
@media (min-width: 1900px) and (min-height: 1000px) {
  [data-screen="setup"] .su[data-step="0"] .su-cta { min-height: 72px; font-size: 22px; }
  [data-screen="setup"] .su[data-step="0"] .su-ring > svg.su-ring__svg--labels { width: min(820px, 40vw); }
}
/* and the steps on a large monitor: titles, fields, chips and buttons a size up, to match the start screen */
@media (min-width: 1500px) and (min-height: 800px) {
  [data-screen="setup"] .su-h { font-size: clamp(44px, 2.8vw, 64px); }
  [data-screen="setup"] .su-time { font-size: 30px; min-height: 76px; }
  [data-screen="setup"] .su-tfield > span, [data-screen="setup"] .su-label, [data-screen="setup"] .su-sec__col { font-size: 16px; }
  [data-screen="setup"] .su-line { font-size: 17px; }
  [data-screen="setup"] .su-chip, [data-screen="setup"] .su-opt { font-size: 18px; }
  [data-screen="setup"] .su-next, [data-screen="setup"] .su-skip { min-height: 62px; font-size: 19px; padding: 0 30px; }
  [data-screen="setup"] .su-sec__title { font-size: 18px; }
  [data-screen="setup"] .su-ring > svg.su-ring__svg--labels { width: min(640px, 36vw); }
}

/* v5 setup on a computer: every step has the same layout as the start screen, so pressing Start moves nothing.
   The ring takes the room the window has (a wider screen, a slimmer text column), limited by the height;
   on the start screen the language sits centred right under Start */
@media (min-width: 900px) {
  body[data-screen="setup"] .screen { max-width: min(2300px, 94vw); }
  [data-screen="setup"] .su, [data-screen="setup"] .su[data-step="0"] { grid-template-columns: minmax(0, 1fr) minmax(0, clamp(440px, 36vw, 720px)); }
  [data-screen="setup"] .su .su-ring > svg.su-ring__svg--labels,
  [data-screen="setup"] .su[data-step="0"] .su-ring > svg.su-ring__svg--labels,
  [data-screen="setup"] .su.is-done .su-ring > svg.su-ring__svg--labels { width: min(100%, 118vh, 1100px); }
  [data-screen="setup"] .su[data-step="0"] .su-welcome > .su-h { font-size: clamp(40px, 3.6vw, 84px); }
  [data-screen="setup"] .su[data-step="0"] .su-lang { grid-column: 1; justify-self: center; margin-left: 0; margin-right: 0; }
  [dir="rtl"] [data-screen="setup"] .su[data-step="0"] .su-lang { margin: 0; }
  /* the finished ring already fills its side, so it only grows a little at the end */
  [data-screen="setup"] .su.is-done .su-art { transform: scale(1.15); }
  /* every step sits on the ring's middle line: centred in the window like the ring (a step taller than the window
     starts at the top and runs on below), so the ring and the step always line up */
  [data-screen="setup"] .su-form, [data-screen="setup"] .su[data-step="0"] .su-form { justify-content: center; padding: 32px 0 32px; }
  [data-screen="setup"] .su:not([data-step="0"]) .su-form { padding-bottom: 56px; }   /* the button row ends with a -24px margin (it sticks to the bottom), so 24px more here keeps the step on the middle line */
  /* a little smaller ring, centred in its half */
  [data-screen="setup"] .su .su-ring > svg.su-ring__svg--labels,
  [data-screen="setup"] .su[data-step="0"] .su-ring > svg.su-ring__svg--labels,
  [data-screen="setup"] .su.is-done .su-ring > svg.su-ring__svg--labels { width: min(86%, 100vh, 940px); }
  [data-screen="setup"] .su-ring { justify-items: center; }
}
[data-screen="setup"] .su-chip__check:empty { display: none; }
[data-screen="setup"] .su-chip__check { display: inline-flex; }
[data-screen="setup"] .su-chip { display: inline-flex; align-items: center; gap: 6px; }
