/* ============================================================
   TextDiff Pro — Premium Stylesheet
   Dark / Light theme · Responsive · Animated
   ============================================================ */

/* ── 1. DESIGN TOKENS ──────────────────────────────────────── */
:root {
    /* Brand */
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-glow: rgba(99,102,241,.35);

    /* Diff colours */
    --ins-bg:       #14532d;
    --ins-bg-soft:  rgba(20,83,45,.45);
    --ins-border:   #16a34a;
    --ins-text:     #86efac;
    --ins-char-bg:  #166534;

    --del-bg:       #450a0a;
    --del-bg-soft:  rgba(69,10,10,.45);
    --del-border:   #dc2626;
    --del-text:     #fca5a5;
    --del-char-bg:  #7f1d1d;

    /* Neutrals (dark) */
    --bg-base:      #0d0f14;
    --bg-surface:   #13161e;
    --bg-raised:    #1a1e2a;
    --bg-overlay:   #1f2435;
    --bg-hover:     #252a3a;
    --border:       #2a2f42;
    --border-soft:  #1f2435;
    --text-primary: #f1f5f9;
    --text-sec:     #94a3b8;
    --text-muted:   #475569;
    --line-num-bg:  #10131b;
    --line-num-fg:  #374151;

    /* Sizing */
    --radius-sm:    6px;
    --radius-md:    10px;
    --radius-lg:    16px;
    --radius-xl:    22px;
    --header-h:     58px;
    --font-mono:    'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-ui:      'Inter', system-ui, sans-serif;

    /* Transitions */
    --ease:         cubic-bezier(.4,0,.2,1);
    --dur-fast:     120ms;
    --dur-med:      220ms;
    --dur-slow:     380ms;
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-base:      #f8fafc;
    --bg-surface:   #ffffff;
    --bg-raised:    #f1f5f9;
    --bg-overlay:   #e2e8f0;
    --bg-hover:     #e8edf5;
    --border:       #cbd5e1;
    --border-soft:  #e2e8f0;
    --text-primary: #0f172a;
    --text-sec:     #475569;
    --text-muted:   #94a3b8;
    --line-num-bg:  #f1f5f9;
    --line-num-fg:  #94a3b8;

    --ins-bg:       #dcfce7;
    --ins-bg-soft:  rgba(220,252,231,.6);
    --ins-border:   #22c55e;
    --ins-text:     #15803d;
    --ins-char-bg:  #bbf7d0;

    --del-bg:       #fee2e2;
    --del-bg-soft:  rgba(254,226,226,.6);
    --del-border:   #ef4444;
    --del-text:     #b91c1c;
    --del-char-bg:  #fecaca;
}

/* ── 2. RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Ensure the HTML hidden attribute always wins, even when CSS sets display */
[hidden] { display: none !important; }

html {
    font-size: 15px;
    color-scheme: dark light;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
    transition: background var(--dur-slow) var(--ease),
                color var(--dur-slow) var(--ease);
    -webkit-font-smoothing: antialiased;
}

svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    overflow: visible;
}

button { cursor: pointer; font-family: inherit; }
textarea { font-family: inherit; }
a { color: var(--brand-500); }

/* ── 3. HEADER ─────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.header-inner {
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.brand-icon svg {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: block;
    filter: drop-shadow(0 2px 8px var(--brand-glow));
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -.3px;
}

.brand-name em {
    font-style: normal;
    background: linear-gradient(90deg, var(--brand-500), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tag {
    font-size: .65rem;
    font-weight: 600;
    color: #22c55e;
    text-transform: uppercase;
    letter-spacing: .6px;
}

/* Nav (split / unified) */
.header-nav {
    display: flex;
    gap: 4px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 3px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-sec);
    font-size: .8rem;
    font-weight: 500;
    transition: background var(--dur-fast), color var(--dur-fast);
}

.nav-btn svg { width: 16px; height: 16px; stroke-width: 1.5; fill: currentColor; }

.nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav-btn.active {
    background: var(--brand-500);
    color: #fff;
    box-shadow: 0 2px 8px var(--brand-glow);
}

/* Mode pills */
.mode-pills {
    display: flex;
    gap: 3px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 3px;
}

.pill {
    padding: 4px 11px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-sec);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .2px;
    transition: all var(--dur-fast) var(--ease);
}

.pill:hover { background: var(--bg-hover); color: var(--text-primary); }

.pill.active {
    background: var(--brand-500);
    color: #fff;
    box-shadow: 0 1px 6px var(--brand-glow);
}

/* Icon buttons */
.icon-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    color: var(--text-sec);
    transition: all var(--dur-fast) var(--ease);
}

