/* goonlab — the parts every page shares (the redesign's design system,
   section by section). Linked by base.html on every page, right after
   goonlab.css and before mobile.css. Phone rules stand in this file's own
   (max-width: 899px) blocks; no rule here depends on the site's frame
   (the tokens stand on :root, no rule is scoped under the header, main or
   a body class), so a page drawn without the frame still gets them.

   Old class names keep working: a part restyles the old class it replaces
   through a selector list here (an alias), so a page nobody rebuilt yet
   looks right at once. The aliases go once no template uses the old name. */

/* ==== 1. Scales ========================================================= */

:root {
  /* 1.1 type: seven steps */
  --text-badge: 0.8125rem;  /* 13 px: marks, tags, the length on a picture */
  --text-fine: 0.875rem;    /* 14 px: real fine print only */
  --text-meta: 0.9375rem;   /* 15 px: facts lines, labels, table cells */
  --text-body: 1rem;        /* 16 px: every sentence */
  --text-h3: 1.0625rem;
  --text-h2: 1.25rem;
  --text-h1: 1.75rem;

  /* 1.2 reading measure: about 70 characters of running text a line. The
     ch unit is the width of a "0", wider than an average letter: 70ch held
     83 to 89 characters a line on the legal pages, 56ch holds about 70. */
  --measure: 56ch;

  /* 1.3 spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  /* 1.4 radius, outline, layers */
  --radius-sm: 6px;
  --radius-pill: 999px;
  --line-strong: #705f86;   /* outlines of controls: 3:1 or more on every ground */
  --layer-dropdown: 40;
  --layer-tip: 45;
  --layer-header: 50;
  --layer-tabbar: 55;
  --layer-consent: 57;
  --layer-drawer: 70;
  --layer-modal: 90;

  /* 1.5 control height */
  --control-h: 2.5rem;
}

@media (max-width: 899px) {
  :root {
    --text-h2: 1.15rem;
    --text-h1: 1.5rem;
    --control-h: 2.75rem;
  }
}

/* ---- 1.1 the old classes raised to their step -------------------------- */

/* figures in monospace are as large as the text around them (before the
   lists below, so .timeline-time.mono still takes its own step) */
.mono { font-size: 1em; }

/* every sentence: 16 px at both widths */
.notice, .message, .job-error, .funscript-help, .funscript-lead, .funscript-status,
.creator-bio, .home-cta p, .helptext, .hint, .errorlist, .form-errors, .estimate-note,
.estimate-warning, .estimate-loud, .estimate-loud strong, .question-inline, .tip-pop,
.choice-text small, .mode-desc, .switch-text small, .toggle-row small, .radio-stack label,
.confirm-row, .auth-sub, .auth-alt, .pack-hint, .refund-hint, .custom-warning,
.comment-more, .comment-empty, .empty-note, .age-lock-box p, .timeline-detail,
.timeline-row, .form-cost, .consent-bar p, .step p, .feature p, .upload-summary,
.order-prompt-full, .profile-line, .music-order li {
  font-size: var(--text-body);
}

/* facts lines, labels, table cells: 15 px. The staff tables (.eco-table,
   .mod-table) keep their own dense sizes. */
.job-meta, .video-meta, .watch-meta, .progress-caption, .job-stat-label, .estimate-label,
.estimate-row, .sub-label, .field-label, .toolbar-item, .result-count, .view-all,
.timeline-time, .timeline-cost, .creator-meta, .order-grid,
:where(.table-wrap > table:not(.eco-table)) th,
:where(.table-wrap > table:not(.eco-table)) td {
  font-size: var(--text-meta);
}
/* the customer tables themselves, so a figure cell (td.mono, 1em) is 15 px */
.table-wrap > table:not(.eco-table) { font-size: var(--text-meta); }

/* real fine print: 14 px, full colour. After the sentence rule on purpose,
   so the agreement line (p.pack-hint.legal-agree) is fine print. */
.auth-note, .footer-note, .footer-credit, .legal-agree, .thumb-pct, .comment-time {
  font-size: var(--text-fine);
}

/* one to three words: 13 px */
.pill, .chip-filter, .tag-chip, .video-duration, .status-dot {
  font-size: var(--text-badge);
}

/* labels are never set in upper case by the style sheet */
.job-stat-label, .estimate-label { text-transform: none; letter-spacing: normal; }

/* headings */
.page-head h1, .prose h1, .auth-panel h1 { font-size: var(--text-h1); }
.section-title, .modal-panel h2, .home-section-head h2 { font-size: var(--text-h2); }

/* ---- 1.2 reading measure: running text stops at 70 characters --------- */

.prose, .note-body, .field-help, .field-error, .page-lead, .modal-body p,
.helptext, .hint, .notice p {
  max-width: var(--measure);
}

/* the owner's letter on the home page keeps the whole width of its box, as he placed it
   (2026-09-23); whether it gets narrower or folded is his decision */
.home-note p { max-width: none; }

/* list marks stay inside the text column on reading pages and in boxes */
:where(.prose, .modal-panel, .notice, .note-body) :where(ul, ol):not([class]),
.publish-rules {
  padding-left: 1.25rem;
}

/* ---- 1.4 the outline of a control can be seen (3:1) --------------------
   border-color only: each control keeps its own border width, radius and
   its hover and focus colours (those rules are more specific). */
.btn-ghost,
.stack-form input, .stack-form select, .stack-form textarea,
.stack-form input[type="file"]::file-selector-button,
.toolbar-search, .toolbar-item select,
.nav-search input, .nav-search button,
#char-search,
.comment-form textarea,
.folder-new input[type="text"], .folder-manage input[type="text"],
.video-manage select,
.folder-chip,
.radio-stack input[type="radio"], .radio-stack input[type="checkbox"] {
  border-color: var(--line-strong);
}
/* a quiet button that is also a dangerous one keeps its red edge */
.btn-danger { border-color: var(--danger); }

/* ---- 1.5 control sizes on a phone ---------------------------------------
   Under 900 px no field makes the phone zoom in when it is tapped, and every
   control can be hit with a thumb: drawn 44 px tall, or (the '?' of a tip
   alone, section 8) given a 44 px area that reaches no other control. The
   rows of chips that mobile.css lays out (.tag-chip, .folder-chip, the
   filter chips) take var(--control-h) there. */
@media (max-width: 899px) {
  /* 16 px or more in every field, whatever the page: a smaller size makes a
     phone zoom in on the tap. The !important is deliberate: page sheets set
     smaller sizes with heavier selectors (.studio-form fields, .toolbar-item
     select, .video-manage select, .folder-new input), and a page that zooms
     in is never a page's choice. */
  :where(body) input:not([type=checkbox]):not([type=radio]):not([type=range]),
  :where(body) select,
  :where(body) textarea {
    font-size: max(16px, 1em) !important;
  }

  /* buttons, drop-downs and fields: 44 px at the least (a button with one
     sign, the folder bar's '+', also 44 px wide). Weightless, so a page
     rule that draws a taller box keeps it. */
  :where(.btn) { min-width: var(--control-h); }
  :where(.btn),
  :where(select),
  :where(textarea),
  :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=image])) {
    min-height: var(--control-h);
  }

  /* the quick lengths of the order form: chips drawn 44 px tall */
  .chip-btn {
    display: inline-flex; align-items: center;
    min-height: 44px;
  }

  /* the ✕ of a picked character: a 44 x 44 box at the chip's end, inside
     the chip, its sign in the middle (the filter chips' ✕: mobile.css) */
  .char-chip { padding-block: 0; padding-right: 0; }
  .char-chip-x {
    display: inline-flex; align-items: center; justify-content: center;
    align-self: stretch; min-width: 44px; min-height: 44px; padding: 0;
  }

  /* SHOW beside a password: a 44 x 44 box inside the field's right end */
  .pw-toggle {
    right: 1px;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 0 0.6rem;
  }

  /* a text link alone on its line ("Forgot your password?", "Log in",
     "View all"): 44 px tall */
  .auth-alt a, .view-all {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; min-width: 44px;
  }
  /* a card's title link: a block 44 px tall, two lines of 22 px, so a short
     title takes two lines' height and a long one still stops after two
     (with a shorter line a third line would show in the 44 px) */
  .video-title { min-height: 44px; line-height: 22px; }
}

/* ---- 1.6 focus, links, motion ------------------------------------------ */

/* the ring of goonlab.css (:focus-visible) reaches every control; a tick
   inside a check row also marks its row */
.check:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* a link inside running text or a notice box is underlined, so it is told
   from the text by its shape as well as its colour (a label too: the
   sign-up tick's Terms and Refund Policy links stand in theirs until the
   sign-up page is rebuilt) */
:where(p, li, td, .note-body, .field-help, label) a:not([class]),
:where(.notice, .notice-warn, .message, .alert-banner, .promo-banner, .note) a:not([class]) {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* text that is not a link does not wear the link colour alone */
.timeline-stage { color: var(--text); font-weight: 700; }
.job-stat-value { color: var(--text); }

/* nothing moves for a customer who asked his system for less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ==== 4. Sliders ======================================================== */

/* A native range, named by its own label, with its value beside it. The
   input is 44 px tall at every width (its track is drawn 6 px, its thumb
   22 px), so a thumb catches it easily. Alias: .slider-row with its range
   and its output, the markup of pages not rebuilt yet. */
.slider, .slider-row { display: flex; align-items: center; gap: var(--space-3); }
.slider-input, .slider-row input[type="range"] {
  flex: 1; min-width: 0; height: 44px; margin: 0;
  background: transparent; accent-color: var(--accent); cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
.slider-input::-webkit-slider-runnable-track,
.slider-row input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: var(--radius-pill); background: var(--line-strong);
}
.slider-input::-moz-range-track,
.slider-row input[type="range"]::-moz-range-track {
  height: 6px; border-radius: var(--radius-pill); background: var(--line-strong);
}
.slider-input::-webkit-slider-thumb,
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -8px;
  border: 2px solid var(--panel); border-radius: 50%; background: var(--accent);
}
.slider-input::-moz-range-thumb,
.slider-row input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; box-sizing: border-box;
  border: 2px solid var(--panel); border-radius: 50%; background: var(--accent);
}
.slider-input:disabled, .slider-row input[type="range"]:disabled { cursor: not-allowed; opacity: 0.5; }
.slider-value, .slider-row output {
  font-family: var(--mono); font-size: var(--text-meta); color: var(--text);
  min-width: 3rem; text-align: right;
}

/* ==== 8. The "?" tip ===================================================== */

/* A short explanation most customers never need, beside a label or a
   heading. Hover or focus shows it; a press holds it open (parts.js ties
   each one to its text and opens and closes it). */
