/* WORDS-02 and WORDS-03: Describe a pizza on Build. Loaded only when the
   sheet opens. WORDS-03's "Workspace" look (round 2 mocks, direction A): a
   solid card with a hairline border, a soft shadow and a 16 px radius, a
   fixed header bar and a fixed footer action bar, the body scrolling between
   them. It is a dense tool surface, so it leaves out the brand modal's grain,
   rust border and watermark (docs/codex/design-rules.md, the scoped
   amendment to Modal brand DNA). Two panes from 900 px, one column below,
   and the whole screen on a phone. Every rule is scoped to the sheet. */

/* ── The card ── */
body .brb-modal-shell.words-sheet-modal {
    display: flex;
    width: min(720px, calc(100vw - 56px));
    max-width: none;
    max-height: min(852px, calc(var(--brb-modal-viewport-height, 100vh) - 48px));
    padding: 0;
    overflow: hidden;
    background-color: var(--card-bg);
    background-image: none;
    border: 1px solid rgba(var(--ink-rgb), .12);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(43, 30, 22, .28), 0 4px 14px rgba(43, 30, 22, .10);
}
body .brb-modal-shell.words-sheet-modal.words-unavailable-modal { width: min(100%, 468px); }
body .brb-modal-shell.words-sheet-modal::before { content: none; display: none; }
/* modal.js's close button moves into the header bar; its own holder stays empty. */
body .brb-modal-shell.words-sheet-modal > .brb-modal-header { display: none; }
body .brb-modal-shell.words-sheet-modal > .brb-modal-content.words-sheet {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    padding: 0;
}
.words-sheet *,
.words-how-modal * { box-sizing: border-box; }
@media (min-width: 900px) {
    body .brb-modal-shell.words-sheet-modal.words-has-draft { width: min(1040px, calc(100vw - 56px)); }
}

/* ── The bars ── */
.words-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
}
.words-head {
    padding: 18px 20px 18px 28px;
    border-bottom: 1px solid rgba(var(--ink-rgb), .10);
}
.words-foot {
    padding: 16px 28px;
    border-top: 1px solid rgba(var(--ink-rgb), .10);
}
.words-spacer { flex: 1 1 auto; }
.words-title {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.2;
}
.words-beta {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border: 1px solid rgba(var(--sage-rgb), .5);
    border-radius: 999px;
    color: var(--sage-deep);
    font-family: var(--font-app);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}
.words-feedback, .words-save-image {
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: underline;
    text-decoration-color: rgba(var(--stone-rgb), .4);
    text-underline-offset: 3px;
}
.words-feedback:hover, .words-save-image:hover { color: var(--ink); text-decoration-color: currentColor; }
/* modal.js's close, as a bar control rather than a floating one. */
body .words-sheet-modal .words-head .brb-modal-close.words-close {
    position: static;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(var(--ink-rgb), .12);
    background: var(--card-bg);
    color: var(--stone);
}
body .words-sheet-modal .words-head .brb-modal-close.words-close:hover { border-color: rgba(var(--rust-rgb), .3); color: var(--ink); }
.words-close svg { width: 18px; height: 18px; }
.words-title:focus,
.words-name:focus,
.words-status:focus,
.words-alert:focus,
.words-foot-status:focus { outline: none; }

.words-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ── Controls ── */
.words-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 10px;
    font-family: var(--font-app);
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.words-btn-primary { border: 1px solid var(--rust); background: var(--rust); color: var(--card-bg); }
.words-btn-primary:hover:not(:disabled) { border-color: var(--rust-hover); background: var(--rust-hover); }
.words-btn-secondary { border: 1px solid rgba(var(--rust-rgb), .35); background: var(--card-bg); color: var(--rust); }
.words-btn-secondary:hover:not(:disabled) { border-color: rgba(var(--rust-rgb), .6); background: rgba(var(--rust-rgb), .04); }
.words-btn:disabled { opacity: .45; cursor: default; }
.words-btn[aria-busy="true"] { cursor: progress; }
.words-btn-small { min-height: 36px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; }
.words-icon { display: inline-flex; flex: 0 0 auto; }
.words-icon svg { display: block; width: 100%; height: 100%; }
.words-btn .words-icon { width: 17px; height: 17px; }
.words-link {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    color: var(--rust);
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
}
.words-link-label {
    text-decoration: underline;
    text-decoration-color: rgba(var(--rust-rgb), .35);
    text-underline-offset: 3px;
}
.words-link:hover .words-link-label { text-decoration-color: currentColor; }

/* ── Describe ── */
.words-describe { padding: 26px 28px 24px; }
.words-label {
    display: block;
    margin: 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}
