/*
 * TextForge: the tool's own components, styled in the site's design language (13 Nov 2026, automatic mode, on the
 * UltraCompress Pro template). The first part is ToolForge's shared block (tools-app/text-compare/styles.css), whose author's
 * apps share class names with this one: tokens, page, hero, buttons, toolbar and pill tabs, fields, toasts, information
 * sections, the windows. The second part is TextForge's own components from the original's styles on the site's tokens: the
 * shared text with its mark layer and side panel (on wide screens the two scroll on their own inside a box as tall as the
 * window allows, as the original did with the whole window), the counts, limits, readability, writing checks, case buttons,
 * find and fix, Convert, Fancy text and Make text. Its ink-black and violet buttons and chips became the site's gradient pills;
 * its own header, bottom tab bar on phones and footer are gone. Base: /libs/site-pages.css and /libs/shared-nav.css. Light is
 * the default; dark applies when <html> has no data-theme. Written once from ToolForge's file and the original's styles, then
 * edited by hand: this file is the source.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f8;
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
    --line: rgba(0, 0, 0, 0.1);
    --line-strong: rgba(0, 0, 0, 0.24);
    --ok: #166534;
    --ok-soft: rgba(22, 101, 52, 0.09);
    --bad: #b91c1c;
    --bad-soft: rgba(185, 28, 28, 0.08);
    --warn: #92400e;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --head: 81px;
    /* the original's names, on the site's tokens */
    --panel: var(--surface);
    --panel-2: var(--surface-2);
    --muted: var(--text-2);
    --faint: var(--text-3);
    --border: var(--line);
    --border-strong: var(--line-strong);
    --accent-soft: var(--tint-brand);
    --good: var(--ok);
    --good-soft: var(--ok-soft);
    --info: #1d4ed8;
    --info-soft: rgba(29, 78, 216, 0.08);
    --focus: var(--brand);
    --ember: #c2410c;
    --ember-ink: #9a3412;
    --ember-soft: #ffedd5;
    --del: #b91c1c;
    --del-soft: #fee2e2;
    --ins: #166534;
    --ins-soft: #dcfce7;
    --del-strong: #fecaca;
    --ins-strong: #bbf7d0;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
    --line: rgba(255, 255, 255, 0.1);
    --line-strong: rgba(255, 255, 255, 0.26);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.1);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, 0.1);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, 0.1);
    --info: #93c5fd;
    --info-soft: rgba(147, 197, 253, 0.12);
    --ember: #fb923c;
    --ember-ink: #fdba74;
    --ember-soft: rgba(251, 146, 60, 0.14);
    --del: #fca5a5;
    --del-soft: rgba(248, 113, 113, 0.16);
    --ins: #86efac;
    --ins-soft: rgba(74, 222, 128, 0.14);
    --del-strong: rgba(248, 113, 113, 0.34);
    --ins-strong: rgba(74, 222, 128, 0.3);
}
@media (max-width: 639.98px) { :root { --head: 65px; } }

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container { max-width: calc(var(--app-max) + 2 * var(--content-gutter)); margin-top: 16px; }
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- The site header is the first thing on the page and stays at the top ----- */
body { padding-top: 0; }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: 90px; }
@media (max-width: 639.98px) { .theme-toggle { top: 75px; } } /* the header is 81 px tall from 640 px, 65 px below */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ----- Hero ----- */
.app-hero { margin: 0 0 2rem; text-align: center; }
.app-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 1.25rem; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-strong); }
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.app-hero h1 { margin-bottom: 0.75rem; }
.app-tagline { color: var(--text-2); font-size: 1.125rem; line-height: 1.6; max-width: 46rem; margin: 0 auto; }

/* ----- The site's text rules (p, ul, li, headings, tables) must not reach the tool: same weight as the site's ----- */
:where(.app-shell) p, :where(.app-shell) ul, :where(.app-shell) ol, :where(.app-shell) li, :where(.dialog) p, :where(.dialog) ul, :where(.dialog) li { margin: 0; line-height: 1.5; }
:where(.app-shell) ul, :where(.app-shell) ol { padding: 0; list-style: none; }
:where(.app-shell) h2, :where(.app-shell) h3, :where(.dialog) h2, :where(.dialog) h3 { margin: 0; line-height: 1.25; }
:where(.app-shell) table, :where(.dialog) table { width: auto; margin: 0; border-radius: 0; overflow: visible; background: none; }
:where(.app-shell) th, :where(.app-shell) td { border: 0; padding: 0; color: inherit; }
:where(.app-shell) pre, :where(.dialog) pre { margin: 0; }
.app-shell, .dialog { font-size: 1rem; }