.tip { position: relative; display: inline-flex; align-items: center; vertical-align: middle; }
.tip-btn {
  width: 1.25rem; height: 1.25rem; border-radius: 50%; padding: 0;
  border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--muted);
  font-size: 0.74rem; font-weight: 700; line-height: 1;
  display: grid; place-items: center; cursor: help;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.tip-btn:hover, .tip:focus-within .tip-btn, .tip.is-open .tip-btn {
  border-color: var(--accent); color: var(--accent); background: var(--tint);
}
.tip-pop {
  position: absolute; z-index: var(--layer-tip); top: calc(100% + 9px); left: 50%;
  transform: translateX(-50%) translateY(-4px);
  width: 19rem; max-width: calc(100vw - 2rem);
  background: #241a30; border: 1px solid var(--accent-dim); border-radius: 10px;
  padding: 0.7rem 0.85rem; color: var(--text);
  font-size: var(--text-body); font-weight: 400; line-height: 1.45;
  text-transform: none; letter-spacing: 0; text-align: left; white-space: normal;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.tip-pop::before {
  content: ""; position: absolute; top: -5px; left: 50%;
  width: 8px; height: 8px; background: #241a30;
  border-left: 1px solid var(--accent-dim); border-top: 1px solid var(--accent-dim);
  transform: translateX(-50%) rotate(45deg);
}
.tip:hover .tip-pop, .tip:focus-within .tip-pop, .tip.is-open .tip-pop {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* Escape hides the text even while the button keeps the focus or the
   pointer stays on it (parts.js marks the tip until both have left it).
   Same weight as the rule above and written after it, so it wins. */
.tip.is-dismissed .tip-pop { opacity: 0; visibility: hidden; pointer-events: none; }
/* a mark at the right edge of a panel opens its explanation leftwards */
.tip-left .tip-pop { left: auto; right: 0; transform: translateY(-4px); }
.tip-left .tip-pop::before { left: auto; right: 0.45rem; transform: rotate(45deg); }
.tip-left:hover .tip-pop, .tip-left:focus-within .tip-pop, .tip-left.is-open .tip-pop { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) { .tip-pop { transition: none; } }

@media (max-width: 899px) {
  /* the explanation becomes a sheet above the tab bar and above a page's
     action bar, never clipped */
  .tip-pop, .tip-left .tip-pop {
    position: fixed; left: 1rem; right: 1rem; top: auto; width: auto; max-width: none;
    bottom: calc(var(--tabbar-space, 0px) + 0.8rem + var(--actionbar-space, 0px)); transform: none;
  }
  .tip:hover .tip-pop, .tip:focus-within .tip-pop, .tip.is-open .tip-pop,
  .tip-left:hover .tip-pop, .tip-left:focus-within .tip-pop, .tip-left.is-open .tip-pop { transform: none; }
  .tip-pop::before { display: none; }

  /* 1.5: the circle stays 20 px; the 12 px around it take the tap too. A
     tip stands beside a label or a heading, which are not controls; where
     a control stands closer than 12 px, .tip-tight cuts the area to 4 px.
     A field's label or head has its field 6 to 10 px under it, and a
     switch row has its switch 10 px beside the tip: there the area is cut
     to 4 px without a change to the page (the tips keep their markup). */
  .tip-btn { position: relative; }
  .tip-btn::before { content: ""; position: absolute; inset: -12px; }
  .tip-tight .tip-btn::before, .tip-btn.tip-tight::before,
  .field-label .tip-btn::before, .field-head .tip-btn::before,
  .switch-row .tip-btn::before { inset: -4px; }
}

/* ==== 13. Screen readers ================================================ */

/* read by a screen reader, never drawn */
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

/* ==== S3. Buttons by rank (design-system 2) ============================== */

/* Four ranks on the base .btn. The base keeps the primary look, so the
   pages nobody rebuilt yet keep theirs; .btn-ghost is the secondary rank
   under its old name until no template uses it. */
.btn-primary {
  background: #5b21b6; color: #fff; border: 1px solid #6d28d9;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); font-weight: 700;
}
.btn-primary:hover { background: #6d28d9; border-color: #8b5cf6; }

.btn-secondary, .btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line-strong); box-shadow: none; font-weight: 600;
}
.btn-secondary:hover, .btn-ghost:hover { background: transparent; border-color: #8b5cf6; color: #a78bfa; }

/* the safe way out of a question: no fill, no outline, the same height */
.btn-quiet {
  background: transparent; color: var(--muted);
  border: 1px solid transparent; box-shadow: none; font-weight: 600;
}
.btn-quiet:hover {
  background: transparent; border-color: transparent; color: var(--muted);
  text-decoration: underline; text-underline-offset: 0.15em;
}

/* an act that cannot be undone or that spends without a result */
.btn-danger {
  background: transparent; color: var(--danger);
  border: 1px solid var(--danger); box-shadow: none; font-weight: 600;
}
.btn-danger:hover { background: rgba(227, 123, 123, 0.12); border-color: var(--danger); color: var(--danger); }

/* a greyed button never stands without its reason in sight: under it
   (.btn-wrap), or beside it and under it when the row is too narrow
   (.btn-wrap-inline) */
.btn-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-1); }
.btn-wrap > .btn-block { align-self: stretch; }
.btn-wrap-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.btn-reason { margin: 0; max-width: var(--measure); font-size: var(--text-body); color: var(--muted); }

/* a press that waits for the server: the pressed button turns a sign and
   cannot be pressed again (parts.js); the sign stands still for a customer
   who asked his system for less motion (the rule of 1.6 above) */
.is-busy { cursor: progress; }
.btn.is-busy:disabled { opacity: 1; }
.is-busy::before {
  content: ""; display: inline-block; box-sizing: border-box;
  width: 1em; height: 1em; margin-right: 0.5em; vertical-align: -0.125em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: busy-turn 0.8s linear infinite;
}
@keyframes busy-turn { to { transform: rotate(360deg); } }

/* ==== S4. Notices and messages (design-system 5) ======================== */

/* One notice, four kinds: done (green, a tick), information (pink, an i),
   warning (yellow, !), failure (red, a cross). Each kind is told by its
   colour, its sign and, for a screen reader, a hidden word; the sign is
   never read (its alternative text is empty). */
.notes, .messages { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-5); }
.note {
  --note-tone: var(--accent);
  --note-ground: var(--tint);
  display: flex; align-items: flex-start; gap: var(--space-3);
  border: 1px solid var(--line); border-left: 3px solid var(--note-tone);
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--note-ground), transparent 40%), var(--panel);
  padding: var(--space-3) var(--space-4);
  color: var(--text); font-size: var(--text-body); line-height: 1.6;
}
.note-success { --note-tone: var(--ok); --note-ground: rgba(124, 227, 168, 0.10); }
.note-info { --note-tone: var(--accent); --note-ground: var(--tint); }
.note-warning { --note-tone: var(--warn); --note-ground: rgba(232, 196, 104, 0.10); }
.note-error { --note-tone: var(--danger); --note-ground: rgba(227, 123, 123, 0.12); }
.note-sign {
  flex: none; display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem; margin-top: 0.05rem; border-radius: 50%;
  background: var(--note-tone); color: var(--ground);
  font-weight: 800; line-height: 1;
}
.note-sign::before { content: "i"; content: "i" / ""; }
.note-success .note-sign::before { content: "\2713"; content: "\2713" / ""; }
.note-warning .note-sign::before { content: "!"; content: "!" / ""; }
.note-error .note-sign::before { content: "\2715"; content: "\2715" / ""; }
.note-body { flex: 1 1 auto; min-width: 0; }
.note-body > * { margin: 0; }
.note-body > * + * { margin-top: var(--space-2); }
.note-title { font-weight: 700; }
.note-body > .note-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.note-actions form { margin: 0; }
.note-link { color: var(--accent); text-decoration: underline; text-underline-offset: 0.15em; }
/* inside a form or a price panel */
.note-compact { padding: var(--space-2) var(--space-3); gap: var(--space-2); }
.note-compact .note-sign { width: 1.25rem; height: 1.25rem; margin-top: 0.15rem; }

/* the promotion: the information note's look; its row, its countdown and
   its button stay as they were (the owner's order of 2026-10-28) */
.note.promo-banner { flex-wrap: nowrap; align-items: center; margin-bottom: var(--space-5); }
.promo-banner .note-sign { margin-top: 0; }
.promo-banner .note-body {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; max-width: none;
}
.promo-banner .note-body > * + * { margin-top: 0; }

/* Old notice markup keeps working until its page is rebuilt: each old
   class takes the look of its kind, and its sign is drawn by ::before on
   the box itself, in the box's left padding. */
.message, .notice, .message-info, .age-blur-note,
.message-success,
.notice-warn, .message-warning, .question-inline, .estimate-warning, .custom-warning,
.message-error, .form-errors {
  --note-tone: var(--accent);
  --note-ground: var(--tint);
  position: relative;
  border: 1px solid var(--line); border-left: 3px solid var(--note-tone);
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--note-ground), transparent 40%), var(--panel);
  color: var(--text);
  padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 1.5rem + var(--space-3));
}
.notice { margin-bottom: var(--space-5); }
.message-success { --note-tone: var(--ok); --note-ground: rgba(124, 227, 168, 0.10); }
.notice-warn, .message-warning, .question-inline, .estimate-warning, .custom-warning {
  --note-tone: var(--warn); --note-ground: rgba(232, 196, 104, 0.10);
}
.message-error, .form-errors { --note-tone: var(--danger); --note-ground: rgba(227, 123, 123, 0.12); }
.message::before, .notice::before, .message-info::before, .age-blur-note::before,
.message-success::before,
.notice-warn::before, .message-warning::before, .question-inline::before,
.estimate-warning::before, .custom-warning::before,
.message-error::before, .form-errors::before {
  position: absolute; left: var(--space-4); top: calc(var(--space-3) + 0.05rem);
  display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem; border-radius: 50%;
  background: var(--note-tone); color: var(--ground);
  font-weight: 800; line-height: 1;
}
.message::before, .notice::before, .message-info::before, .age-blur-note::before {
  content: "i"; content: "i" / "";
}
.message-success::before { content: "\2713"; content: "\2713" / ""; }
.notice-warn::before, .message-warning::before, .question-inline::before,
.estimate-warning::before, .custom-warning::before {
  content: "!"; content: "!" / "";
}
.message-error::before, .form-errors::before { content: "\2715"; content: "\2715" / ""; }
/* the compact warnings of the order form's price panel and its cast; the
   order form's own sheet sets a smaller padding, so these two are named
   with the class each one always carries beside it */
.estimate-note.estimate-warning, .notice-warn.custom-warning {
  padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 1.25rem + var(--space-2));
  border-radius: var(--radius); border-left-width: 3px;
}
.estimate-note.estimate-warning::before, .notice-warn.custom-warning::before {
  left: var(--space-3); top: calc(var(--space-2) + 0.15rem); width: 1.25rem; height: 1.25rem;
}
/* the owner's letter on the home page is a .notice: it keeps the look,
   the width and the place it has (decisions, section 8), so it takes no
   sign and no room for one */
.notice.home-note { padding: 0.7rem 1rem; }
.notice.home-note::before { content: none; }

@media (max-width: 899px) {
  .note { padding: var(--space-3); }
  /* the promotion takes two or three lines here: its sign stands by the first */
  .note.promo-banner { align-items: flex-start; }
  .promo-banner .note-sign { margin-top: 0.05rem; }
  .message, .notice, .message-info, .age-blur-note,
  .message-success,
  .notice-warn, .message-warning, .question-inline, .estimate-warning, .custom-warning,
  .message-error, .form-errors {
    padding: var(--space-3) var(--space-3) var(--space-3) calc(var(--space-3) + 1.5rem + var(--space-3));
  }
  .message::before, .notice::before, .message-info::before, .age-blur-note::before,
  .message-success::before,
  .notice-warn::before, .message-warning::before, .question-inline::before,
  .estimate-warning::before, .custom-warning::before,
  .message-error::before, .form-errors::before {
    left: var(--space-3);
  }
  .estimate-note.estimate-warning, .notice-warn.custom-warning {
    padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 1.25rem + var(--space-2));
  }
  .estimate-note.estimate-warning::before, .notice-warn.custom-warning::before { left: var(--space-3); }
  .notice.home-note { padding: 0.65rem 0.8rem; }
}

/* ==== S9: 3. Form fields, the error summary, folds ======================= */

/* 3.1 One field: its label, the control, the error under the control, a
   note, the help line, in that order (drawn by {% field %}). Some rules
   name the part twice (".field .field-input"): the old stack-form rules of
   goonlab.css (".stack-form input", ".stack-form label", ".stack-form div")
   weigh more than one class, and a field drawn inside a stack form must
   still look like the part. */
div.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
div.field-head { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.field-label, .field .field-label {
  font-size: var(--text-meta); font-weight: 600; color: var(--text);
}
.field-optional { font-weight: 400; color: var(--muted); }
.field-input, .field .field-input {
  width: 100%; min-height: var(--control-h);
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--text); padding: 0.6rem 0.8rem;
  font: inherit; font-size: var(--text-body);
}
textarea.field-input, .field textarea.field-input { min-height: 6rem; resize: vertical; line-height: 1.5; }
.field-input:focus, .field .field-input:focus { border-color: var(--accent); }
/* room for SHOW at the right end of a password box */
.field .pw-wrap > .field-input { padding-right: 3.4rem; }

/* a field in error: a red outline AND the error line with its sign, never
   the colour alone. The second selector reaches the forms not rebuilt yet,
   whose fields Django marks aria-invalid. */
.is-invalid .field-input,
:is(.field, .stack-form, .studio-form) :is(input, select, textarea)[aria-invalid="true"]:not([type=checkbox]):not([type=radio]) {
  border-color: var(--danger);
}

/* the error line; Django's .errorlist is drawn the same way everywhere */
.field-error, .errorlist {
  margin: 0; padding: 0; list-style: none;
  color: var(--danger); font-size: var(--text-body); line-height: 1.5;
  max-width: var(--measure);
}
.field-error::before, .errorlist > li::before {
  content: "✕"; content: "✕" / "";
  display: inline-block; margin-right: 0.4em; font-weight: 700;
}
/* two columns of fields (.form-grid; inside a stack form again from S9 on):
   both columns as wide as each other whatever their fields hold, so a
   drop-down with a long choice shrinks to its column instead of pushing the
   other column out of the panel. Narrower than 641 px the old rules keep
   one column. */