.words-helper {
    margin: 4px 0 12px;
    color: var(--stone-ink);
    font-family: var(--font-app);
    font-size: 14.5px;
    line-height: 1.45;
    text-wrap: pretty;
}
.words-sheet .words-field {
    display: block;
    width: 100%;
    min-height: 128px;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid rgba(var(--ink-rgb), .18);
    border-radius: 12px;
    background: #fffdf9;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 16.5px;
    line-height: 1.5;
    resize: vertical;
    scroll-margin: 16px;
}
/* The field's focus: the mock's quieter treatment (QA P3-5), a 2px wine
   border (1px border plus a 1px inset ring) and a soft halo, in place of
   shared.css's double ring for inputs. Both shared.css rules are
   :where(...):focus-visible with !important, so this one needs !important
   too; its specificity (0,3,0 with the textarea's own class) keeps it to
   this field and no other. The 2px wine edge contrasts 9:1 with the field
   and the page, and encloses the field, so it meets WCAG 2.2 focus
   appearance (2.4.13) and focus visible (2.4.7). */
.words-sheet .words-field:focus,
.words-sheet .words-field:focus-visible {
    border-color: var(--rust) !important;
    box-shadow: inset 0 0 0 1px var(--rust), 0 0 0 4px rgba(var(--rust-rgb), .12) !important;
    outline: none !important;
}
.words-count {
    min-height: 18px;
    margin: 6px 2px 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
    text-align: right;
}
.words-count:empty { min-height: 0; margin-top: 0; }
.words-count.is-over { color: var(--rust); font-weight: 700; }
.words-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(var(--rust-rgb), .22);
    border-radius: 10px;
    background: rgba(var(--rust-rgb), .06);
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.45;
}
.words-alert .words-icon { width: 18px; height: 18px; margin-top: 2px; color: var(--rust); }
.words-eyebrow {
    margin: 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .14em;
    line-height: 1.2;
    text-transform: uppercase;
}
.words-examples { margin-top: 18px; }
.words-example-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.words-example {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 14px;
    max-width: 100%;
    overflow-wrap: anywhere;
    border: 1px solid rgba(var(--ink-rgb), .14);
    border-radius: 999px;
    background: #fffdf9;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}
.words-example:hover { border-color: rgba(var(--rust-rgb), .4); }
.words-privacy {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 24px;
    padding: 14px 16px;
    border-radius: 12px;
    background: var(--cream);
}
.words-privacy p {
    margin: 0;
    color: var(--stone-ink);
    font-family: var(--font-app);
    font-size: 13.5px;
    line-height: 1.5;
}
.words-privacy > .words-icon { width: 18px; height: 18px; margin-top: 1px; color: var(--stone); }
.words-privacy .words-link { display: inline-block; margin-top: 6px; font-size: 13.5px; }

/* Feedback stays at the end of the body at every width. */
.words-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid rgba(var(--ink-rgb), .08);
}
.words-describe > .words-footer-links { display: flex; }

/* ── The words and the pizza ── */
.words-panes { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100%; }
.words-rail {
    padding: 26px 24px;
    border-right: 1px solid rgba(var(--ink-rgb), .08);
    background: var(--cream);
}
.words-rail-head { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.words-quote {
    margin: 12px 0 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 16px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}
.words-rail-note {
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid rgba(var(--ink-rgb), .10);
    color: var(--stone-ink);
    font-family: var(--font-app);
    font-size: 13px;
    line-height: 1.5;
    text-wrap: pretty;
}
.words-rail .words-field { min-height: 150px; margin-top: 12px; font-size: 15.5px; }
.words-rail label.words-eyebrow { display: block; line-height: 36px; }
.words-main { min-width: 0; padding: 26px 32px 28px; }
.words-kicker {
    margin: 0 0 6px;
    color: var(--rust);
    font-family: var(--font-app);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .14em;
    line-height: 1.2;
    text-transform: uppercase;
}
.words-name {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-brand);
    font-size: 34px;
    font-weight: 500;
    letter-spacing: -.01em;
    line-height: 1.12;
}
.words-why {
    max-width: 62ch;
    margin: 8px 0 0;
    color: var(--stone-ink);
    font-family: var(--font-app);
    font-size: 15.5px;
    line-height: 1.5;
    text-wrap: pretty;
}
.words-sec { margin-top: 26px; }
.words-sec-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(var(--ink-rgb), .10);
}
.words-sec-head.has-meta { align-items: center; }
.words-sec-head h4 {
    margin: 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .14em;
    line-height: 1.2;
    text-transform: uppercase;
}
.words-sec-meta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.3;
    text-align: right;
}
.words-sec-meta .words-icon { width: 14px; height: 14px; }
.words-rows { display: grid; gap: 10px; }
.words-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: start; gap: 12px; }
.words-row-label {
    padding-top: 6px;
    color: var(--stone-ink);
    font-family: var(--font-app);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
}
.words-none { padding-top: 6px; color: var(--stone); font-family: var(--font-app); font-size: 14px; line-height: 1.2; }
/* Build's ticket chips (.ticket-chip): the sage tint, the darker added tint
   with its plus, the struck name for one left out. */