/* ----- Small helpers ----- */
main [hidden], .dialog [hidden], .menu [hidden] { display: none !important; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.mono { font-family: var(--mono); }
.meta { color: var(--muted); font-size: 0.85rem; }
.hint { color: var(--muted); font-size: 0.82rem; font-weight: 400; line-height: 1.45; }
.hint:empty { display: none; }
.hint.block { display: block; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--link-hover); }
.app-shell code, .dialog code { font-family: var(--mono); font-size: 0.85em; padding: 1px 6px; border-radius: 6px; background: var(--code-bg); color: var(--code-text); }
kbd { font-family: var(--mono); font-size: 0.78rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--chip-border); border-bottom-width: 2px; background: var(--chip); color: var(--text-strong); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ----- Buttons: the original's classes in the site's pills ----- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid var(--surface-border); border-radius: 9999px; background: var(--surface); color: var(--text-strong); font-family: inherit; font-weight: 600; font-size: 0.925rem; line-height: 1.2; padding: 10px 20px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease; }
.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .ico { width: 17px; height: 17px; }
.btn.primary { background: var(--gradient-brand); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn.primary:hover:not(:disabled) { color: #fff; box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { border-color: var(--brand); }
.btn.danger { color: var(--danger); border-color: rgba(185, 28, 28, 0.35); }
.btn.danger:hover:not(:disabled) { background: var(--danger-strong); color: #fff; border-color: transparent; }
.small-btn { min-height: 36px; padding: 7px 14px; font-size: 0.85rem; }
.small-btn .ico { width: 16px; height: 16px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--surface-border); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); flex-shrink: 0; padding: 0; font-family: inherit; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.icon-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.sq-btn { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: inline-grid; place-items: center; padding: 0; cursor: pointer; text-decoration: none; }
.sq-btn:hover { background: var(--panel-2); color: var(--link); }
.sq-btn[aria-pressed="true"] { color: var(--link); }

/* ----- Toolbar and the six tools as pill tabs ----- */
.app-shell { margin: 0 0 3rem; scroll-margin-top: 90px; display: flex; flex-direction: column; gap: 20px; }
.app-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; }
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 26px; background: var(--surface-2); max-width: 100%; }
.tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: 9999px; background: transparent; font-family: inherit; font-size: 0.875rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease; }
.tab .ico { width: 16px; height: 16px; }
.tab:hover { color: var(--link); }
.tab[aria-current="page"] { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.tab .short, .tab .tiny { display: none; }
@media (max-width: 1279.98px) { .tab .long { display: none; } .tab .short { display: inline; } }
@media (max-width: 899.98px) { .tab .ico { display: none; } }
@media (max-width: 639.98px) {
    .app-toolbar { flex-direction: column-reverse; align-items: stretch; }
    .toolbar-right { justify-content: flex-start; } /* away from the site's round theme button at the right edge */
    .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; border-radius: 22px; }
    .tab { padding: 8px 4px; min-width: 0; }
    .tab .short { display: none; }
    .tab .tiny { display: inline; }
}
.shell-hint { margin: 0; }