@media (min-width: 641px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.form-grid > * { min-width: 0; }
.form-grid :is(select, input, textarea) { min-width: 0; max-width: 100%; }

/* a line of information that is not an error */
.field-note { margin: 0; color: var(--text); font-size: var(--text-body); max-width: var(--measure); }
/* one help line under the field (the old .helptext and .hint the same) */
.field-help, .helptext, .hint { margin: 0; color: var(--muted); font-size: var(--text-body); }

/* 3.2 A tick: the whole row is the hit area; its links stand on their own
   line after it, outside the label, indented to the label's words */
label.check, .field label.check {
  display: flex; flex-direction: row; align-items: flex-start; gap: var(--space-3);
  font-size: var(--text-body); line-height: 1.5; color: var(--text); cursor: pointer;
}
.check .check-input {
  flex: none; width: 1.15rem; height: 1.15rem; margin: 0.2rem 0 0; padding: 0;
  accent-color: var(--accent);
}
.check-body { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.check-label { font-weight: 600; }
.check-help { color: var(--muted); }
.check-links { padding-left: calc(1.15rem + var(--space-3)); }
/* the old tick row (.toggle-row, until its page is rebuilt): the ring
   around the row, its words at the size of a sentence */
.toggle-row:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-row strong { font-size: var(--text-body); }

/* 3.4 The list of what to fix, at the top of a long form after a refused
   press (parts.js builds it inside the notice part of 5.1). On the order
   form, a grid, it spans every column. */
.error-summary { grid-column: 1 / -1; }
.error-summary-list {
  margin: var(--space-2) 0 0; padding-left: 1.25rem;
  display: flex; flex-direction: column; gap: var(--space-1);
}

/* 3.5 A fold for rare options: a head at least 44 px high whose sign turns
   when it is open. A fold that holds an error opens by itself (parts.js).
   Set apart by thin lines, never a box inside a box. */
.fold { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.fold + .fold { border-top: 0; }
.fold-head {
  display: flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding-block: var(--space-2);
  list-style: none; cursor: pointer;
  font-size: var(--text-body); font-weight: 600; color: var(--text);
}
.fold-head::-webkit-details-marker { display: none; }
.fold-sign {
  margin-left: auto; flex: none; width: 0.6rem; height: 0.6rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform 0.15s ease;
}
.fold[open] > .fold-head .fold-sign { transform: rotate(-135deg); }
.fold-body { display: flex; flex-direction: column; gap: var(--space-4); padding-bottom: var(--space-4); }

@media (max-width: 899px) {
  /* every tick row and each of a tick's links is 44 px tall */
  label.check, .toggle-row { min-height: 44px; }
  .check-links a, .error-summary-list a {
    display: inline-flex; align-items: center; min-height: 44px;
  }
  /* the old folds' heads (until their pages are rebuilt) are 44 px tall:
     the order form's "Optional extras" and its writer and art sources
     (the watch page's Report is a button, 44 px already) */
  .step-extras > summary { min-height: 44px; }
  .adv-options > summary { padding-block: 0.6rem; }
}

/* ==== S11: 12. List toolbars, pagination, empty states ================== */

/* 12.1 The toolbar of a list: a search, the filters with the apply button,
   then the active filters as chips and the count. One row on a desktop,
   each label above its field. Under 900 px the filters fold behind the
   "Filters" button from the first drawn frame (parts.js opens them;
   base.html's <noscript> style shows them when scripts are off). */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.toolbar-filters {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  gap: var(--space-3) var(--space-4);
}
.toolbar-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
/* the search field takes the room the filters leave (the old search box of
   goonlab.css is an input with this class; the part's is its wrapper) */
.toolbar-field.toolbar-search {
  flex: 1 1 16rem; max-width: 30rem;
  background: none; border: 0; border-radius: 0; padding: 0;
}
.toolbar-field.toolbar-search input { width: 100%; }
.toolbar-toggle { display: none; }
.toolbar-toggle-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.5rem; margin-left: var(--space-2); padding: 0 var(--space-2);
  border-radius: var(--radius-pill); background: var(--panel-2);
  font-size: var(--text-badge); color: var(--text);
}
.toolbar-toggle-count:empty { display: none; }
.toolbar-chips {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-2); margin-bottom: var(--space-3);
}
.toolbar-count { margin: 0 0 var(--space-3); font-size: var(--text-meta); color: var(--muted); }

@media (max-width: 899px) {
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  .toolbar-field.toolbar-search { max-width: none; }
  .toolbar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    justify-self: start;
  }
  .toolbar-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
  /* folded from the first drawn frame; never on a toolbar-open toolbar */
  .toolbar:not(.toolbar-open) .toolbar-filters:not(.is-expanded) { display: none; }
  .toolbar-filters select, .toolbar-filters input { width: 100%; }
  .toolbar-apply { width: 100%; }

  /* toolbar-open (a toolbar of at most two fields and no search): drawn
     open, two fields to a row, a field alone takes the whole row, the
     apply button on its own row at full width; no Filters button */
  .toolbar-open .toolbar-toggle { display: none; }
  .toolbar-open .toolbar-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar-open .toolbar-field:last-of-type:nth-of-type(odd) { grid-column: 1 / -1; }
  .toolbar-open .toolbar-apply { grid-column: 1 / -1; }

  /* the old browse toolbar (videos/_browse.html until its page package
     moves it onto .toolbar): a column that wraps measured its drop-downs as
     one column and then drew them as two from 600 px, so each row stood 26
     px too tall and the visible Apply button 73 px tall at 768 px */
  .browse-toolbar { flex-wrap: nowrap; }
}

/* 12.3 The pages of a list: Prev and Next are the buttons, the page number
   between them is plain text. Alias: .page-status (the old gradient pill). */
.pager {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: var(--space-3) var(--space-4); margin-top: var(--space-6);
}
.pager .btn { display: inline-flex; align-items: center; min-height: var(--control-h); }
.pager-status, .page-status {
  margin: 0; padding: 0; border-radius: 0; background: none;
  font-family: inherit; font-size: var(--text-meta); font-weight: 400; color: var(--muted);
}

/* 12.4 The empty state of a list: the whole width of its list (a grid's
   every column), centred, no border. Aliases: .empty-note, .comment-empty
   (one line each, so they keep their own flow). */
.empty, .empty-note, .comment-empty {
  grid-column: 1 / -1;
  padding: var(--space-5) var(--space-4);
  text-align: center; color: var(--muted);
}
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.empty-title { margin: 0; font-size: var(--text-body); font-weight: 700; color: var(--text); }
.empty-text { margin: 0; max-width: var(--measure); font-size: var(--text-body); color: var(--muted); }

/* ==== S13: 9.2 The video card ========================================== */

/* The heart: a switch with one name ("Favorite") that says whether it is
   on. Off: an outlined heart; on: a filled heart in the accent colour with
   an accent outline, so its shape tells the state besides its colour. The
   count beside it is every heart the video has. The old .fav-btn rules of
   goonlab.css stand before this file and lose to these of the same weight;
   on a phone mobile.css makes it 44 px tall (.fav-btn). */
.heart {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  min-height: 2rem; padding: 0 var(--space-3);
  background: none; border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  color: var(--text); font-family: var(--mono); font-size: var(--text-meta); line-height: 1;
  cursor: pointer;
}
.heart-sign { font-family: var(--sans); font-size: 1.15em; line-height: 1; color: var(--muted); }
.heart:hover { color: var(--text); border-color: var(--line-strong); background: none; }
@media (hover: hover) {
  .heart:hover { border-color: var(--accent); }
  .heart:hover .heart-sign { color: var(--accent); }
}
@media (hover: none) {
  .heart:hover, .heart:active { transform: none; }
}
.heart[aria-pressed="true"], .heart[aria-pressed="true"]:hover {
  color: var(--text); border-color: var(--accent); background: var(--tint);
}
.heart[aria-pressed="true"] .heart-sign { color: var(--accent); }
.heart[aria-busy="true"] { cursor: progress; }

/* The creator's name on a card looks like a link: the text colour with a
   dotted line under it, a full line under the pointer. The same on every
   card. */
.card-link {
  color: var(--text);
  text-decoration: underline dotted; text-underline-offset: 0.2em;
}
.card-link:hover { color: var(--text); text-decoration: underline solid; }

/* The folder picker of a card on "Your videos": its label above it, the
   picker and its Move button on one row under it; the whole row of the
   card's foot is its own, so a folder's name is not cut. Heavier than
   mobile.css's .video-manage .inline-form rules, which load after it. */
.video-manage .inline-form.card-move {
  flex: 1 1 100%; min-width: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: var(--space-1) var(--space-2);
}
.card-move-label { grid-column: 1 / -1; font-size: var(--text-meta); color: var(--muted); }
/* the picker draws as the field part (.field-input); the old .video-manage
   select rule of goonlab.css weighs more and is beaten here. Its Move
   button stands as tall as the picker. */
.video-manage .card-move select.field-input {
  width: 100%; min-width: 0; max-width: none;
  padding: 0.4rem 0.5rem; border-radius: var(--radius); font-size: var(--text-body);
}
.video-manage .card-move .btn { min-height: var(--control-h); }

/* Cards keep their own height in a strip (the foot is no longer pushed to
   the bottom of the tallest card). */
.video-strip { align-items: start; }

/* ==== S16b: 26. Narrow page, 27. Chart, 28. Picture field ================
   (design-system 26 to 28). The account pages' three parts. The old
   classes of the sign-in column are aliases of the narrow page until S17:
   .auth-wrap -> .page-narrow, .auth-panel and .panel.narrow ->
   .card-plain-narrow, .auth-sub -> .page-lead, .auth-alt -> a plain line,
   .auth-note -> .page-fine; so the thirteen pages that use .auth-panel take
   the look before their own packages rebuild them. Some selectors name the
   element or a second class (div.auth-wrap, div.auth-panel,
   .card.card-plain-narrow): mobile.css comes after this file and weighs as
   much with one class, and the plain card's own padding (.card) must not
   win over the narrow card's, whatever order the blocks stand in. */

/* ---- Narrow page ---- */

/* one centred column of 440 px for a short form or a notice that stands
   alone, with the soft glow behind it; the fine print under the card */