.words-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.words-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: rgba(var(--sage-rgb), .13);
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.1;
}
.words-chip.is-added { border-color: rgba(var(--sage-rgb), .46); background: rgba(var(--sage-rgb), .34); }
.words-plus { margin-right: -1px; color: var(--sage-deep); font-weight: 700; }
.words-chip.is-out { gap: 8px; border-color: rgba(var(--stone-rgb), .38); background: transparent; color: var(--stone-light); }
.words-out-name { color: var(--stone-ink); text-decoration: line-through; text-decoration-color: rgba(var(--stone-rgb), .85); text-decoration-thickness: 1.5px; }
.words-chip.is-own { border: 1px dashed rgba(var(--stone-rgb), .6); background: var(--card-bg); }
.words-tag {
    margin-left: 3px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1;
    text-transform: uppercase;
}
.words-tag-out { margin-left: 0; padding-left: 8px; border-left: 1px solid rgba(var(--stone-rgb), .3); line-height: 14px; }
.words-notes { display: grid; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.words-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: var(--stone-ink);
    font-family: var(--font-app);
    font-size: 13.5px;
    line-height: 1.45;
}
.words-note > span:last-child { text-wrap: pretty; }
.words-note .words-icon { width: 16px; height: 16px; margin-top: 1px; color: var(--stone); }
/* A caution: untitled, a caution icon, a warmer tint and a rust rule. */
.words-caution {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 16px 12px 14px;
    border-left: 3px solid var(--rust);
    border-radius: 4px 10px 10px 4px;
    background: rgba(var(--rust-rgb), .055);
}
.words-caution > .words-icon { width: 18px; height: 18px; margin-top: 2px; color: var(--rust); }
.words-caution ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.words-caution li { color: var(--ink); font-family: var(--font-app); font-size: 14.5px; line-height: 1.45; text-wrap: pretty; }

/* Balance: the plain meter, five ticks, a quiet change at a riff's row end. */
.words-delta { margin: 0 0 14px; color: var(--ink); font-family: var(--font-app); font-size: 14.5px; font-weight: 500; line-height: 1.45; text-wrap: pretty; }
.words-meters { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, auto); grid-auto-flow: column; gap: 10px 40px; }
.words-meter { display: grid; grid-template-columns: 78px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.words-meter-label { color: var(--stone-ink); font-family: var(--font-app); font-size: 13px; font-weight: 500; line-height: 1.2; }
.words-ticks { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.words-tick { height: 8px; border-radius: 3px; background: rgba(var(--ink-rgb), .10); }
.words-tick.is-on { background: var(--sage); }
.words-meter-delta { color: var(--stone-ink); font-family: var(--font-app); font-size: 12.5px; font-weight: 700; line-height: 1; text-align: right; white-space: nowrap; }

/* ── Waiting ── */
.words-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    /* Two lines held, so a waiting line that wraps never moves the skeleton. */
    min-height: calc(2 * 1.3em);
}
/* The rotating waiting line (ai-waiting-lines.js): it fades out and in. */
.words-wait-line { flex: 1 1 auto; min-width: 0; opacity: 1; transition: opacity .1s ease; }
.words-wait-line.is-fading { opacity: 0; }
.words-how-privacy { margin: 14px 0 0; font-family: var(--font-app); font-size: 14.5px; line-height: 1.5; }
.words-spin {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(var(--rust-rgb), .2);
    border-top-color: var(--rust);
    border-radius: 50%;
    animation: words-spin .9s linear infinite;
}
@keyframes words-spin { to { transform: rotate(360deg); } }
@keyframes words-pulse { 50% { opacity: .55; } }
.words-skel { display: block; border-radius: 8px; background: rgba(var(--ink-rgb), .07); animation: words-pulse 1.6s ease-in-out infinite; }
.words-skel.is-name { width: 62%; height: 34px; margin-top: 22px; }
.words-skel.is-why { width: 80%; height: 14px; margin-top: 14px; }
.words-skel.is-label { width: 64px; height: 14px; margin-top: 8px; }
.words-skel.is-chip { height: 30px; border-radius: 999px; }
.words-skel.is-chip.is-s { width: 84px; }
.words-skel.is-chip.is-m { width: 112px; }
.words-skel.is-chip.is-l { width: 140px; }
.words-skel.is-meters { height: 64px; }
.words-skel-chips { display: flex; gap: 6px; }

/* ── Edit: the earlier pizza stays, quieter, its text still 4.5:1 or more ── */
.words-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(var(--sage-rgb), .12);
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}
.words-banner .words-icon { width: 16px; height: 16px; color: var(--sage-deep); }
/* One treatment for the whole earlier pizza (QA P3-6): every word in --stone
   (6:1 or more on every fill below), every fill, rule and icon at about half
   strength. The pizza is inert while the words are edited. */