.icon-btn svg { width: 17px; height: 17px; }

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--brand-500);
}

.icon-btn[aria-pressed="true"] {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: #fff;
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.icon-moon path, .icon-sun circle,
.icon-sun line { stroke: currentColor; }

.icon-sun { fill: none; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.divider-v {
    width: 1px;
    height: 22px;
    background: var(--border);
    flex-shrink: 0;
}

/* ── 4. MAIN WRAP ──────────────────────────────────────────── */
.main-wrap {
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 20px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── LIVE BADGE ────────────────────────────────────────────── */
.live-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(34,197,94,.12);
    border: 1px solid rgba(34,197,94,.3);
    color: #22c55e;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
}
.live-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .5; transform: scale(.7); }
}

/* ── 5. STATS BAR ──────────────────────────────────────────── */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px 16px;
    animation: slideDown var(--dur-med) var(--ease);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .78rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
}

.chip-label { color: var(--text-sec); font-weight: 500; }

.chip-value {
    font-weight: 700;
    font-size: .82rem;
    color: var(--text-primary);
}

.chip-ins .chip-value { color: var(--ins-text); }
.chip-del .chip-value { color: var(--del-text); }

.chip-sim .chip-value {
    font-size: .9rem;
    background: linear-gradient(90deg, var(--brand-500), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-ins { background: var(--ins-border); box-shadow: 0 0 5px var(--ins-border); }
.dot-del { background: var(--del-border); box-shadow: 0 0 5px var(--del-border); }
.dot-orig { background: var(--del-border); }
.dot-mod  { background: var(--ins-border); }

.stat-bar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.change-nav-label {
    font-size: .78rem;
    color: var(--text-sec);
    min-width: 52px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* Action buttons (copy, export, etc.) */
.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
    color: var(--text-sec);
    font-size: .78rem;
    font-weight: 500;
    transition: all var(--dur-fast) var(--ease);
}

.action-btn svg { width: 13px; height: 13px; }

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--brand-500);
}

.action-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
    pointer-events: none;
}

.action-btn.danger:hover {
    border-color: var(--del-border);
    color: var(--del-text);
    background: var(--del-bg-soft);
}

/* ── 6. INPUT STAGE ────────────────────────────────────────── */
.input-stage {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    min-height: 320px;
}

.input-col {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--dur-med) var(--ease),
                box-shadow var(--dur-med) var(--ease);
}

.input-col:focus-within {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.input-col.drag-over {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 4px var(--brand-glow);
}

.input-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-raised);
}

.input-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.input-meta {
    font-size: .72rem;
    color: var(--text-muted);
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.input-header-btns {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

/* Micro buttons */
.micro-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 27px;
    height: 27px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--dur-fast) var(--ease);
}

.micro-btn svg { width: 13px; height: 13px; stroke-width: 1.7; }

.micro-btn:hover {
    background: var(--bg-hover);
    border-color: var(--brand-500);
    color: var(--text-primary);
}

/* Editor */
.editor-wrap {
    position: relative;
    flex: 1;
    display: flex;
}

.editor {
    flex: 1;
    width: 100%;
    min-height: 280px;
    padding: 14px 16px;
    background: transparent;
    color: var(--text-primary);
    border: none;
    outline: none;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: .84rem;
    line-height: 1.7;
    caret-color: var(--brand-500);
    transition: background var(--dur-fast);
}

.editor::placeholder {
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: .82rem;
    line-height: 1.8;
}

/* Drop overlay */
.drop-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg-overlay);
    border: 2px dashed var(--brand-500);
    border-radius: var(--radius-md);
    color: var(--brand-500);
    font-size: .9rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-fast) var(--ease);
}

.drop-overlay svg { width: 44px; height: 44px; stroke-width: 1.5; }

.drag-over .drop-overlay { opacity: 1; }

/* Input divider / swap button */
.input-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    flex-shrink: 0;
}

.swap-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-raised);
    color: var(--text-sec);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--dur-fast) var(--ease);
}

.swap-btn svg { width: 18px; height: 18px; }

.swap-btn:hover {
    background: var(--brand-500);
    border-color: var(--brand-500);
    color: #fff;
    box-shadow: 0 2px 12px var(--brand-glow);
    transform: rotate(180deg);
}

/* ── 7. COMPARE ROW ────────────────────────────────────────── */
.compare-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.compare-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: .2px;
    box-shadow: 0 4px 20px var(--brand-glow);
    transition: all var(--dur-fast) var(--ease);
    position: relative;
    overflow: hidden;
}

