/*
 * tools-v4.css: the free-tool page family built 2026-11 (docs/tools-2026-11/PLAN.md).
 * Ink hero, the tool on a light sheet, then about + steps and facts with sources; the FAQ and the lime panel are the
 * shared tool-page parts styled in theme-2026-tools.css (linked before this file). Restyled 2026-11-18 onto pn-system.
 * Uses the 2026 frame tokens from theme-2026.css (--pn-ink, --pn-surface-warm, --pn-line...).
 * Every rule is scoped under .tv4 so the legacy Foundation/app-critical rules cannot leak in,
 * and nothing here can leak out. Linked OUTSIDE the usemin build blocks with ?v=<date>.
 */

.tv4 {
    /* The 2026 frame tokens this family was written with, pointed at pn-system's neutral set (2026-11-18), so
     * fields, fills and lines match the rest of the site. */
    --pn-ink: var(--pns-text);
    --pn-ink-2: var(--pns-text-2);
    --pn-ink-3: var(--pns-text-3);
    --pn-line: var(--pns-line);
    --pn-surface: var(--pns-card);
    --pn-surface-warm: var(--pns-mist);
    --pn-radius-control: var(--pns-r-btn);
    --pn-radius-media: var(--tl-r-tile, 16px);
    --tv4-field: var(--pns-field);
    --tv4-ok: #0b7a4b;
    --tv4-warn: #9a5b00;
    --tv4-bad: #b42318;
    --tv4-ring: rgba(93, 95, 239, 0.22);
    --tv4-shadow: 0 1px 2px rgba(27, 27, 27, 0.04), 0 24px 48px -28px rgba(27, 27, 27, 0.22);
    display: block;
    padding: 0 !important;
    margin: 0 !important;
    background: var(--pn-surface);
    color: var(--pn-ink);
    font-family: var(--pn-font);
    font-size: 16px;
    line-height: 1.55;
    text-align: left;
    -webkit-font-smoothing: antialiased;
}

.tv4 *,
.tv4 *::before,
.tv4 *::after {
    box-sizing: border-box;
}

.tv4 h1,
.tv4 h2,
.tv4 h3,
.tv4 h4,
.tv4 p,
.tv4 ul,
.tv4 ol,
.tv4 dl,
.tv4 figure {
    margin: 0;
    padding: 0;
    font-family: var(--pn-font);
    text-align: left;
    text-transform: none;
}

.tv4 ul,
.tv4 ol {
    list-style: none;
}

.tv4 a {
    color: inherit;
}

/* Legacy CSS sets code to weight 300; Unicode codes read at the body weight. */
.tv4 code {
    font-weight: 400;
}

.tv4 [hidden] {
    display: none !important;
}

/* Widths and the left edge come from pn-system.css: --pns-w on the ink hero, --pns-w-sheet inside a light sheet. */
.tv4 .tv4-wrap {
    width: var(--pns-w);
    max-width: none;
    margin: 0 auto;
    padding: 0;
}

.tv4 > section:not(.tv4-hero) .tv4-wrap {
    width: var(--pns-w-sheet);
}

.tv4 .tv4-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ============ Hero + tool ============ */
/* The tool page layout of theme-2026-tools.css (section 22): a compact ink hero (logo tile, H1, one lead line),
 * then the tool on a white sheet that starts in the first screen. ID selectors beat pn-system's H1 rule. */
html body main#hero.tv4 > section.tv4-hero {
    padding: 20px 0 28px;
    background: var(--pns-ink);
    color: var(--pns-on-ink);
}

.tv4 .tv4-head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tv4 .tv4-head img.tl-hero-logo {
    flex: none;
    box-sizing: border-box;
    width: 52px;
    height: 52px;
    padding: 10px;
    border-radius: var(--pns-r-btn);
    background: #ffffff;
}

html body main#hero.tv4 > section.tv4-hero h1.tv4-h1 {
    max-width: none;
    margin: 0;
    color: var(--pns-on-ink);
    font-size: clamp(30px, 3vw, 44px) !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    letter-spacing: -0.035em !important;
}