/* ----- Fields ----- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.label { font-weight: 600; font-size: 0.875rem; color: var(--text-strong); }
.input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px; background: var(--field); border: 1px solid var(--field-border); border-radius: 12px; font-family: inherit; font-size: 0.95rem; color: var(--text); outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.input::placeholder { color: var(--placeholder); }
.input[aria-invalid="true"] { border-color: var(--bad); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.55; }
textarea.input.mono, .input.mono { font-family: var(--mono); font-size: 0.875rem; }
.input.mini { min-height: 36px; padding: 6px 10px; font-size: 0.875rem; border-radius: 10px; }
.select { width: auto; max-width: 100%; appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; cursor: pointer; }
.select option { color: #0a0a14; background: #fff; }
.check-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: 0.925rem; color: var(--text); padding: 4px 0; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--brand); flex: none; }
.check-row.small { font-size: 0.85rem; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.inline-field .input { width: auto; color: var(--text); }
.opt-line { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--surface); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease; }
.seg button .ico { width: 15px; height: 15px; }
.seg button:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.seg button[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 5px 13px; border-radius: 9999px; border: 1px solid var(--chip-border); background: var(--chip); font-family: inherit; font-size: 0.85rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease; }
.chip .n { color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 500; }
.chip:hover { border-color: var(--brand); color: var(--link); transform: translateY(-1px); }
.chip[aria-pressed="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.85; }
.search-wrap { position: relative; display: block; min-width: 0; }
.search-wrap > .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 38px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 600; padding: 1px 9px; border-radius: 9999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.tag.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* ----- Toasts ----- */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { pointer-events: auto; background: #0a0a14; color: #fff; border: 1px solid rgba(255, 255, 255, 0.12); border-left: 4px solid var(--brand); border-radius: 14px; padding: 12px 16px; display: flex; align-items: center; gap: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3); min-width: 260px; max-width: 460px; font-size: 0.875rem; font-weight: 500; overflow-wrap: anywhere; animation: slideIn 0.3s ease; transition: opacity 0.3s ease, transform 0.3s ease; }
.toast button { background: none; border: 0; padding: 0; color: #c4b5fd; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; white-space: nowrap; }
.toast.leaving { opacity: 0; transform: translateX(40px); }
/* while a window is open the box of messages is in the browser's top layer (a popover), above the window's backdrop */
.toasts[popover] { left: auto; top: auto; margin: 0; border: 0; padding: 0; width: auto; height: auto; background: transparent; color: inherit; overflow: visible; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ----- Information sections ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section .info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 1rem 0 1.5rem; }
.info-stack { display: grid; gap: 12px; }
.info-card { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child { margin-bottom: 0; }
.step-card { position: relative; padding-top: 24px; }
.step-num { position: absolute; top: -16px; left: 20px; width: 34px; height: 34px; border-radius: 50%; background: var(--gradient-brand); color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary { cursor: pointer; padding: 16px 20px; font-weight: 600; color: var(--text-strong); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '\2212'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ===== The components ToolForge shares with MicroTools ===== */

/* ----- Each tool ----- */
.screen { display: flex; flex-direction: column; gap: 24px; width: 100%; min-width: 0; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.view-title { font-size: clamp(1.4rem, 2.4vw, 1.75rem); color: var(--text-strong); }
.lead { margin-top: 4px; color: var(--muted); max-width: 76ch; }
.lead code { white-space: nowrap; }
.empty { color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 14px; padding: 22px 8px; text-align: center; font-size: 0.925rem; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty b { color: var(--text-strong); }
.empty .actions { justify-content: center; }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 8px; border-radius: 12px; background: var(--tint-brand); border: 1px solid var(--tint-brand-border); font-size: 0.925rem; color: var(--text); }
.banner > span { flex: 1 1 220px; min-width: 0; }
.banner > .ico { color: var(--link); }
.banner.warn { background: var(--warn-soft); border-color: transparent; }
.banner.warn > .ico { color: var(--warn); }
.banner.inline { align-items: flex-start; }
.view-head .short { display: none; }
@media (max-width: 560px) {
    .view-head .long { display: none; }
    .view-head .short { display: inline; }
    .view-head .actions { width: 100%; }
    .view-head .actions .btn { flex: 1; padding: 9px 10px; }
}

/* ----- Menus (inside the tool; the original's buttons) ----- */
.menu { position: fixed; z-index: 70; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); max-height: min(70vh, 520px); overflow: auto; background: var(--surface); border: 1px solid var(--surface-border); border-radius: 14px; box-shadow: 0 16px 44px rgba(0, 0, 0, 0.22); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu button { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-family: inherit; font-size: 0.9rem; color: var(--text); cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--tint-brand); color: var(--link); outline: none; }
.menu button .ico { color: var(--muted); width: 17px; height: 17px; }
.menu button[disabled] { opacity: 0.45; cursor: not-allowed; }
.menu button[aria-checked="true"]::after { content: ""; margin-left: auto; width: 14px; height: 8px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translateY(-2px); flex: none; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
.menu .menu-note { font-size: 0.8rem; color: var(--muted); padding: 2px 10px 4px; }

/* ----- Windows (the original's: the head and the buttons sit inside the body) ----- */
.dialog { margin: auto; border: 1px solid var(--surface-border); border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 16px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); }
.dialog.wide { width: min(820px, calc(100vw - 16px)); }
.dialog::backdrop { background: rgba(10, 10, 20, 0.6); backdrop-filter: blur(6px); }
.dialog[open] { animation: pop 0.2s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; margin: 0; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-body h2 { font-size: 1.2rem; color: var(--text-strong); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; align-items: center; }
.dialog-actions.split .grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px 16px; }
.save-recipe .field { flex: 1 1 220px; }
.settings { display: flex; flex-direction: column; gap: 22px; max-height: min(70vh, 640px); overflow: auto; }
.set-block { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.set-block:first-child { border-top: 0; padding-top: 0; }
.set-block h3 { margin: 0; font-size: 1rem; color: var(--text-strong); }
.help { max-height: min(76vh, 760px); overflow: auto; }
.help p { color: var(--text); font-size: 0.925rem; }
.help h3 { margin-top: 8px; font-size: 1rem; color: var(--text-strong); }
.keys { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.keys div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 12px; font-size: 0.9rem; }
.keys dt { white-space: nowrap; }

/* ===== TextForge's own components ===== */

/* ----- Tokens: the original's names on the site's colours ----- */
:root {
    --forge: var(--link);
    --forge-soft: var(--tint-brand);
    --accent-soft: var(--tint-brand);
    --sans: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Nirmala UI", sans-serif;
    --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
    /* marks in the text box */
    --m-find: rgba(255, 196, 0, 0.42);
    --m-cur: rgba(255, 128, 0, 0.62);
    --m-long: #fbeec4;
    --m-vlong: #f6d2cd;
    --m-passive: #1d8a55;
    --m-adverb: #2a5db0;
    --m-simpler: #7c3aed;
    --m-repeat: #c0362c;
    --m-kw: rgba(139, 92, 246, 0.22);
    --m-sel: rgba(139, 92, 246, 0.16);
}
:root:not([data-theme="light"]) {
    --m-find: rgba(255, 196, 0, 0.32);
    --m-cur: rgba(255, 140, 0, 0.55);
    --m-long: #3d3315;
    --m-vlong: #4a2622;
    --m-passive: #5fd39a;
    --m-adverb: #8fb4ff;
    --m-simpler: #c4b2ff;
    --m-repeat: #f0867c;
    --m-kw: rgba(169, 150, 255, 0.28);
    --m-sel: rgba(169, 150, 255, 0.2);
}

/* ----- Small parts the original shares between its tools ----- */
.row { display: flex; align-items: center; gap: 8px; }
.icon-btn.small { width: 36px; height: 36px; border-radius: 10px; }
.icon-btn.small .ico { width: 16px; height: 16px; }
.icon-btn[aria-pressed="true"] { background: var(--tint-brand); border-color: var(--brand); color: var(--link); }
.danger-hover:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }
.actions.end { justify-content: flex-end; }
.input.num { width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.small-sel { width: auto; min-height: 40px; padding-top: 6px; padding-bottom: 6px; font-size: 0.9rem; max-width: 100%; }
.check-row small { display: block; color: var(--muted); font-size: 0.82rem; }
.check-row.compact { padding: 2px 0; font-size: 0.9rem; }
.inline-field { flex-direction: row; flex-wrap: wrap; gap: 6px 10px; } /* the original's: the label beside its box */
.chip[aria-checked="true"] { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 520px) { .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fields { display: flex; flex-direction: column; gap: 14px; }
.fields h3 { margin: 6px 0 0; font-size: 1rem; color: var(--text-strong); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 600; padding: 1px 9px; border-radius: 9999px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.pill:empty { display: none; }
.pill.info { background: var(--tint-brand); color: var(--link); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 36px; height: 22px; border-radius: 9999px; background: var(--line-strong); position: relative; transition: background 0.15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.note { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 2px solid currentColor; font-size: 0.9rem; }
.note > span { color: var(--text); flex: 1; min-width: 10rem; }
.note.bad { color: var(--bad); }
.meter { height: 6px; border-radius: 3px; background: var(--tint-brand); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; background: var(--gradient-brand); border-radius: 3px; transition: width 0.2s; }
.meter.over > span { background: var(--bad); }
.meter.near > span { background: var(--warn); }
.meter.done > span { background: var(--ok); }
.grp-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 4px 0 0; font-weight: 700; }
.mode-seg { align-self: flex-start; }

/* ----- Panes: the original's cards with a bar on top ----- */
.pane { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 16px; box-shadow: var(--surface-shadow); display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.pane-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; min-height: 48px; border-bottom: 1px solid var(--border); background: var(--panel-2); flex-wrap: wrap; }
.pane-title { font-weight: 700; font-size: 0.9rem; margin-right: auto; color: var(--text-strong); }
.pane-tools { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.statusline { display: flex; gap: 6px 16px; align-items: center; padding: 6px 12px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--muted); background: var(--panel-2); font-variant-numeric: tabular-nums; min-height: 32px; flex-wrap: wrap; }

/* ----- The shared text (Count, Case, Find and fix) ----- */
.desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.ed-pane { height: max(320px, 56vh); height: max(320px, 56dvh); }
@media (max-width: 639.98px) { .ed-pane { height: max(260px, 50vh); height: max(260px, 50dvh); } }
@media (min-width: 1100px) {
    /* the text box and the panel fill a box as tall as the window allows; each scrolls on its own, so the page never jumps */
    .desk { grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); grid-template-rows: minmax(0, 1fr); gap: 24px; height: clamp(560px, calc(100vh - var(--head) - 140px), 920px); height: clamp(560px, calc(100dvh - var(--head) - 140px), 920px); }
    .ed-pane { height: auto; }
    /* the panel's scrollbar sits in the margin, so its contents still end at the page's side space (--side-sb is measured) */
    .side { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-gutter: stable; padding-right: 6px; margin-right: calc(-6px - var(--side-sb, 0px)); }
}
.ed-bar { display: flex; align-items: center; gap: 2px 4px; padding: 4px; min-height: 48px; flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.ed-bar .btn.ghost { padding-left: 10px; padding-right: 10px; }
.bar-sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; flex: none; }
.ed-bar-end { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding-right: 4px; min-width: 0; }
.saved { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 1279.98px) and (min-width: 1100px), (max-width: 699.98px) {
    .ed-bar .small-btn span { display: none; }
    .ed-bar .small-btn { min-width: 36px; padding: 0 9px; }
}
@media (max-width: 420px) { .ed-bar .saved { display: none; } }
.ed-wrap { position: relative; flex: 1; min-height: 0; background: var(--surface); }
.ed, .ed-hl { font-family: var(--ed-font, var(--sans)); font-size: var(--ed-size, 16px); line-height: 1.65; padding: 12px 14px; margin: 0; border: 0; border-radius: 0; letter-spacing: normal; word-spacing: normal; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; -moz-tab-size: 4; font-variant-ligatures: none; font-kerning: normal; text-rendering: auto; box-shadow: none; min-height: 0; }
.ed { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; z-index: 1; background: transparent; color: var(--text); outline: none; overflow-y: auto; overflow-x: hidden; }
.ed::placeholder { color: var(--placeholder); }
.ed:focus-visible { outline: none; }
.ed-wrap:focus-within { box-shadow: inset 0 0 0 2px var(--ring); }
.ed-back { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ed-hl { position: absolute; top: 0; left: 0; color: transparent; box-sizing: border-box; will-change: transform; }
.ed-hl mark { color: transparent; background: none; border-radius: 2px; padding: 0; }
.ed-hl .m-long { background: var(--m-long); }
.ed-hl .m-vlong { background: var(--m-vlong); }
.ed-hl .m-passive { box-shadow: inset 0 -2px 0 var(--m-passive); }
.ed-hl .m-adverb { box-shadow: inset 0 -2px 0 var(--m-adverb); }
.ed-hl .m-simpler { box-shadow: inset 0 -2px 0 var(--m-simpler); background-color: color-mix(in srgb, var(--m-simpler) 12%, transparent); }
.ed-hl .m-repeat { box-shadow: inset 0 -2px 0 var(--m-repeat); background-color: color-mix(in srgb, var(--m-repeat) 14%, transparent); }
.ed-hl .m-kw { background: var(--m-kw); }
.ed-hl .m-find { background: var(--m-find); }
.ed-hl .m-cur { background: var(--m-cur); }
.ed-hl .m-flash { background: var(--m-sel); }
.st-hl { color: var(--warn); }

.side { display: flex; flex-direction: column; gap: 0; min-width: 0; position: relative; }
.side-panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding-bottom: 8px; }
.sec { border-top: 1px solid var(--border); }
.sec > summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; list-style: none; font-weight: 700; font-size: 1rem; color: var(--text-strong); }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform 0.15s; flex: none; }
.sec[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.sec > summary:not(:has(.sum-note))::after { margin-left: auto; } /* the arrow at the right edge, as in the sections with a note */
.sec > summary:hover::after { border-color: var(--link); }
.sum-note { margin-left: auto; font-weight: 500; font-size: 0.82rem; color: var(--muted); text-align: right; }
.sec[open] { padding-bottom: 14px; }
.sec[open] > :not(summary) + :not(summary) { margin-top: 10px; }
.scope { font-size: 0.9rem; color: var(--muted); }
.scope strong { color: var(--link); }

/* counts */
.big-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 0; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--surface-border); min-width: 0; }
.tile .num { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: clamp(1.25rem, 2.2vw, 1.55rem); font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.tile .lbl { font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.tile .sub { display: block; font-size: 0.72rem; }
.tile:first-child .num { color: var(--link); }
@media (min-width: 640px) and (max-width: 1099.98px) { .big-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.sel-note { font-size: 0.88rem; padding: 6px 8px; border-radius: 8px; background: var(--tint-brand); color: var(--text); }
.goal { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.goal .link { align-self: flex-start; }
.goal-line { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; }
.limit-list { display: flex; flex-direction: column; gap: 10px; }
.limit { display: flex; flex-direction: column; gap: 4px; }
.limit-top { display: flex; gap: 8px; align-items: baseline; font-size: 0.88rem; }
.limit-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.limit-num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.limit-num.over { color: var(--bad); font-weight: 700; }
.limit-x { width: 28px; height: 28px; border: 0; background: none; color: var(--faint); border-radius: 8px; display: inline-grid; place-items: center; padding: 0; flex: none; cursor: pointer; }
.limit-x:hover { color: var(--link); background: var(--panel-2); }
.limit-x .ico { width: 14px; height: 14px; }
.limit-sub { font-size: 0.78rem; color: var(--muted); }
.limit-sub.bad { color: var(--bad); }
.read-head { display: flex; flex-direction: column; gap: 2px; }
.read-grade { font-size: 1.15rem; font-weight: 700; color: var(--text-strong); }
.read-scale { position: relative; height: 8px; border-radius: 4px; margin: 10px 0 2px; background: linear-gradient(90deg, #2f9e62 0%, #8cc04b 30%, #e7b416 55%, #e07a2f 75%, #c8392e 100%); }
.read-scale i { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; background: var(--text-strong); box-shadow: 0 0 0 2px var(--surface); }
.read-ends { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin: 0; font-size: 0.88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.facts .link { font-weight: 500; }
.check-list { display: flex; flex-direction: column; gap: 2px; }
.ck { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.ck .switch { flex: 1; min-width: 0; font-size: 0.9rem; }
.ck .swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.ck .swatch.long { background: var(--m-long); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.ck .swatch.vlong { background: var(--m-vlong); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.ck .swatch.passive { background: var(--m-passive); height: 4px; border-radius: 2px; }
.ck .swatch.adverb { background: var(--m-adverb); height: 4px; border-radius: 2px; }
.ck .swatch.simpler { background: var(--m-simpler); height: 4px; border-radius: 2px; }
.ck .swatch.repeat { background: var(--m-repeat); height: 4px; border-radius: 2px; }
.ck .n { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 2ch; text-align: right; }
.ck .n.zero { color: var(--faint); font-weight: 500; }
.simpler-list { display: flex; flex-wrap: wrap; gap: 6px; }
.simpler-list button { border: 1px solid var(--border); background: var(--surface); border-radius: 9999px; padding: 4px 10px; font-family: inherit; font-size: 0.82rem; min-height: 32px; color: var(--text); cursor: pointer; }
.simpler-list button:hover { border-color: var(--m-simpler); }
.simpler-list b { color: var(--m-simpler); }
.kw-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.kw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kw-list li { border-bottom: 1px solid var(--border); margin: 0; }
.kw-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 4.2rem; gap: 10px; align-items: center; width: 100%; min-height: 36px; padding: 4px 2px; border: 0; background: none; text-align: left; font-family: inherit; font-size: 0.9rem; color: var(--text); position: relative; cursor: pointer; }
.kw-row:hover { background: var(--panel-2); }
.kw-row[aria-pressed="true"] { background: var(--tint-brand); }
.kw-term { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.kw-count { font-variant-numeric: tabular-nums; }
.kw-pct { font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
.kw-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--brand); opacity: 0.55; }

/* case */
.case-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) and (max-width: 1099.98px) { .case-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.case-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-width: 0; min-height: 64px; padding: 8px 10px; border: 1px solid var(--surface-border); border-radius: 12px; background: var(--surface); font-family: inherit; color: var(--text); cursor: pointer; transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.case-btn:hover { border-color: var(--brand); box-shadow: var(--surface-hover-shadow); transform: translateY(-2px); }
.case-name { font-weight: 700; font-size: 0.9rem; color: var(--text-strong); }
.case-prev { font-size: 0.82rem; color: var(--muted); width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-opts { display: flex; flex-direction: column; gap: 6px; }

/* find and fix */
.find-box { display: flex; flex-direction: column; gap: 8px; }
.find-row { display: flex; gap: 4px; align-items: center; }
.find-row .input { flex: 1; min-width: 0; }
.find-count { font-size: 0.8rem; color: var(--muted); white-space: nowrap; min-width: 3.5rem; text-align: right; font-variant-numeric: tabular-nums; }
.find-count.none { color: var(--bad); }
.find-count:empty { min-width: 0; }
.find-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 380px) { .find-opts { grid-template-columns: minmax(0, 1fr); } }
.pairs { display: flex; flex-direction: column; gap: 8px; }
.found { display: flex; flex-direction: column; gap: 6px; }
.found-row { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.found-row > span { flex: 1; min-width: 0; }
.found-row .ico { color: var(--warn); }
.found-none { font-size: 0.88rem; color: var(--ok); display: flex; gap: 8px; align-items: center; }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 640px) and (max-width: 1099.98px) { .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tool-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; min-height: 52px; padding: 7px 10px; border: 1px solid var(--surface-border); border-radius: 12px; background: var(--surface); min-width: 0; font-family: inherit; color: var(--text); cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease; }
.tool-btn:hover { border-color: var(--brand); transform: translateY(-2px); }
.tool-btn b { font-size: 0.88rem; color: var(--text-strong); }
.tool-btn small { font-size: 0.76rem; color: var(--muted); }
.line-opts { display: flex; flex-direction: column; gap: 10px; }
.line-opts .row { flex-wrap: wrap; }
.line-go { padding-top: 2px; }

/* convert */
.fmt-groups { display: flex; flex-direction: column; gap: 10px; }
.fmt-group { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.fmt-group > .grp-title { width: 100%; margin: 0; }
@media (min-width: 1100px) { .fmt-groups { flex-direction: row; flex-wrap: wrap; gap: 12px 28px; } .fmt-group { flex: 0 1 auto; } }
.cv-opts { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; min-height: 36px; }
.cv-opts:empty { display: none; }
.cv-opts .inline-field .label { font-weight: 500; color: var(--muted); }
.detect { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 8px 0; border-top: 2px solid var(--brand); font-size: 0.92rem; }
.detect .q { flex: 1; min-width: 14rem; }
.detect .q b { color: var(--link); }
.detect code { white-space: pre-wrap; word-break: break-word; }
.cv-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.cv-grid.two { gap: 16px; }
.cv-mid { display: flex; justify-content: center; align-items: center; color: var(--muted); }
.cv-mid .icon-btn .ico { transform: rotate(90deg); }
@media (min-width: 900px) {
    .cv-grid { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; }
    .cv-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
    .cv-mid .icon-btn .ico { transform: none; }
}
.cv-pane { min-height: 0; }
.cv-ta { flex: 1; width: 100%; min-height: 200px; height: 32vh; resize: vertical; border: 0; outline: none; background: var(--surface); color: var(--text); padding: 12px 14px; font-family: inherit; font-size: 1rem; line-height: 1.55; overflow-wrap: anywhere; }
.cv-ta.mono { font-family: var(--mono); font-size: 0.95rem; }
.cv-ta:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); outline: none; }
.cv-note { font-size: 0.82rem; padding: 6px 12px; border-top: 1px solid var(--border); background: var(--panel-2); color: var(--muted); min-height: 30px; }
.cv-note:empty { display: none; }
.cv-note.bad { color: var(--bad); background: var(--bad-soft); }
.cv-note.warn { color: var(--warn); background: var(--warn-soft); }
.cv-extra { display: flex; flex-direction: column; gap: 12px; }
.cv-extra:empty { display: none; }
.player { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.lamp { width: 28px; height: 28px; border-radius: 50%; background: var(--tint-brand); border: 1px solid var(--line-strong); flex: none; transition: background 0.03s; }
.lamp.on { background: #ffd23f; box-shadow: 0 0 18px 4px rgba(255, 210, 63, 0.7); border-color: #e0b000; }
.shift-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; border-top: 1px solid var(--border); }
@media (min-width: 900px) { .shift-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; } }
.shift-row { display: flex; gap: 10px; align-items: center; padding: 6px 2px; border: 0; border-bottom: 1px solid var(--border); font-family: inherit; font-size: 0.9rem; color: var(--text); background: none; text-align: left; min-height: 40px; width: 100%; cursor: pointer; }
.shift-row:hover { background: var(--panel-2); }
.shift-row .k { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 4.5rem; }
.shift-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shift-row.best { background: var(--tint-brand); }
.shift-row.best .k { color: var(--link); font-weight: 700; }
.pad-fields { display: flex; flex-direction: column; gap: 12px; padding: 8px; }
.reveal-out { display: flex; flex-direction: column; gap: 8px; font-size: 0.92rem; }
.reveal-out .secret { padding: 8px; border-radius: 8px; background: var(--tint-brand); font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }

/* fancy */
.fx-part { display: flex; flex-direction: column; gap: 14px; }
.fx-in { font-size: 1.1rem; min-height: 56px; }
.fx-filter { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; }
.fx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 640px) { .fx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .fx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.fx-card { position: relative; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--surface-border); border-radius: 16px; background: var(--surface); box-shadow: var(--surface-shadow); transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; }
.fx-card:hover, .fx-card:focus-within { border-color: var(--brand); box-shadow: var(--surface-hover-shadow); transform: translateY(-2px); }
.fx-copy { display: flex; flex-direction: column; gap: 4px; padding: 10px 44px 10px 12px; border: 0; background: none; text-align: left; min-height: 78px; width: 100%; border-radius: 16px; font-family: inherit; color: var(--text); cursor: pointer; }
.fx-name { font-size: 0.78rem; font-weight: 700; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fx-name .pill { font-weight: 600; }
.fx-prev { font-size: 1.2rem; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; color: var(--text); max-height: 7.5em; overflow: hidden; }
.fx-card.copied .fx-name::after { content: "Copied"; color: var(--ok); font-weight: 700; }
.fx-star { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border: 0; background: none; color: var(--faint); border-radius: 10px; display: grid; place-items: center; padding: 0; cursor: pointer; }
.fx-star:hover { background: var(--panel-2); color: var(--link); }
.fx-star[aria-pressed="true"] { color: #b45309; }
:root:not([data-theme="light"]) .fx-star[aria-pressed="true"] { color: #fbbf24; }
.fx-star[aria-pressed="true"] .ico { fill: currentColor; }
.fx-empty { color: var(--muted); padding: 12px 0; }
.post-pane { min-height: 360px; }
.post-ta { flex: 1; min-height: 300px; height: 46vh; width: 100%; resize: vertical; border: 0; outline: none; background: var(--surface); color: var(--text); padding: 12px 14px; font-family: inherit; font-size: 1.05rem; line-height: 1.6; }
.post-ta:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); outline: none; }

/* make */
.mk-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1000px) { .mk-grid { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 24px; } }
.mk-opts { display: flex; flex-direction: column; gap: 14px; }
.mk-opts .row { flex-wrap: wrap; }
.mk-out-pane { min-height: 280px; }
.mk-out-pane .cv-ta { height: 46vh; }
.mk-list { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.mk-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--border); }
.mk-item code { flex: 1; min-width: 0; background: none; padding: 0; font-size: 1rem; overflow-wrap: anywhere; color: var(--text); }
.strength { display: flex; flex-direction: column; gap: 6px; }
.strength-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9rem; }
.strength b.weak { color: var(--bad); }
.strength b.fair { color: var(--warn); }
.strength b.strong, .strength b.vstrong { color: var(--ok); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--brand); min-width: 0; }
.inv-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.inv-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.inv-row b { font-size: 0.92rem; color: var(--text-strong); }
.inv-row small { grid-column: 1; color: var(--muted); font-size: 0.8rem; }
.inv-row .actions { grid-row: 1 / span 2; grid-column: 2; }
.inv-row code { font-size: 0.75rem; }

/* ----- Dropping files, toasts, help ----- */
.drop-overlay { position: fixed; inset: 0; z-index: 2900; display: grid; place-items: center; pointer-events: none; background: rgba(10, 10, 20, 0.5); }
.drop-overlay span { background: var(--surface); color: var(--text-strong); border: 2px dashed var(--brand); border-radius: 20px; padding: 22px 28px; font-weight: 700; font-size: 1.05rem; }
.toast.bad { border-left-color: #f87171; }
.help-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px 32px; }
.help-grid section { display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 760px) { .help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.keys div { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 12px; font-size: 0.9rem; }
.keys dt { white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }
.shell-hint .link { font-size: inherit; }

/* ----- Phones ----- */
@media (max-width: 639px) {
    .app-hero { margin-bottom: 1.5rem; }
    .app-tagline { font-size: 1rem; }
    .toasts, .toasts[popover] { bottom: 16px; right: 16px; left: 16px; align-items: stretch; }
    .toast { min-width: 0; max-width: none; }
    .dialog-body { padding: 16px; }
    .info-section h2 { font-size: 1.4rem; }
    .info-section .info-grid, .info-three { grid-template-columns: 1fr; }
    .info-card { padding: 16px; }
    .step-num { left: 16px; }
    .keys div { grid-template-columns: 7rem minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .icon-btn, .tab, .seg button, .chip, .info-card, .dialog, .toast, .case-btn, .tool-btn, .fx-card, .meter > span, .switch-track, .switch-track::after, .lamp { transition: none; animation: none; }
    .btn:hover, .icon-btn:hover, .chip:hover, .seg button:hover, .info-card:hover, .case-btn:hover, .tool-btn:hover, .fx-card:hover, .fx-card:focus-within { transform: none; }
}

@media print {
    .app-toolbar, .shell-hint, .toasts, .side, .ed-bar, .statusline, .theme-toggle { display: none !important; }
}

/* Brought over from TextTransform and TextAnalyzer Pro (15 Nov 2026): the example line, sentence lengths, most used
   letters, the word cloud, Compare two texts and what the two tools left in this browser. */
.empty-hint { font-size: 0.9rem; }
.bar-list { display: flex; flex-direction: column; gap: 4px; }
.bar-list:empty, .sent-chart:empty, .cmp-out:empty { display: none; }
.bar-row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; margin-top: 6px; color: var(--text); }
.bar-row:first-child { margin-top: 0; }
.bar-num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.sent-chart svg { display: block; width: 100%; max-width: none; height: 90px; overflow: visible; }
.sent-line { fill: none; stroke: var(--brand); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.sent-long, .sent-vlong { stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.sent-long { stroke: var(--warn); }
.sent-vlong { stroke: var(--bad); }
.letter-row { cursor: default; }
.letter-row:hover { background: none; }
.count-actions { border-top: 1px solid var(--border); padding-top: 14px; }
.cloud-wrap { border: 1px solid var(--surface-border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.cloud-wrap canvas { display: block; max-width: 100%; }
.cmp-out { overflow-x: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.cmp-table th, .cmp-table td { padding: 7px 8px; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.cmp-table th:first-child { text-align: left; font-weight: 500; }
.cmp-table thead th { font-weight: 700; color: var(--text-strong); }
.cmp-table td:last-child { font-weight: 600; }
.cmp-table td.cmp-same { color: var(--muted); font-weight: 400; }
.old-data { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 639.98px) {
    main .bar-row, .dialog .cmp-table { font-size: 1rem; }
    .cmp-table th, .cmp-table td { padding: 8px 6px; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026). */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"], main .btn,
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]) { min-height: 44px; }
    main .icon-btn, main .icon-btn.small { width: 44px; height: 44px; min-width: 44px; }
    main .tab { min-width: 44px; }
    main :is(p, li, .hint, .label, .input, .seg button, .chip, .tab, .muted, .link, .check-row, .inline-field, .scope, .sel-note, .goal, .limit-top, .limit-sub, .read-ends, .facts, .ck .switch, .kw-row, .case-name, .case-prev, .find-count, .found-row, .found-none, .tool-btn b, .tool-btn small, .grp-title, .cv-note, .cv-ta, .detect, .shift-row, .fx-name, .mk-item code, .strength-top, .inv-row b, .inv-row small, .tile .lbl, .tile .sub, .statusline, .pill, .saved, .sum-note, .pane-title, .simpler-list button) { font-size: 1rem; }
    .dialog button, .dialog .btn, .dialog input:not([type="checkbox"]), .dialog select { min-height: 44px; }
    .dialog .icon-btn { width: 44px; height: 44px; }
    .dialog :is(p, .hint, .label, .input, .muted, dd, dt, .check-row small) { font-size: 1rem; }
    /* 14 Nov 2026: the words on buttons and the lines beside tick boxes too (they were 13.6 to 14.8 px) */
    main .btn, main .small-btn, main .check-row small, .dialog .btn, .dialog .check-row { font-size: 1rem; }
    main .seg button, main .chip, main .select, main .small-sel, main .simpler-list button, main .kw-row, main .shift-row, main .limit-x, main .fx-star { min-height: 44px; }
    main .limit-x, main .fx-star { width: 44px; height: 44px; }
    main .check-row, main .ck { min-height: 44px; align-items: center; }
    main .ck .switch { min-height: 44px; }
    .toast button { min-height: 44px; min-width: 44px; }
    .menu button { min-height: 44px; font-size: 1rem; }
    .inline-field { white-space: normal; flex-wrap: wrap; }
    .inline-field .select, .inline-field .input { flex: none; }
    .ed-bar { padding-right: 52px; } /* keeps clear of the site's round theme button at the right edge when the tool is scrolled up */
    main .ed-bar .small-btn { min-width: 44px; } /* icon-only on phones */
    main input[type="range"] { min-height: 44px; }
}