.compare-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,.12), transparent);
    opacity: 0;
    transition: opacity var(--dur-fast);
}

.compare-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--brand-glow);
}

.compare-btn:hover::after { opacity: 1; }

.compare-btn:active { transform: translateY(0); }

.compare-btn svg { width: 18px; height: 18px; }

.compare-btn .btn-hint {
    font-size: .68rem;
    font-weight: 400;
    opacity: .65;
    margin-left: 2px;
}

.compare-btn.comparing {
    opacity: .75;
    cursor: wait;
}

/* keyboard shortcut tags in footer */
kbd {
    display: inline-block;
    padding: 1px 5px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: .7rem;
    color: var(--text-sec);
}

/* input-btns alias (same as input-header-btns) */
.input-btns {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

/* Auto-compare toggle */
.option-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
}

.option-toggle input { display: none; }

.toggle-track {
    position: relative;
    width: 38px;
    height: 22px;
    background: var(--bg-overlay);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: background var(--dur-fast), border-color var(--dur-fast);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform var(--dur-fast), background var(--dur-fast);
}

.option-toggle input:checked + .toggle-track {
    background: var(--brand-500);
    border-color: var(--brand-500);
}

.option-toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(16px);
    background: #fff;
}

.toggle-label {
    font-size: .8rem;
    color: var(--text-sec);
    font-weight: 500;
}

/* ── 8. RESULT STAGE ───────────────────────────────────────── */
.result-stage {
    display: flex;
    flex-direction: column;
    gap: 0;
    animation: fadeIn var(--dur-med) var(--ease);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Split view */
.split-view {
    display: grid;
    grid-template-columns: 1fr 20px 1fr;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
}

.result-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.result-col.full { flex: 1; }

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-soft);
}

.result-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Gutter (connector lines between left and right diffs) */
.result-gutter {
    background: var(--bg-raised);
    border-left: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
    position: relative;
    overflow: hidden;
}

/* Result body — scrollable code view */
.result-body {
    overflow: auto;
    flex: 1;
    max-height: 540px;
    font-family: var(--font-mono);
    font-size: .82rem;
    line-height: 1.75;
}

/* Diff lines */
.diff-line {
    display: flex;
    align-items: baseline;
    min-height: 1.75em;
    transition: background var(--dur-fast);
}

.diff-line:hover { background: var(--bg-hover); }

.line-num {
    min-width: 48px;
    padding: 0 10px 0 6px;
    text-align: right;
    color: var(--line-num-fg);
    background: var(--line-num-bg);
    border-right: 1px solid var(--border-soft);
    user-select: none;
    font-size: .75rem;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.line-body {
    flex: 1;
    padding: 0 14px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-primary);
}

/* Highlights */
mark.hl-del {
    background: var(--del-bg);
    color: var(--del-text);
    border-radius: 3px;
    padding: 1px 0;
    font-style: normal;
}

mark.hl-ins {
    background: var(--ins-bg);
    color: var(--ins-text);
    border-radius: 3px;
    padding: 1px 0;
    font-style: normal;
}

mark.hl-char {
    padding: 1px 2px;
    border-radius: 2px;
}

mark.hl-del.hl-char { background: var(--del-char-bg); }
mark.hl-ins.hl-char { background: var(--ins-char-bg); }

/* Ghost — invisible placeholder for alignment */
.ghost {
    opacity: 0;
    pointer-events: none;
    user-select: none;
}

/* Entire-line coloured bg for strong changes */
.diff-line.line-del { background: var(--del-bg-soft); border-left: 3px solid var(--del-border); }
.diff-line.line-ins { background: var(--ins-bg-soft); border-left: 3px solid var(--ins-border); }

/* Unified view */
.unified-view {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
}

.u-ins { background: var(--ins-bg-soft); border-left: 3px solid var(--ins-border); }
.u-del { background: var(--del-bg-soft); border-left: 3px solid var(--del-border); }
.u-eq  {}

.u-prefix {
    min-width: 22px;
    padding: 0 4px;
    text-align: center;
    font-size: .82rem;
    flex-shrink: 0;
    color: var(--text-muted);
    font-weight: 700;
}

.u-ins .u-prefix { color: var(--ins-text); }
.u-del .u-prefix { color: var(--del-text); }

/* Current highlight (navigation) */
.diff-line.current-change {
    outline: 2px solid var(--brand-500);
    outline-offset: -2px;
    border-radius: 2px;
}

/* No diff banner */
.no-diff-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 64px 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
    animation: fadeIn var(--dur-med) var(--ease);
}

