/* ==========================================================================
   NathanTools Tool UI Kit ("tk-")
   --------------------------------------------------------------------------
   Shared building blocks for every tool page, built only on the semantic
   tokens in nt.css, so light/dark themes and brand changes flow through.

   Five archetypes, one vocabulary:
     Transform  input panel → output panel            (encoders, hashes, case)
     Analyze    input → stat tiles + tables           (word count, density)
     Generate   options → hero / code output          (passwords, robots.txt)
     Lookup     big URL/domain bar → results          (DNS, tags, SERP)
     File       dropzone → preview → download         (resize, compress)

   Behaviour lives in /js/nt-tools.js (copy, download, clear, paste, counters,
   dropzones, toasts). Live reference: /design-system#tool-kit
   ========================================================================== */

.tool-wrapper.is-wide { max-width: var(--nt-content) !important; }

/* Toolbar ------------------------------------------------------------------ */
.tk-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1rem; }
.tk-toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.tk-toolbar .form-check { margin: 0; }
.tk-toolbar .form-select { width: auto; padding-top: .45rem; padding-bottom: .45rem; font-size: var(--nt-text-sm); }

/* Workspace ---------------------------------------------------------------- */
.tk-workspace { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tk-workspace.is-single { grid-template-columns: minmax(0, 1fr); }
.tk-workspace.is-aside { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 767px) { .tk-workspace, .tk-workspace.is-aside { grid-template-columns: minmax(0, 1fr); } }

/* Panel -------------------------------------------------------------------- */
.tk-panel:not(.is-output) { border-color: var(--nt-border-input); }
.tk-panel { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-surface); overflow: hidden; }
.tk-panel:focus-within { border-color: var(--nt-primary); box-shadow: 0 0 0 4px var(--nt-focus); }
.tk-panel.is-output { background: var(--nt-bg-subtle); }
.tk-panel.is-output:focus-within { border-color: var(--nt-border); box-shadow: none; }
.tk-panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .4rem .5rem .4rem .9rem; border-bottom: 1px solid var(--nt-border); min-height: 46px; }
.tk-panel-title { font-family: var(--nt-font-mono); font-size: 11px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--nt-text-subtle); margin: 0; display: flex; align-items: center; gap: .45rem; }
.tk-panel-body { flex: 1; padding: 1rem; min-height: 0; }
.tk-panel-body.is-flush { padding: 0; }
.tk-panel-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; padding: .45rem .9rem; border-top: 1px solid var(--nt-border); font-size: var(--nt-text-xs); color: var(--nt-text-subtle); font-variant-numeric: tabular-nums; }

/* Editor ------------------------------------------------------------------- */
.tk-editor { display: block; width: 100%; min-height: 260px; height: 100%; resize: vertical; border: 0; outline: 0; padding: .9rem 1rem; background: transparent; color: var(--nt-text); font-family: var(--nt-font-mono); font-size: .9rem; line-height: 1.6; tab-size: 4; }
.tk-editor::placeholder { color: var(--nt-text-subtle); }
.tk-editor.is-prose { font-family: var(--nt-font-sans); font-size: 1rem; line-height: 1.65; }
.tk-editor.is-lg { min-height: 360px; }
.tk-editor.is-sm { min-height: 140px; }

/* Icon actions ------------------------------------------------------------- */
.tk-actions { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; justify-content: flex-end; }
.tk-action { display: inline-flex; align-items: center; gap: .35rem; height: 32px; padding: 0 .55rem; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--nt-text-muted); font-size: var(--nt-text-xs); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.tk-action:hover { background: var(--nt-bg-muted); color: var(--nt-text); }
.tk-action:disabled { opacity: .45; cursor: not-allowed; background: none; }
.tk-action.is-done { color: var(--tone-green-fg); }
.tk-action i { font-size: .85rem; }
@media (max-width: 575px) { .tk-action span { display: none; } }

/* Options ------------------------------------------------------------------ */
.tk-options { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); padding: 1rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-bg-subtle); margin-bottom: 1rem; }
.tk-option-label { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: var(--nt-text-sm); font-weight: 600; color: var(--nt-text); margin-bottom: .4rem; }
.tk-option-label output { font-variant-numeric: tabular-nums; color: var(--nt-primary); font-weight: 700; }
.tk-option.is-full { grid-column: 1 / -1; }
.tk-checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.tk-check { position: relative; margin: 0; }
.tk-check input { position: absolute; opacity: 0; pointer-events: none; }
.tk-check span { display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: 999px; border: 1px solid var(--nt-border-strong); background: var(--nt-surface); font-size: var(--nt-text-sm); font-weight: 600; color: var(--nt-text-muted); cursor: pointer; user-select: none; }
.tk-check input:checked + span { background: var(--nt-primary-soft); border-color: var(--nt-primary); color: var(--nt-primary); }
.tk-check input:checked + span::before { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .7rem; }
.tk-check input:focus-visible + span { box-shadow: 0 0 0 4px var(--nt-focus); }
.tk-check input:disabled + span { opacity: .5; cursor: not-allowed; }
input[type=range].form-range { accent-color: var(--nt-primary); }

/* Hero output -------------------------------------------------------------- */
.tk-hero { display: flex; align-items: center; gap: .75rem; padding: .9rem .9rem .9rem 1.25rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-bg-subtle); }
.tk-hero-value { flex: 1; min-width: 0; font-family: var(--nt-font-mono); font-size: clamp(1.05rem, .9rem + 1.1vw, 1.55rem); font-weight: 600; color: var(--nt-text); word-break: break-all; line-height: 1.35; }
.tk-hero-value.is-sans { font-family: var(--nt-font-display); font-weight: 700; }
.tk-hero .btn { flex-shrink: 0; }
.tk-hero-actions { display: flex; gap: .4rem; flex-shrink: 0; }

