/* ==========================================================================
   HumanProse writing templates
   The gallery and form pages (body.hp-ui.hp-templates, on the guides shell)
   and the "Start from a template" strip in the workspace. Colours come from
   the --hx-* tokens, so the dark theme follows; logical properties keep
   Arabic (RTL) right.
   ========================================================================== */

/* ---------- Workspace entry point ---------- */
body.hp-ui .hp-wt {
    display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap;
    padding: 9px 20px; border-bottom: 1px solid var(--hx-line); background: var(--hx-surface-2);
}
@media (min-width: 640px) { body.hp-ui .hp-wt { padding-inline: 24px; } }
body.hp-ui .hp-wt[hidden] { display: none; }
body.hp-ui .hp-wt-icon { flex: none; width: 18px; height: 18px; color: var(--hx-royal-ink); fill: none; stroke: var(--hx-quill); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.hp-ui .hp-wt-copy { margin: 0; flex: 1 1 240px; min-width: 0; font-size: .82rem; line-height: 1.45; color: var(--hx-ink-2); }
body.hp-ui .hp-wt-copy strong { color: var(--hx-ink); font-weight: 700; }
body.hp-ui .hp-wt-link {
    flex: none; display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px; border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--hx-quill) 55%, transparent); background: var(--hx-quill-soft);
    color: var(--hx-quill-ink) !important; font-size: .8rem; font-weight: 800; text-decoration: none; white-space: nowrap;
    transition: background-color .2s ease, border-color .2s ease;
}
body.hp-ui .hp-wt-link:hover { border-color: var(--hx-quill); background: color-mix(in srgb, var(--hx-quill) 22%, var(--hx-quill-soft)); }
body.hp-ui .hp-wt-notice {
    display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px 10px 20px;
    border-bottom: 1px solid var(--hx-line); background: var(--hx-royal-soft); color: var(--hx-ink);
}
body.hp-ui .hp-wt-notice[hidden] { display: none; }
body.hp-ui .hp-wt-notice p { margin: 0; flex: 1; font-size: .84rem; font-weight: 600; }
body.hp-ui .hp-wt-notice-close { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 10px; background: transparent; color: var(--hx-ink-2); cursor: pointer; }
body.hp-ui .hp-wt-notice-close:hover { background: var(--hx-surface); color: var(--hx-ink); }
body.hp-ui .hp-wt-notice-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* ---------- Shared icon ---------- */
body.hp-ui.hp-templates .hpt-icon,
body.hp-ui.hp-templates .hpt-icon-sm,
body.hp-ui.hp-templates .hpt-arrow { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
body.hp-ui.hp-templates .hpt-icon { width: 24px; height: 24px; }
body.hp-ui.hp-templates .hpt-icon-sm { width: 16px; height: 16px; }
body.hp-ui.hp-templates .hpt-arrow { width: 16px; height: 16px; stroke-width: 2; transition: transform .2s var(--hx-ease); }
[dir="rtl"] body.hp-ui.hp-templates .hpt-arrow { transform: scaleX(-1); }

/* ---------- Banner ---------- */
body.hp-ui.hp-templates .hpt-banner-points {
    display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 24px 0 0; padding: 0; list-style: none;
}
body.hp-ui.hp-templates .hpt-banner-points li {
    padding: 7px 13px; border-radius: 999px; font-size: .84rem; font-weight: 600;
    background: rgba(255, 255, 255, .07); border: 1px solid rgba(240, 214, 170, .25); color: var(--hx-on-stage);
}
body.hp-ui.hp-templates .hpt-banner.is-template { padding-bottom: clamp(28px, 4vw, 44px); }
body.hp-ui.hp-templates .hpt-banner-row { display: flex; align-items: flex-start; gap: 18px 22px; }
body.hp-ui.hp-templates .hpt-banner-icon {
    flex: none; display: grid; place-items: center; width: 64px; height: 64px; margin-top: 6px; border-radius: 20px;
    background: rgba(240, 214, 170, .12); border: 1px solid rgba(240, 214, 170, .35); color: var(--hx-cream);
}
body.hp-ui.hp-templates .hpt-banner-icon .hpt-icon { width: 30px; height: 30px; }
body.hp-ui.hp-templates .hpt-banner.is-template .hpg-banner-title { font-size: clamp(2.2rem, 4.6vw, 3.6rem) !important; max-width: 22ch; }
body.hp-ui.hp-templates .hpt-banner.is-template .hpg-banner-lead { margin-top: 14px; }

/* ---------- Gallery ---------- */
body.hp-ui.hp-templates .hpt-gallery { margin-top: 28px; }
body.hp-ui.hp-templates .hpt-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
body.hp-ui.hp-templates .hpt-card {
    position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0;
    padding: 26px 24px 22px; border-radius: 24px;
    background: var(--hx-surface); border: 1px solid var(--hx-line);
    transition: border-color .2s ease, transform .25s var(--hx-ease), box-shadow .25s ease;
}
body.hp-ui.hp-templates .hpt-card:hover { border-color: color-mix(in srgb, var(--hx-quill) 70%, transparent); transform: translateY(-2px); box-shadow: var(--hx-shadow); }
body.hp-ui.hp-templates .hpt-card:has(a:focus-visible) { outline: 2px solid var(--hx-quill); outline-offset: 3px; }
body.hp-ui.hp-templates .hpt-card-icon {
    display: grid; place-items: center; width: 50px; height: 50px; border-radius: 16px;
    background: var(--hx-royal-soft); color: var(--hx-royal-ink);
    transition: background-color .25s ease, color .25s ease;
}
body.hp-ui.hp-templates .hpt-card:hover .hpt-card-icon { background: var(--hx-royal); color: var(--hx-cream); }
body.hp-ui.hp-templates .hpt-card-mode { margin: 6px 0 0; font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--hx-quill-ink); }
body.hp-ui.hp-templates .hpt-card-title { margin: 0; font-size: clamp(1.5rem, 2.2vw, 1.8rem) !important; line-height: 1.12 !important; color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-card-title a { color: inherit; text-decoration: none; }
body.hp-ui.hp-templates .hpt-card-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
body.hp-ui.hp-templates .hpt-card-title a:focus-visible { outline: none !important; }
body.hp-ui.hp-templates .hpt-card-copy { margin: 0; flex: 1; color: var(--hx-ink-2); font-size: .94rem; line-height: 1.6; }
body.hp-ui.hp-templates .hpt-card-meta {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 14px;
    margin: 6px 0 0; padding-top: 14px; border-top: 1px dashed var(--hx-line-2);
    font-size: .84rem; font-weight: 600; color: var(--hx-ink-3);
}
body.hp-ui.hp-templates .hpt-card-more { display: inline-flex; align-items: center; gap: 6px; color: var(--hx-royal-ink); font-weight: 700; }
body.hp-ui.hp-templates .hpt-card:hover .hpt-card-more .hpt-arrow { transform: translateX(3px); }
[dir="rtl"] body.hp-ui.hp-templates .hpt-card:hover .hpt-card-more .hpt-arrow { transform: scaleX(-1) translateX(3px); }

/* How it works */
body.hp-ui.hp-templates .hpt-how { margin-top: 72px; }
body.hp-ui.hp-templates .hpt-how > h2 { margin: 0 0 22px; font-size: clamp(2rem, 4vw, 2.8rem) !important; color: var(--hx-ink); }
/* Light brass matches the design layer's AA-safe headline accent; the brighter brass is kept for dark. */
body.hp-ui.hp-templates .hp-display em { color: #8b6634; font-style: italic; }
html[data-hp-theme="dark"] body.hp-ui.hp-templates .hp-display em { color: var(--hx-quill); }
body.hp-ui.hp-templates .hpg-banner .hp-display em { color: var(--hx-cream); }
body.hp-ui.hp-templates .hpt-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 0; padding: 0; list-style: none; }
body.hp-ui.hp-templates .hpt-steps li { padding: 22px 22px 20px; border-radius: 20px; background: var(--hx-surface-2); border: 1px solid var(--hx-line); }
body.hp-ui.hp-templates .hpt-step-n { display: block; font-family: var(--hx-f-display); font-size: 2.4rem; line-height: 1; color: var(--hx-quill); }
body.hp-ui.hp-templates .hpt-steps strong { display: block; margin-top: 12px; font-size: 1.05rem; color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-steps p { margin: 6px 0 0; color: var(--hx-ink-2); font-size: .93rem; line-height: 1.6; }

/* ---------- Form page ---------- */
body.hp-ui.hp-templates .hpt-layout {
    display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 22px; align-items: start;
    margin-top: 28px;
}
body.hp-ui.hp-templates .hpt-form,
body.hp-ui.hp-templates .hpt-result,
body.hp-ui.hp-templates .hpt-preview {
    background: var(--hx-surface); border: 1px solid var(--hx-line); border-radius: 26px; box-shadow: var(--hx-shadow);
}
body.hp-ui.hp-templates .hpt-form { padding: clamp(20px, 3vw, 32px); display: grid; gap: 20px; }
body.hp-ui.hp-templates .hpt-form-head h2 { margin: 0; font-size: 2rem !important; color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-lang-note {
    display: flex; align-items: flex-start; gap: 9px; margin: 10px 0 0; padding: 10px 14px; border-radius: 14px;
    background: var(--hx-quill-soft); color: var(--hx-quill-ink); font-size: .88rem; font-weight: 600; line-height: 1.5;
}
body.hp-ui.hp-templates .hpt-lang-note .hpt-icon-sm { margin-top: 3px; }

body.hp-ui.hp-templates .hpt-field { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
body.hp-ui.hp-templates .hpt-field > label,
body.hp-ui.hp-templates .hpt-choice > legend { display: flex; align-items: baseline; gap: 8px; padding: 0; font-size: .93rem; font-weight: 700; color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-choice > legend { margin-bottom: 8px; }
body.hp-ui.hp-templates .hpt-optional { font-size: .74rem; font-weight: 700; color: var(--hx-ink-3); }
body.hp-ui.hp-templates .hpt-help { margin: -2px 0 2px; font-size: .84rem; color: var(--hx-ink-3); line-height: 1.5; }
body.hp-ui.hp-templates .hpt-control {
    width: 100%; min-height: 48px; padding: 12px 15px; border-radius: 14px;
    border: 1px solid var(--hx-line-2); background: var(--hx-paper); color: var(--hx-ink);
    font: inherit; font-size: .98rem; line-height: 1.55;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
body.hp-ui.hp-templates textarea.hpt-control { resize: vertical; min-height: 96px; }
body.hp-ui.hp-templates .hpt-control::placeholder { color: color-mix(in srgb, var(--hx-ink-3) 78%, transparent); }
body.hp-ui.hp-templates .hpt-control:hover { border-color: color-mix(in srgb, var(--hx-royal) 40%, var(--hx-line-2)); }
body.hp-ui.hp-templates .hpt-control:focus { outline: none; border-color: var(--hx-royal); background: var(--hx-surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hx-royal) 20%, transparent); }
body.hp-ui.hp-templates .hpt-control[aria-invalid="true"] { border-color: var(--hx-danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hx-danger) 14%, transparent); }
body.hp-ui.hp-templates .hpt-field-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; min-height: 1.1em; }
body.hp-ui.hp-templates .hpt-error { margin: 0; color: var(--hx-danger); font-size: .84rem; font-weight: 600; }
body.hp-ui.hp-templates .hpt-count { direction: ltr; unicode-bidi: isolate; margin-inline-start: auto; font-size: .76rem; color: var(--hx-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
body.hp-ui.hp-templates .hpt-count.is-near { color: var(--hx-warn); font-weight: 700; }

body.hp-ui.hp-templates .hpt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
body.hp-ui.hp-templates .hpt-chip { position: relative; display: inline-flex; cursor: pointer; }
body.hp-ui.hp-templates .hpt-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
body.hp-ui.hp-templates .hpt-chip > span {
    display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px;
    border: 1px solid var(--hx-line-2); background: var(--hx-paper); color: var(--hx-ink-2);
    font-size: .9rem; font-weight: 700; transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
body.hp-ui.hp-templates .hpt-chip.is-length > span { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; min-height: 52px; padding: 6px 16px; border-radius: 16px; }
body.hp-ui.hp-templates .hpt-chip.is-length small { font-size: .74rem; font-weight: 600; color: var(--hx-ink-3); font-variant-numeric: tabular-nums; }
body.hp-ui.hp-templates .hpt-chip:hover > span { border-color: var(--hx-royal); color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-chip input:checked + span { background: var(--hx-royal); border-color: var(--hx-royal); color: #fff; }
body.hp-ui.hp-templates .hpt-chip input:checked + span small { color: rgba(255, 255, 255, .78); }
body.hp-ui.hp-templates .hpt-chip input:focus-visible + span { outline: 2px solid var(--hx-quill); outline-offset: 2px; }

body.hp-ui.hp-templates .hpt-submit { display: grid; gap: 10px; padding-top: 6px; border-top: 1px dashed var(--hx-line-2); }
body.hp-ui.hp-templates .hpt-submit-btn { justify-self: start; margin-top: 12px; padding-inline: 28px; }
body.hp-ui.hp-templates .hpt-submit-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.hp-ui.hp-templates .hpt-submit-btn:disabled { cursor: progress; }
body.hp-ui.hp-templates .hpt-cost, body.hp-ui.hp-templates .hpt-guest { margin: 0; font-size: .84rem; color: var(--hx-ink-3); line-height: 1.5; }
body.hp-ui.hp-templates .hpt-guest { color: var(--hx-ink-2); }

/* Output column */
body.hp-ui.hp-templates .hpt-output { position: sticky; top: 92px; display: grid; gap: 14px; min-width: 0; }
body.hp-ui.hp-templates .hpt-preview {
    padding: 18px 22px; border-inline-start: 3px solid var(--hx-quill);
    background: linear-gradient(135deg, var(--hx-quill-soft), var(--hx-surface) 70%);
}
body.hp-ui.hp-templates .hpt-preview-k { margin: 0 0 6px; font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--hx-quill-ink); }
body.hp-ui.hp-templates .hpt-preview-line { margin: 0; font-family: var(--hx-f-display); font-size: 1.32rem; line-height: 1.4; color: var(--hx-ink); overflow-wrap: anywhere; }

body.hp-ui.hp-templates .hpt-result { padding: 20px 22px 22px; min-height: 340px; display: flex; flex-direction: column; gap: 14px; }
body.hp-ui.hp-templates .hpt-result-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
body.hp-ui.hp-templates .hpt-result-head h2 { margin: 0; font-size: 1.7rem !important; color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-words { font-size: .8rem; font-weight: 700; color: var(--hx-ink-3); font-variant-numeric: tabular-nums; }
body.hp-ui.hp-templates .hpt-words[hidden] { display: none; }
body.hp-ui.hp-templates :is(.hpt-empty, .hpt-loading) { flex: 1; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px 8px; text-align: center; }
body.hp-ui.hp-templates :is(.hpt-empty, .hpt-loading)[hidden] { display: none; }
body.hp-ui.hp-templates :is(.hpt-empty, .hpt-loading) p { margin: 0; max-width: 34ch; color: var(--hx-ink-3); font-size: .92rem; line-height: 1.55; }
body.hp-ui.hp-templates .hpt-loading p { color: var(--hx-royal-ink); font-weight: 700; }
body.hp-ui.hp-templates .hpt-sheet {
    display: grid; gap: 9px; width: 170px; padding: 20px 18px; border-radius: 14px;
    background: var(--hx-paper); border: 1px solid var(--hx-line); box-shadow: 0 18px 30px -24px rgba(8, 26, 19, .5);
    transform: rotate(-2deg);
}
body.hp-ui.hp-templates .hpt-sheet i { display: block; height: 7px; border-radius: 4px; background: var(--hx-line); }
body.hp-ui.hp-templates .hpt-sheet i:nth-child(1) { width: 62%; background: color-mix(in srgb, var(--hx-quill) 55%, var(--hx-line)); }
body.hp-ui.hp-templates .hpt-sheet i:nth-child(2) { width: 92%; }
body.hp-ui.hp-templates .hpt-sheet i:nth-child(3) { width: 80%; }
body.hp-ui.hp-templates .hpt-sheet i:nth-child(4) { width: 88%; }
body.hp-ui.hp-templates .hpt-sheet i:nth-child(5) { width: 46%; }
body.hp-ui.hp-templates .hpt-sheet.is-writing i {
    background: linear-gradient(90deg, var(--hx-line) 0%, color-mix(in srgb, var(--hx-royal) 35%, var(--hx-line)) 45%, var(--hx-line) 90%);
    background-size: 220% 100%; animation: hptWrite 1.4s ease-in-out infinite;
}
body.hp-ui.hp-templates .hpt-sheet.is-writing i:nth-child(2) { animation-delay: .12s; }
body.hp-ui.hp-templates .hpt-sheet.is-writing i:nth-child(3) { animation-delay: .24s; }
body.hp-ui.hp-templates .hpt-sheet.is-writing i:nth-child(4) { animation-delay: .36s; }
body.hp-ui.hp-templates .hpt-sheet.is-writing i:nth-child(5) { animation-delay: .48s; }
@keyframes hptWrite { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

body.hp-ui.hp-templates .hpt-alert {
    display: grid; gap: 8px; justify-items: start; padding: 14px 16px; border-radius: 16px;
    background: var(--hx-warn-soft); color: var(--hx-warn); border: 1px solid color-mix(in srgb, var(--hx-warn) 30%, transparent);
}
body.hp-ui.hp-templates .hpt-alert[hidden] { display: none; }
body.hp-ui.hp-templates .hpt-alert p { margin: 0; font-size: .92rem; font-weight: 600; line-height: 1.5; }
body.hp-ui.hp-templates .hpt-alert-link { font-size: .88rem; font-weight: 800; color: var(--hx-royal-ink); }
body.hp-ui.hp-templates .hpt-text {
    flex: 1; margin: 0; padding: 20px 22px; border-radius: 18px; max-height: 560px; overflow-y: auto;
    background: var(--hx-paper); border: 1px solid var(--hx-line);
    font-family: var(--hx-f-body); font-size: 1rem; line-height: 1.75; color: var(--hx-ink);
    white-space: pre-wrap; overflow-wrap: anywhere; text-align: left;
}
body.hp-ui.hp-templates .hpt-text[hidden] { display: none; }
body.hp-ui.hp-templates .hpt-text:focus-visible { outline: 2px solid var(--hx-quill); outline-offset: 2px; }
html[lang="ar"] body.hp-ui.hp-templates .hpt-text { font-family: "HP Sans", "Segoe UI", system-ui, sans-serif; }
body.hp-ui.hp-templates .hpt-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
body.hp-ui.hp-templates .hpt-actions[hidden] { display: none; }
body.hp-ui.hp-templates .hpt-actions .hp-btn { padding: 12px 18px; font-size: .88rem; }
body.hp-ui.hp-templates .hpt-actions .hp-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.hp-ui.hp-templates .hpt-doc-link { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; font-size: .86rem; font-weight: 700; color: var(--hx-royal-ink); text-decoration: none; }
body.hp-ui.hp-templates .hpt-doc-link[hidden] { display: none; }
body.hp-ui.hp-templates .hpt-doc-link:hover { text-decoration: underline; text-underline-offset: 4px; }
body.hp-ui.hp-templates .hpt-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* More templates */
body.hp-ui.hp-templates .hpt-more { margin-top: 64px; }
body.hp-ui.hp-templates .hpt-more h2 { margin: 0 0 16px; font-size: clamp(1.8rem, 3.4vw, 2.4rem) !important; color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-more ul { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
body.hp-ui.hp-templates .hpt-more a {
    display: inline-flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 16px; border-radius: 999px;
    background: var(--hx-surface); border: 1px solid var(--hx-line); color: var(--hx-ink-2); font-size: .9rem; font-weight: 700; text-decoration: none;
    transition: border-color .2s ease, color .2s ease;
}
body.hp-ui.hp-templates .hpt-more a:hover { border-color: var(--hx-quill); color: var(--hx-ink); }
body.hp-ui.hp-templates .hpt-more a .hpt-icon-sm { color: var(--hx-quill); }

/* ---------- Arabic ---------- */
html[lang="ar"] body.hp-ui.hp-templates :is(.hpt-card-mode, .hpt-preview-k) { letter-spacing: 0; font-size: .82rem; }
html[lang="ar"] body.hp-ui.hp-templates :is(.hpt-card-title, .hpt-how > h2, .hpt-more h2, .hpt-form-head h2, .hpt-result-head h2) { line-height: 1.35 !important; }
html[lang="ar"] body.hp-ui.hp-templates .hpt-preview-line { font-size: 1.2rem; line-height: 1.7; }
html[lang="ar"] body.hp-ui.hp-templates .hp-display em { font-style: normal; }
html[lang="ar"] body.hp-ui .hp-wt-copy { line-height: 1.7; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    body.hp-ui.hp-templates .hpt-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.hp-ui.hp-templates .hpt-layout { grid-template-columns: minmax(0, 1fr); }
    body.hp-ui.hp-templates .hpt-output { position: static; }
}
@media (max-width: 720px) {
    body.hp-ui.hp-templates .hpt-cards, body.hp-ui.hp-templates .hpt-steps { grid-template-columns: minmax(0, 1fr); }
    body.hp-ui.hp-templates .hpt-banner-row { flex-direction: column; gap: 14px; }
    body.hp-ui.hp-templates .hpt-banner-icon { width: 52px; height: 52px; border-radius: 16px; margin-top: 0; }
    body.hp-ui.hp-templates .hpt-submit-btn { justify-self: stretch; }
    body.hp-ui.hp-templates .hpt-actions .hp-btn { flex: 1 1 auto; }
    body.hp-ui.hp-templates .hpt-doc-link { margin-inline-start: 0; }
    body.hp-ui.hp-templates .hpt-result { min-height: 0; }
    body.hp-ui.hp-templates .hpt-text { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    body.hp-ui.hp-templates :is(.hpt-card, .hpt-card-icon, .hpt-arrow, .hpt-control, .hpt-chip > span) { transition: none !important; }
    body.hp-ui.hp-templates .hpt-card:hover { transform: none; }
    body.hp-ui.hp-templates .hpt-sheet.is-writing i { animation: none; }
}