.no-diff-icon svg {
    width: 72px;
    height: 72px;
    color: #22c55e;
    stroke-width: 2;
    filter: drop-shadow(0 0 12px rgba(34,197,94,.4));
}

.no-diff-banner h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.no-diff-banner p { color: var(--text-sec); font-size: .9rem; }

/* ── 9. EXPORT MODAL ───────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeBg var(--dur-fast) var(--ease);
}

@keyframes fadeBg {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    padding: 28px;
    box-shadow: 0 24px 64px rgba(0,0,0,.5);
    animation: modalIn var(--dur-med) var(--ease);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-raised);
    color: var(--text-sec);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--dur-fast);
}

.modal-close:hover { background: var(--del-bg-soft); border-color: var(--del-border); color: var(--del-text); }
.modal-close svg { width: 13px; height: 13px; }

.modal-desc { font-size: .85rem; color: var(--text-sec); margin-bottom: 16px; }

.export-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.export-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    text-align: left;
    transition: all var(--dur-fast) var(--ease);
}

.export-card:hover {
    border-color: var(--brand-500);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px var(--brand-glow);
}

.export-card .export-icon svg { width: 40px; height: 40px; }

.export-card div strong {
    display: block;
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.export-card div span {
    font-size: .72rem;
    color: var(--text-sec);
}

/* ── 10. TOAST ─────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0,0,0,.4);
    color: var(--text-primary);
    font-size: .83rem;
    font-weight: 500;
    max-width: 320px;
    pointer-events: auto;
    animation: toastIn var(--dur-fast) var(--ease);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

.toast.out {
    animation: toastOut var(--dur-fast) var(--ease) forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(24px); }
}

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: #22c55e; }
.toast.error   .toast-icon { color: var(--del-border); }
.toast.info    .toast-icon { color: var(--brand-500); }

/* ── 11. FOOTER ────────────────────────────────────────────── */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: .75rem;
    color: var(--text-muted);
}

.footer-sep { opacity: .4; }

/* ── 12. SCROLLBAR STYLING ─────────────────────────────────── */
.result-body::-webkit-scrollbar { width: 7px; height: 7px; }
.result-body::-webkit-scrollbar-track { background: transparent; }
.result-body::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
.result-body::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Similarity ring chip ── */
.chip-sim {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 8px;
}
.sim-ring-wrap {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}
.sim-ring-svg {
    width: 40px;
    height: 40px;
    transform: rotate(-90deg);
}
.ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 3.5;
}
.ring-fg {
    fill: none;
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray .5s var(--ease), stroke .3s;
}
.sim-pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .62rem;
    font-weight: 800;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.sim-labels .chip-label {
    font-size: .75rem;
}

.chip-icon {
    width: 13px; height: 13px;
    color: var(--text-muted);
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
}

/* ── 14. RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
    .input-stage {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .input-divider {
        width: 100%;
        height: 42px;
    }

    .split-view {
        grid-template-columns: 1fr;
        grid-template-rows: auto 4px auto;
    }

    .result-gutter {
        height: 4px;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--border-soft);
        border-bottom: 1px solid var(--border-soft);
    }

    .export-grid { grid-template-columns: 1fr; }

    .header-inner { gap: 8px; }

    .brand-tag { display: none; }

    .stats-bar { gap: 6px; }

    .stat-bar-right { margin-left: 0; width: 100%; justify-content: flex-end; }

    .mode-pills .pill span { display: none; }
}

@media (max-width: 640px) {
    .header-nav { display: none; }
    .main-wrap { padding: 12px 12px 24px; }
    .compare-btn { padding: 10px 22px; font-size: .88rem; }
    .brand-name { font-size: .85rem; }
}

/* ── 15. SELECTION ─────────────────────────────────────────── */
::selection {
    background: var(--brand-glow);
    color: var(--text-primary);
}

/* ── 16. LOADING SHIMMER ───────────────────────────────────── */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-raised) 25%,
        var(--bg-hover) 50%,
        var(--bg-raised) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ── 17. FOCUS RING (ACCESSIBILITY) ───────────────────────── */
:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 2px;
    border-radius: 3px;
}

button:focus:not(:focus-visible) { outline: none; }

/* ── 18. SEO CONTENT SECTION ───────────────────────────────── */
.seo-section {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 56px 24px 64px;
}

.seo-inner {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px 56px;
}

.seo-about {
    grid-column: 1 / -1;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-soft);
}

.seo-section h1 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 12px;
    letter-spacing: -.3px;
    line-height: 1.3;
}

.seo-section h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    letter-spacing: -.2px;
}