.page-narrow, div.auth-wrap {
  position: relative;
  max-width: 27.5rem;
  margin: var(--space-6) auto 0;
  display: flex; flex-direction: column; align-items: stretch;
  gap: var(--space-5);
}
.page-narrow::before {
  content: "";
  position: absolute;
  inset: -6rem -8rem auto;
  height: 22rem;
  background: radial-gradient(24rem 14rem ellipse at 50% 30%, var(--glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* the card: the plain card with the gradient top edge and the deep shadow
   of the sign-in card. Alone on a page (the alias pages that have no
   column around it) it keeps the column's width and stands centred. */
.card-plain-narrow, .card.card-plain-narrow, div.auth-panel, .panel.narrow {
  max-width: 27.5rem;
  margin: 0 auto var(--space-7);
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 2px solid transparent;
  border-image: var(--grad) 1 0 0 0;
  border-radius: var(--radius);
  padding: var(--space-6);
  display: flex; flex-direction: column;
  gap: var(--space-4);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.page-narrow > .card-plain-narrow, div.auth-wrap > div.auth-panel { margin: 0; }
/* the one heading, inside the card, at the type scale's size and line
   height (a heading of two lines no longer stands 45 px apart) */
.card-plain-narrow h1, div.auth-panel h1, .panel.narrow h1 {
  font-size: var(--text-h1); line-height: 1.2;
}

/* the short line under the heading */
.card-plain-narrow > .page-title + .page-lead { margin-top: calc(-1 * var(--space-2)); }
.auth-sub {
  margin-top: calc(-1 * var(--space-2));
  max-width: var(--measure);
  color: var(--muted); font-size: var(--text-body);
}

/* a plain line; its link alone on a line is 44 px tall on a phone (S2) */
.auth-alt { color: var(--muted); font-size: var(--text-body); }

/* the "or" line between the Google button and the e-mail form: its words
   in the middle of a thin rule */
.divider-or {
  display: flex; align-items: center; gap: var(--space-3);
  margin: 0;
  color: var(--muted); font-size: var(--text-body); line-height: 1.5;
  text-align: center;
}
.divider-or::before, .divider-or::after {
  content: "";
  flex: 1 1 0;
  border-top: 1px solid var(--line);
}

/* the fine print under the card (and the agreement line inside it) */
.page-fine, .auth-note {
  margin: 0 auto;
  max-width: var(--measure);
  color: var(--muted); font-size: var(--text-fine);
  text-align: center;
}
.page-fine a { color: inherit; text-decoration: underline; }

/* the card's buttons: one row from 600 px, one column at full width under */
.card-plain-narrow .card-actions {
  display: flex; flex-direction: row; flex-wrap: wrap; align-items: stretch;
  gap: var(--space-3);
}
.card-plain-narrow .card-actions > * { flex: 1 1 auto; }
.card-plain-narrow .card-actions form .btn { width: 100%; }
@media (max-width: 599px) {
  .card-plain-narrow .card-actions { flex-direction: column; }
  .card-plain-narrow .card-actions > *,
  .card-plain-narrow .card-actions .btn { width: 100%; }
}

@media (max-width: 899px) {
  /* the card fills the column between the 16 px gutters; the glow stays
     inside the column, so the page never scrolls sideways */
  .page-narrow, div.auth-wrap { gap: var(--space-4); }
  .page-narrow::before { inset: -6rem 0 auto; }
  .card-plain-narrow, .card.card-plain-narrow, div.auth-panel, .panel.narrow {
    padding: var(--space-5) var(--space-4);
  }
}

/* ---- Chart ---- */

/* one line over days: the scale (the highest day, the middle, 0) beside
   the drawing, the first, middle and last day under it, all as text at the
   facts size, so the stretched drawing never stretches a number. The
   line's colour comes from the tone class alone. The old drawing of the
   analytics page (svg.chart, until its page is rebuilt) keeps its look:
   the new part's box is figure.chart. */
figure.chart {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  grid-template-rows: 8rem auto;
  column-gap: var(--space-2);
  row-gap: var(--space-1);
  width: 100%; height: auto;
  margin: 0;
}
.chart-violet { color: #8b5cf6; }
.chart-accent { color: var(--accent); }
.chart-ok { color: var(--ok); }
/* the scale and the drawing stand in the figure's first row */
.chart-plot { display: contents; }
.chart-scale, .chart-days {
  list-style: none; margin: 0; padding: 0;
  color: var(--muted); font-size: var(--text-meta); line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.chart-scale {
  grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column; justify-content: space-between;
  text-align: right;
}
/* the drawing: its two axes, a faint line at the top and at the middle of
   the scale, and the line itself 2 px wide at any size */
.chart-line {
  grid-column: 2; grid-row: 1;
  display: block; width: 100%; height: 100%;
  overflow: visible;
  border-left: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background:
    linear-gradient(var(--line), var(--line)) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--line), var(--line)) 0 50% / 100% 1px no-repeat;
}
.chart-line polyline {
  fill: none;
  stroke: currentColor; stroke-width: 2;
  stroke-linejoin: round; stroke-linecap: round;
}
.chart-days {
  grid-column: 2; grid-row: 2;
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: var(--space-2);
}
.chart-days li:nth-child(2) { text-align: center; }
.chart-days li:last-child { text-align: right; }
/* every day and its count, in a fold under the drawing */
.chart-table { margin-top: var(--space-3); }

@media (max-width: 899px) {
  figure.chart { grid-template-rows: 7rem auto; }
}

/* ---- Picture field ---- */

/* one picture held by a form and sent with its Save: the current picture
   (or the letter circle the page draws) beside the browser's own file
   control and the remove tick; the chosen picture shows in its place, and
   a file over the limit is refused before the press (parts.js) */
div.picture-field-row {
  display: flex; flex-direction: row; align-items: center;
  gap: var(--space-4);
}
.picture-field-current {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 96px; height: 96px;
  border-radius: 50%; overflow: hidden;
  background: var(--panel-2); border: 2px solid var(--line);
}
/* what stands in the circle fills it: the picture, or the page's letter
   circle (its own ring and its smaller phone size give way to the frame's) */
.picture-field .picture-field-current > * { width: 100%; height: 100%; border: 0; }
.picture-field-img { display: block; object-fit: cover; }
div.picture-field-controls {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--space-2);
  flex: 1 1 auto; min-width: 0;
}
/* the file control stays the browser's own, with its own words; only its
   button is drawn, as a secondary button */
.field input.picture-field-input {
  width: auto; max-width: 100%; min-height: 0;
  padding: 0; border: 0; border-radius: 0; background: none;
  color: var(--muted); font-size: var(--text-meta);
}
.picture-field input.picture-field-input::file-selector-button {
  min-height: var(--control-h);
  margin-right: var(--space-3);
  padding: 0 var(--space-4);
  background: transparent; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font: inherit; font-weight: 600;
  cursor: pointer;
}
.picture-field input.picture-field-input::file-selector-button:hover {
  border-color: #8b5cf6; color: #a78bfa;
}
/* a refused file: the button's outline turns red beside the error line */
.picture-field.is-invalid input.picture-field-input::file-selector-button {
  border-color: var(--danger);
}

@media (max-width: 899px) {
  /* the picture above the controls; the button 44 px tall */
  div.picture-field-row { flex-direction: column; align-items: flex-start; }
  .picture-field input.picture-field-input::file-selector-button { min-height: 44px; }
}
/* ==== S16: page shapes, tables, the copy button, cards ===================
   (design-system 9.1, 14, 17.0, 17.3, 17.5 and 0). Nothing here is drawn
   until a page uses the class; the old classes it names as aliases
   (.home-section-head, .view-all, .pack-featured) take the new look now. */

/* 17.0 the way back: a link named by where it leads, 44 px tall */
.back-link {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; margin-bottom: var(--space-2);
  font-size: var(--text-meta); color: var(--accent);
}
.back-link:hover { color: var(--accent); text-decoration: underline; }

/* 17.0 the head of a page: the one h1 with a short line under it, the
   page's actions at the right on the h1's baseline; a column on a phone */
.page-head-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
}
.page-head-text { flex: 1 1 auto; min-width: 0; }
.page-title { margin: 0; font-size: var(--text-h1); line-height: 1.2; }
.page-lead { margin: var(--space-1) 0 0; font-size: var(--text-body); color: var(--muted); }
.page-actions {
  flex: none; display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-3);
}

/* 17.0 a section: space and its heading set it apart, no box around it */
.section { margin-top: var(--space-6); }
.section > .section-title { margin: 0 0 var(--space-3); font-size: var(--text-h2); }

/* 17.0 a section head with one link to the whole list at its end, on the
   heading's baseline; the heading may wrap, the link never does. Aliases:
   .home-section-head, .view-all (the home page's rows) */
.section-head, .home-section-head {
  display: flex; flex-wrap: nowrap; align-items: baseline; justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-bottom: var(--space-3);
}
.section-head > .section-title, .section-head > h2, .home-section-head > h2 {
  margin: 0; min-width: 0;
}
.section-link, .view-all {
  flex: none; white-space: nowrap;
  font-family: var(--sans); font-size: var(--text-meta); color: var(--accent);
  text-decoration: underline; text-underline-offset: 0.15em;
}
.section-link:hover, .view-all:hover {
  color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px;
}

/* 17.5 the contents of a long reading page: in the reading column under
   its head, no box, nothing sticky; each link jumps to its section */
.contents { max-width: var(--measure); margin: 0 0 var(--space-5); font-size: var(--text-body); }
.contents-title { margin: 0 0 var(--space-2); font-weight: 700; color: var(--text); }
.contents-list { margin: 0; padding-left: 1.25rem; }
.contents-list li + li { margin-top: var(--space-1); }
.contents-list a { text-decoration: underline; text-underline-offset: 0.15em; }
/* a section that takes the focus from a jump lands under the top bar,
   which stays at the top of the screen, not behind it */
:where([id][tabindex="-1"]) { scroll-margin-top: 4.75rem; }

/* 9.1 the card: the panel ground, a thin edge, round corners. A card with
   a picture on top (card-media), a row of a main column and its buttons
   (card-row), or a box for a group that must stand apart (card-plain). A
   card's title is not a heading. */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--space-4);
}
.card-media { padding: 0; border-radius: 12px; overflow: hidden; min-width: 0; }
.card-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4);
}
/* the parts inside a card carry the weight of one class, so a card's own
   rules (the job card, the video card) keep their layout */
.card-row > :where(.card-main) { flex: 1 1 auto; min-width: 0; }
.card-title { margin: 0; font-size: var(--text-h3); line-height: 1.35; font-weight: 600; color: var(--text); }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.card-row > :where(.card-actions) { flex: none; justify-content: flex-end; }
.card-plain > :where(.card-actions:not(:first-child)) { margin-top: var(--space-4); }
/* a list of cards: one under the other, or a grid that fills the row */
.card-list, .card-grid { list-style: none; margin: 0; padding: 0; }
.card-list { display: flex; flex-direction: column; gap: var(--space-3); }
.card-grid {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr));
}
/* the one card of a set marked as the one to take: the accent edge and a
   soft glow, never alone: its tag says why. Alias: .pack-featured */
.card.is-marked, .pack-featured {
  border-color: var(--accent);
  box-shadow: 0 8px 30px var(--glow);
}
.tag.tag-mark { color: var(--accent); border-color: var(--accent); }

/* 14 a table: figures that line up stand at the right; the column heads in
   the site's sans-serif. The old tables keep their look until they move
   onto .table. */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-meta); }
.table th, .table td { padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
.table th {
  font-family: var(--sans); font-size: var(--text-meta); font-weight: 600;
  color: var(--muted); border-bottom: 1px solid var(--line);
}
.table td.mono, .table .num { text-align: right; }
/* a cell never breaks a word only to make its column narrower (the dates
   that split into five lines on a phone) */
.table-wrap > .table td { overflow-wrap: break-word; }
.table-ref .copy { margin-left: var(--space-1); vertical-align: middle; }

/* 14 the copy button: a sign of two sheets, named by the page
   (aria-label); for two seconds after a copy it says so in its own label */
.copy { position: relative; min-width: 2rem; min-height: 2rem; }
.copy:not(.is-done)::before, .copy:not(.is-done)::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 0.6rem; height: 0.72rem;
  border: 1.5px solid currentColor; border-radius: 2px;
}
.copy:not(.is-done)::before { transform: translate(-30%, -70%); }
.copy:not(.is-done)::after { transform: translate(-70%, -30%); }

/* 17.3 the bar of a long form's main button on a phone (built into the
   form as its last child, shown under 900 px only). The bar's own markup
   (data-action-bar) carries the weight that outranks a form's rule for
   every div in it (.stack-form div, the account forms). */
.action-bar, .action-bar[data-action-bar] { display: none; }

@media (max-width: 899px) {
  .page-head-row { flex-direction: column; align-items: stretch; }
  .section { margin-top: var(--space-5); }
  /* the gap keeps the space before the sign, which a flex row drops */
  .section-link, .view-all { display: inline-flex; align-items: center; gap: 0.3em; min-height: 44px; }
  .contents-list a { display: inline-flex; align-items: center; min-height: 44px; }
  .contents-list li + li { margin-top: 0; }
  .card { padding: var(--space-3); }
  .card-media { padding: 0; }
  .card-row { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .card-row > :where(.card-actions) { justify-content: flex-start; }

  /* fixed above the tab bar, the whole width; its height is measured by
     parts.js into --actionbar-space, which the page's bottom padding, the
     footer, the tip sheet and the consent bar add, so none hides behind it */
  .action-bar, .action-bar[data-action-bar] {
    display: flex; flex-direction: column; gap: var(--space-2);
    position: fixed; left: 0; right: 0; bottom: var(--tabbar-space, 0px);
    z-index: var(--layer-tabbar);
    padding: var(--space-3) var(--space-4);
    background: var(--panel); border-top: 1px solid var(--line);
  }
  .action-cost { margin: 0; font-size: var(--text-body); color: var(--text); }
  .action-question { max-height: 40vh; overflow-y: auto; }
  .action-question[hidden] { display: none; }
  .action-bar .btn-block { width: 100%; }
  main {
    padding-bottom: calc(var(--tabbar-space, 0px) + var(--actionbar-space, 0px) + var(--space-4));
  }
  /* the frame's footer: its bottom padding adds the bar's height too (the
     frame's main keeps the padding of mobile.css, which outranks the main
     rule above) */
  footer.site-footer {
    padding-bottom: calc(1.5rem + var(--tabbar-space, 0px) + var(--actionbar-space, 0px));
  }
}

@media (max-width: 599px) {
  /* a table becomes a card per row on a phone: each cell a line "label:
     value" (the label from data-label), the reference on its own line,
     breakable, with its copy button beside it */
  .table-wrap:has(> .table-stack) {
    overflow: visible; margin-inline: 0; border: 0; border-radius: 0;
  }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; }
  .table-stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
  .table-stack tr {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: var(--space-2) var(--space-3);
  }
  .table-stack tr + tr { margin-top: var(--space-3); }
  .table-wrap .table-stack td {
    padding: var(--space-1) 0; border: 0; text-align: left;
    white-space: normal; overflow-wrap: break-word;
  }
  .table-stack td[data-label]::before {
    content: attr(data-label) ": "; color: var(--muted);
    font-family: var(--sans); font-weight: 400;
  }
  .table-wrap .table-stack .table-ref {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    align-items: center; column-gap: var(--space-2);
  }
  .table-stack .table-ref::before, .table-stack .table-ref > :not(.mono):not(.copy) { grid-column: 1 / -1; }
  .table-stack .table-ref .mono { overflow-wrap: anywhere; }
  .table-stack .table-ref .copy { margin-left: 0; }
}

