/* /tools pages. Uses the app.css tokens, same grammar as contest-lists.css and shop.css. */

.tl-page {
    --tl-amber-ink: #6B4F14;
    --tl-amber-wash: rgba(150, 113, 42, 0.13);
    --tl-blue: #3E5C8A;
    /* Text the visitor brings (file names, watermark text) is set in the device's own fonts: showing it never fetches a web font. */
    --tl-local-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --tl-local-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    max-width: 880px; margin: 0 auto; padding: 8px 0 64px;
}
.tl-page [hidden] { display: none !important; }
.tl-page a:not(.btn) { color: inherit; text-decoration: none; border-bottom: 1px solid var(--rule-2); }
.tl-page a:not(.btn):hover { color: var(--red); border-color: var(--red); }
.tl-sr {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.tl-head { max-width: 680px; }
.tl-eyebrow {
    margin: 0 0 16px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em;
    text-transform: uppercase; color: var(--ink-4);
}
.tl-page .tl-eyebrow a { border-color: transparent; }
.tl-title {
    margin: 0 0 16px; font-size: clamp(30px, 4.6vw, 44px); font-weight: 600; line-height: 1.08;
    letter-spacing: -0.024em; color: var(--ink); text-wrap: balance;
}
.tl-lede { margin: 0; font-size: 17px; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.tl-device { margin: 16px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.tl-device::before {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 9px; border-radius: 50%;
    background: var(--positive); vertical-align: 1px;
}

.tl-panel { margin: 32px 0 0; padding: 24px; border-radius: var(--card-radius-sm); background: var(--wall-2); }
.tl-panel + .tl-panel { margin-top: 20px; }
.tl-panel > .tl-h2 { margin-bottom: 16px; }
.tl-h2 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.25; color: var(--ink); }
.tl-h3 { margin: 0 0 10px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }

.tl-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px 20px; }
.tl-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-field-wide { grid-column: 1 / -1; }
.tl-field label {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--ink-4);
}
.tl-field input, .tl-field select {
    width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--rule-2); border-radius: 6px;
    background: var(--wall); font: inherit; font-size: 15px; color: var(--ink);
}
.tl-field input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--red); height: 38px; }
.tl-field input:focus, .tl-field select:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
.tl-field input:disabled { opacity: 0.45; }
.tl-help { font-size: 12.5px; line-height: 1.5; color: var(--ink-4); }
.tl-under { margin: 10px 0 0; }
.tl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 18px 0 0; }

