/* ============================================================
   NFO File Viewer - scoped under .nfv-root / .nfv-* (built 2026-10-11)
   Shared header, footer, FAQ and related pills come from custom_styles.css.
   Accent: blue #3399cc (viewers). Single colours, no gradients,
   no thick side borders. Light default, dark via [data-theme="dark"].
   ============================================================ */
.nfv-root {
    --nfv-accent: #3399cc;
    --nfv-accent-strong: #237a9f;
    --nfv-accent-soft: rgba(51, 153, 204, 0.09);
    --nfv-accent-line: rgba(51, 153, 204, 0.45);
    --nfv-go: #237a9f;
    --nfv-go-hover: #1b6183;
    --nfv-card: var(--bg-elevated, #fff);
    --nfv-sunk: var(--card-tertiary, #f1f5f9);
    --nfv-open: var(--card-secondary, #f8f9fa);
    --nfv-line: var(--border-color, #e2e8f0);
    --nfv-text-1: var(--text-primary, #1e293b);
    --nfv-text-2: var(--text-secondary, #555);
    --nfv-muted: var(--text-muted, #64748b);
    --nfv-warn: #b45309;
    --nfv-red: #c23b3b;
    --nfv-red-soft: rgba(230, 78, 78, 0.08);
    --nfv-red-line: rgba(230, 78, 78, 0.35);
    --nfv-mono: ui-monospace, "Cascadia Mono", SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
}
[data-theme="dark"] .nfv-root {
    --nfv-accent: #60a5fa;
    --nfv-accent-strong: #93c5fd;
    --nfv-accent-soft: rgba(96, 165, 250, 0.12);
    --nfv-accent-line: rgba(96, 165, 250, 0.45);
    --nfv-go: #2563eb;
    --nfv-go-hover: #1d4ed8;
    --nfv-sunk: #172033;
    --nfv-open: #1a2438;
    --nfv-warn: #fbbf24;
    --nfv-red: #f87171;
    --nfv-red-soft: rgba(248, 113, 113, 0.1);
    --nfv-red-line: rgba(248, 113, 113, 0.4);
}

.nfv-root.tool-container { max-width: 1100px; margin: 0 auto; padding: 2rem; }
.nfv-root [hidden] { display: none !important; }
.nfv-root .nfv-main { background: none; border: none; box-shadow: none; border-radius: 0; overflow: visible; padding: 0; }
.nfv-root button { font: inherit; }
.nfv-root code { font-family: var(--nfv-mono); font-size: 0.86em; padding: 0.05rem 0.35rem; border-radius: 5px; background: var(--nfv-sunk); }
.nfv-root kbd {
    display: inline-block; padding: 0.05rem 0.4rem; border-radius: 5px; border: 1px solid var(--nfv-line); border-bottom-width: 2px;
    background: var(--nfv-card); font: 600 0.78em var(--nfv-mono); color: var(--nfv-text-1);
}
.nfv-root .nfv-muted { color: var(--nfv-muted); font-weight: 500; }
.nfv-root :focus-visible { outline: 3px solid var(--nfv-accent-line); outline-offset: 2px; }

/* ---------- title ---------- */
.nfv-root .tool-header { text-align: center; margin-bottom: 1.75rem; }
.nfv-root .nfv-title-row { display: flex; align-items: center; justify-content: center; gap: 0.9rem; margin-bottom: 0.9rem; }
.nfv-root .nfv-title-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--nfv-accent); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
[data-theme="dark"] .nfv-root .nfv-title-icon { color: #0b1e33; }
.nfv-root .nfv-title-icon svg { width: 30px; height: 30px; display: block; }
.nfv-root .tool-title { margin: 0; font-size: 2rem; font-weight: 700; color: var(--nfv-accent); line-height: 1.2; }
.nfv-root .tool-description { max-width: 800px; margin: 0 auto; font-size: 1.05rem; line-height: 1.65; color: var(--nfv-text-2); }
.nfv-root .tool-description a { color: var(--nfv-accent-strong); font-weight: 500; }
[data-theme="dark"] .nfv-root .tool-description a { color: var(--nfv-accent); }

/* ---------- error ---------- */
.nfv-root .nfv-error { display: flex; align-items: flex-start; gap: 0.7rem; margin: 0 0 1rem; padding: 0.9rem 1rem; border-radius: 12px; border: 1px solid var(--nfv-red-line); background: var(--nfv-red-soft); color: var(--nfv-text-1); }
.nfv-root .nfv-error > svg { width: 20px; height: 20px; color: #e64e4e; flex-shrink: 0; margin-top: 2px; }
.nfv-root .nfv-error > div { flex: 1; min-width: 0; }
.nfv-root .nfv-error p { margin: 0; font-size: 0.92rem; line-height: 1.55; overflow-wrap: anywhere; }
.nfv-root .nfv-error p + p { margin-top: 0.3rem; color: var(--nfv-muted); font-size: 0.86rem; }
.nfv-root .nfv-error a { color: var(--nfv-red); font-weight: 600; }
.nfv-root .nfv-error-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.55rem; }
.nfv-root .nfv-x { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; flex-shrink: 0; border: none; border-radius: 8px; background: none; color: var(--nfv-muted); cursor: pointer; padding: 0; margin: 0; }
.nfv-root .nfv-x:hover { background: rgba(100, 116, 139, 0.12); color: var(--nfv-text-1); }
.nfv-root .nfv-x svg { width: 17px; height: 17px; }

/* ---------- cards ---------- */
.nfv-root .nfv-card { background: var(--nfv-card); border: 1px solid var(--nfv-line); border-radius: 20px; padding: 1.25rem; box-shadow: var(--shadow-sm); margin-bottom: 1.25rem; min-width: 0; }
.nfv-root .nfv-caption { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0 0 0.45rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--nfv-muted); }
.nfv-root .nfv-caption svg { width: 14px; height: 14px; }

/* ---------- buttons ---------- */
.nfv-root .nfv-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; width: auto; min-height: 44px; padding: 0.6rem 1.1rem; margin: 0;
    border-radius: 12px; border: 1px solid transparent; font-size: 0.95rem; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.nfv-root .nfv-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.nfv-root .nfv-go { background: var(--nfv-go); color: #fff; }
.nfv-root .nfv-go:hover:not(:disabled) { background: var(--nfv-go-hover); color: #fff; }
.nfv-root .nfv-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.nfv-root .nfv-btn-lg { min-height: 50px; padding: 0.65rem 1.5rem; font-size: 1rem; }
.nfv-root .nfv-btn-sm { min-height: 36px; padding: 0.4rem 0.8rem; font-size: 0.85rem; border-radius: 10px; }
.nfv-root .nfv-btn-sm svg { width: 16px; height: 16px; }
.nfv-root .nfv-btn-ghost { background: var(--nfv-sunk); color: var(--nfv-text-2); border-color: var(--nfv-line); }
.nfv-root .nfv-btn-ghost:hover:not(:disabled) { color: var(--nfv-text-1); border-color: var(--nfv-accent-line); }
.nfv-root .nfv-text-btn { display: inline-flex; align-items: center; gap: 0.35rem; width: auto; padding: 0.35rem 0.6rem; margin: 0; border: none; border-radius: 8px; background: none; color: var(--nfv-accent-strong); font-size: 0.85rem; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
[data-theme="dark"] .nfv-root .nfv-text-btn { color: var(--nfv-accent); }
.nfv-root .nfv-text-btn:hover:not(:disabled) { background: var(--nfv-accent-soft); }
.nfv-root .nfv-text-btn svg { width: 15px; height: 15px; }
.nfv-root .nfv-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; margin: 0; border: none; border-radius: 7px; background: none; color: var(--nfv-text-2); cursor: pointer; flex-shrink: 0; }
.nfv-root .nfv-icon-btn:hover:not(:disabled) { background: var(--nfv-accent-soft); color: var(--nfv-text-1); }
.nfv-root .nfv-icon-btn:disabled { opacity: 0.35; cursor: default; }
.nfv-root .nfv-icon-btn svg { width: 16px; height: 16px; }
.nfv-root .nfv-seg-btn { display: inline-flex; align-items: center; gap: 0.4rem; width: auto; min-height: 36px; padding: 0.35rem 0.85rem; margin: 0; border-radius: 999px; border: 1px solid var(--nfv-line); background: var(--nfv-card); color: var(--nfv-text-2); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.nfv-root .nfv-seg-btn svg { width: 15px; height: 15px; color: var(--nfv-accent); }
.nfv-root .nfv-seg-btn:hover { border-color: var(--nfv-accent-line); color: var(--nfv-text-1); }
.nfv-root .nfv-chip { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; width: auto; min-height: 34px; padding: 0.3rem 0.55rem; margin: 0; border-radius: 9px; border: 1px solid var(--nfv-line); background: var(--nfv-card); color: var(--nfv-text-2); font-size: 0.8rem; font-weight: 700; cursor: pointer; min-width: 0; }
.nfv-root .nfv-chip:hover { border-color: var(--nfv-accent-line); }
.nfv-root .nfv-chip.is-active { border-color: var(--nfv-accent); background: var(--nfv-accent-soft); color: var(--nfv-accent-strong); }
[data-theme="dark"] .nfv-root .nfv-chip.is-active { color: var(--nfv-accent); }
.nfv-root .nfv-chip svg { width: 15px; height: 15px; }
.nfv-root .nfv-quick { display: grid; gap: 0.35rem; }
.nfv-root .nfv-quick > * { min-width: 0; }
.nfv-root .nfv-quick-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.nfv-root .nfv-quick-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.nfv-root .nfv-quick-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.nfv-root .nfv-sub { margin: 0.75rem 0 0.35rem; font-size: 0.78rem; font-weight: 700; color: var(--nfv-text-2); }
.nfv-root .nfv-sub:first-child { margin-top: 0.2rem; }

/* ---------- upload ---------- */
.nfv-root .nfv-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; text-align: center; min-height: 180px; padding: 1.5rem 1.25rem;
    border-radius: 16px; border: 2px dashed var(--nfv-accent-line); background: var(--nfv-accent-soft); cursor: pointer; color: var(--nfv-muted); font-size: 0.86rem; line-height: 1.5;
    transition: border-color 0.15s, background 0.15s; box-sizing: border-box; margin: 0;
}
.nfv-root .nfv-drop:hover, .nfv-root .nfv-drop.is-drag { border-color: var(--nfv-accent); background: rgba(51, 153, 204, 0.14); }
.nfv-root .nfv-drop:focus-within { outline: 3px solid var(--nfv-accent-soft); }
.nfv-root .nfv-drop strong { font-size: 1.08rem; color: var(--nfv-text-1); }
.nfv-root .nfv-drop-link { color: var(--nfv-accent-strong); text-decoration: underline; text-underline-offset: 3px; }
[data-theme="dark"] .nfv-root .nfv-drop-link { color: var(--nfv-accent); }
.nfv-root .nfv-drop-icon { width: 58px; height: 58px; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin-bottom: 0.35rem; background: var(--nfv-card); color: var(--nfv-accent); border: 1px solid var(--nfv-line); }
.nfv-root .nfv-drop-icon svg { width: 28px; height: 28px; }
.nfv-root .nfv-types { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem; margin-top: 0.35rem; max-width: 560px; }
.nfv-root .nfv-types span { padding: 0.05rem 0.45rem; border-radius: 6px; background: var(--nfv-card); border: 1px solid var(--nfv-line); font: 600 0.72rem var(--nfv-mono); color: var(--nfv-text-2); }
.nfv-root .nfv-or { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0 0.6rem; color: var(--nfv-muted); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.nfv-root .nfv-or::before, .nfv-root .nfv-or::after { content: ""; flex: 1; height: 1px; background: var(--nfv-line); }
.nfv-root .nfv-textarea { display: block; width: 100%; min-height: 130px; max-height: 60vh; resize: vertical; box-sizing: border-box; margin: 0; padding: 0.75rem 0.85rem; border-radius: 12px; border: 1px solid var(--nfv-line); background: var(--input-bg, #fff); color: var(--nfv-text-1); font: 0.86rem/1.55 var(--nfv-mono); tab-size: 4; }
.nfv-root .nfv-textarea:focus { outline: none; border-color: var(--nfv-accent); box-shadow: 0 0 0 3px var(--nfv-accent-soft); }
.nfv-root .nfv-input-bar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; }
.nfv-root .nfv-kbd-hint { margin-left: auto; font-size: 0.76rem; color: var(--nfv-muted); }
.nfv-root .nfv-samples { margin-top: 1rem; }
.nfv-root .nfv-sample-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.nfv-root .nfv-under { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.6rem; margin-top: 1rem; }
.nfv-root .nfv-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.22rem 0.65rem; border-radius: 999px; background: var(--nfv-sunk); border: 1px solid var(--nfv-line); font-size: 0.78rem; font-weight: 600; color: var(--nfv-text-2); }
.nfv-root .nfv-pill svg { width: 14px; height: 14px; color: var(--nfv-accent); }
.nfv-root .nfv-recent { margin-top: 1rem; padding-top: 0.85rem; border-top: 1px solid var(--nfv-line); }
.nfv-root .nfv-recent-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.nfv-root .nfv-recent-head .nfv-caption { margin: 0; }
.nfv-root .nfv-recent-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem; }
.nfv-root .nfv-recent-list button { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; width: 100%; padding: 0.5rem 0.7rem; margin: 0; border-radius: 10px; border: 1px solid var(--nfv-line); background: var(--nfv-sunk); cursor: pointer; text-align: left; min-width: 0; }
.nfv-root .nfv-recent-list button:hover { border-color: var(--nfv-accent-line); }
.nfv-root .nfv-recent-name { font-size: 0.85rem; font-weight: 700; color: var(--nfv-text-1); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nfv-root .nfv-recent-meta { font-size: 0.74rem; color: var(--nfv-muted); }

/* page-wide drop overlay */
.nfv-root .nfv-overlay { position: fixed; inset: 0; z-index: 10004; display: flex; align-items: center; justify-content: center; background: rgba(15, 23, 42, 0.45); pointer-events: none; }
.nfv-root .nfv-overlay-box { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2rem 2.5rem; border-radius: 20px; border: 2px dashed var(--nfv-accent); background: var(--nfv-card); color: var(--nfv-text-1); font-weight: 700; font-size: 1.1rem; }
.nfv-root .nfv-overlay-box svg { width: 36px; height: 36px; color: var(--nfv-accent); }

/* ---------- viewer head ---------- */
.nfv-root .nfv-filehead { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.nfv-root .nfv-fileicon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--nfv-accent-soft); color: var(--nfv-accent); }
.nfv-root .nfv-fileicon svg { width: 22px; height: 22px; }
.nfv-root .nfv-filetext { flex: 1; min-width: 0; }
.nfv-root .nfv-filetext strong { display: block; font-size: 1.02rem; color: var(--nfv-text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nfv-root .nfv-filetext span { display: block; font-size: 0.82rem; color: var(--nfv-muted); }
.nfv-root .nfv-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.nfv-root .nfv-badge { display: inline-flex; align-items: center; gap: 0.35rem; width: auto; margin: 0; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; background: var(--nfv-accent-soft); border: 1px solid var(--nfv-accent-line); color: var(--nfv-accent-strong); cursor: pointer; }
[data-theme="dark"] .nfv-root .nfv-badge { color: var(--nfv-accent); }
.nfv-root .nfv-badge svg { width: 14px; height: 14px; }
.nfv-root .nfv-badge.is-plain { cursor: default; background: var(--nfv-sunk); border-color: var(--nfv-line); color: var(--nfv-text-2); }
.nfv-root .nfv-badge.is-edit { cursor: default; background: rgba(217, 119, 6, 0.1); border-color: rgba(217, 119, 6, 0.4); color: var(--nfv-warn); }

/* notes */
.nfv-root .nfv-notes { display: grid; gap: 0.5rem; margin-top: 0.75rem; }
.nfv-root .nfv-note { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.65rem 0.9rem; border-radius: 12px; font-size: 0.86rem; line-height: 1.5; color: var(--nfv-text-1); background: rgba(51, 153, 204, 0.08); border: 1px solid rgba(51, 153, 204, 0.3); }
.nfv-root .nfv-note.is-warn { background: rgba(217, 119, 6, 0.08); border-color: rgba(217, 119, 6, 0.35); }
.nfv-root .nfv-note > svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--nfv-accent); }
.nfv-root .nfv-note.is-warn > svg { color: var(--nfv-warn); }
.nfv-root .nfv-note > div { flex: 1; min-width: 0; }
.nfv-root .nfv-note p { margin: 0; overflow-wrap: anywhere; }
.nfv-root .nfv-note a { color: var(--nfv-accent-strong); font-weight: 600; }
[data-theme="dark"] .nfv-root .nfv-note a { color: var(--nfv-accent); }
.nfv-root .nfv-alts { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.45rem; align-items: center; }

/* stats */
.nfv-root .nfv-stats { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.75rem; }
.nfv-root .nfv-stat { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.22rem 0.6rem; border-radius: 999px; background: var(--nfv-sunk); border: 1px solid var(--nfv-line); font-size: 0.78rem; color: var(--nfv-text-2); max-width: 100%; }
.nfv-root .nfv-stat svg { width: 14px; height: 14px; color: var(--nfv-accent); flex-shrink: 0; }
.nfv-root .nfv-stat strong { color: var(--nfv-text-1); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.nfv-root .nfv-stat.is-busy svg { animation: nfvSpinR 1.4s linear infinite; }
.nfv-root .nfv-stat-more { display: none; width: auto; margin: 0; cursor: pointer; font-weight: 700; color: var(--nfv-accent-strong); border-style: dashed; }
[data-theme="dark"] .nfv-root .nfv-stat-more { color: var(--nfv-accent); }
.nfv-root .nfv-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }

/* ---------- toolbar ---------- */
.nfv-root .nfv-toolbar { position: relative; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.nfv-root .nfv-search { flex: 1; min-width: 260px; display: flex; align-items: center; gap: 0.2rem; height: 42px; padding: 0 0.3rem 0 0.7rem; border-radius: 10px; border: 1px solid var(--nfv-line); background: var(--input-bg, #fff); box-sizing: border-box; }
.nfv-root .nfv-search:focus-within { border-color: var(--nfv-accent); box-shadow: 0 0 0 3px var(--nfv-accent-soft); }
.nfv-root .nfv-search > svg { width: 16px; height: 16px; color: var(--nfv-muted); flex-shrink: 0; }
.nfv-root .nfv-search input { flex: 1; min-width: 0; width: auto; height: 100%; border: none; background: none; outline: none; box-shadow: none; color: var(--nfv-text-1); font-size: 0.9rem; padding: 0 0 0 0.4rem; margin: 0; }
.nfv-root .nfv-flag { display: inline-flex; align-items: center; justify-content: center; width: auto; min-width: 28px; height: 28px; padding: 0 0.3rem; margin: 0; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--nfv-muted); font: 700 0.75rem var(--nfv-mono); cursor: pointer; flex-shrink: 0; }
.nfv-root .nfv-flag svg { width: 15px; height: 15px; }
.nfv-root .nfv-flag:hover { color: var(--nfv-text-1); }
.nfv-root .nfv-flag[aria-pressed="true"] { border-color: var(--nfv-accent); background: var(--nfv-accent-soft); color: var(--nfv-accent-strong); }
[data-theme="dark"] .nfv-root .nfv-flag[aria-pressed="true"] { color: var(--nfv-accent); }
.nfv-root .nfv-search-count { font-size: 0.76rem; color: var(--nfv-muted); white-space: nowrap; font-variant-numeric: tabular-nums; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.nfv-root .nfv-search-count.is-none { color: var(--nfv-red); }
.nfv-root .nfv-sep { width: 1px; height: 20px; background: var(--nfv-line); flex-shrink: 0; }
.nfv-root .nfv-goto { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: flex; align-items: center; gap: 0.4rem; padding: 0.6rem; border-radius: 12px; border: 1px solid var(--nfv-line); background: var(--nfv-card); box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); }
.nfv-root .nfv-goto label { font-size: 0.82rem; font-weight: 700; color: var(--nfv-text-2); white-space: nowrap; }
.nfv-root .nfv-input { width: 150px; height: 36px; padding: 0 0.7rem; margin: 0; border: 1px solid var(--nfv-line); border-radius: 9px; background: var(--input-bg, #fff); color: var(--nfv-text-1); font: 0.88rem var(--nfv-mono); box-sizing: border-box; }
.nfv-root .nfv-input:focus { outline: none; border-color: var(--nfv-accent); box-shadow: 0 0 0 3px var(--nfv-accent-soft); }
.nfv-root .nfv-select { width: 100%; height: 40px; max-width: 100%; min-width: 0; padding: 0 0.6rem; margin: 0; border-radius: 9px; border: 1px solid var(--nfv-line); background: var(--input-bg, #fff); color: var(--nfv-text-1); font-size: 0.88rem; box-sizing: border-box; }

/* ---------- options (collapsed rows) ---------- */
.nfv-root .nfv-adv { border: 1px solid var(--nfv-line); border-radius: 12px; overflow: hidden; background: var(--nfv-card); margin-top: 0.75rem; }
.nfv-root .nfv-adv-row + .nfv-adv-row { border-top: 1px solid var(--nfv-line); }
.nfv-root .nfv-adv-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; min-height: 52px; box-sizing: border-box; padding: 0.55rem 1rem; margin: 0; border: none; background: none; cursor: pointer; text-align: left; color: var(--nfv-text-1); font-weight: 400; }
.nfv-root .nfv-adv-left { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.nfv-root .nfv-adv-left > svg { width: 18px; height: 18px; color: var(--nfv-accent); flex-shrink: 0; }
.nfv-root .nfv-adv-text { display: flex; flex-direction: column; min-width: 0; }
.nfv-root .nfv-adv-title { font-size: 0.9rem; font-weight: 700; }
.nfv-root .nfv-adv-hint { font-size: 0.76rem; color: var(--nfv-muted); line-height: 1.35; }
.nfv-root .nfv-adv-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.nfv-root .nfv-adv-value { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0.2rem 0.55rem; border-radius: 999px; background: var(--nfv-accent-soft); color: var(--nfv-accent-strong); font-size: 0.76rem; font-weight: 700; }
[data-theme="dark"] .nfv-root .nfv-adv-value { color: var(--nfv-accent); }
.nfv-root .nfv-chevron { width: 17px; height: 17px; color: var(--nfv-muted); transition: transform 0.2s; }
.nfv-root .nfv-adv-row.open .nfv-chevron { transform: rotate(180deg); }
.nfv-root .nfv-adv-row.open .nfv-adv-head, .nfv-root .nfv-adv-row.open .nfv-adv-body { background: var(--nfv-open); }
.nfv-root .nfv-adv-body { padding: 0.2rem 1rem 1rem; }
.nfv-root .nfv-adv-note { margin: 0.5rem 0 0; font-size: 0.78rem; color: var(--nfv-muted); line-height: 1.45; }
.nfv-root .nfv-size { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.5rem; }
.nfv-root .nfv-size-val { min-width: 48px; text-align: center; font-weight: 800; font-size: 0.86rem; color: var(--nfv-text-1); font-variant-numeric: tabular-nums; }
.nfv-root .nfv-switch-text { font-size: 0.74rem; font-weight: 800; color: var(--nfv-muted); min-width: 26px; text-align: right; }
/* switch - beats the global .tool-container checkbox rules */
.tool-container.nfv-root input[type="checkbox"].nfv-switch {
    -webkit-appearance: none !important; appearance: none !important; position: relative; flex-shrink: 0;
    width: 40px !important; height: 22px !important; margin: 0 !important; padding: 0 !important;
    border: none !important; border-radius: 999px !important; background: #cbd5e1 !important; box-shadow: none !important; cursor: pointer; transition: background 0.2s;
}
[data-theme="dark"] .tool-container.nfv-root input[type="checkbox"].nfv-switch { background: #475569 !important; }
.tool-container.nfv-root input[type="checkbox"].nfv-switch::after, .tool-container.nfv-root input[type="checkbox"].nfv-switch:checked::after {
    content: '' !important; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; transform: none !important; transition: left 0.2s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); font-size: 0; line-height: 0; border: none;
}
.tool-container.nfv-root input[type="checkbox"].nfv-switch:checked { background: var(--nfv-go) !important; }
.tool-container.nfv-root input[type="checkbox"].nfv-switch:checked::after { left: 21px; }
.tool-container.nfv-root input[type="checkbox"].nfv-switch:focus-visible { outline: 3px solid var(--nfv-accent-line); outline-offset: 2px; }

/* action bar */
.nfv-root .nfv-actionbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--nfv-line); }
.nfv-root .nfv-actionbar .nfv-btn-ghost { min-height: 40px; padding: 0.4rem 0.7rem; font-size: 0.86rem; gap: 0.35rem; }
.nfv-root .nfv-actionbar .nfv-btn-ghost svg { width: 16px; height: 16px; }
.nfv-root .nfv-actionbar .nfv-go { margin-left: auto; }
.nfv-root .nfv-dl-hint { font-weight: 600; font-size: 0.8rem; opacity: 0.85; }

/* toast */
.nfv-root .nfv-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 10003; max-width: calc(100vw - 32px); box-sizing: border-box; padding: 0.55rem 1rem; border-radius: 10px; background: #1e293b; color: #fff; font-size: 0.86rem; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); transition: opacity 0.25s; text-align: center; }
[data-theme="dark"] .nfv-root .nfv-toast { background: #e2e8f0; color: #0f172a; }
.nfv-root .nfv-toast.is-out { opacity: 0; }

/* ---------- content ---------- */
.nfv-root .nfv-info { margin-top: 2rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
.nfv-root .nfv-info > * { min-width: 0; }
.nfv-root .nfv-info-card { background: var(--bg-elevated, #fff); border: 1px solid var(--nfv-line); border-radius: var(--radius-md, 12px); padding: 1.4rem 1.5rem; }
.nfv-root .nfv-info-card h2 { display: flex; align-items: center; gap: 0.55rem; margin: 0 0 0.9rem; font-size: 1.25rem; color: var(--nfv-text-1); }
.nfv-root .nfv-info-card h2 svg { width: 22px; height: 22px; color: var(--nfv-accent); flex-shrink: 0; }
.nfv-root .nfv-info-card h3 { margin: 1.2rem 0 0.5rem; font-size: 1.05rem; color: var(--nfv-text-1); }
.nfv-root .nfv-info-card p, .nfv-root .nfv-info-card li { color: var(--nfv-text-2); line-height: 1.65; font-size: 0.97rem; }
.nfv-root .nfv-info-card p { margin: 0.8rem 0 0; }
.nfv-root .nfv-info-card h2 + p { margin-top: 0; }
.nfv-root .nfv-info a { color: var(--nfv-accent-strong); font-weight: 500; }
[data-theme="dark"] .nfv-root .nfv-info a { color: var(--nfv-accent); }
.nfv-root .nfv-steps, .nfv-root .nfv-list { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.45rem; }
.nfv-root .nfv-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.nfv-root .nfv-feature { padding: 0.9rem 1rem; border-radius: 12px; border: 1px solid var(--nfv-line); background: var(--nfv-open); min-width: 0; }
.nfv-root .nfv-feature > svg { width: 20px; height: 20px; color: var(--nfv-accent); }
.nfv-root .nfv-info-card .nfv-feature h3 { margin: 0.35rem 0 0.2rem; font-size: 0.95rem; }
.nfv-root .nfv-info-card .nfv-feature p { margin: 0; font-size: 0.88rem; line-height: 1.55; }
.nfv-root .nfv-table-wrap { overflow-x: auto; border: 1px solid var(--nfv-line); border-radius: 10px; margin-top: 0.9rem; }
.nfv-root .nfv-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 520px; margin: 0; }
.nfv-root .nfv-table th, .nfv-root .nfv-table td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--nfv-line); color: var(--nfv-text-2); vertical-align: top; }
.nfv-root .nfv-table th { background: var(--nfv-sunk); color: var(--nfv-text-1); font-weight: 700; font-size: 0.82rem; }
.nfv-root .nfv-table tr:last-child td { border-bottom: none; }
.nfv-root .nfv-table td:first-child { font-weight: 700; color: var(--nfv-text-1); white-space: nowrap; }
.nfv-root .nfv-keys { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 1rem; margin-top: 0.9rem; padding: 0; list-style: none; }
.nfv-root .nfv-keys li { display: flex; justify-content: space-between; gap: 0.6rem; padding: 0.35rem 0.6rem; border-radius: 8px; background: var(--nfv-open); font-size: 0.88rem; min-width: 0; }
.nfv-root .nfv-keys li span:last-child { text-align: right; white-space: nowrap; }
.nfv-root .nfv-faq .faq-question svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- responsive ---------- */
@media (max-width: 600px) {
    .nfv-root.tool-container { padding: 1.1rem 16px; }
    .nfv-root .tool-title { font-size: 1.55rem; }
    .nfv-root .nfv-title-icon { width: 46px; height: 46px; border-radius: 13px; }
    .nfv-root .nfv-title-icon svg { width: 25px; height: 25px; }
    .nfv-root .tool-description { font-size: 0.98rem; }
    .nfv-root .nfv-card { padding: 1rem; border-radius: 16px; }
    .nfv-root .nfv-drop { min-height: 150px; }
    .nfv-root .nfv-kbd-hint { display: none; }
    .nfv-root .nfv-input-bar .nfv-go { flex: 1 1 100%; }
    .nfv-root .nfv-input-bar .nfv-btn-ghost { flex: 1; }
    .nfv-root .nfv-toolbar > .nfv-btn { flex: 1; }
    .nfv-root .nfv-adv-head { padding: 0.55rem 0.75rem; }
    .nfv-root .nfv-adv-hint { display: none; }
    .nfv-root .nfv-adv-value { max-width: 110px; }
    .nfv-root .nfv-quick-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nfv-root .nfv-actionbar .nfv-go { flex: 1 1 100%; margin-left: 0; order: -1; }
    .nfv-root .nfv-actionbar .nfv-btn-ghost { flex: 1 1 calc(33% - 0.5rem); padding: 0.45rem 0.4rem; }
    .nfv-root .nfv-recent-list { grid-template-columns: minmax(0, 1fr); }
    .nfv-root .nfv-features, .nfv-root .nfv-keys { grid-template-columns: minmax(0, 1fr); }
    .nfv-root .nfv-info-card { padding: 1.1rem; }
    .nfv-root .nfv-panel.is-full { inset: 0; border-radius: 0; }
}


/* ---------- NFO: fonts (The Ultimate Oldschool PC Font Pack by VileR, CC BY-SA 4.0) ---------- */
@font-face { font-family: "nfv-vga9"; src: url("lib/WebPlus_IBM_VGA_9x16.woff?v=20261010") format("woff"); font-display: swap; }
@font-face { font-family: "nfv-vga8"; src: url("lib/WebPlus_IBM_VGA_8x16.woff?v=20261010") format("woff"); font-display: swap; }

/* toolbar */
.nfv-root .nfv-zoom { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.15rem; border-radius: 10px; border: 1px solid var(--nfv-line); background: var(--nfv-sunk); }
.nfv-root .nfv-zoom-val { min-width: 54px; height: 32px; padding: 0 0.3rem; margin: 0; border: none; border-radius: 7px; background: none; font: 800 0.82rem var(--nfv-mono); color: var(--nfv-text-1); cursor: pointer; font-variant-numeric: tabular-nums; }
.nfv-root .nfv-zoom-val:hover { background: var(--nfv-accent-soft); }
.nfv-root .nfv-zoom .nfv-icon-btn { width: 32px; height: 32px; }
.nfv-root .nfv-tool-spacer { flex: 1; }
.nfv-root .nfv-swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(100, 116, 139, 0.45); flex-shrink: 0; }

/* SAUCE */
.nfv-root .nfv-sauce { margin-top: 0.75rem; border: 1px solid var(--nfv-line); border-radius: 12px; background: var(--nfv-open); }
.nfv-root .nfv-sauce > summary { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.9rem; cursor: pointer; font-size: 0.88rem; font-weight: 700; color: var(--nfv-text-1); list-style: none; }
.nfv-root .nfv-sauce > summary::-webkit-details-marker { display: none; }
.nfv-root .nfv-sauce > summary svg { width: 17px; height: 17px; color: var(--nfv-accent); flex-shrink: 0; }
.nfv-root .nfv-sauce > summary .nfv-chevron { margin-left: auto; }
.nfv-root .nfv-sauce[open] > summary .nfv-chevron { transform: rotate(180deg); }
.nfv-root .nfv-sauce-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.45rem; margin: 0; padding: 0 0.9rem 0.9rem; }
.nfv-root .nfv-sauce-list > div { min-width: 0; padding: 0.45rem 0.65rem; border-radius: 9px; background: var(--nfv-card); border: 1px solid var(--nfv-line); }
.nfv-root .nfv-sauce-list .nfv-wide { grid-column: 1 / -1; }
.nfv-root .nfv-sauce-list dt { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--nfv-muted); }
.nfv-root .nfv-sauce-list dd { margin: 0.1rem 0 0; font-size: 0.88rem; color: var(--nfv-text-1); overflow-wrap: anywhere; }

/* the art panel */
.nfv-root .nfv-panel { position: relative; margin-top: 0.85rem; border: 1px solid var(--nfv-line); border-radius: 14px; overflow: hidden; background: #000; }
.nfv-root .nfv-panel.is-full { position: fixed; inset: 10px; z-index: 10000; margin: 0; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.nfv-root .nfv-panel.is-full .nfv-view { flex: 1; height: auto; min-height: 0; }
body.nfv-noscroll { overflow: hidden; }
.nfv-root .nfv-full-btn { position: absolute; top: 8px; right: 16px; z-index: 4; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; margin: 0; border-radius: 8px; border: 1px solid rgba(148, 163, 184, 0.45); background: rgba(15, 23, 42, 0.55); color: #e2e8f0; cursor: pointer; opacity: 0.8; }
.nfv-root .nfv-full-btn:hover { opacity: 1; }
.nfv-root .nfv-full-btn svg { width: 16px; height: 16px; }
.nfv-root .nfv-view { position: relative; height: 640px; overflow: auto; outline: none; overscroll-behavior: contain; background: #000; color: #aaa; }
.nfv-root .nfv-view:focus-visible { box-shadow: inset 0 0 0 2px var(--nfv-accent-line); }
.nfv-root .nfv-space { position: relative; min-width: 100%; }
.nfv-root .nfv-art {
    position: relative; box-sizing: content-box; padding: 12px; margin: 0 auto; white-space: pre; font-family: "nfv-vga9", monospace; font-size: 16px; line-height: 16px;
    font-kerning: none; font-variant-ligatures: none; letter-spacing: 0; text-rendering: optimizeSpeed; -webkit-font-smoothing: none; -moz-osx-font-smoothing: unset; will-change: transform;
}
.nfv-root .nfv-r { height: var(--nfv-lh, 16px); overflow: visible; }
.nfv-root .nfv-view.is-wrap .nfv-art { white-space: pre-wrap; overflow-wrap: anywhere; width: auto !important; }
.nfv-root .nfv-view.is-wrap .nfv-r { height: auto; min-height: var(--nfv-lh, 16px); }
.nfv-root .nfv-art ::selection { background: rgba(51, 153, 204, 0.55); color: #fff; }
.nfv-root .nfv-view.is-light .nfv-art ::selection { background: rgba(51, 153, 204, 0.35); color: inherit; }
/* CRT look: scanlines + a soft glow on the phosphor themes */
.nfv-root .nfv-view.is-crt .nfv-art::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) calc(var(--nfv-z, 1) * 1px), rgba(0, 0, 0, 0.28) calc(var(--nfv-z, 1) * 1px), rgba(0, 0, 0, 0.28) calc(var(--nfv-z, 1) * 2px)); }
.nfv-root .nfv-view.is-crt.is-light .nfv-art::after { background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) calc(var(--nfv-z, 1) * 1px), rgba(0, 0, 0, 0.07) calc(var(--nfv-z, 1) * 1px), rgba(0, 0, 0, 0.07) calc(var(--nfv-z, 1) * 2px)); }
.nfv-root .nfv-view.is-crt[data-theme-art="amber"] .nfv-art { text-shadow: 0 0 calc(var(--nfv-z, 1) * 3px) rgba(255, 176, 0, 0.55); }
.nfv-root .nfv-view.is-crt[data-theme-art="green"] .nfv-art { text-shadow: 0 0 calc(var(--nfv-z, 1) * 3px) rgba(51, 255, 102, 0.5); }
.nfv-root .nfv-view.is-crt[data-theme-art="classic"] .nfv-art { text-shadow: 0 0 calc(var(--nfv-z, 1) * 2px) rgba(200, 200, 200, 0.35); }
@keyframes nfvBlink { 50% { color: transparent; } }
@media (prefers-reduced-motion: reduce) { .nfv-root .nfv-art span { animation: none !important; } }
.nfv-root .nfv-status { display: flex; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; padding: 0.35rem 0.85rem; border-top: 1px solid var(--nfv-line); background: var(--nfv-sunk); font-size: 0.76rem; color: var(--nfv-muted); font-variant-numeric: tabular-nums; }
.nfv-root .nfv-status span { min-width: 0; overflow-wrap: anywhere; }
.nfv-root .nfv-theme-note { margin: 0.4rem 0 0; font-size: 0.78rem; color: var(--nfv-muted); }
.nfv-root .nfv-code { margin: 0.9rem 0 0; padding: 0.8rem 1rem; border-radius: 10px; overflow-x: auto; background: #000; color: #aaa; font: 16px/16px "nfv-vga9", monospace; white-space: pre; }
@media (max-width: 600px) {
    .nfv-root .nfv-view { height: 460px; }
    .nfv-root .nfv-toolbar .nfv-segs { order: 3; width: 100%; display: flex; }
    .nfv-root .nfv-toolbar .nfv-segs button { flex: 1; justify-content: center; padding: 0.15rem 0.3rem; gap: 0.25rem; }
    .nfv-root .nfv-tool-spacer { display: none; }
    .nfv-root .nfv-sauce-list { grid-template-columns: minmax(0, 1fr); }
    .nfv-root .nfv-code { font-size: 12px; line-height: 12px; }
}
.nfv-root .nfv-segs { display: inline-flex; flex-wrap: wrap; padding: 0.15rem; gap: 0.15rem; border-radius: 10px; background: var(--nfv-sunk); border: 1px solid var(--nfv-line); max-width: 100%; }
.nfv-root .nfv-segs button { display: inline-flex; align-items: center; gap: 0.35rem; width: auto; min-height: 32px; padding: 0.15rem 0.6rem; margin: 0; border: none; border-radius: 7px; background: none; color: var(--nfv-muted); font-size: 0.8rem; font-weight: 700; cursor: pointer; }
.nfv-root .nfv-segs button:hover:not(:disabled) { color: var(--nfv-text-1); }
.nfv-root .nfv-segs button:disabled { opacity: 0.45; cursor: default; }
.nfv-root .nfv-segs button.is-active { background: var(--nfv-card); color: var(--nfv-accent-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
[data-theme="dark"] .nfv-root .nfv-segs button.is-active { color: var(--nfv-accent); background: #26334a; }
.nfv-root .nfv-segs button:focus-visible, .nfv-root .nfv-zoom button:focus-visible, .nfv-root .nfv-chip:focus-visible, .nfv-root .nfv-btn:focus-visible, .nfv-root .nfv-seg-btn:focus-visible, .nfv-root .nfv-adv-head:focus-visible { outline: 3px solid var(--nfv-accent-line); outline-offset: 1px; }
.nfv-root .nfv-sauce:not([open]) > :not(summary) { display: none; }
.nfv-root .nfv-sauce > summary + div:empty { display: none; }
.nfv-root details.nfv-sauce { padding: 0; margin-bottom: 0; border-bottom: 1px solid var(--nfv-line); }
.nfv-root details.nfv-sauce > summary { margin: 0; font-size: 0.88rem; }
.nfv-root details.nfv-sauce > summary:hover { color: var(--nfv-accent-strong); }
[data-theme="dark"] .nfv-root details.nfv-sauce > summary:hover { color: var(--nfv-accent); }