.seo-section h3 {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.seo-section p {
    font-size: .86rem;
    color: var(--text-sec);
    line-height: 1.75;
}

.seo-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

.seo-features ul,
.seo-howto ol {
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.seo-features li,
.seo-howto li {
    font-size: .84rem;
    color: var(--text-sec);
    line-height: 1.6;
}

.seo-faq {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border-soft);
    padding-top: 32px;
}

.faq-item {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
}

.faq-item:last-child { border-bottom: none; }

.faq-item p {
    font-size: .84rem;
    color: var(--text-sec);
    line-height: 1.7;
    margin-top: 4px;
}

@media (max-width: 720px) {
    .seo-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .seo-about,
    .seo-faq { grid-column: 1; }
}

/* ── 19. (reserved) ───────────────────────────────────────── */

/* ── 20. USE CASES SECTION ─────────────────────────────────── */
.content-section {
    padding: 64px 24px;
    border-top: 1px solid var(--border);
}

.content-section--alt {
    background: var(--bg-surface);
}

.content-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.content-header {
    text-align: center;
    margin-bottom: 40px;
}

.content-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -.4px;
    margin-bottom: 12px;
}

.content-header p {
    font-size: .95rem;
    color: var(--text-sec);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Use case cards */
.usecase-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.usecase-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: transform var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease),
                border-color var(--dur-fast);
}

.usecase-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    border-color: var(--brand-500);
}

.usecase-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    line-height: 1;
}

.usecase-card h3 {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.usecase-card p {
    font-size: .82rem;
    color: var(--text-sec);
    line-height: 1.7;
}

/* Diff modes */
.modes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.mode-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    position: relative;
    overflow: hidden;
    transition: transform var(--dur-fast) var(--ease),
                box-shadow var(--dur-fast) var(--ease);
}

.mode-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.mode-card--word  { background: rgba(99,102,241,.06);  border-color: rgba(99,102,241,.3); }
.mode-card--char  { background: rgba(239,68,68,.06);   border-color: rgba(239,68,68,.3);  }
.mode-card--line  { background: rgba(34,197,94,.06);   border-color: rgba(34,197,94,.3);  }

.mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.mode-card--word .mode-badge  { background: rgba(99,102,241,.15);  color: #818cf8; }
.mode-card--char .mode-badge  { background: rgba(239,68,68,.15);   color: #f87171; }
.mode-card--line .mode-badge  { background: rgba(34,197,94,.15);   color: #4ade80; }

.mode-card h3 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.mode-card p {
    font-size: .82rem;
    color: var(--text-sec);
    line-height: 1.7;
    margin-bottom: 16px;
}

.mode-example {
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ex-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
}

.ex-text {
    font-family: var(--font-mono);
    font-size: .82rem;
    color: var(--text-primary);
}

.ex-del {
    background: var(--del-bg);
    color: var(--del-text);
    padding: 1px 4px;
    border-radius: 3px;
}

.ex-ins {
    background: var(--ins-bg);
    color: var(--ins-text);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Tips */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.tip-card {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.tip-card:hover {
    border-color: var(--brand-500);
    box-shadow: 0 4px 16px var(--brand-glow);
}

.tip-num {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--brand-500);
    opacity: .4;
    line-height: 1;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.tip-card h3 {
    font-size: .88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.tip-card p {
    font-size: .82rem;
    color: var(--text-sec);
    line-height: 1.7;
}

.tip-card code, .tip-card kbd {
    font-family: var(--font-mono);
    font-size: .78rem;
    background: var(--bg-overlay);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    color: var(--text-primary);
}

/* Related tools */
.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.related-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    text-decoration: none;
    transition: all var(--dur-fast) var(--ease);
    color: inherit;
}

.related-card:hover {
    border-color: var(--brand-500);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--brand-glow);
}

.related-card--coming {
    opacity: .55;
    cursor: default;
}

.related-icon { font-size: 1.5rem; flex-shrink: 0; }

.related-card strong {
    display: block;
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.related-card span {
    font-size: .75rem;
    color: var(--text-sec);
    line-height: 1.4;
}

/* ── RESPONSIVE for new sections ──────────────────────────── */
@media (max-width: 1024px) {
    .usecase-grid  { grid-template-columns: repeat(2, 1fr); }
    .modes-grid    { grid-template-columns: repeat(2, 1fr); }
    .related-grid  { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .usecase-grid  { grid-template-columns: 1fr; }
    .modes-grid    { grid-template-columns: 1fr; }
    .tips-grid     { grid-template-columns: 1fr; }
    .related-grid  { grid-template-columns: 1fr; }
    .content-header h2 { font-size: 1.25rem; }
    .content-section { padding: 40px 16px; }
}