/* ==== 25. Parts of a page of one thing (package S16a) =================== */

/* 25.1 The status block at the top of a page of one thing (a video
   generation, a video, a creator): the picture, a text column (the state,
   one line of what is happening, the bar, a must-know line, the cost) and
   the actions in one row, the dangerous act set apart after them. On a
   phone one column: the picture on top, the main button and the second
   one full width, the dangerous act alone on its own line at its own
   width. No state is ever printed as a class here. */
.status-block { display: flex; align-items: flex-start; gap: var(--space-5); }
.status-media {
  flex: 0 0 14rem; display: block;
  border-radius: var(--radius); overflow: hidden; background: var(--panel-2);
}
.status-media img { display: block; width: 100%; height: auto; }
.status-body {
  flex: 1 1 auto; min-width: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
}
.status-body > p { margin: 0; }
.status-subject { font-size: var(--text-body); overflow-wrap: anywhere; }
.status-meta { font-size: var(--text-meta); color: var(--muted); overflow-wrap: anywhere; }
.status-line { font-size: var(--text-body); max-width: var(--measure); }
.status-cost { font-size: var(--text-meta); color: var(--text); }
.status-link { align-self: flex-start; }
.status-actions {
  flex: none; display: flex; flex-wrap: nowrap; align-items: center;
  justify-content: flex-end; gap: var(--space-2);
}
.status-actions form { display: flex; margin: 0; }
.status-actions .btn { white-space: nowrap; }
/* with the row's gap, --space-5 before the dangerous act */
.status-actions .status-danger { margin-left: var(--space-4); }

@media (max-width: 899px) {
  .status-block { flex-direction: column; align-items: stretch; gap: var(--space-4); }
  .status-media { flex: none; width: 100%; }
  .status-actions { flex-direction: column; align-items: stretch; justify-content: flex-start; }
  .status-actions > .btn,
  .status-actions > form:not(.status-danger) .btn { width: 100%; }
  /* with the column's gap, --space-4 above the dangerous act */
  .status-actions .status-danger { align-self: flex-start; margin: var(--space-2) 0 0; }
  .status-actions .status-danger .btn { width: auto; }
  .status-link { display: inline-flex; align-items: center; min-height: 44px; }
}

/* 25.2 Progress: the bar and its caption (the stage, the percentage). The
   bar keeps the job card's markup (.progress-track > .progress-fill); no
   box around the part; the caption is a facts line, not monospace.
   Alias: .progress-wrap (the job page's bar until its page is rebuilt). */
.progress, .progress-wrap { display: flex; flex-direction: column; gap: var(--space-2); }
.progress-caption {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--space-3); margin: 0;
  font-family: var(--sans); font-size: var(--text-meta); color: var(--muted);
}
.progress-stage { min-width: 0; overflow-wrap: anywhere; }
.progress-pct { flex: none; font-variant-numeric: tabular-nums; }

/* 25.3 Timeline: one entry a line, newest first, divided by a line, no box
   around it. Past the newest twelve an entry waits behind the show-all
   control (a must-know entry never does). The control is a toggle that
   stays in the page: once pressed it is not drawn and the list carries
   is-expanded, which the live updates put back after every refresh. A
   must-know entry has the attention tone's bar, its "!" sign and bold
   words. On a phone two lines an entry: the time and the stage, then the
   detail; the percentage is not shown. Aliases: .job-timeline (no box any
   more), .timeline-row, .timeline-row.is-loud. */
.timeline, .job-timeline {
  display: flex; flex-direction: column;
  margin: 0; padding: 0; list-style: none;
  background: none; border: 0; border-radius: 0;
}
.timeline-row {
  display: grid; grid-template-columns: 5rem minmax(0, 12rem) minmax(0, 1fr) 3.5rem;
  gap: var(--space-3); align-items: baseline;
  padding: var(--space-2) 0;
}
.timeline-row + .timeline-row { border-top: 1px solid var(--line); }
.timeline-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
/* a long stage name wraps: no word of it is cut away */
.timeline-stage { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.timeline-pct {
  text-align: right; color: var(--muted);
  font-size: var(--text-meta); font-variant-numeric: tabular-nums;
}
.timeline.is-expanded .timeline-row.is-folded { display: grid; }
/* the bar and its room come out of the time column, so the stage and the
   detail stand in line with the other entries */
.timeline-row.is-loud {
  grid-template-columns: calc(5rem - var(--space-3) - 3px) minmax(0, 12rem) minmax(0, 1fr) 3.5rem;
  padding-left: var(--space-3);
  border-left: 3px solid var(--warn); background: rgba(232, 196, 104, 0.08);
}
.timeline-row.is-loud .timeline-stage { color: var(--warn); }
.timeline-row.is-loud .timeline-stage::before {
  content: "!"; content: "!" / "";
  display: inline-block; width: 1.25em; height: 1.25em; margin-right: var(--space-2);
  border-radius: 50%; background: var(--warn); color: var(--ground);
  line-height: 1.25em; text-align: center; font-weight: 700; vertical-align: 0.05em;
}
.timeline-row.is-loud .timeline-detail { color: var(--text); font-weight: 700; grid-column: auto; }
.timeline-empty { margin: 0; color: var(--muted); font-size: var(--text-body); }
.timeline-all { align-self: flex-start; margin-top: var(--space-1); }
.timeline-all[aria-expanded="true"] { display: none; }

@media (max-width: 899px) {
  .timeline .timeline-row {
    grid-template-columns: 4.6rem minmax(0, 1fr);
    gap: var(--space-1) var(--space-3); padding: var(--space-2) 0;
  }
  .timeline .timeline-row.is-loud {
    grid-template-columns: calc(4.6rem - var(--space-3) - 3px) minmax(0, 1fr);
    padding-left: var(--space-3);
  }
  .timeline .timeline-detail,
  .timeline .timeline-row.is-loud .timeline-detail { grid-column: 1 / -1; }
  .timeline .timeline-pct { display: none; }
}

/* 25.4 Facts list: label and value pairs, a description list. Labels at
   the facts-line size in the muted colour (never upper case), values at
   the sentence size. facts-2col lets the pairs flow in columns where the
   width allows, each label over its value; under 600 px every label stands
   over its value. Alias: .order-grid (the job page's order facts until its
   page is rebuilt; its .job-stat-label spans stand for the labels). */
.facts { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
.facts-row {
  display: grid; grid-template-columns: 11rem minmax(0, 1fr);
  gap: var(--space-1) var(--space-3); align-items: baseline; min-width: 0;
}
.facts-label {
  margin: 0; font-size: var(--text-meta); color: var(--muted);
  text-transform: none; letter-spacing: normal;
}
.facts-value { margin: 0; min-width: 0; font-size: var(--text-body); color: var(--text); overflow-wrap: anywhere; }
.facts-2col, .order-grid {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--space-3) var(--space-5);
}
.facts-2col .facts-row { grid-template-columns: minmax(0, 1fr); }
.order-grid { font-size: var(--text-body); }
.order-grid .job-stat-label {
  display: block; margin: 0 0 var(--space-1);
  font-family: var(--sans); font-size: var(--text-meta); color: var(--muted);
}

@media (max-width: 599px) {
  .facts-row { grid-template-columns: minmax(0, 1fr); }
  .facts-2col, .order-grid { grid-template-columns: minmax(0, 1fr); }
  .order-panel .order-grid > div { display: block; }
}

/* ==== LB-P3: Card variant: pack (the packs page, design-system 9.1) ======
   A pack: its name and its tags in one row, the token figure over the
   price, the line of what it buys, then its buttons at the card's foot.
   Under 600 px the card is compact: the figure at the left and the price
   at the right in one row, Buy and "Pay with crypto" side by side, so the
   Buy buttons stand on a phone's first screen. Today's three columns stay
   (.pack-grid beside .card-grid). Two classes beat the old .pack rules of
   goonlab.css and mobile.css until S17 deletes them. */
.card-grid.pack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.card.card-plain-pack {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4);
}
.card-plain-pack > .pack-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2);
}
.card-plain-pack > .pack-figures { display: flex; flex-direction: column; gap: var(--space-2); }
.card-plain-pack .pack-tokens, .card-plain-pack .pack-price, .card-plain-pack > .pack-hint { margin: 0; }
/* the buttons stand at the foot of the card, so the cards of a row line
   their buttons up; two buttons share the row while each keeps 9rem */
.card.card-plain-pack > .card-actions { margin-top: auto; gap: var(--space-2); }
.card-plain-pack > .card-actions > form,
.card-plain-pack > .card-actions > .btn { flex: 1 1 9rem; min-width: 0; }
.card-plain-pack > .card-actions .btn { padding-inline: var(--space-2); }

/* the heading of the table of typical costs with its "?" beside it */
.costs-head { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.costs-head > .section-title { margin: 0; }

@media (max-width: 899px) {
  .card.card-plain-pack { padding: var(--space-3); }
}

@media (max-width: 719px) {
  .card-grid.pack-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
}

@media (max-width: 599px) {
  .card.card-plain-pack { gap: var(--space-2); }
  .card-plain-pack > .pack-figures {
    flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
    gap: var(--space-1) var(--space-3);
  }
}

/* ==== S5a: 6. Boxes over the page (design-system 6.1, 6.2, 6.4) =========
   parts.js opens and closes every box (the focus, the page behind made
   inert, Escape). Here: their layer, the page that stays still behind
   them, and the skeleton of a rebuilt box: its head and its foot stay in
   sight and only its body scrolls, with a shade at the body's lower edge
   while more follows. A panel without .modal-body (a box not rebuilt yet)
   keeps its one-column look. */

/* every box stands above the menu, the consent bar and the tab bar */
.modal-backdrop { z-index: var(--layer-modal); }
/* a box another box opened over waits behind it unseen (parts.js makes it
   inert) and shows again when that one closes */
.modal-backdrop[inert] { visibility: hidden; }
/* the page behind an open box does not scroll; it keeps its width where
   its scroll bar was (parts.js measures it) */
html.modal-open { overflow: hidden; padding-right: var(--modal-gap, 0px); }

.modal-panel:has(> .modal-body) {
  display: flex; flex-direction: column;
  max-width: 34rem; padding: 0; overflow: hidden;
}
.modal-panel.modal-wide { max-width: 40rem; }
.modal-head { flex: none; padding: var(--space-5) var(--space-5) var(--space-3); }
.modal-head .modal-title { margin: 0; }
.modal-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 0 var(--space-5) var(--space-4);
  /* the shade: drawn at the box's lower edge, and covered by the panel's
     colour that moves with the text once its end is in sight */
  background:
    linear-gradient(rgba(23, 16, 33, 0), var(--panel) 40%) 0 100% / 100% 2.5rem no-repeat local,
    linear-gradient(rgba(8, 4, 14, 0), rgba(8, 4, 14, 0.85)) 0 100% / 100% 1.5rem no-repeat scroll,
    var(--panel);
}
/* the body takes the keyboard where its text is long: its ring stays inside it */
.modal-body:focus-visible { outline-offset: -2px; }
.modal-body :where(ul, ol) { margin: 0 0 var(--space-4); }
.modal-body > :last-child { margin-bottom: 0; }
/* the line that names what the box is about (the video being published) */
.modal-panel .modal-subject { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.modal-foot {
  flex: none; padding: var(--space-4) var(--space-5) var(--space-5);
  border-top: 1px solid var(--line);
}
/* the answers: one row at the right, the main answer first */
.modal-actions {
  display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start;
  gap: var(--space-3);
}
.modal-action { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.modal-cost { margin: 0; max-width: 16rem; font-size: var(--text-body); color: var(--muted); }

@media (max-width: 899px) {
  /* 0.75rem from the top, the width less 1.5rem, and clear of the tab bar
     with the spacer mobile.css puts after it */
  .modal-panel:has(> .modal-body) {
    width: calc(100% - 1.5rem); margin-inline: auto;
    max-height: calc(100vh - 2.75rem - var(--tabbar-space, 0px));
    max-height: calc(100dvh - 2.75rem - var(--tabbar-space, 0px));
  }
  .modal-head { padding: var(--space-4) var(--space-4) var(--space-3); }
  .modal-body { padding: 0 var(--space-4) var(--space-4); }
  .modal-foot { padding: var(--space-3) var(--space-4) var(--space-4); }
}
@media (max-width: 599px) {
  /* the answers stack at full width, the main answer on top */
  .modal-actions { flex-direction: column; align-items: stretch; }
  .modal-action .btn { width: 100%; }
  .modal-cost { max-width: none; }
}

/* ==== S5b: 6.3 The blocking question (design-system 6.1, 6.3) ===========
   The question about money carries a line under its answers: under the one
   that goes on, the tokens needed before it goes on; under the stop answer,
   what stopping keeps and loses. Those answers share their row in equal
   parts while each label fits on one line, and stand one under the other
   at full width when they do not: a label is never broken over two lines.
   Under 600 px S5a's rule stacks them, the main answer on top. */

/* goonlab.css gives every paragraph of a panel a gap below it; the line
   under an answer keeps none */
.modal-panel .modal-cost { margin: 0; }
@media (min-width: 600px) {
  .modal-actions:has(.modal-cost) > .modal-action { flex: 1 1 0; min-width: min-content; }
  .modal-actions:has(.modal-cost) > .modal-action > .btn { white-space: nowrap; }
  .modal-actions:has(.modal-cost) .modal-cost { max-width: none; }
}

/* ==== LB-P7, LB-P8: the billing history page (billing/history.html) =====
   Page rules beside the table of design-system 14: the line under a
   purchase's state that says what happened to the money, the refund link
   under a paid purchase's reference, the fold of the older purchases, the
   fold of the parts of one video generation in its line, the one line of
   a list that is empty. Dates and figures stay on one line; the state, the
   reference and the note wrap (goonlab.css keeps every cell on one line,
   which would make the tables wider than the page). */
.table.history-purchases td.history-status,
.table.history-activity td.history-note { white-space: normal; }
.table.history-activity td.history-note { min-width: 14rem; overflow-wrap: anywhere; }
/* a date never splits, at any width (the phone sheet lets every cell wrap) */
.table td.history-date { white-space: nowrap; }
.history-money {
  margin: var(--space-1) 0 0; max-width: 16rem;
  font-size: var(--text-body); line-height: 1.45; color: var(--muted);
}
.history-refund {
  display: block; width: max-content; margin-top: var(--space-1);
  text-decoration: underline; text-underline-offset: 0.15em;
}
.history-none { margin: 0; font-size: var(--text-body); color: var(--muted); }
/* the pager's Prev and Next lead to #s-activity: the heading lands under
   the top bar, which stays at the top of the screen, not behind it */
#s-activity { scroll-margin-top: 4.75rem; }
.fold.history-older { margin-top: var(--space-3); }
.fold.history-older > .fold-body { gap: 0; }

/* the parts of one video generation, folded under its name: the head is
   a line of the note, its sign right after the words; each part a row of
   its date, its signed change and its words */
.fold.history-parts { margin-top: var(--space-1); border: 0; }
.fold.history-parts > .fold-head {
  min-height: 2rem; padding-block: var(--space-1);
  font-size: var(--text-meta); font-weight: 600;
}
.fold.history-parts > .fold-head .fold-sign { margin-left: var(--space-1); }
.fold.history-parts > .fold-body { padding-bottom: var(--space-2); }
.history-part-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--space-1);
}
.history-part-list > li {
  display: grid; grid-template-columns: 9.5rem 5rem minmax(0, 1fr);
  gap: var(--space-3); align-items: baseline;
}
.history-part-date { color: var(--muted); white-space: nowrap; }
.history-part-list .mono { text-align: right; white-space: nowrap; }