/* Key–value rows ----------------------------------------------------------- */
.tk-kv { border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); overflow: hidden; background: var(--nt-surface); }
.tk-kv-row { display: grid; grid-template-columns: minmax(100px, 170px) minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .55rem .5rem .55rem .9rem; border-bottom: 1px solid var(--nt-border); }
.tk-kv-row:last-child { border-bottom: 0; }
.tk-kv-row.is-active { background: var(--nt-primary-soft); }
.tk-kv-key { font-family: var(--nt-font-mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--nt-text-subtle); word-break: break-word; }
.tk-kv-val { font-family: var(--nt-font-mono); font-size: .85rem; color: var(--nt-text); word-break: break-all; }
.tk-kv-val.is-sans { font-family: var(--nt-font-sans); font-size: var(--nt-text-sm); word-break: break-word; }
.tk-kv-val.is-muted { color: var(--nt-text-subtle); }
@media (max-width: 575px) { .tk-kv-row { grid-template-columns: minmax(0, 1fr) auto; } .tk-kv-key { grid-column: 1 / -1; } }

/* Stat tiles --------------------------------------------------------------- */
.tk-stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); }
.tk-stat { padding: .85rem 1rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); min-width: 0; container-type: inline-size; }
.tk-stat strong { display: block; font-family: var(--nt-font-display); font-size: 1.55rem; font-weight: 650; letter-spacing: -.02em; color: var(--nt-text); line-height: 1.1; font-variant-numeric: tabular-nums; word-break: break-word; }
.tk-stat span { display: block; margin-top: .3rem; font-family: var(--nt-font-mono); font-size: 11px; font-weight: 500; letter-spacing: .02em; color: var(--nt-text-subtle); }
/* Values shrink with their tile instead of breaking mid-number ("$320,00 / 0") */
@supports (font-size: 1cqi) { .tk-stat strong { font-size: clamp(1rem, 16cqi, 1.55rem); word-break: normal; overflow-wrap: anywhere; } }
.tk-stat.is-accent strong { color: var(--nt-primary); }
.tk-stat.is-good strong { color: var(--tone-green-fg); }

/* Data table --------------------------------------------------------------- */
.tk-table-wrap { border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); overflow: auto; max-height: 520px; background: var(--nt-surface); }
.tk-table { width: 100%; border-collapse: collapse; font-size: var(--nt-text-sm); }
.tk-table th { position: sticky; top: 0; z-index: 1; background: var(--nt-bg-subtle); text-align: left; font-family: var(--nt-font-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--nt-text-subtle); padding: .6rem .8rem; border-bottom: 1px solid var(--nt-border); white-space: nowrap; }
.tk-table th button { all: unset; cursor: pointer; }
.tk-table td { padding: .5rem .8rem; border-bottom: 1px solid var(--nt-border); color: var(--nt-text); vertical-align: top; word-break: break-word; }
.tk-table tr:last-child td { border-bottom: 0; }
.tk-table tr.is-active td { background: var(--nt-primary-soft); }
.tk-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tk-table .mono { font-family: var(--nt-font-mono); font-size: .82rem; }
.tk-table .w-bar { width: 28%; min-width: 80px; }
.tk-bar { display: block; height: 6px; border-radius: 999px; background: var(--nt-primary); opacity: .75; min-width: 2px; margin-top: .45rem; }

/* Dropzone ----------------------------------------------------------------- */
.tk-dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; min-height: 240px; padding: 2rem 1rem; border: 1.5px dashed var(--nt-border-strong); border-radius: var(--nt-radius-lg); background: var(--nt-bg-subtle); text-align: center; cursor: pointer; transition: border-color var(--nt-dur) var(--nt-ease), background var(--nt-dur) var(--nt-ease); }
.tk-dropzone:hover, .tk-dropzone.is-over { border-color: var(--nt-primary); background: var(--nt-primary-soft); }
.tk-dropzone:focus-within { box-shadow: 0 0 0 4px var(--nt-focus); }
.tk-dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.tk-dropzone-icon { width: 48px; height: 48px; border-radius: var(--nt-radius-lg); display: grid; place-items: center; background: var(--nt-surface); border: 1px solid var(--nt-border); color: var(--nt-primary); font-size: 1.2rem; }
.tk-dropzone strong { font-size: var(--nt-text-md); font-weight: 600; color: var(--nt-text); }
.tk-dropzone small { color: var(--nt-text-subtle); }
.tk-dropzone[hidden] { display: none; }