.tl-source { margin: 14px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.tl-drop {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    margin: 20px 0 0; padding: 28px 16px; border: 1.5px dashed var(--rule-2); border-radius: var(--card-radius-sm);
    background: var(--wall); text-align: center; cursor: pointer;
    transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.tl-drop:hover, .tl-drop.is-over { border-color: var(--red); background: var(--red-wash); }
.tl-drop:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }
.tl-drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.tl-drop-main { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.tl-drop-sub { font-size: 13px; color: var(--ink-4); }
.tl-file-name { margin: 6px 0 0; font-family: var(--tl-local-mono); font-size: 12px; color: var(--ink-4); overflow-wrap: anywhere; }
.tl-field input.tl-local-text { font-family: var(--tl-local-sans); }
.tl-field input[type="color"] { height: 42px; padding: 4px; cursor: pointer; }

.tl-error {
    margin: 14px 0 0; padding: 10px 14px; border-radius: 6px; background: var(--red-wash);
    border: 1px solid var(--red-line); color: var(--red-dim); font-size: 14px; line-height: 1.55;
}
.tl-notice {
    margin: 12px 0 0; padding: 12px 14px; border-radius: 6px; background: var(--wall);
    border: 1px solid var(--rule-2); font-size: 14.5px; line-height: 1.6; color: var(--ink);
}
.tl-note { margin: 10px 0 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.tl-status { margin: 10px 0 0; font-size: 13.5px; color: var(--ink-2); min-height: 1em; }
.tl-fine { margin: 18px 0 0; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.65; color: var(--ink-4); }
.tl-page .tl-fine a { border-color: var(--rule-2); }

.tl-verdict { margin: 24px 0 0; font-size: 19px; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; color: var(--ink); }
.tl-verdict::before {
    content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%;
    background: var(--positive); vertical-align: 1px;
}
.tl-verdict-fail::before { background: var(--red); }
.tl-verdict-check::before { background: var(--amber); }

.tl-preview { margin: 16px 0 0; }
.tl-preview canvas { display: block; max-width: 100%; height: auto; border-radius: 3px; background: var(--wall-3); }
.tl-preview canvas.is-marking { cursor: crosshair; touch-action: none; }
.tl-form-crop { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.tl-trim { margin: 16px 0 0; }
.tl-trim-label { margin: 0 0 10px; }
.tl-field output { margin-left: 4px; color: var(--ink-2); }

.tl-checks { width: 100%; margin: 14px 0 0; border-collapse: collapse; font-size: 14px; }
.tl-checks thead th {
    padding: 0 12px 9px 0; border-bottom: 1px solid var(--ink); text-align: left; vertical-align: bottom;
    font-family: var(--font-mono); font-size: 10px; font-weight: 400; letter-spacing: 0.16em;
    text-transform: uppercase; color: var(--ink-4); white-space: nowrap;
}
.tl-checks tbody th, .tl-checks td {
    padding: 11px 12px 11px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top;
    line-height: 1.45; color: var(--ink-2);
}
.tl-checks tbody th { font-weight: 600; color: var(--ink); white-space: nowrap; }
.tl-checks td:last-child, .tl-checks thead th:last-child { text-align: right; padding-right: 0; }
.tl-sub { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 400; line-height: 1.45; color: var(--ink-4); }

.tl-chip {
    display: inline-block; padding: 2px 9px; border-radius: 999px; font-family: var(--font-mono);
    font-size: 11px; line-height: 1.6; letter-spacing: 0.02em; white-space: nowrap;
}
.tl-chip-pass { background: var(--positive-wash); color: var(--positive); }
.tl-chip-fail { background: var(--red-wash); color: var(--red-dim); }
.tl-chip-check { background: var(--tl-amber-wash); color: var(--tl-amber-ink); }
.tl-chip-info { background: var(--rule-soft); color: var(--ink-4); }
.tl-chip-on { background: var(--rule); color: var(--ink-2); }
.tl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }

.tl-fix { margin: 28px 0 0; padding-top: 22px; border-top: 1px solid var(--rule-2); }
.tl-fix .btn { margin-top: 16px; }
.tl-output { margin: 18px 0 0; }
.tl-ok { margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink); }
.tl-ok::before {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 9px; border-radius: 50%;
    background: var(--positive); vertical-align: 1px;
}

.tl-figures {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin: 22px 0 0;
    background: var(--rule); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden;
}
.tl-figures > div { padding: 14px 16px; background: var(--wall); }
.tl-figures dt { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-4); }
.tl-figures dd {
    margin: 6px 0 0; font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -0.012em;
    color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.tl-figures .tl-small { font-size: 15px; font-weight: 500; }

.tl-table { width: 100%; margin: 18px 0 0; border-collapse: collapse; font-size: 14.5px; }
.tl-table caption { padding-bottom: 8px; text-align: left; font-weight: 600; color: var(--ink); }
.tl-table thead th {
    padding: 0 12px 8px 0; border-bottom: 1px solid var(--ink); text-align: left; font-family: var(--font-mono);
    font-size: 10px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-4);
}
.tl-table tbody th, .tl-table td {
    padding: 9px 12px 9px 0; border-bottom: 1px solid var(--rule); text-align: left; color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}
.tl-table tbody th { font-weight: 600; color: var(--ink); }

.tl-zone { margin: 18px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.tl-sun { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin: 14px 0 0; }
.tl-sun-part { padding: 14px 16px 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--wall); }
.tl-sun-part dl { margin: 0; }
.tl-sun-row {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    padding: 9px 0; border-top: 1px solid var(--rule);
}
.tl-sun-row dt { font-weight: 600; color: var(--ink); white-space: nowrap; }
.tl-sun-row dt::before {
    content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%;
    background: var(--ink-4); vertical-align: 1px;
}
.tl-sun-golden dt::before { background: var(--amber); }
.tl-sun-blue dt::before { background: var(--tl-blue); }
.tl-sun-sunrise dt::before, .tl-sun-sunset dt::before { background: var(--red); }
.tl-sun-row dd { margin: 0; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.tl-notes { margin: 14px 0 0; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--ink-2); }

.tl-meta { margin: 18px 0 0; border-top: 1px solid var(--rule-2); }
.tl-meta > div {
    display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--rule);
}
.tl-meta dt { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); padding-top: 3px; }
.tl-meta dd { margin: 0; font-family: var(--tl-local-sans); color: var(--ink); overflow-wrap: anywhere; }
.tl-meta dd.tl-empty { color: var(--ink-4); }