.words-pizza.is-earlier,
.words-pizza.is-earlier * { color: var(--stone); }
.words-pizza.is-earlier .words-icon { opacity: .7; }
.words-pizza.is-earlier .words-chip { background: rgba(var(--sage-rgb), .07); }
.words-pizza.is-earlier .words-chip.is-added { background: rgba(var(--sage-rgb), .16); border-color: rgba(var(--sage-rgb), .28); }
.words-pizza.is-earlier .words-chip.is-own,
.words-pizza.is-earlier .words-chip.is-out { border-color: rgba(var(--stone-rgb), .3); background: transparent; }
.words-pizza.is-earlier .words-out-name { text-decoration-color: rgba(var(--stone-rgb), .6); }
.words-pizza.is-earlier .words-caution { background: rgba(var(--rust-rgb), .03); border-left-color: rgba(var(--rust-rgb), .4); }
.words-pizza.is-earlier .words-tick { background: rgba(var(--ink-rgb), .06); }
.words-pizza.is-earlier .words-tick.is-on { background: rgba(var(--sage-rgb), .45); }

/* ── Footer ── */
.words-foot-status {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin: 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
}
.words-foot-status .words-icon { width: 16px; height: 16px; color: var(--rust); }
.words-foot-status > span:last-child { text-wrap: pretty; }

/* ── How your words are used, over the sheet ── */
body .brb-modal-shell.words-how-modal {
    width: min(100%, 520px);
    padding: 0;
    background-image: none;
    border: 1px solid rgba(var(--ink-rgb), .12);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(43, 30, 22, .28), 0 4px 14px rgba(43, 30, 22, .10);
}
body .brb-modal-shell.words-how-modal::before { content: none; display: none; }
body .words-how-modal .brb-modal-content.words-how { padding: 26px 28px 26px; }
.words-how-title {
    margin: 0 52px 14px 0;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}
.words-how-list { display: grid; gap: 10px; margin: 0; padding: 0 0 0 18px; }
.words-how-list li { color: var(--stone-ink); font-family: var(--font-app); font-size: 14.5px; line-height: 1.5; text-wrap: pretty; }

/* ── One column, below 900 px ── */
@media (max-width: 899.98px) {
    .words-panes { display: block; }
    .words-rail.is-compact {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        column-gap: 12px;
        margin: 16px 16px 0;
        padding: 10px 10px 10px 16px;
        border: 0;
        border-radius: 12px;
    }
    .words-rail.is-compact .words-eyebrow { font-size: 11px; }
    .words-rail.is-compact .words-quote { margin-top: 3px; font-size: 15px; line-height: 1.5; }
    .words-more {
        display: inline-flex;
        position: relative;
        align-items: center;
        gap: 1px;
        margin-left: 6px;
        padding: 0;
        border: 0;
        background: none;
        color: var(--rust);
        font-family: var(--font-app);
        font-size: 13.5px;
        font-weight: 700;
        line-height: 1;
        vertical-align: baseline;
        cursor: pointer;
    }
    .words-more::after { content: ""; position: absolute; inset: -12px -8px; }
    .words-more .words-icon { width: 14px; height: 14px; }
    /* Less points up (QA P3-1). */
    .words-more[aria-expanded="true"] .words-icon { transform: rotate(180deg); }
    .words-main { padding: 20px 24px 24px; }
    .words-describe > .words-footer-links,
    .words-main > .words-footer-links { display: flex; }
}