/* Preview + file bar ------------------------------------------------------- */
.tk-preview { position: relative; display: grid; place-items: center; min-height: 240px; padding: 1rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: repeating-conic-gradient(var(--nt-bg-muted) 0 25%, var(--nt-surface) 0 50%) 0 0 / 18px 18px; overflow: hidden; }
.tk-preview img, .tk-preview canvas { max-width: 100%; max-height: 440px; height: auto; border-radius: 4px; box-shadow: var(--nt-shadow-md); }
.tk-filebar { display: flex; align-items: center; gap: .75rem; padding: .55rem .6rem .55rem .9rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); margin-bottom: 1rem; }
.tk-filebar i.fa-file-image { color: var(--nt-primary); }
.tk-filebar .name { flex: 1; min-width: 0; font-weight: 600; color: var(--nt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-filebar .meta { font-size: var(--nt-text-xs); color: var(--nt-text-subtle); white-space: nowrap; }

/* Meter -------------------------------------------------------------------- */
.tk-meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.tk-meter span { height: 8px; border-radius: 999px; background: var(--nt-bg-muted); transition: background var(--nt-dur) var(--nt-ease); }
.tk-meter[data-score="0"] span:nth-child(-n+1) { background: #dc2626; }
.tk-meter[data-score="1"] span:nth-child(-n+2) { background: #ea580c; }
.tk-meter[data-score="2"] span:nth-child(-n+3) { background: #ca8a04; }
.tk-meter[data-score="3"] span:nth-child(-n+4) { background: #16a34a; }
.tk-meter[data-score="4"] span:nth-child(-n+5) { background: #059669; }

/* Checklist ---------------------------------------------------------------- */
.tk-checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.tk-checklist li { overflow-wrap: anywhere; display: flex; gap: .6rem; align-items: flex-start; font-size: var(--nt-text-sm); color: var(--nt-text-muted); }
.tk-checklist li::before { content: "\f111"; font-family: "Font Awesome 6 Free"; font-weight: 400; color: var(--nt-border-strong); flex-shrink: 0; width: 1rem; text-align: center; }
.tk-checklist li.is-pass { color: var(--nt-text); }
.tk-checklist li.is-pass::before { content: "\f058"; font-weight: 900; color: var(--tone-green-fg); }
.tk-checklist li.is-warn::before { content: "\f071"; font-weight: 900; color: var(--tone-amber-fg); }
.tk-checklist li.is-fail::before { content: "\f057"; font-weight: 900; color: var(--nt-danger); }

/* Alerts + empty state ----------------------------------------------------- */
.tk-alert { display: flex; gap: .6rem; align-items: flex-start; padding: .7rem .9rem; border-radius: var(--nt-radius-md); font-size: var(--nt-text-sm); border: 1px solid; margin-bottom: 1rem; }
.tk-alert[hidden] { display: none; }
.tk-alert.is-error { color: var(--nt-danger); background: color-mix(in srgb, var(--nt-danger) 8%, var(--nt-surface)); border-color: color-mix(in srgb, var(--nt-danger) 30%, transparent); }
.tk-alert.is-ok { color: var(--tone-green-fg); background: var(--tone-green-bg); border-color: color-mix(in srgb, var(--tone-green-fg) 30%, transparent); }
.tk-alert.is-info { color: var(--nt-text-muted); background: var(--nt-bg-subtle); border-color: var(--nt-border); }
.tk-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; min-height: 200px; padding: 1.5rem; text-align: center; color: var(--nt-text-subtle); font-size: var(--nt-text-sm); }
.tk-empty i { font-size: 1.6rem; opacity: .6; }
.tk-empty[hidden] { display: none; }

/* Lookup bar --------------------------------------------------------------- */
.tk-lookup { display: flex; gap: .5rem; margin-bottom: 1rem; }
.tk-lookup .form-control { height: 52px; font-size: 1.05rem; }
.tk-lookup .btn { height: 52px; white-space: nowrap; }
@media (max-width: 575px) { .tk-lookup { flex-direction: column; } }
.tk-examples { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: var(--nt-text-xs); color: var(--nt-text-subtle); margin: -.25rem 0 1rem; }
.tk-examples button { border: 0; background: var(--nt-bg-muted); color: var(--nt-text-muted); border-radius: 999px; padding: .2rem .6rem; font-size: var(--nt-text-xs); font-weight: 600; cursor: pointer; }
.tk-examples button:hover { color: var(--nt-primary); }

/* Tabs --------------------------------------------------------------------- */
.tk-tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--nt-border); margin-bottom: 1rem; scrollbar-width: none; }
.tk-tab { border: 0; background: none; padding: .6rem .9rem; font-weight: 600; font-size: var(--nt-text-sm); color: var(--nt-text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tk-tab:hover { color: var(--nt-text); }
.tk-tab[aria-selected="true"] { color: var(--nt-primary); border-bottom-color: var(--nt-primary); }
.tk-tab .count { margin-left: .35rem; font-size: 11px; padding: .05rem .4rem; border-radius: 999px; background: var(--nt-bg-muted); color: var(--nt-text-subtle); }

/* Code output -------------------------------------------------------------- */
.tk-code { margin: 0; padding: 1rem; font-family: var(--nt-font-mono); font-size: .85rem; line-height: 1.6; color: var(--nt-text); white-space: pre-wrap; word-break: break-word; min-height: 220px; max-height: 560px; overflow: auto; }

/* Hints + toast ------------------------------------------------------------ */
.tk-hint { font-size: var(--nt-text-xs); color: var(--nt-text-subtle); margin-top: .6rem; }
.tk-hint kbd { font-size: 10px; }
.tk-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); z-index: 2000; padding: .6rem 1rem; border-radius: 999px; background: var(--nt-gray-900); color: #fff; font-size: var(--nt-text-sm); font-weight: 600; box-shadow: var(--nt-shadow-lg); opacity: 0; pointer-events: none; transition: opacity var(--nt-dur) var(--nt-ease), transform var(--nt-dur) var(--nt-ease); }
.tk-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
:root[data-theme="dark"] .tk-toast { background: #eef0f6; color: #0c0f15; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tk-toast { background: #eef0f6; color: #0c0f15; } }

/* SERP preview (Google result card) ---------------------------------------- */
.tk-serp { padding: 1rem 1.25rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: #fff; color: #202124; font-family: Arial, Helvetica, sans-serif; }
.tk-serp.is-mobile { max-width: 400px; }
.tk-serp-site { display: flex; align-items: center; gap: .6rem; margin-bottom: .35rem; }
.tk-serp-fav { width: 26px; height: 26px; border-radius: 50%; background: #f1f3f4; display: grid; place-items: center; font-size: 12px; color: #5f6368; flex-shrink: 0; }
.tk-serp-name { font-size: 14px; color: #202124; line-height: 1.3; }
.tk-serp-url { font-size: 12px; color: #4d5156; line-height: 1.3; word-break: break-all; }
.tk-serp-title { display: block; font-size: 20px; line-height: 1.3; color: #1a0dab; margin: .1rem 0 .25rem; word-break: break-word; }
.tk-serp.is-mobile .tk-serp-title { font-size: 18px; }
.tk-serp-desc { font-size: 14px; line-height: 1.58; color: #4d5156; word-break: break-word; }
.tk-serp-desc b { color: #5f6368; }

/* Colour swatch ------------------------------------------------------------ */
.tk-swatch { width: 100%; aspect-ratio: 16 / 7; border-radius: var(--nt-radius-lg); border: 1px solid var(--nt-border); box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }

/* Compact dropzone (e.g. "add more files" under a file list) --------------- */
.tk-dropzone.is-compact { min-height: 0; flex-direction: row; gap: .75rem; padding: .9rem 1rem; }
.tk-dropzone.is-compact .tk-dropzone-icon { width: 36px; height: 36px; border-radius: 10px; font-size: 1rem; }
.tk-dropzone.is-compact strong { font-size: var(--nt-text-sm); }

/* Sortable file cards (merge PDF, JPG to PDF) ------------------------------- */
.tk-sort { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 1rem; }
.tk-sort-item { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); overflow: hidden; cursor: grab; transition: border-color var(--nt-dur) var(--nt-ease), box-shadow var(--nt-dur) var(--nt-ease); }
.tk-sort-item:hover { border-color: var(--nt-border-strong); }
.tk-sort-item.is-dragging { opacity: .45; }
.tk-sort-item.is-target { border-color: var(--nt-primary); box-shadow: 0 0 0 3px var(--nt-focus); }
.tk-sort-thumb { display: grid; place-items: center; aspect-ratio: 3 / 4; padding: .5rem; background: var(--nt-bg-subtle); color: var(--nt-text-subtle); font-size: 1.6rem; overflow: hidden; }
.tk-sort-thumb img, .tk-sort-thumb canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 3px; box-shadow: var(--nt-shadow-sm); background: #fff; pointer-events: none; }
.tk-sort-info { display: flex; flex-direction: column; gap: .1rem; padding: .5rem .6rem .25rem; min-width: 0; }
.tk-sort-name { font-size: var(--nt-text-xs); font-weight: 600; color: var(--nt-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-sort-meta { font-size: 11px; color: var(--nt-text-subtle); font-variant-numeric: tabular-nums; }
.tk-sort-actions { display: flex; align-items: center; justify-content: space-between; gap: .1rem; padding: .1rem .25rem .3rem; }
.tk-sort-actions .tk-action { height: 28px; padding: 0 .45rem; }
.tk-sort-actions [data-remove] { margin-left: auto; }
.tk-sort-actions [data-remove]:hover { color: var(--nt-danger); }
.tk-sort-pos { font-size: 11px; font-weight: 700; color: var(--nt-text-subtle); min-width: 1.2rem; text-align: center; font-variant-numeric: tabular-nums; }

/* PDF page thumbnails (split, PDF to JPG) ----------------------------------- */
.tk-pages { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 640px; overflow: auto; padding: .25rem; }
.tk-page { position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .5rem .5rem .4rem; border: 2px solid transparent; border-radius: var(--nt-radius-md); background: var(--nt-bg-subtle); color: var(--nt-text-muted); cursor: pointer; }
.tk-page:hover { border-color: var(--nt-border-strong); }
.tk-page:focus-visible { outline: 0; box-shadow: 0 0 0 4px var(--nt-focus); }
.tk-page-img { display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4; font-size: 1.5rem; color: var(--nt-text-subtle); }
.tk-page-img canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; background: #fff; box-shadow: var(--nt-shadow-sm); border-radius: 2px; }
.tk-page-num { font-size: var(--nt-text-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.tk-page[aria-pressed="true"] { border-color: var(--nt-primary); background: var(--nt-primary-soft); color: var(--nt-primary); }
.tk-page[aria-pressed="true"]::after { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; top: .35rem; right: .35rem; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; background: var(--nt-primary); color: #fff; }
.tk-page-dl { position: absolute; top: .35rem; right: .35rem; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--nt-surface); color: var(--nt-text); box-shadow: var(--nt-shadow-sm); font-size: .8rem; }
.tk-page:hover .tk-page-dl { color: var(--nt-primary); }
.tk-page.is-loading { opacity: .55; pointer-events: none; }
.tk-filebar i.fa-file-pdf { color: var(--nt-danger); }

/* Progress ------------------------------------------------------------------ */
.tk-progress { height: 6px; border-radius: 999px; background: var(--nt-bg-muted); overflow: hidden; margin: .75rem 0; }
.tk-progress > span { display: block; height: 100%; width: 0; background: var(--nt-primary); transition: width .2s ease; }
.tk-progress[hidden] { display: none; }
.tk-progress.is-indeterminate > span { width: 35% !important; animation: tk-indeterminate 1.2s ease-in-out infinite; }
@keyframes tk-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { .tk-progress.is-indeterminate > span { animation: none; width: 100% !important; opacity: .5; } }
.cv-state { padding: .25rem 0 .5rem; }

/* Remove background --------------------------------------------------------------- */
.rb-preview { min-height: 320px; }
.rb-busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 1rem; text-align: center; background: color-mix(in srgb, var(--nt-surface) 82%, transparent); backdrop-filter: blur(2px); }
.rb-busy[hidden] { display: none; }
.rb-busy strong { color: var(--nt-text); }
.rb-busy small { color: var(--nt-text-subtle); max-width: 34ch; }
.rb-busy .spinner-border { color: var(--nt-primary); }

/* PDF editor ------------------------------------------------------------------------ */
.pe-toolbar { position: sticky; top: 64px; z-index: 5; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .4rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); box-shadow: var(--nt-shadow-sm); }
.pe-tools, .pe-props { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem; }
.pe-tool { display: inline-flex; align-items: center; gap: .35rem; height: 34px; padding: 0 .6rem; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--nt-text-muted); font-size: var(--nt-text-xs); font-weight: 600; cursor: pointer; }
.pe-tool:hover { background: var(--nt-bg-muted); color: var(--nt-text); }
.pe-tool[aria-pressed="true"] { background: var(--nt-primary-soft); color: var(--nt-primary); border-color: color-mix(in srgb, var(--nt-primary) 30%, transparent); }
.pe-tool.is-small { width: 32px; padding: 0; justify-content: center; }
@media (max-width: 991px) { .pe-tool span { display: none; } .pe-tool { width: 36px; justify-content: center; padding: 0; } }
.pe-prop { display: inline-flex; align-items: center; gap: .25rem; }
.pe-prop[hidden] { display: none; }
.pe-prop input[type=color] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--nt-border); border-radius: 6px; background: var(--nt-surface); cursor: pointer; }
.pe-prop .form-control, .pe-prop .form-select { width: auto; max-width: 92px; }
.pe-unit { font-size: var(--nt-text-xs); color: var(--nt-text-subtle); }
.pe-main { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 1rem; margin-top: .5rem; align-items: start; }
@media (max-width: 767px) { .pe-main { grid-template-columns: minmax(0, 1fr); } .pe-side { order: 2; } }
.pe-pages { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; max-height: 75vh; overflow: auto; }
@media (max-width: 767px) { .pe-pages { grid-auto-flow: column; grid-auto-columns: 130px; max-height: none; overflow-x: auto; padding-bottom: .5rem; } }
.pe-thumb { border: 2px solid transparent; border-radius: var(--nt-radius-md); background: var(--nt-bg-subtle); padding: .35rem; }
.pe-thumb.is-current { border-color: var(--nt-primary); background: var(--nt-primary-soft); }
.pe-thumb-img { position: relative; display: grid; place-items: center; width: 100%; min-height: 90px; border: 0; background: none; padding: 0; cursor: pointer; }
.pe-thumb-img canvas { max-width: 100%; box-shadow: var(--nt-shadow-sm); background: #fff; }
.pe-thumb-num { position: absolute; left: 4px; bottom: 4px; font-size: 11px; font-weight: 700; padding: 0 .35rem; border-radius: 999px; background: var(--nt-gray-900, #111); color: #fff; }
.pe-thumb-actions { display: flex; justify-content: space-between; margin-top: .3rem; }
.pe-thumb-actions button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: none; color: var(--nt-text-muted); font-size: .72rem; cursor: pointer; }
.pe-thumb-actions button:hover:not(:disabled) { background: var(--nt-bg-muted); color: var(--nt-text); }
.pe-thumb-actions button:disabled { opacity: .3; cursor: default; }
.pe-thumb-actions [data-del]:hover:not(:disabled) { color: var(--nt-danger); }
.pe-stage-wrap { border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-bg-muted); padding: 1rem; overflow: auto; }
.pe-stage { position: relative; margin: 0 auto; background: #fff; box-shadow: var(--nt-shadow-md); touch-action: none; user-select: none; }
.pe-stage[data-tool="select"] { cursor: default; }
.pe-stage[data-tool="text"] { cursor: text; }
.pe-stage[data-tool="ink"], .pe-stage[data-tool="line"], .pe-stage[data-tool="rect"], .pe-stage[data-tool="ellipse"], .pe-stage[data-tool="whiteout"], .pe-stage[data-tool="highlight"] { cursor: crosshair; }
.pe-canvas { display: block; }
.pe-svg, .pe-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pe-svg { overflow: visible; }
.pe-path { pointer-events: stroke; cursor: move; }
.pe-path.is-selected { filter: drop-shadow(0 0 2px var(--nt-primary)); }
.pe-el { position: absolute; transform-origin: 0 0; pointer-events: auto; cursor: move; box-sizing: border-box; }
.pe-el.is-selected { outline: 1.5px dashed var(--nt-primary); outline-offset: 1px; }
.pe-t-ellipse { border-radius: 50%; }
.pe-t-image img { display: block; width: 100%; height: 100%; pointer-events: none; }
.pe-text { min-width: 2ch; outline: 0; white-space: pre; line-height: 1.2; cursor: text; user-select: text; }
.pe-text:empty::before { content: "Type here"; opacity: .4; }
.pe-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--nt-primary); border: 2px solid #fff; cursor: nwse-resize; box-shadow: var(--nt-shadow-sm); }

/* Compress PDF level cards ------------------------------------------------------ */
.cp-levels { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); border: 0; padding: 0; margin: 0; }
.cp-levels legend { float: none; width: 100%; }
.cp-level { position: relative; margin: 0; cursor: pointer; }
.cp-level input { position: absolute; opacity: 0; }
.cp-level > span { display: flex; flex-direction: column; gap: .2rem; height: 100%; padding: .8rem .9rem; border: 2px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); }
.cp-level strong { color: var(--nt-text); }
.cp-level small { color: var(--nt-text-subtle); font-size: var(--nt-text-xs); line-height: 1.4; }
.cp-level input:checked + span { border-color: var(--nt-primary); background: var(--nt-primary-soft); }
.cp-level input:focus-visible + span { box-shadow: 0 0 0 4px var(--nt-focus); }
.cv-state[hidden] { display: none; }

/* Sign PDF ------------------------------------------------------------------ */
.sg-pad { position: relative; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: #fff; touch-action: none; }
.sg-pad canvas { display: block; width: 100%; height: 180px; cursor: crosshair; border-radius: var(--nt-radius-md); }
.sg-pad-line { position: absolute; left: 8%; right: 8%; bottom: 42px; border-bottom: 1px dashed #c9ced8; pointer-events: none; }
.sg-typed { min-height: 120px; display: grid; place-items: center; padding: .5rem 1rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: #fff; color: #111; font-size: 3rem; line-height: 1.2; overflow: hidden; white-space: nowrap; }
.sg-colors { display: flex; gap: .4rem; }
.sg-colors button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--nt-surface); box-shadow: 0 0 0 1px var(--nt-border-strong); cursor: pointer; }
.sg-colors button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--nt-primary); }
.sg-sig-preview { display: grid; place-items: center; min-height: 70px; padding: .5rem; border: 1px dashed var(--nt-border-strong); border-radius: var(--nt-radius-md); background: repeating-conic-gradient(var(--nt-bg-muted) 0 25%, var(--nt-surface) 0 50%) 0 0 / 14px 14px; }
.sg-sig-preview img { max-width: 100%; max-height: 80px; }
.sg-stage-wrap { border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-bg-muted); padding: 1rem; overflow: auto; }
.sg-stage { position: relative; margin: 0 auto; width: fit-content; box-shadow: var(--nt-shadow-md); background: #fff; cursor: copy; }
.sg-stage canvas { display: block; max-width: 100%; height: auto; }
.sg-box { position: absolute; border: 1.5px dashed var(--nt-primary); background: color-mix(in srgb, var(--nt-primary) 6%, transparent); cursor: move; touch-action: none; user-select: none; }
.sg-box img { display: block; width: 100%; height: 100%; pointer-events: none; }
.sg-box-del, .sg-box-size { position: absolute; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 0; background: var(--nt-primary); color: #fff; font-size: .7rem; box-shadow: var(--nt-shadow-sm); }
.sg-box-del { top: -12px; right: -12px; cursor: pointer; }
.sg-box-size { bottom: -12px; right: -12px; cursor: nwse-resize; touch-action: none; }
.sg-pager { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-top: .75rem; font-size: var(--nt-text-sm); color: var(--nt-text-muted); font-variant-numeric: tabular-nums; }

/* Finance calculators ------------------------------------------------------- */
.fin-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--nt-bg-muted); }
.fin-bar span { display: block; height: 100%; transition: width var(--nt-dur) var(--nt-ease); }
#ln-bar-p { background: var(--nt-primary); }
#ln-bar-i { background: var(--tone-amber-fg); }
.fin-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin-top: .5rem; font-size: var(--nt-text-sm); color: var(--nt-text-muted); }
.fin-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; vertical-align: -1px; }
.fin-legend .is-p::before { background: var(--nt-primary); }
.fin-legend .is-i::before { background: var(--tone-amber-fg); }
.fin-legend strong { color: var(--nt-text); font-variant-numeric: tabular-nums; }
.fin-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .5rem; vertical-align: -1px; }
.mg-more summary { cursor: pointer; font-size: var(--nt-text-sm); font-weight: 600; color: var(--nt-text); }

/* Time calculator rows -------------------------------------------------------- */
.tc-row { display: grid; grid-template-columns: 64px repeat(4, minmax(0, 1fr)) 36px; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.tc-row .form-select { padding-right: 1.6rem; }
@media (max-width: 420px) {
    /* Phones: sign and remove span both lines; d/h on top, m/s below, so each input has room for 2–3 digits. */
    .tc-row { grid-template-columns: 56px repeat(2, minmax(0, 1fr)) 30px; gap: .35rem; margin-bottom: .85rem; }
    .tc-row > .form-select { grid-row: span 2; align-self: stretch; }
    .tc-row > .tk-action { grid-column: 4; grid-row: 1 / 3; } .tc-row .nt-input-unit .form-control { padding-right: 1.6rem; } .tc-row .nt-input-unit .unit { right: .5rem; } }

/* Scientific calculator --------------------------------------------------------- */
.sc { max-width: 520px; margin: 0 auto; padding: 1rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-bg-subtle); }
.sc-screen { position: relative; padding: .6rem .9rem .7rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); margin-bottom: .6rem; }
.sc-flags { display: flex; gap: .5rem; align-items: center; min-height: 22px; font-size: 11px; font-weight: 700; color: var(--nt-text-subtle); }
.sc-mode { border: 1px solid var(--nt-border-strong); background: var(--nt-bg-subtle); color: var(--nt-primary); border-radius: 6px; font-size: 11px; font-weight: 700; padding: .05rem .45rem; cursor: pointer; }
.sc-expr { display: block; width: 100%; border: 0; outline: 0; background: transparent; text-align: right; font-family: var(--nt-font-mono); font-size: clamp(1.3rem, 1rem + 1.5vw, 1.8rem); color: var(--nt-text); padding: .2rem 0; }
.sc-result { display: block; min-height: 1.5em; text-align: right; font-family: var(--nt-font-mono); font-size: var(--nt-text-sm); color: var(--nt-text-subtle); word-break: break-all; }
.sc-result.is-error { color: var(--nt-danger); font-family: var(--nt-font-sans); font-weight: 600; }
.sc-mem { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin-bottom: .4rem; }
.sc-mem button { border: 0; background: none; color: var(--nt-text-muted); font-size: var(--nt-text-xs); font-weight: 700; padding: .3rem; border-radius: 6px; cursor: pointer; }
.sc-mem button:hover { background: var(--nt-bg-muted); color: var(--nt-text); }
.sc-keys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; }
.sc-key { height: 48px; border: 1px solid var(--nt-border); border-radius: 10px; background: var(--nt-surface); color: var(--nt-text); font-size: .95rem; font-weight: 600; cursor: pointer; user-select: none; transition: background var(--nt-dur) var(--nt-ease); }
.sc-key:hover { background: var(--nt-bg-muted); }
.sc-key:active { transform: translateY(1px); }
.sc-key.is-fn { font-size: .82rem; color: var(--nt-text-muted); background: var(--nt-bg-subtle); }
.sc-key.is-num { font-size: 1.1rem; }
.sc-key.is-op { color: var(--nt-primary); font-size: 1.2rem; background: var(--nt-primary-soft); border-color: transparent; }
.sc-key.is-eq { background: var(--nt-primary); color: #fff; border-color: transparent; font-size: 1.3rem; }
.sc-key.is-eq:hover { filter: brightness(1.08); }
.sc-key.is-danger { color: var(--nt-danger); }
@media (max-width: 420px) { .sc { padding: .6rem; } .sc-keys { gap: .3rem; } .sc-key { height: 44px; font-size: .9rem; } .sc-key.is-fn { font-size: .72rem; } }
.sc-history { max-width: 520px; margin: 1rem auto 0; }
.sc-history ol { list-style: none; padding: 0; margin: 0; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); overflow: hidden; }
.sc-history li + li { border-top: 1px solid var(--nt-border); }
.sc-history button { all: unset; box-sizing: border-box; display: flex; width: 100%; justify-content: space-between; gap: 1rem; padding: .5rem .8rem; cursor: pointer; font-family: var(--nt-font-mono); font-size: var(--nt-text-sm); color: var(--nt-text-muted); }
.sc-history button:hover { background: var(--nt-bg-subtle); }
.sc-history button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-history strong { color: var(--nt-text); white-space: nowrap; }

/* Stopwatch + timer ----------------------------------------------------------- */
.tm-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1.25rem; padding: 2rem 1rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-bg-subtle); }
.tm-card:fullscreen { justify-content: center; background: var(--nt-bg); border: 0; border-radius: 0; }
.tm-card:fullscreen .tm-clock { font-size: min(22vw, 40vh); }
.tm-clock { font-family: var(--nt-font-display); font-weight: 700; font-size: clamp(3rem, 2rem + 8vw, 6.5rem); line-height: 1; letter-spacing: -.02em; color: var(--nt-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-clock small { font-size: .45em; color: var(--nt-text-subtle); font-weight: 700; }
.tm-controls { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; }
.tm-controls .btn { min-width: 120px; }
.tm-corner { position: absolute; top: .6rem; right: .6rem; display: flex; gap: .15rem; }
.tm-status { min-height: 1.5em; font-weight: 700; color: var(--nt-text-muted); margin: 0; }
.tm-card.is-done { animation: tm-flash 1s ease-in-out infinite; }
.tm-card.is-done .tm-status { color: var(--nt-danger); }
@keyframes tm-flash { 50% { background: color-mix(in srgb, var(--nt-danger) 14%, var(--nt-bg-subtle)); } }
@media (prefers-reduced-motion: reduce) { .tm-card.is-done { animation: none; border-color: var(--nt-danger); } }
.tm-set { display: grid; grid-template-columns: repeat(3, minmax(0, 110px)); gap: .5rem; justify-content: center; }
.tm-set input { text-align: center; font-family: var(--nt-font-display); font-weight: 700; font-size: clamp(1.8rem, 1.2rem + 3vw, 3rem); padding: .4rem .25rem; font-variant-numeric: tabular-nums; }
.tm-set label { display: block; text-align: center; font-size: var(--nt-text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--nt-text-subtle); margin-top: .3rem; }
.tm-set[hidden], .tm-ring[hidden] { display: none; }
.tm-ring { width: min(340px, 78vw); aspect-ratio: 1; position: relative; display: grid; place-items: center; }
.tm-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.tm-ring circle { fill: none; stroke-width: 6; }
.tm-ring .track { stroke: var(--nt-border); }
.tm-ring .bar { stroke: var(--nt-primary); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.tm-ring .tm-clock { font-size: clamp(2.6rem, 1.6rem + 6vw, 4.6rem); }
.tm-card:fullscreen .tm-ring { width: min(80vh, 90vw); }
.tm-card:fullscreen .tm-ring .tm-clock { font-size: min(14vw, 18vh); }
.tm-laps .best td { color: var(--tone-green-fg); font-weight: 700; }
.tm-laps .worst td { color: var(--nt-danger); font-weight: 700; }

/* Font generator ---------------------------------------------------------------- */
.fg-list { display: grid; gap: .5rem; }
.fg-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .55rem .5rem .55rem .9rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); }
.fg-row:hover { border-color: var(--nt-border-strong); }
.fg-name { display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--nt-text-subtle); }
.fg-text { display: block; font-size: 1.25rem; color: var(--nt-text); overflow-wrap: anywhere; line-height: 1.4; }

/* Speech tools ------------------------------------------------------------------ */
.sp-live { color: var(--nt-text-subtle); font-style: italic; }
.sp-mic { width: 84px; height: 84px; border-radius: 50%; border: 0; display: grid; place-items: center; margin: 0 auto; background: var(--nt-primary); color: #fff; font-size: 2rem; box-shadow: var(--nt-shadow-md); cursor: pointer; }
.sp-mic.is-on { background: var(--nt-danger); animation: sp-pulse 1.4s ease-out infinite; }
@keyframes sp-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--nt-danger) 45%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
@media (prefers-reduced-motion: reduce) { .sp-mic.is-on { animation: none; } }
.tts-word { background: var(--nt-primary-soft); color: var(--nt-primary); border-radius: 3px; }
.tts-read { min-height: 360px; max-height: 520px; overflow: auto; cursor: pointer; padding: .9rem 1rem; font-size: 1rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }

/* YouTube tools (Areas/YouTubeTools, js/youtube-tools.js) ------------------ */
.yt-head { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-surface); margin-bottom: 1rem; }
.yt-head-thumb { position: relative; flex: 0 0 auto; width: min(240px, 38%); aspect-ratio: 16 / 9; border-radius: var(--nt-radius-md); overflow: hidden; background: var(--nt-bg-muted); }
.yt-head-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-head-avatar { flex: 0 0 auto; width: 88px; height: 88px; border-radius: 50%; overflow: hidden; background: var(--nt-bg-muted); }
.yt-head-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-head-body { min-width: 0; flex: 1; }
.yt-head-title { display: block; font-family: var(--nt-font-display); font-weight: 700; font-size: 1.1rem; line-height: 1.3; color: var(--nt-text); text-decoration: none; overflow-wrap: anywhere; }
.yt-head-title:hover { color: var(--nt-primary); }
.yt-head-meta { margin-top: .3rem; font-size: var(--nt-text-sm); color: var(--nt-text-muted); overflow-wrap: anywhere; }
.yt-head-meta a { color: inherit; }
.yt-dur { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px; background: rgba(0,0,0,.8); color: #fff; font: 600 12px/1.4 var(--nt-font-mono); }
@media (max-width: 575px) { .yt-head { flex-direction: column; } .yt-head-thumb { width: 100%; } }
.yt-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.yt-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border: 1px solid var(--nt-border); border-radius: 999px; background: var(--nt-surface); color: var(--nt-text); font-size: var(--nt-text-sm); cursor: pointer; }
.yt-chip:hover { border-color: var(--nt-primary); color: var(--nt-primary); }
.yt-chip small { color: var(--nt-text-subtle); font-family: var(--nt-font-mono); font-size: 11px; }
.yt-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--nt-text-sm); line-height: 1.6; color: var(--nt-text); }
.yt-ts { font-family: var(--nt-font-mono); color: var(--nt-primary); }
.yt-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-lg); background: var(--nt-surface); }
.yt-list > li { display: flex; gap: .85rem; padding: .85rem 1rem; border-bottom: 1px solid var(--nt-border); min-width: 0; }
.yt-list > li:last-child { border-bottom: 0; }
.yt-list .yt-av { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; background: var(--nt-bg-muted); object-fit: cover; }
.yt-list .yt-vthumb { flex: 0 0 auto; width: 168px; aspect-ratio: 16 / 9; border-radius: var(--nt-radius-sm); object-fit: cover; background: var(--nt-bg-muted); }
@media (max-width: 575px) { .yt-list .yt-vthumb { width: 112px; } }
.yt-list .yt-item-body { min-width: 0; flex: 1; }
.yt-list .yt-item-title { font-weight: 600; color: var(--nt-text); text-decoration: none; overflow-wrap: anywhere; }
.yt-list .yt-item-title:hover { color: var(--nt-primary); }
.yt-list .yt-item-meta { font-size: var(--nt-text-xs); color: var(--nt-text-subtle); margin-top: .15rem; }
.yt-list .yt-replies { margin: .5rem 0 0; padding-left: .85rem; border-left: 2px solid var(--nt-border); }
.yt-list mark { background: color-mix(in srgb, var(--tone-amber-fg) 25%, transparent); color: inherit; padding: 0 1px; border-radius: 2px; }
.yt-rank { flex: 0 0 auto; min-width: 2.2rem; font: 700 1rem/1.4 var(--nt-font-mono); color: var(--nt-text-subtle); }
.yt-list > li.is-hit { background: var(--nt-primary-soft); }
.yt-list > li.is-hit .yt-rank { color: var(--nt-primary); }
.yt-bar { height: 10px; border-radius: 999px; overflow: hidden; display: flex; background: var(--nt-bg-muted); }
.yt-bar > span { display: block; height: 100%; }
.yt-big { font-family: var(--nt-font-display); font-size: clamp(2.6rem, 1.6rem + 5vw, 4.6rem); font-weight: 750; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--nt-text); }
.yt-img-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.yt-img-grid figure { margin: 0; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); overflow: hidden; background: var(--nt-surface); }
.yt-img-grid img { display: block; width: 100%; height: auto; background: var(--nt-bg-muted); }
.yt-img-grid figcaption { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .5rem .75rem; font-size: var(--nt-text-xs); color: var(--nt-text-muted); }
.yt-player { position: relative; aspect-ratio: 16 / 9; border-radius: var(--nt-radius-lg); overflow: hidden; background: #000; }
.yt-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-out { display: grid; gap: .5rem; }
.yt-out-row { display: flex; gap: .75rem; align-items: center; padding: .65rem .85rem; border: 1px solid var(--nt-border); border-radius: var(--nt-radius-md); background: var(--nt-surface); }
.yt-out-row > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.yt-out-row small { font-family: var(--nt-font-mono); color: var(--nt-text-subtle); }

/* UUID / ULID bit layout (UUID decoder) ------------------------------------- */
.tk-bits { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-family: var(--nt-font-mono); font-size: clamp(.9rem, 3.4vw, 1.3rem); line-height: 1.4; margin-bottom: .85rem; overflow-wrap: anywhere; }
.tk-bits > span { padding: .15rem .2rem; border-radius: 4px; background: var(--seg-bg, transparent); color: var(--seg-fg, var(--nt-text)); }
.tk-bits > .is-sep { padding: 0; color: var(--nt-text-subtle); }
.tk-bits-legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: 0; padding: 0; list-style: none; font-size: var(--nt-text-xs); color: var(--nt-text-muted); }
.tk-bits-legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; background: var(--seg-fg); }
.seg-time { --seg-bg: var(--tone-blue-bg); --seg-fg: var(--tone-blue-fg); }
.seg-ver { --seg-bg: var(--tone-violet-bg); --seg-fg: var(--tone-violet-fg); }
.seg-var { --seg-bg: var(--tone-pink-bg); --seg-fg: var(--tone-pink-fg); }
.seg-rand { --seg-bg: var(--tone-slate-bg); --seg-fg: var(--tone-slate-fg); }
.seg-clock { --seg-bg: var(--tone-amber-bg); --seg-fg: var(--tone-amber-fg); }
.seg-node { --seg-bg: var(--tone-teal-bg); --seg-fg: var(--tone-teal-fg); }
.seg-hash { --seg-bg: var(--tone-green-bg); --seg-fg: var(--tone-green-fg); }
.seg-custom { --seg-bg: var(--tone-orange-bg); --seg-fg: var(--tone-orange-fg); }

/* Grade calculator rows ------------------------------------------------------ */
.grd-head, .grd-row { display: grid; gap: .5rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, .9fr) 2.25rem; align-items: center; }
.grd-head { font-size: var(--nt-text-xs); font-weight: 700; color: var(--nt-text-subtle); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem; }
.grd-rows { display: grid; gap: .5rem; }
.grd-cell { display: block; margin: 0; min-width: 0; }
.grd-cap { display: none; }
@media (max-width: 575px) {
  .grd-head { display: none; }
  .grd-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 2.25rem; grid-template-areas: "name name del" "grade weight weight"; padding-bottom: .5rem; border-bottom: 1px solid var(--nt-border); }
  .grd-row .grd-name { grid-area: name; }
  .grd-row .grd-cell-grade { grid-area: grade; }
  .grd-row .grd-cell-weight { grid-area: weight; }
  .grd-row .gpa-del { grid-area: del; }
  .grd-cap { display: block; font-size: var(--nt-text-xs); font-weight: 700; color: var(--nt-text-subtle); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
}