.tl-section { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule-2); }
.tl-howto { margin: 14px 0 0; padding-left: 22px; max-width: 70ch; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.tl-howto li + li { margin-top: 6px; }
.tl-section .comp-faq-list { margin-top: 16px; max-width: 72ch; }

.tl-terms { margin: 36px 0 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.tl-page .tl-terms a { font-weight: 600; color: var(--ink); border-color: var(--red-line); }

.tl-index { list-style: none; margin: 32px 0 0; padding: 0; border-top: 1px solid var(--ink); }
.tl-index li { padding: 16px 0; border-bottom: 1px solid var(--rule); font-size: 16px; line-height: 1.5; }
.tl-page .tl-index a { font-weight: 600; color: var(--ink); }
.tl-index .tl-sub { font-size: 14px; color: var(--ink-2); }
.tl-group { margin: 40px 0 0; }
.tl-group-title {
    margin: 0; font-family: var(--font-mono); font-size: 10.5px; font-weight: 400; letter-spacing: 0.2em;
    text-transform: uppercase; color: var(--ink-4);
}
.tl-group .tl-index { margin-top: 12px; }

.tl-preview canvas.tl-fit { width: auto; max-width: 100%; max-height: 640px; }
.tl-preview + .btn, .tl-note + .btn, .tl-notice + .btn, .tl-form + .btn, .tl-output > .btn { margin-top: 16px; }
.tl-note + .tl-form, .tl-wm-form { margin-top: 18px; }
.tl-sr + .tl-drop { margin-top: 0; }
.tl-compare th:first-child, .tl-compare td:first-child { width: 28%; }
.tl-compare thead th:first-child { border-bottom-color: var(--ink); }
.tl-what { margin: 18px 0 0; }
.tl-what-title { margin: 0; font-weight: 600; color: var(--ink); }
.tl-what .tl-notes { margin-top: 8px; }

.tl-files { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--rule-2); }
.tl-files:empty { display: none; }
.tl-file {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 14px; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--rule);
}
.tl-file .tl-file-name { grid-column: 1; margin: 0; color: var(--ink); font-size: 12.5px; }
.tl-file-status { grid-column: 1; margin-top: 3px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.tl-file .btn { grid-column: 2; grid-row: 1 / span 2; }
.tl-file.is-error .tl-file-status { color: var(--red-dim); }
.tl-file.is-skip .tl-file-status { color: var(--ink-4); }

.tl-tiles {
    list-style: none; margin: 16px 0 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 14px;
}
.tl-tiles img { display: block; width: 100%; height: auto; border-radius: 3px; background: var(--wall-3); }
.tl-tiles a { display: inline-block; margin-top: 6px; font-size: 13.5px; }

.tl-more {
    margin: 40px 0 0; padding-top: 16px; border-top: 1px solid var(--rule-2);
    font-size: 14px; line-height: 1.9; color: var(--ink-2);
}
.tl-more-label { margin-right: 6px; color: var(--ink-4); }
.tl-dot { color: var(--ink-4); }

@media (max-width: 640px) {
    .tl-panel { padding: 18px 16px; }
    .tl-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
    .tl-form-stack, .tl-form-crop { grid-template-columns: minmax(0, 1fr); }
    .tl-checks thead { display: none; }
    .tl-checks, .tl-checks tbody { display: block; }
    .tl-checks tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px;
        padding: 12px 0; border-bottom: 1px solid var(--rule);
    }
    .tl-checks tbody th, .tl-checks td { padding: 0; border: 0; text-align: left; }
    .tl-checks tbody th { grid-column: 1; grid-row: 1; margin-bottom: 6px; white-space: normal; }
    .tl-checks td:last-child { grid-column: 2; grid-row: 1; }
    .tl-checks td:not(:last-child) {
        grid-column: 1 / -1; display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 10px; padding: 3px 0;
    }
    .tl-checks td:not(:last-child)::before {
        content: attr(data-label); padding-top: 2px; font-family: var(--font-mono); font-size: 10px;
        letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4);
    }
    .tl-meta > div { grid-template-columns: 1fr; gap: 2px; }
    .tl-figures dd { font-size: 19px; }
}