/* ── A phone: the whole screen, the same bars ── */
@media (max-width: 640px) {
    .brb-modal-overlay.words-sheet-overlay { align-items: stretch; padding: 0; }
    body .brb-modal-shell.words-sheet-modal,
    body .brb-modal-shell.words-sheet-modal.words-has-draft {
        width: 100%;
        height: var(--brb-modal-viewport-height, 100dvh);
        max-height: var(--brb-modal-viewport-height, 100dvh);
        border: 0;
        border-radius: 0;
        animation: none;
    }
    body .brb-modal-shell.words-sheet-modal.words-unavailable-modal {
        height: auto;
        border: 1px solid rgba(var(--ink-rgb), .12);
        border-radius: 16px;
    }
    .words-head { gap: 10px; padding: 10px 10px 10px 18px; }
    .words-title { font-size: 18px; }
    body .words-sheet-modal .words-head .brb-modal-close.words-close { width: 44px; height: 44px; }
    .words-foot { gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
    .words-foot > .words-spacer { display: none; }
    .words-foot .words-btn { flex: 1 1 0; min-width: 0; padding: 0 12px; }
    .words-foot .words-btn-primary { flex-grow: 1.35; }
    .words-foot.is-stacked { flex-direction: column; align-items: stretch; }
    .words-foot.is-stacked .words-btn { flex: 0 0 auto; width: 100%; }
    .words-foot.has-status { flex-wrap: wrap; row-gap: 10px; }
    .words-foot.has-status .words-foot-status { flex: 1 0 100%; align-items: flex-start; justify-content: flex-start; }
    .words-foot-status .words-icon { margin-top: 2px; }
    .words-foot-status > span:last-child { text-wrap: balance; }
    .words-describe { padding: 20px 18px 24px; }
    .words-rail.is-compact { margin: 12px 16px 0; }
    .words-main { padding: 16px 18px 24px; }
    .words-name { font-size: 29px; }
    .words-row { grid-template-columns: 78px minmax(0, 1fr); gap: 8px; }
    .words-row-label { font-size: 13px; }
    .words-sec-head { flex-wrap: wrap; row-gap: 6px; }
    .words-sec-meta { text-align: left; }
    .words-meters { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
    .words-meter { grid-template-columns: 84px minmax(0, 1fr) 36px; }
    body .words-how-modal .brb-modal-content.words-how { padding: 22px 18px 20px; }
}
/* The narrowest phones: Make another keeps its icon and words inside the button. */
@media (max-width: 360px) {
    .words-foot .words-btn { gap: 6px; padding: 0 8px; font-size: 14px; }
    .words-foot .words-btn-primary { flex-grow: 1; }
}
/* Between a phone and two panes: the footer's buttons sit right, unstretched,
   and the words card lines up with the pizza's text. */
@media (min-width: 641px) and (max-width: 899.98px) {
    .words-rail.is-compact { margin: 16px 24px 0; }
    .words-foot.has-status { flex-wrap: wrap; row-gap: 10px; }
    .words-foot.has-status .words-foot-status { flex: 1 0 100%; justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .words-spin { animation-duration: 2.4s; }
    .words-skel { animation: none; }
    .words-btn, .words-example { transition: none; }
    .words-wait-line { transition: none; }
}
@media (forced-colors: active) {
    .words-chip, .words-example, .words-caution, .words-alert, .words-banner { border: 1px solid CanvasText; }
    .words-tick { background: GrayText; }
    .words-tick.is-on { background: CanvasText; }
    .words-skel { background: GrayText; }
}

/* AIUX-03: hit areas grow without inflating type. */
.words-link, .words-feedback, .words-save-image, .words-privacy .words-link { display: inline-flex; align-items: center; min-height: 44px; }
body .words-sheet-modal .words-head .brb-modal-close.words-close { width: 44px; height: 44px; }

/* Local words actions wrap outside the primary footer. */
.words-controls { display: flex; flex-wrap: wrap; gap: 8px; }
#words-reset { min-height: 44px; margin-bottom: 8px; }
#words-reset[hidden] { display: none; }
.words-rail.is-compact .words-controls { margin-left: auto; }
.words-rail:not(.is-compact) .words-controls { margin-top: 12px; align-items: center; }
.words-rail:not(.is-compact) .words-controls .words-btn { min-height: 44px; }
.words-rail:not(.is-compact) .words-controls #words-reset { margin-bottom: 0; }

@media (max-width: 640px) {
    .words-rail.is-compact { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
    .words-rail.is-compact .words-controls { justify-self: end; align-items: center; }
    .words-controls .words-btn { min-height: 44px; }
    .words-controls #words-reset { margin-bottom: 0; }
}

.words-save-image { background: none; border: 0; padding: 0; cursor: pointer; }
.words-save-image:disabled { opacity: .55; cursor: wait; }
.words-image-error { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--rust); }