html body main#hero.tv4 > section.tv4-hero p.tv4-sub {
    max-width: none;
    margin: 8px 0 0;
    color: var(--pns-on-ink-2);
    font-size: var(--pns-body);
    line-height: 1.5;
    letter-spacing: 0;
}

/* Light sheets: inset from the edges, rounded, on the ink page (pn-system's .pns-sheet). */
html body main#hero.tv4 > section.tv4-sheet,
html body main#hero.tv4 > section.tv4-section {
    margin: var(--pns-inset) var(--pns-inset) 0;
    padding: var(--pns-y) 0;
    border: 0;
    border-radius: var(--pns-r-sheet);
    background: var(--pns-card);
    color: var(--pns-text);
}

html body main#hero.tv4 > section.tv4-hero + section.tv4-sheet {
    margin-top: 0;
    padding: 28px 0 32px;
}

html body main#hero.tv4 > section.tv4-section--mist {
    background: var(--pns-mist);
}

/* The tool is the sheet: no second card, border or shadow inside it. */
.tv4 .tv4-app {
    position: relative;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.tv4 .tv4-app__noscript {
    padding: 16px;
    border-radius: 12px;
    background: var(--pn-surface-warm);
    color: var(--pn-ink-2);
    font-size: 15px;
}

/* ============ Controls ============ */
.tv4 .tv4-label {
    display: block;
    margin: 0 0 8px;
    color: var(--pn-ink);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.tv4 .tv4-hint {
    margin-top: 8px;
    color: var(--pn-ink-3);
    font-size: 14px;
    line-height: 1.45;
}

.tv4 .tv4-field,
.tv4 textarea.tv4-field,
.tv4 input.tv4-field,
.tv4 select.tv4-field {
    display: block;
    width: 100%;
    height: auto;
    min-height: 48px;
    margin: 0;
    padding: 12px 16px;
    border: 1px solid var(--tv4-field);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: none;
    color: var(--pn-ink);
    font-family: var(--pn-font);
    font-size: 17px;
    line-height: 1.5;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.tv4 textarea.tv4-field {
    min-height: 132px;
    resize: vertical;
}

.tv4 select.tv4-field {
    padding-right: 44px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231b1b1b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    font-size: 16px;
    cursor: pointer;
}

.tv4 .tv4-field:hover {
    border-color: #b9b5ae;
}

.tv4 .tv4-field:focus {
    outline: none;
    border-color: var(--pn-ink);
    box-shadow: 0 0 0 4px var(--tv4-ring);
}

.tv4 .tv4-field[aria-invalid="true"] {
    border-color: var(--tv4-bad);
}

.tv4 .tv4-err {
    margin-top: 8px;
    color: var(--tv4-bad);
    font-size: 14px;
}

/* Segmented control: tabs that filter or switch. Scrolls sideways on phones, never wraps. */
.tv4 .tv4-seg {
    display: flex;
    gap: 4px;
    max-width: 100%;
    padding: 4px;
    overflow-x: auto;
    border-radius: 14px;
    background: var(--pn-surface-pill);
    scrollbar-width: none;
}

.tv4 .tv4-seg::-webkit-scrollbar {
    display: none;
}

.tv4 .tv4-seg button {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    height: 40px;
    margin: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: var(--pn-ink-2);
    font-family: var(--pn-font);
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.tv4 .tv4-seg button:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--pn-ink);
}

.tv4 .tv4-seg button[aria-pressed="true"],
.tv4 .tv4-seg button[aria-selected="true"] {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(27, 27, 27, 0.08), 0 0 0 1px rgba(27, 27, 27, 0.04);
    color: var(--pn-ink);
}

.tv4 .tv4-seg button:focus-visible {
    outline: 2px solid var(--pn-accent);
    outline-offset: 1px;
}

.tv4 .tv4-seg img {
    width: 18px;
    height: 18px;
}

.tv4 .tv4-seg .tv4-count {
    color: var(--pn-ink-3);
    font-size: 13px;
    font-weight: 400;
}

/* Buttons */
.tv4 .tv4-btn,
.tv4 a.tv4-btn,
.tv4 button.tv4-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    margin: 0;
    padding: 0 20px;
    border: 1px solid var(--pn-ink);
    border-radius: var(--pn-radius-control);
    background: var(--pn-ink);
    box-shadow: none;
    color: #ffffff !important;
    font-family: var(--pn-font);
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tv4 .tv4-btn:hover {
    border-color: #000000;
    background: #000000;
}

.tv4 .tv4-btn:focus-visible {
    outline: 2px solid var(--pn-accent);
    outline-offset: 2px;
}

.tv4 .tv4-btn svg {
    width: 16px;
    height: 16px;
    flex: none;
}

.tv4 .tv4-btn--ghost,
.tv4 a.tv4-btn--ghost,
.tv4 button.tv4-btn--ghost {
    border-color: var(--tv4-field);
    background: #ffffff;
    color: var(--pn-ink) !important;
}

.tv4 .tv4-btn--ghost:hover {
    border-color: var(--pn-ink);
    background: #ffffff;
}

.tv4 .tv4-btn--sm,
.tv4 button.tv4-btn--sm {
    height: 36px;
    padding: 0 14px;
    font-size: 14px;
}

.tv4 .tv4-btn--lg,
.tv4 button.tv4-btn--lg {
    height: 56px;
    padding: 0 28px;
    border-radius: 12px;
    font-size: 17px;
}

.tv4 .tv4-btn.is-done {
    border-color: var(--tv4-ok);
    background: var(--tv4-ok);
    color: #ffffff !important;
}

.tv4 .tv4-btn--ghost.is-done {
    border-color: var(--tv4-ok);
    background: #ecf8f1;
    color: var(--tv4-ok) !important;
}

.tv4 .tv4-btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Result strip: appears once the tool made something worth keeping. */
.tv4 .tv4-next {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    margin-top: 24px;
    padding: 20px 24px;
    border-radius: var(--pn-radius-media);
    background: var(--pn-surface-warm);
}

.tv4 .tv4-next__title {
    color: var(--pn-ink);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.35;
}

.tv4 .tv4-next__text {
    margin-top: 4px;
    color: var(--pn-ink-2);
    font-size: 15px;
}

.tv4 .tv4-next__nets {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.tv4 .tv4-next__nets img {
    width: 18px;
    height: 18px;
}

/* The one lime button on the page: "post it" in the result strip. */
.tv4 .tv4-next a.tv4-btn {
    border-color: var(--pns-lime);
    background: var(--pns-lime);
    color: var(--pns-on-lime) !important;
}

.tv4 .tv4-next a.tv4-btn:hover {
    border-color: var(--pns-lime-hover);
    background: var(--pns-lime-hover);
}

/* Toast */
.tv4-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 2147483000;
    max-width: calc(100vw - 32px);
    padding: 12px 18px;
    border-radius: 12px;
    background: #1b1b1b;
    color: #ffffff;
    font-family: var(--pn-font);
    font-size: 15px;
    line-height: 1.35;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    transform: translate(-50%, 12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.tv4-toast.is-on {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* ============ Content sections ============ */
/* Each section is its own sheet (rules above); sizes follow pn-system's h2 scale. */
.tv4 .tv4-h2 {
    color: var(--pn-ink);
    font-size: clamp(28px, 3vw, 40px);
    font-weight: 500;
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.tv4 .tv4-lead {
    max-width: 62ch;
    margin-top: 16px;
    color: var(--pn-ink-2);
    font-size: 17px;
    line-height: 1.6;
}

.tv4 .tv4-split {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 64px;
}

.tv4 .tv4-prose p {
    max-width: 64ch;
    margin-top: 16px;
    color: var(--pn-ink-2);
    font-size: 17px;
    line-height: 1.65;
}

.tv4 .tv4-prose p:first-of-type {
    margin-top: 20px;
}

.tv4 .tv4-steps {
    display: grid;
    gap: 12px;
    counter-reset: tv4step;
}

.tv4 .tv4-steps li {
    position: relative;
    padding: 20px 20px 20px 68px;
    border-radius: var(--pn-radius-media);
    background: var(--pn-surface-warm);
    counter-increment: tv4step;
}

/* On the mist sheet the steps are white cards. */
.tv4 .tv4-section--mist .tv4-steps li {
    background: var(--pns-card);
}

.tv4 .tv4-steps li::before {
    content: counter(tv4step);
    position: absolute;
    top: 20px;
    left: 20px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--pn-ink);
    color: #ffffff;
    font-size: 15px;
    font-weight: 500;
}

.tv4 .tv4-steps h3 {
    color: var(--pn-ink);
    font-size: 17px;
    font-weight: 500;
    line-height: 1.35;
}

.tv4 .tv4-steps p {
    margin-top: 4px;
    color: var(--pn-ink-2);
    font-size: 15px;
    line-height: 1.55;
}

/* Facts table with sources */
.tv4 .tv4-table-wrap {
    margin-top: 32px;
    overflow-x: auto;
    border: 1px solid var(--pn-line);
    border-radius: var(--pn-radius-media);
}

.tv4 table.tv4-table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    background: #ffffff;
    font-size: 15px;
}

.tv4 table.tv4-table th,
.tv4 table.tv4-table td {
    padding: 14px 18px;
    border: 0;
    border-bottom: 1px solid var(--pn-line);
    color: var(--pn-ink);
    text-align: left;
    vertical-align: top;
    line-height: 1.45;
}

.tv4 table.tv4-table thead th {
    background: var(--pn-surface-warm);
    color: var(--pn-ink-2);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tv4 table.tv4-table tbody tr:last-child td {
    border-bottom: 0;
}

.tv4 table.tv4-table tbody tr:nth-child(even) {
    background: transparent;
}

.tv4 table.tv4-table td.tv4-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Links are ink with an underline (pn-system: no purple text). */
.tv4 table.tv4-table a {
    color: var(--pns-text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tv4 .tv4-net {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.tv4 .tv4-net img {
    width: 18px;
    height: 18px;
}

.tv4 .tv4-checked {
    margin-top: 12px;
    color: var(--pn-ink-3);
    font-size: 14px;
}

/* ============ Font generator ============ */
.tv4 .fg-top {
    display: grid;
}

.tv4 #fg-input {
    min-height: 92px;
    font-size: 19px;
}

.tv4 .fg-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.tv4 .fg-meta {
    color: var(--pn-ink-3);
    font-size: 14px;
}

.tv4 .fg-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.tv4 .fg-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 12px 12px 12px 18px;
    border: 1px solid var(--pn-line);
    border-radius: 18px;
    background: #ffffff;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tv4 .fg-row:hover {
    border-color: #cfcbc4;
    background: #fcfcfc;
}

.tv4 .fg-row__name {
    display: block;
    margin-bottom: 2px;
    color: var(--pn-ink-3);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.tv4 .fg-row__out {
    display: block;
    overflow: hidden;
    color: var(--pn-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans", "Noto Sans Math", "Apple Symbols", "Segoe UI Symbol", sans-serif;
    font-size: 21px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv4 .fg-group {
    grid-column: 1 / -1;
    margin: 16px 0 2px;
    color: var(--pn-ink-2);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.tv4 .fg-group:first-child {
    margin-top: 0;
}

.tv4 .fg-note {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--pn-surface-warm);
    color: var(--pn-ink-2);
    font-size: 14px;
    line-height: 1.5;
}

.tv4 .fg-note svg {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

/* ============ Character counter ============ */
.tv4 .cc-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.tv4 .cc-stats li {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 10px;
    background: var(--pn-surface-warm);
    color: var(--pn-ink-2);
    font-size: 14px;
}

.tv4 .cc-stats b {
    color: var(--pn-ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.tv4 .cc-sum {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 28px 0 14px;
}

.tv4 .cc-sum__text {
    color: var(--pn-ink);
    font-size: 17px;
    font-weight: 500;
}

.tv4 .cc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.tv4 .cc-card {
    padding: 18px 18px 16px;
    border: 1px solid var(--pn-line);
    border-radius: 20px;
    background: #ffffff;
    transition: border-color 0.15s ease;
}

.tv4 .cc-card.is-over {
    border-color: #f1c4bf;
    background: #fffafa;
}

.tv4 .cc-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tv4 .cc-card__net {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-size: 15px;
    font-weight: 500;
}

.tv4 .cc-card__net img {
    width: 20px;
    height: 20px;
}

.tv4 .cc-card__count {
    color: var(--pn-ink);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tv4 .cc-card__count small {
    color: var(--pn-ink-3);
    font-size: 13px;
}

.tv4 .cc-bar {
    position: relative;
    height: 6px;
    margin: 14px 0 10px;
    overflow: hidden;
    border-radius: 99px;
    background: #ededf0;
}

.tv4 .cc-bar i {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    border-radius: 99px;
    background: var(--pn-ink);
    transition: width 0.2s ease, background-color 0.2s ease;
}

.tv4 .cc-card.is-near .cc-bar i {
    background: #d08a00;
}

.tv4 .cc-card.is-over .cc-bar i {
    background: var(--tv4-bad);
}

.tv4 .cc-card__status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--pn-ink-2);
    font-size: 14px;
    line-height: 1.4;
}

.tv4 .cc-card.is-over .cc-card__status {
    color: var(--tv4-bad);
    font-weight: 500;
}

.tv4 .cc-card.is-ok .cc-card__status {
    color: var(--tv4-ok);
}

.tv4 .cc-card__fold {
    margin-top: 6px;
    color: var(--pn-ink-3);
    font-size: 13px;
    line-height: 1.4;
}

/* ============ Invisible character ============ */
.tv4 .ic-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    align-items: stretch;
}

.tv4 .ic-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
    padding: 28px;
    border-radius: 24px;
    background: var(--pn-ink);
    color: #ffffff;
}

.tv4 .ic-main__label {
    color: rgba(255, 255, 255, 0.72);
    font-size: 14px;
}

.tv4 .ic-main__name {
    color: #ffffff;
    font-size: 22px;
    font-weight: 500;
    line-height: 1.3;
}

.tv4 .ic-main .tv4-btn {
    align-self: flex-start;
    border-color: #ffffff;
    background: #ffffff;
    color: var(--pn-ink) !important;
}

.tv4 .ic-main .tv4-btn:hover {
    background: #f0f0f2;
}

.tv4 .ic-main .tv4-btn.is-done {
    border-color: #ffffff;
    background: #e7f7ee;
    color: var(--tv4-ok) !important;
}

.tv4 .ic-qty {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
}

.tv4 .ic-qty input {
    width: 72px;
    height: 36px;
    margin: 0;
    padding: 0 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    color: #ffffff;
    font-family: var(--pn-font);
    font-size: 15px;
}

.tv4 .ic-test {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
    border-radius: 24px;
    background: var(--pn-surface-warm);
}

.tv4 .ic-test .tv4-field {
    min-height: 120px;
    background: #ffffff;
}

.tv4 .ic-test__count {
    color: var(--pn-ink-2);
    font-size: 14px;
}

.tv4 .ic-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 28px;
}

.tv4 .ic-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 14px 14px 14px;
    border: 1px solid var(--pn-line);
    border-radius: 18px;
}

.tv4 .ic-row__box {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1px dashed #c8c8cd;
    border-radius: 12px;
    background: repeating-linear-gradient(45deg, #fafafa, #fafafa 6px, #f4f4f5 6px, #f4f4f5 12px);
    color: var(--pn-ink-3);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11px;
}

.tv4 .ic-row__name {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.tv4 .ic-row__meta {
    margin-top: 2px;
    color: var(--pn-ink-3);
    font-size: 13px;
    line-height: 1.4;
}

.tv4 .ic-row__meta code {
    padding: 1px 5px;
    border-radius: 5px;
    background: #f1f1f3;
    color: var(--pn-ink-2);
    font-size: 12px;
}

/* ============ Best time to post ============ */
.tv4 .bt-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

.tv4 .bt-tz {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 300px));
    gap: 12px;
}

.tv4 .bt-tz .tv4-field {
    min-height: 44px;
    padding-top: 9px;
    padding-bottom: 9px;
    font-size: 15px;
}

.tv4 .bt-format {
    margin-top: 16px;
}

.tv4 .bt-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}

.tv4 .bt-top {
    position: relative;
    padding: 18px 20px;
    border-radius: 20px;
    background: var(--pn-surface-warm);
}

.tv4 .bt-top:first-child {
    background: var(--pn-ink);
    color: #ffffff;
}

.tv4 .bt-top__rank {
    color: var(--pn-ink-3);
    font-size: 13px;
    font-weight: 500;
}

.tv4 .bt-top:first-child .bt-top__rank {
    color: rgba(255, 255, 255, 0.65);
}

.tv4 .bt-top__when {
    margin-top: 6px;
    font-size: 24px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.tv4 .bt-top__local {
    margin-top: 4px;
    color: var(--pn-ink-2);
    font-size: 14px;
}

.tv4 .bt-top:first-child .bt-top__local {
    color: rgba(255, 255, 255, 0.75);
}

.tv4 .bt-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.tv4 .bt-day {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 10px 12px;
    border: 1px solid var(--pn-line);
    border-radius: 18px;
    background: #ffffff;
}

.tv4 .bt-day.is-best {
    border-color: var(--pn-ink);
    box-shadow: inset 0 0 0 1px var(--pn-ink);
}

.tv4 .bt-day__name {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 0 4px 6px;
    font-size: 14px;
    font-weight: 500;
}

.tv4 .bt-day__tag {
    white-space: nowrap;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--pn-ink);
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
}

.tv4 .bt-day__tag.is-weak {
    background: #efeff1;
    color: var(--pn-ink-2);
}

.tv4 .bt-slot {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 10px;
    border-radius: 12px;
    background: var(--pn-surface-warm);
}

.tv4 .bt-slot:first-of-type {
    background: #e9e9ec;
}

.tv4 .bt-week--unranked .bt-slot:first-of-type:not(.is-top) {
    background: var(--pn-surface-warm);
}

.tv4 .bt-slot.is-top {
    background: var(--pn-ink);
    color: #ffffff;
}

.tv4 .bt-slot__time {
    font-size: 16px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
}

.tv4 .bt-slot__local {
    color: var(--pn-ink-3);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tv4 .bt-slot.is-top .bt-slot__local {
    color: rgba(255, 255, 255, 0.7);
}

.tv4 .bt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-top: 16px;
    color: var(--pn-ink-2);
    font-size: 14px;
}

.tv4 .bt-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tv4 .bt-legend i {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    background: var(--pn-ink);
}

.tv4 .bt-legend i.is-day {
    border: 2px solid var(--pn-ink);
    background: #ffffff;
}

.tv4 .bt-quiet {
    margin-top: 6px;
    color: var(--pn-ink-2);
    font-size: 14px;
}

.tv4 .bt-source {
    margin-top: 16px;
    color: var(--pn-ink-3);
    font-size: 13px;
    line-height: 1.5;
}

.tv4 .bt-source a {
    color: var(--pn-ink-2);
}

.tv4 .bt-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

/* All-networks plan table */
.tv4 .bt-plan td,
.tv4 .bt-plan th {
    white-space: nowrap;
}

.tv4 .bt-plan td.is-top {
    font-weight: 600;
}

/* ============ Engagement rate calculator ============ */
.tv4 .er-grid {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 24px;
    margin-top: 24px;
}

.tv4 .er-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.tv4 .er-fields .is-wide {
    grid-column: 1 / -1;
}

.tv4 .er-result {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 28px;
    border-radius: 24px;
    background: var(--pn-ink);
    color: #ffffff;
}

.tv4 .er-result__label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.tv4 .er-result__num {
    font-size: clamp(48px, 6vw, 72px);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    letter-spacing: -0.04em;
}

.tv4 .er-result__band {
    align-self: flex-start;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 14px;
    font-weight: 500;
}

.tv4 .er-result__formula {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    line-height: 1.5;
}

.tv4 .er-result .tv4-btn {
    align-self: flex-start;
    border-color: #ffffff;
    background: #ffffff;
    color: var(--pn-ink) !important;
}

/* ============ Resizers ============ */
.tv4 .rz {
    display: grid;
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
    gap: 24px;
}

.tv4 .rz-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 420px;
    padding: 20px;
    overflow: hidden;
    border-radius: 24px;
    background: #efeff1 repeating-conic-gradient(#e7e7ea 0% 25%, #f4f4f5 0% 50%) 50% / 24px 24px;
}

.tv4 .rz-frame {
    position: relative;
    max-width: 100%;
    overflow: hidden;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(27, 27, 27, 0.12), 0 24px 48px -24px rgba(27, 27, 27, 0.4);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.tv4 .rz-frame.is-dragging {
    cursor: grabbing;
}

.tv4 .rz-frame canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.tv4 .rz-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.tv4 .rz-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px;
    border: 1.5px dashed #c4c0b9;
    border-radius: 18px;
    background: #ffffff;
    color: var(--pn-ink-2);
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tv4 .rz-drop:hover,
.tv4 .rz-drop.is-over {
    border-color: var(--pn-ink);
    background: #fcfcfc;
}

.tv4 .rz-drop svg {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
    color: var(--pn-ink);
}

.tv4 .rz-drop b {
    color: var(--pn-ink);
    font-size: 15px;
    font-weight: 500;
}

.tv4 .rz-side {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tv4 .rz-presets {
    display: grid;
    gap: 8px;
}

.tv4 .rz-preset {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--pn-line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: none;
    color: var(--pn-ink);
    font-family: var(--pn-font);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tv4 .rz-preset:hover {
    border-color: #c8c8cd;
    background: #ffffff;
}

.tv4 .rz-preset[aria-pressed="true"] {
    border-color: var(--pn-ink);
    box-shadow: inset 0 0 0 1px var(--pn-ink);
}

.tv4 .rz-preset__shape {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
}

.tv4 .rz-preset__shape i {
    display: block;
    border: 1.5px solid var(--pn-ink);
    border-radius: 3px;
}

.tv4 .rz-preset__name {
    display: block;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.tv4 .rz-preset__size {
    display: block;
    color: var(--pn-ink-3);
    font-size: 13px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.tv4 .rz-zoom {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tv4 .rz-zoom input[type="range"] {
    flex: 1;
    accent-color: var(--pn-ink);
}

.tv4 .rz-dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tv4 .rz-info {
    color: var(--pn-ink-3);
    font-size: 13px;
    line-height: 1.5;
}

.tv4 .rz-guides {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    color: var(--pn-ink-2);
    font-size: 14px;
}

.tv4 .rz-guides label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--pn-ink-2);
    font-size: 14px;
    cursor: pointer;
}

.tv4 .rz-guides input {
    margin: 0;
    accent-color: var(--pn-ink);
}

/* ============ Responsive ============ */
/* Up to 1,280px the fixed phone bar is cleared by main's own top padding (theme-2026-tools.css, section 1). */
@media (max-width: 1100px) {
    .tv4 .bt-week {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

}

@media (max-width: 900px) {
    .tv4 .tv4-split,
    .tv4 .er-grid,
    .tv4 .rz,
    .tv4 .ic-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 32px;
    }

    .tv4 .fg-list,
    .tv4 .ic-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .tv4 .bt-controls {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 767.98px) {
    .tv4 .tv4-head {
        gap: 12px;
    }

    .tv4 .tv4-head img.tl-hero-logo {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    html body main#hero.tv4 > section.tv4-hero + section.tv4-sheet {
        padding: 20px 0 28px;
    }

    .tv4 .tv4-next {
        padding: 18px;
    }

    /* Tap targets: 44px on a phone, the small buttons included. */
    .tv4 .tv4-btn--sm,
    .tv4 button.tv4-btn--sm {
        height: 44px;
    }

    .tv4 .ic-qty input {
        height: 44px;
    }

    .tv4 .tv4-next .tv4-btn {
        width: 100%;
    }

    .tv4 .bt-week {
        grid-template-columns: minmax(0, 1fr);
    }

    .tv4 .bt-day {
        display: grid;
        grid-template-columns: 64px repeat(3, minmax(0, 1fr));
        align-items: center;
        gap: 6px;
        padding: 8px;
    }

    .tv4 .bt-day__name {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 4px;
    }

    .tv4 .bt-slot {
        padding: 8px;
    }

    .tv4 .bt-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .tv4 .bt-tz {
        grid-template-columns: minmax(0, 1fr);
    }

    .tv4 .er-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .tv4 .rz-stage {
        min-height: 260px;
        padding: 12px;
    }

    .tv4 .fg-row__out {
        font-size: 19px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .tv4 *,
    .tv4-toast {
        transition: none !important;
    }
}

/* Phone pass (2026-11-19). The font list was 10,458px tall at 390: 108 cards of 86px each. On a phone it is one
 * list with hairlines between rows (no card per row), so the same 108 styles take about two thirds of the height. */
@media (max-width: 640px) {
    .tv4 .fg-list {
        gap: 0;
        margin-top: 12px;
        overflow: hidden;
        border: 1px solid var(--pn-line);
        border-radius: 18px;
        background: #ffffff;
    }

    .tv4 .fg-row {
        min-height: 60px;
        gap: 8px;
        padding: 8px 8px 8px 14px;
        border: 0;
        border-top: 1px solid var(--pn-line);
        border-radius: 0;
    }

    .tv4 .fg-group + .fg-row {
        border-top: 0;
    }

    .tv4 .fg-group {
        margin: 0;
        padding: 18px 14px 8px;
        border-top: 1px solid var(--pn-line);
        background: var(--pns-mist, #f4f4f5);
    }

    .tv4 .fg-group:first-child {
        border-top: 0;
    }

    .tv4 .fg-row__name {
        margin-bottom: 0;
        font-size: 11px;
    }

    .tv4 .fg-row__out {
        font-size: 18px;
    }

    /* Facts tables (tv4-common.js labels each cell): one card per row, the column name above each value. */
    .tv4 .tv4-table-wrap:has(table.tv4-table--stack) {
        overflow: visible;
    }

    /* The character counter set min-width: 640px on its table for the scroll box; a stacked table fits. */
    .tv4 table.tv4-table.tv4-table--stack {
        min-width: 0;
    }

    .tv4 table.tv4-table--stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .tv4 table.tv4-table--stack,
    .tv4 table.tv4-table--stack tbody,
    .tv4 table.tv4-table--stack tr,
    .tv4 table.tv4-table--stack td {
        display: block;
        width: auto;
    }

    .tv4 table.tv4-table--stack tr {
        padding: 14px 16px;
        border-bottom: 1px solid var(--pn-line);
    }

    .tv4 table.tv4-table--stack tbody tr:last-child {
        border-bottom: 0;
    }

    .tv4 table.tv4-table--stack td {
        padding: 2px 0;
        border: 0;
        white-space: normal;
    }

    .tv4 table.tv4-table--stack td.tv4-num {
        white-space: normal;
    }

    .tv4 table.tv4-table.tv4-table--stack td:first-child {
        width: auto;
        padding-bottom: 6px;
        font-weight: 500;
    }

    /* Label and value side by side, so a row costs one line per value. */
    .tv4 table.tv4-table--stack td:not(:first-child)[data-label] {
        position: relative;
        min-height: 1.4em;
        padding-left: calc(38% + 12px);
    }

    .tv4 table.tv4-table--stack td:not(:first-child)[data-label]::before {
        content: attr(data-label);
        position: absolute;
        top: 4px;
        left: 0;
        width: 38%;
        color: var(--pn-ink-3);
        font-size: 12px;
        font-weight: 500;
        line-height: 1.4;
    }

    .tv4 table.tv4-table--stack td:not(:first-child) + td {
        margin-top: 4px;
    }
}

/* Short lists (2026-11-19): font-generator.js and tv4-common.js add these classes, so without JS every row shows. */
.tv4 .fg-row.fg-row--more,
.tv4 .tv4-fold-more {
    display: none !important;
}

.tv4 .fg-group:has(.fg-group__all) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tv4 button.fg-group__all {
    min-height: 44px;
    margin: -12px 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--pn-ink);
    font: inherit;
    font-weight: 500;
    letter-spacing: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.tv4 button.fg-group__all:focus-visible {
    outline: 2px solid var(--pns-focus, #141414);
    outline-offset: 2px;
}

.tv4 .tv4-fold {
    margin: 12px 0 0;
}


/* Links between the font pages (font_generator.pug) */
.tv4 .fg-links {
    margin: 16px 0 0;
    color: var(--pn-ink-2);
    font-size: 15px;
}

.tv4 .fg-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--pn-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tv4 .fg-links a + a {
    margin-left: 8px;
}