@media (max-width: 899px) {
  /* the copy button of a reference: 44 px a side on a phone (S16's .copy
     sets 2rem, which outweighs the weightless 44 px of every .btn) */
  .table.history-purchases .copy { min-width: 44px; min-height: 44px; }
  .history-refund { display: flex; align-items: center; min-height: 44px; margin-top: 0; }
  .fold.history-parts > .fold-head { min-height: 44px; }
  /* the name of a video generation, a funscript's or a promotion's video:
     a link alone on its line, 44 px tall */
  .table.history-activity td.history-note > a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (max-width: 599px) {
  /* the head's Get tokens: the whole width under the balance */
  .history-actions > .btn { flex: 1 1 100%; }
  .table.history-activity td.history-note { min-width: 0; }
  .history-money { max-width: none; }
  /* a part: its date and its change on one line, its words under them */
  .history-part-list { gap: var(--space-3); }
  .history-part-list > li { grid-template-columns: max-content minmax(0, 1fr); gap: 0 var(--space-3); }
  .history-part-list .mono { text-align: left; }
  .history-part-words { grid-column: 1 / -1; }
}

/* ==== LB-P9: the note after a payment (billing/history.html) ============
   The note of design-system 5.1 under the page head, after a Buy press:
   paid, not confirmed yet, or failed. On a phone its one button takes the
   whole width, as the head's Get tokens does. */
@media (max-width: 599px) {
  .note.history-checkout .note-actions > .btn { flex: 1 1 100%; }
}

/* ==== SJ-P3: the page of one video generation (job-detail.md) ============
   The page places the parts of section 25; these few rules only fit them
   together on this page. */

/* the order's heading stands inside the head of its fold: the fold's own
   line spacing, none of a section heading's */
.fold-head > .section-title { margin: 0; }

/* a status block whose state offers no button draws no empty column */
.status-actions:empty { display: none; }

/* a notice whose hidden kind word stands before its paragraphs (the
   owner's failure texts come as whole paragraphs): the first paragraph
   keeps its place at the top */
.note-body > .sr-only:first-child + * { margin-top: 0; }

@media (max-width: 899px) {
  /* the video's picture on top of the status block stays a picture's size
     on a wide phone or a tablet (at 768 px a full-width picture pushed
     Watch under the first screen); on a narrow phone it is the full width */
  .status-block > .status-media { max-width: 24rem; }
  /* the order's copy button is 44 px square on a phone, like every
     other control there (the part itself is drawn 32 px) */
  .facts-value > .copy { min-width: 44px; min-height: 44px; }
}

/* ==== S6: 7. The question before an act that cannot be undone ============
   The box (core/_confirm.html) is a dialog of S5a's skeleton; parts.js
   fills it from the pressed form. Its title can carry words the customer
   typed (a video's title, the first words of an order): a long word wraps.
   A question without a text under its title keeps the head's full space
   above the answers. (The job page's Cancel generation is placed by the
   status block of S16a: .status-actions .status-danger.) */
.confirm-modal .modal-title { overflow-wrap: anywhere; }
.confirm-modal .modal-head:has(+ .modal-body[hidden]) { padding-bottom: var(--space-5); }

/* ==== 10. Status marks and tags (package S12) =========================== */

/* 10.1 A state, always with a word: a sign and a colour for its tone, its
   words from core/status.py ({% status_mark obj %}, core/_status.html).
   One to four words on one line; there is no long mark. Every tone's
   colour is 5.2:1 or more on the ground, the panels and the tip's box. */
.status {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.1rem 0.6rem 0.1rem 0.5rem;
  border: 1px solid currentColor; border-radius: var(--radius-pill);
  font-family: var(--sans); font-size: var(--text-badge); font-weight: 600;
  line-height: 1.3; letter-spacing: normal; text-transform: none;
  white-space: nowrap; vertical-align: middle;
}
.status-sign {
  flex: none; display: inline-grid; place-items: center;
  width: 1em; height: 1em; font-weight: 700; line-height: 1;
}
.status-sign::before { display: block; }
.status-working { color: var(--accent); }
.status-waiting { color: var(--muted); }
.status-attention { color: var(--warn); }
.status-done { color: var(--ok); }
.status-failed { color: var(--danger); }
.status-ended { color: var(--muted); }
/* the signs: a dot that pulses (still for a customer who asked for less
   motion), a ring, an exclamation mark, a tick, a cross, a dash */
.status-working .status-sign::before {
  content: ""; width: 0.55em; height: 0.55em; border-radius: 50%;
  background: currentColor; animation: status-pulse 1.4s ease-in-out infinite;
}
.status-waiting .status-sign::before { content: "\25CB"; }
.status-attention .status-sign::before { content: "!"; }
.status-done .status-sign::before { content: "\2713"; }
.status-failed .status-sign::before { content: "\2715"; }
.status-ended .status-sign::before { content: "\2013"; }
@keyframes status-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) {
  .status-working .status-sign::before { animation: none; }
}

/* 10.2 A label that is not a state ('custom', 'revision', 'older version',
   a cost beside a switch): an outline only, no sign, never a state's
   colour unless it warns. */
.tag {
  display: inline-flex; align-items: center;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill);
  background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: var(--text-badge); font-weight: 400;
  line-height: 1.3; letter-spacing: normal; text-transform: none;
  white-space: nowrap; vertical-align: middle;
}
.tag-warn { color: var(--warn); border-color: var(--warn); }

/* ==== 9.3 The job card (package S14) ==================================== */

/* The card of one video generation (studio/_job_card.html) on the list of
   video generations, on Your Generations and under the order form. The
   text column takes the rest of the row, so the bar runs its whole width
   (SJ-M2); the buttons stand in one row at the right and never stack
   (SJ-06). The state is the mark that leads the facts line: nothing
   state-like stands among the buttons (SJ-13). The facts line is a line of
   text, not a column of figures, so it is set in the site's sans-serif. */
.job-card .job-main { flex: 1 1 auto; min-width: 0; }
.job-card .job-meta {
  display: block; font-family: var(--sans); line-height: 1.7;
  overflow-wrap: anywhere;
}
.job-card .job-meta .status { margin-right: var(--space-1); }
/* one line each: what happened and what it cost; the Discord help, quiet;
   the stage under the bar */
.job-card .card-line { margin-top: var(--space-1); font-size: var(--text-body); line-height: 1.5; }
.job-card .job-outcome { color: var(--text); }
.job-card .card-help { color: var(--muted); }
.job-card .job-stage { font-size: var(--text-meta); color: var(--muted); overflow-wrap: anywhere; }
.job-card .job-actions {
  flex: none; display: flex; flex-wrap: nowrap; align-items: center;
  justify-content: flex-end; gap: var(--space-2);
}
.job-card .job-actions form { display: flex; margin: 0; }
.job-card .job-actions .btn { white-space: nowrap; }
/* the compact card under the order form: the title, the mark, Open */
.job-card-compact .job-meta { margin-top: var(--space-1); }

@media (max-width: 899px) {
  /* the buttons form a row under the text: Open on the left, the second
     action on the right at its own width, never two equal halves (SJ-08) */
  .job-card .job-actions { justify-content: space-between; }
  .job-card .job-actions > * { flex: none; }
  .job-card .job-actions .btn { width: auto; }
  /* the compact card stays one row: the title over the mark, Open at the
     right of the title */
  .job-card.job-card-compact { flex-direction: row; align-items: flex-start; }
  .job-card-compact .job-actions { justify-content: flex-end; }
}

/* ==== S7: the top bar marks where he is, the skip link, the balance ======
   (design-system 11.1, 11.4, 15; pages/site-shell.md 2 and 8) */

/* the first stop of the keyboard on every page: it waits above the top
   edge and comes into sight while it has the focus; it jumps into the page
   past the top bar */
.skip-link {
  position: absolute; left: var(--space-4); top: var(--space-2); z-index: var(--layer-modal);
  display: inline-flex; align-items: center; min-height: var(--control-h);
  padding: 0 var(--space-4);
  background: var(--panel-2); color: var(--text); font-weight: 700;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; text-decoration: none; }
/* the jump lands under the top bar, which stays at the top of the screen,
   not behind it */
#main { scroll-margin-top: 4.75rem; }

/* the links of the top bar have a little room above and below, so the
   mark of the current section stands clear of the label (mobile.css lays
   the menu rows out on a phone) */
.nav-links > .nav-link { padding-block: var(--space-1); }

/* the section he is in: the label in full white with a 2 px pink bar under
   it, a shape and not a colour alone, at every width and in the phone menu
   (the link also carries aria-current="page") */
.nav-link.is-active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
/* Studio keeps its pink label at every width, also as the current section
   (it lost to .nav-link before) */
.nav-link.nav-accent { color: var(--accent); }

/* the top bar's Sign up on the sign-up page: pressed, with the same bar
   under it, so the form's own Sign up is the one button to press there */
.btn.is-active[aria-current="page"] {
  background: var(--panel-2); border-color: var(--line-strong); color: var(--text);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45), inset 0 -2px 0 var(--accent);
}

/* the balance: a pill that leads to the token packs, its figure with a
   comma every three digits, the unit word and a "+" that says pressing it
   buys more; yellow below the tokens a video generation needs to start */
.balance {
  display: inline-flex; align-items: center; gap: 0.35em;
  padding: 0.15rem 0.3rem 0.15rem 0.75rem;
  border: 1px solid var(--accent-dim); border-radius: var(--radius-pill);
  color: var(--text); font-size: var(--text-meta); line-height: 1.5; white-space: nowrap;
}
.balance:hover { text-decoration: none; color: var(--text); border-color: var(--accent); }
.balance-amount { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.balance-unit { color: var(--muted); }
/* the "+" is drawn, two bars through the middle of the circle, and the
   written "+" is hidden: a written "+" sits where the font puts it, low and
   to one side of the circle (the owner's picture of 2026-11-17, 22:03) */
.balance-add {
  --add-ground: var(--accent);
  display: inline-block; flex: none;
  width: 1.25rem; height: 1.25rem; border-radius: 50%;
  background:
    linear-gradient(var(--accent-ink), var(--accent-ink)) center / 0.625rem 0.125rem no-repeat,
    linear-gradient(var(--accent-ink), var(--accent-ink)) center / 0.125rem 0.625rem no-repeat,
    var(--add-ground);
  font-size: 0; line-height: 0; color: transparent; overflow: hidden;
}
.balance.is-low, .balance.is-low:hover { border-color: var(--warn); }
.balance.is-low .balance-amount { color: var(--warn); }
.balance.is-low .balance-add { --add-ground: var(--warn); }
/* on the packs page the balance is the current link: the same straight bar,
   under the pill (a bar inside it would bend with its round ends) */
.balance.is-active { position: relative; box-shadow: none; }
.balance.is-active::after {
  content: ""; position: absolute; left: 0.75rem; right: 0.75rem; bottom: -6px;
  height: 2px; background: var(--accent);
}

@media (min-width: 900px) and (max-width: 1099px) {
  /* a narrow desktop: the search field is already at its smallest, so the
     row keeps on one line and inside the screen with smaller gaps and the
     balance without its unit word (its name still says it). Measured: at
     900 px the row of a customer was 67 px wider than the screen without
     this, 0 px with it, also with a six-figure balance. */
  .nav, .nav-links { gap: var(--space-3); }
  .nav-links .balance-unit { display: none; }
}

@media (max-width: 899px) {
  /* the balance in the phone's top bar is as tall as the controls beside it */
  .balance { min-height: var(--control-h); }
  /* in the phone menu the balance is a row like the others, its words
     "Get more tokens" at the row's end */
  .nav-links .nav-link.balance {
    justify-content: flex-start; gap: 0.35em;
    border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  }
  .nav-links .nav-link.balance .menu-only { margin-left: auto; }
  .nav-links .nav-link.balance.is-active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav-links .nav-link.balance.is-active::after { content: none; }
  /* the tab of the section he is in: a 3 px pink bar above its sign as
     well as its pink label */
  .tab.is-active { box-shadow: inset 0 3px 0 var(--accent); }
}

@media (max-width: 379px) {
  /* the narrowest phones show the figure and its "+" without the unit word;
     the control's name still says it */
  .nav-chip-m .balance-unit { display: none; }
}

/* ==== S8: the phone's bars, the menu, the consent bar ===================
   (design-system 11.2, 11.3, 11.5, 17.3; pages/site-shell.md 3 and 6.4).
   The phone's top bar, tab bar and menu are laid out by mobile.css. */

/* Log out is the last link of the desktop row; on a phone it stands apart
   at the menu's foot (mobile.css) */
.menu-foot { display: contents; }

@media (max-width: 899px) {
  /* the consent bar stands above the tab bar, and above a form's bar of
     its main button where a page shows one (0 until then), so it hides
     neither; every box over the page covers it (--layer-consent) */
  .consent-bar {
    bottom: calc(var(--tabbar-space, 0px) + var(--actionbar-space, 0px));
    padding-bottom: 0.7rem;
  }
}

/* ==== SO-P1: 21. The upload panel ======================================== */

/* A place of a form that takes files: its buttons and the line that counts
   what it holds, then the files, as small pictures (pictures and clips) or
   as rows (music in its play order, one reference video). A file on its way
   shows how far it is sent; a failed one gets a red edge, the cross sign of
   a failure and its own Try again button beside its remove button, so the
   two never lie on each other. Under 900 px a picture is 72 px and every
   button of a file is 44 x 44 px.
   Old names keep this look until no page uses them (aliases): .upload-panel,
   .thumb-strip, .thumb, .thumb-pct, .thumb-x, .thumb-clip, .thumb-more,
   .music-order, .music-move, .music-remove, .note-act. */
.upload, .upload-panel { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.upload .upload-actions, .upload-panel .upload-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin: 0;
}
.upload-summary { margin: 0; color: var(--muted); font-size: var(--text-body); }
.upload-summary:empty { display: none; }
.upload-bulk { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }

/* pictures: a grid of small pictures, three rows in sight, the rest scrolls */
.upload-tiles, .thumb-strip {
  list-style: none; margin: 0; padding: var(--space-1);
  display: grid; grid-template-columns: repeat(auto-fill, 64px); gap: var(--space-2);
  max-height: calc(3 * 64px + 2 * var(--space-2) + 2 * var(--space-1) + 2px);
  overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.upload-tile, .thumb {
  position: relative; width: 64px; height: 64px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--panel-2);
}
.upload-pic, .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.upload-ext, .thumb-clip, .upload-more, .thumb-more {
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-badge); font-weight: 700; color: var(--muted);
}
/* a clip's or a kept file's kind, at the bottom: the remove button keeps the top corner */
.upload-ext { width: 100%; height: 100%; align-items: flex-end; padding-bottom: 6px; }
.upload-more { width: 64px; height: 64px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
/* how far a picture is sent */
.upload-pct, .thumb-pct {
  position: absolute; left: 4px; bottom: 4px; z-index: 2;
  padding: 0 0.3rem; border-radius: 4px;
  background: rgba(0, 0, 0, 0.75); color: var(--text);
  font-family: var(--mono); font-size: var(--text-badge); line-height: 1.4;
  pointer-events: none;
}
/* the remove button in the picture's corner */
.upload-x, .thumb-x {
  position: absolute; top: 0; right: 0; z-index: 3;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 0 0 0 var(--radius-sm);
  background: rgba(0, 0, 0, 0.7); color: #fff;
  font: inherit; font-size: 14px; line-height: 1; cursor: pointer;
}
.upload-x:hover, .thumb-x:hover { background: rgba(200, 30, 30, 0.9); }
/* a failed picture: two cells wide, a red edge and the cross sign, the
   picture with its remove button in the first cell, Try again in the second */
.upload-tile.is-failed {
  grid-column: span 2; width: auto;
  display: flex; align-items: center; gap: var(--space-1);
  border-color: var(--danger);
}
.upload-tile.is-failed .upload-pic, .upload-tile.is-failed .upload-ext { flex: none; width: 62px; }
.upload-tile.is-failed .upload-x { right: auto; left: calc(62px - 28px); }
.upload-tile.is-failed::after, .upload-row.is-failed .upload-state::before {
  content: "\2715"; content: "\2715" / "";
  display: inline-grid; place-items: center;
  width: 1.15rem; height: 1.15rem; border-radius: 50%;
  background: var(--danger); color: var(--ground);
  font-size: 0.7rem; font-weight: 800; line-height: 1;
}
.upload-tile.is-failed::after { position: absolute; left: 4px; bottom: 4px; z-index: 2; }
.upload-tile .upload-retry {
  flex: 1 1 auto; min-width: 0; margin-right: var(--space-1);
  padding: 0.2rem 0.3rem; white-space: normal; line-height: 1.15;
  font-size: var(--text-badge);
}

/* music and the reference video: one row a file; music is numbered in its
   play order */
.upload-rows, .music-order {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--space-1);
  counter-reset: upload-row;
}
.upload-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2);
  font-size: var(--text-body);
}
[data-upload-order] .upload-row::before {
  counter-increment: upload-row; content: counter(upload-row) "."; flex: none; color: var(--muted);
}
.upload-name { flex: 1 1 6rem; min-width: 0; overflow-wrap: anywhere; }
.upload-size, .upload-state { color: var(--muted); font-size: var(--text-meta); }
.upload-size { white-space: nowrap; }
/* the buttons of a row stand together at its right end, also when they
   drop to a second line */
.upload-row > button:first-of-type { margin-left: auto; }
.upload-state:empty { display: none; }
.upload-row.is-failed { border-color: var(--danger); }
.upload-row.is-failed .upload-state { color: var(--danger); }
.upload-row.is-failed .upload-state::before { margin-right: 0.35em; vertical-align: -0.1em; }
.upload-row .upload-x {
  position: static; width: 2rem; height: 2rem; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
}
.upload-row .upload-x:hover, .music-remove:hover { background: rgba(227, 123, 123, 0.12); color: var(--danger); }
.upload-up:disabled, .upload-down:disabled, .music-move:disabled { opacity: 0.35; cursor: default; }
/* the old small buttons of a row and of a note keep a button's height */
.music-move, .note-act { min-height: 2rem; }

/* how his own pictures are used: two choice cards under the pictures, the
   whole group outlined in red with its line when it is refused */
#art-mode-wrap { margin: var(--space-2) 0 0; padding: 0; border: 0; min-width: 0; }
#art-mode-wrap > .field-error, #art-mode-wrap > .errorlist { grid-column: 1 / -1; }
#art-mode-wrap.is-invalid .choice-card { border-color: var(--danger); }

@media (max-width: 899px) {
  .upload-tiles, .thumb-strip {
    grid-template-columns: repeat(auto-fill, 72px);
    max-height: calc(3 * 72px + 2 * var(--space-2) + 2 * var(--space-1) + 2px);
  }
  .upload-tile, .thumb, .upload-more { width: 72px; height: 72px; }
  .upload-tile.is-failed { width: auto; }
  .upload-tile.is-failed .upload-pic, .upload-tile.is-failed .upload-ext { width: 70px; }
  /* every button of a file is 44 x 44 px, and none lies on another */
  .upload-x, .thumb-x { width: 44px; height: 44px; font-size: 16px; }
  .upload-tile.is-failed .upload-x { left: calc(70px - 44px); }
  .upload-tile .upload-retry { min-height: 44px; }
  /* a row: the file's name on its own line, its size, state and buttons
     under it, the buttons together at the right */
  .upload-row .upload-name { flex-basis: calc(100% - 2.5rem); }
  .upload-row .upload-x, .upload-up, .upload-down, .upload-row .upload-retry, .music-move, .note-act {
    min-width: 44px; min-height: 44px;
  }
}

/* ==== SO-P3: 22. The character picker, a combobox ======================== */

/* A search box with a visible label over the site's list of characters:
   the names that hold the typed letters drop down over the page, the
   marked one with an outline and a ground (not colour alone); the line
   that says nothing matches stands under the box with its button; each
   name taken is a chip with its own remove button, 44 px tall with a
   44 x 44 px remove button under 900 px.
   Old names keep this look until no page uses them (aliases): .char-picker,
   .char-selected, .char-chip, .char-chip-x, .char-search-wrap,
   .char-suggestions, .char-suggestion. The old pill of goonlab.css
   (#char-search) is beaten by the same id. */
.picker, .char-picker { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.picker-box, .char-search-wrap { position: relative; }
#char-search.picker-input {
  width: 100%; min-height: var(--control-h);
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--text); padding: 0.6rem 0.8rem;
  font: inherit; font-size: var(--text-body);
}
#char-search.picker-input:focus { border-color: var(--accent); }
.is-invalid #char-search.picker-input { border-color: var(--danger); }

/* the names that hold the typed letters, over the page */
.picker-list, .char-suggestions {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: var(--layer-dropdown);
  width: min(26rem, 100%);
  margin: 0; padding: var(--space-1); list-style: none;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
}
.picker-option, .char-suggestion {
  display: flex; align-items: center; min-height: var(--control-h);
  padding: 0.35rem 0.75rem; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); text-align: left;
  font: inherit; font-size: var(--text-body); cursor: pointer;
}
/* the marked name: a ground and an outline, so it is told by shape too */
.picker-option[aria-selected="true"], .char-suggestion:hover, .char-suggestion:focus-visible {
  background: var(--tint); color: var(--text);
  outline: 2px solid var(--accent); outline-offset: -2px;
}

/* nothing on the list holds the typed letters: the line and its button */
.picker-none {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
  color: var(--muted); font-size: var(--text-body); line-height: 1.5;
}

/* the names taken: chips with a remove button at the end */
.picker-chips, .char-selected {
  display: flex; flex-wrap: wrap; gap: var(--space-2);
  margin: 0; padding: 0; list-style: none;
}
.picker-chips:empty, .char-selected:empty { display: none; }
.picker-chip, .char-chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: 2rem; padding: 0 0 0 0.85rem;
  background: var(--tint); color: var(--accent);
  border: 1px solid var(--accent-dim); border-radius: var(--radius-pill);
  font-family: var(--sans); font-size: var(--text-meta); line-height: 1.3;
}
.chip-x, .char-chip-x {
  display: inline-flex; align-items: center; justify-content: center; align-self: stretch;
  min-width: 2rem; padding: 0;
  border: 0; border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  background: none; color: var(--muted);
  font: inherit; font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.chip-x:hover, .char-chip-x:hover { color: var(--danger); background: rgba(227, 123, 123, 0.12); }

/* a typed name close to a listed one (the order form, after a press): the
   buttons that take the listed one, then the tick that keeps the typed
   name; the live line that a typed name is on the list, with its buttons */
.near-name { display: flex; flex-direction: column; gap: var(--space-3); }
.near-name-use, .roster-hint { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }

@media (max-width: 899px) {
  .picker-list, .char-suggestions { width: 100%; }
  /* each chip 44 px tall, its remove button a 44 x 44 px box at its end */
  .picker-chip, .char-chip { min-height: 44px; padding-block: 0; padding-right: 0; }
  .chip-x, .char-chip-x { min-width: 44px; min-height: 44px; }
}

/* ==== SO-P4: 20. Numbered steps ========================================== */

/* A long form cut into numbered steps: space and the step's heading set
   each step apart, never a box around it (only choices, the price, notes
   and the upload tiles keep an edge). The number badge keeps the site's
   gradient circle; a counter draws it on an empty badge only, so a step a
   script hides is not counted and a page that writes its own number keeps
   it. The rare options stand after the steps in one fold, unnumbered, each
   of its sections headed one step smaller. Old names keep their look in
   studio.css until no page uses them: .step, .step-extras, .adv-options. */
.form-steps {
  display: flex; flex-direction: column; gap: var(--space-6);
  min-width: 0; counter-reset: form-step;
}
.form-step, .form-step-sub { min-width: 0; margin: 0; }
.form-step-head {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4);
}
.form-step-n {
  flex: none; display: grid; place-items: center;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  background: var(--grad); color: var(--accent-ink);
  font-weight: 800; font-size: 0.9rem; line-height: 1;
  box-shadow: 0 2px 10px var(--glow-strong);
}
.form-step-n:empty { counter-increment: form-step; }
.form-step-n:empty::before { content: counter(form-step); }
.form-step-title {
  margin: 0; min-width: 0;
  font-size: var(--text-h3); line-height: 1.35; font-weight: 700; letter-spacing: -0.01em;
}
/* a section inside the fold: an h2 for the page's order of headings, drawn
   at the same step and a little lighter than a numbered step's */
.form-step-title-sub { font-weight: 600; }
.form-step-body { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
/* a note inside a step sits in the step's own rhythm */
.form-step .notice, .form-step-sub .notice { margin: 0; }

/* the one fold of rare options after the steps */
.form-step-fold > .fold-body { gap: var(--space-5); padding-top: var(--space-2); }
.form-step-fold .form-step-head { margin-bottom: var(--space-3); }

/* a group of ticks or round choices named by its legend, with no frame */
fieldset.field-set {
  margin: 0; padding: 0; border: 0; min-width: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
}
fieldset.field-set > legend { padding: 0; margin: 0 0 var(--space-2); }

/* the add-ons: one tick each, its tip beside the tick's first line */
.addons-title { margin: 0; font-size: var(--text-meta); font-weight: 600; line-height: 1.5; }
div.field-head.addon { flex-wrap: nowrap; align-items: flex-start; }
div.field-head.addon > label.check { flex: 0 1 auto; min-width: 0; }
div.field-head.addon > .tip { flex: none; margin-top: 0.15rem; }

@media (max-width: 899px) {
  .form-steps { gap: var(--space-5); }
  .form-step-n { width: 1.5rem; height: 1.5rem; font-size: 0.8rem; }
}

/* ==== SO-P5: 3.3 Pick-one choices ========================================= */

/* A choice of one among a few, each a card with a real radio in it: the
   whole card is the hit area; the radio itself is not drawn, the card's
   sign shows the state instead: an empty ring, or the pink circle with a
   tick on the checked card, whose edge turns pink too (shape and colour).
   The arrow keys move between the cards (the radios' own behaviour); the
   focus ring is drawn around the card. Used by the order form's reference
   video, the four quality levels and the two ways of using his own
   pictures. Old names keep their look until no page uses them (aliases in
   studio.css): .choice-cards, .choice-card, .mode-cards, .mode-card. */
fieldset.choices {
  margin: 0; padding: 0; border: 0; min-width: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: var(--space-3);
}
fieldset.choices > .field-error, fieldset.choices > .errorlist { grid-column: 1 / -1; }
label.choice {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  padding: var(--space-3) calc(var(--space-4) + 1.3rem) var(--space-3) var(--space-4);
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--text); cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
label.choice:hover { border-color: var(--accent); }
/* the radio stays in the card for the keyboard and a screen reader, unseen */
label.choice > .choice-input {
  position: absolute; top: var(--space-3); right: var(--space-3);
  width: 1.3rem; height: 1.3rem; margin: 0; opacity: 0; pointer-events: none;
}
/* the card's sign */
label.choice::after {
  content: ""; position: absolute; top: var(--space-3); right: var(--space-3);
  box-sizing: border-box; width: 1.3rem; height: 1.3rem; border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 800; line-height: 1;
}
label.choice:has(> .choice-input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 6px 20px var(--glow);
  background: linear-gradient(180deg, var(--tint), transparent 60%), var(--panel-2);
}
label.choice:has(> .choice-input:checked)::after {
  content: "\2713"; content: "\2713" / "";
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
label.choice:has(> .choice-input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset.choices.is-invalid label.choice { border-color: var(--danger); }
.choice-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.choice-title { font-size: var(--text-body); font-weight: 700; line-height: 1.35; }
.choice-body .choice-text { display: block; color: var(--muted); font-size: var(--text-body); line-height: 1.45; }
/* a card's price: at the card's foot, with its estimate word */
.choice-figure {
  margin-top: auto; padding-top: var(--space-2);
  font-family: var(--mono); font-size: var(--text-meta); color: var(--accent);
}
.choice-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.choice-tags:not(:has(.tag:not([hidden]))) { display: none; }

/* the order form's four quality levels: four in a row, two in a row up to
   1000 px, one under 480 px */
fieldset.choices.quality-choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) {
  fieldset.choices.quality-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  fieldset.choices.quality-choices { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { label.choice { transition: none; } }

/* ==== SO-P6: the order form's press and its questions (design-system 6.1, 6.5;
   studio-order-form.md 4.6) ====================================================
   The seven boxes stand on the skeleton of 6.1. The refusal box holds two rows
   of answers: its switch answers in a row of their own, one rank and the same
   width each (no switch is the recommended one), then the row of "Keep" and
   "Edit my request", set apart by space and a line. The copy of a question
   beside the start button keeps each part of the box's text on a line of its
   own. */
.modal-foot > .modal-actions + .modal-actions {
  margin-top: var(--space-3); padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}
@media (min-width: 600px) {
  .modal-actions-switch { flex-wrap: nowrap; align-items: stretch; }
  .modal-actions-switch > .modal-action { flex: 1 1 0; }
  .modal-actions-switch > .modal-action > .btn { width: 100%; flex: 1 1 auto; }
}
[data-question-text] { white-space: pre-line; }

/* ==== SO-P7: 23. Price and start ============================================
   The price card and the start button of a form that spends tokens (the
   order form; the change form from SO-P12). At desktop width they stand in
   a side column that stays in sight beside the form; under 900 px the
   price card stays in the flow, its start button is hidden, and the bar at
   the end of the form (17.3) holds the figure, the question and the start
   button. One start button is in sight at any width. Old names keep
   working until S17: the order form's .studio-form, .studio-main,
   .studio-side and .side-sticky (studio.css held their rules), and
   .estimate-panel, .estimate-head, .estimate-label, .estimate-value,
   .estimate-rows, .estimate-row, .studio-actions and .btn-generate. */

/* the two columns: the form, and the price beside it; 16rem between 900
   and 1000 px; one column under 900 px. .price-layout-stacked keeps one
   column at every width (a change form that is one section of a page). */
.price-layout, .studio-form {
  display: grid; grid-template-columns: minmax(0, 1fr) 19rem;
  gap: var(--space-5); align-items: start;
}
.price-layout-main, .studio-main {
  display: flex; flex-direction: column; gap: var(--space-4); min-width: 0;
}
/* the side column is as tall as the form, so the column in it has room to
   stay in sight; parts.js lowers its top when it is taller than the screen,
   so that the start button at its foot stays in sight */
.price-layout-side, .studio-side { min-width: 0; align-self: stretch; }
.price-layout-sticky, .side-sticky {
  position: sticky; top: var(--price-sticky-top, 5rem);
  display: flex; flex-direction: column; gap: var(--space-3);
}
@media (max-width: 1000px) {
  .price-layout, .studio-form { grid-template-columns: minmax(0, 1fr) 16rem; }
}
.price-layout.price-layout-stacked { grid-template-columns: minmax(0, 1fr); }

/* the part: the price card, the question, the line of a held press, the
   start button with its reason, "Start over" */
.price-start, .studio-actions { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; }
.price-start > #form-reset { align-self: center; }
.btn-generate { width: 100%; }

/* the price card: its label and tip, the estimate, the rows, the balance,
   its two warnings */
.card.price, .estimate-panel {
  display: flex; flex-direction: column; gap: var(--space-2);
  border-color: var(--accent-dim);
  background: linear-gradient(160deg, var(--tint), transparent 60%), var(--panel);
  box-shadow: 0 8px 30px var(--glow);
}
.price-head, .estimate-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
}
.price-label, .estimate-label {
  font-family: var(--sans); font-size: var(--text-meta); font-weight: 600; color: var(--muted);
}
.price-figure, .estimate-value { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.price-figure { margin: 0; font-size: 1.5rem; line-height: 1.2; overflow-wrap: anywhere; }
/* a length the form refuses: a sentence in place of the figure */
.price-figure.is-refused {
  font-family: var(--sans); font-size: var(--text-body); font-weight: 600;
  line-height: 1.5; color: var(--text);
}
.price-rows, .estimate-rows { display: flex; flex-direction: column; gap: var(--space-1); margin: 0; }
.price-rows { border-top: 1px solid var(--line); padding-top: var(--space-2); }
.price-row, .estimate-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--space-3); font-size: var(--text-meta); color: var(--muted);
}
.price-row > dt, .price-row > dd { margin: 0; min-width: 0; }
.price-row > dd, .estimate-row .mono { flex: none; white-space: nowrap; color: var(--text); }
.price-balance { margin: 0; font-size: var(--text-body); color: var(--text); }
.price .note { margin: 0; }

/* the question beside the start button, on the compact warning's look
   (its old class draws the sign) */
.note-compact.question-inline {
  margin: 0;
  padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 1.25rem + var(--space-2));
}
.note-compact.question-inline::before {
  left: var(--space-3); top: calc(var(--space-2) + 0.15rem); width: 1.25rem; height: 1.25rem;
}
.question-inline > p, .action-question > p { margin: 0; min-width: 0; }

/* the phone's bar: the figure and the balance, a link to the price card;
   the attention sign beside the figure while a warning of the price card
   shows */
.price-bar .action-cost a {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--space-1);
  min-height: 44px; color: var(--text); text-decoration: none;
}
.action-cost-figure { font-family: var(--mono); font-weight: 700; color: var(--accent); }
.price-bar [data-balance-mirror], .action-cost-sep { color: var(--muted); }
.price-bar[data-price-refused] .action-cost-figure {
  font-family: var(--sans); font-weight: 600; color: var(--text);
}
.price-bar[data-price-warn] .action-cost-figure::before {
  content: "!"; content: "!" / "";
  display: inline-grid; place-items: center; vertical-align: 0.1em;
  width: 1.25rem; height: 1.25rem; margin-right: var(--space-2); border-radius: 50%;
  background: var(--warn); color: var(--ground);
  font-family: var(--sans); font-size: 0.8rem; font-weight: 800; line-height: 1;
}

@media (max-width: 899px) {
  .price-layout, .studio-form { grid-template-columns: minmax(0, 1fr); }
  .price-layout-sticky, .side-sticky { position: static; }
  /* the bar holds the start button, its reason and "Get tokens" here */
  .price-layout:not(.price-layout-stacked) .price-start-go .btn-generate { display: none; }
  .price-layout:not(.price-layout-stacked) .price-start-go { display: none; }
}
/* a narrow phone: the balance on its own line under the figure, without
   the dot that would end the first line */
@media (max-width: 479px) {
  .action-cost-sep { display: none; }
  .price-bar [data-balance-mirror] { flex-basis: 100%; }
}
