/* ═══════════════════════════════════════════════════════════════
   Nightmare coMPARA — CSS
   FREDDY VS JASON Edition 🔪🖐️
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-deep: #08060c;
    --bg-surface: #110e18;
    --bg-elevated: #1a1524;
    --bg-hover: #241e30;
    --border-subtle: rgba(255,255,255,0.06);
    --border-medium: rgba(255,255,255,0.12);
    --text-primary: #ece8f4;
    --text-secondary: #9e94b8;
    --text-muted: #5e5680;

    /* Jason Theme Colors */
    --jason-red: #dc2626;
    --jason-dark: #7f1d1d;
    --jason-glow: rgba(220,38,38,0.4);

    /* Freddy Theme Colors */
    --freddy-green: #15803d;
    --freddy-dark: #064e3b;
    --freddy-glow: rgba(21,128,61,0.4);
    --freddy-stripe-red: #991b1b;

    --blood: #dc2626;
    --blood-dark: #8b0000;
    --blood-glow: rgba(220,38,38,0.3);
    --match-green: #22c55e;
    --match-green-bg: rgba(34,197,94,0.12);
    --no-match-red: #ef4444;
    --no-match-red-bg: rgba(239,68,68,0.1);

    --glass-bg: rgba(17,14,24,0.85);
    --glass-border: rgba(255,255,255,0.08);
    --glass-blur: 24px;

    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

    --radius-sm: 6px; --radius-md: 10px; --radius-lg: 14px; --radius-xl: 20px;

    --ease-out: cubic-bezier(0.16,1,0.3,1);
    --ease-spring: cubic-bezier(0.34,1.56,0.64,1);
    --duration-fast: 150ms; --duration-normal: 250ms; --duration-slow: 400ms;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --font-horror: 'Creepster', cursive;
}

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body.fvj-theme {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ─── Ambient Background ── */
.bg-grid {
    position: fixed; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
    background-size: 48px 48px;
    z-index: 0; pointer-events: none;
}

.bg-glow {
    position: fixed; border-radius: 50%; filter: blur(130px);
    opacity: 0.22; pointer-events: none; z-index: 0;
    animation: glowFloat 25s ease-in-out infinite;
}
.bg-glow--jason { width: 600px; height: 600px; background: var(--jason-dark); top: -200px; left: -100px; }
.bg-glow--freddy { width: 550px; height: 550px; background: var(--freddy-dark); top: -150px; right: -100px; animation-delay: -8s; }
.bg-glow--clash { width: 450px; height: 450px; background: #b91c1c; top: 45%; left: 45%; animation-delay: -16s; }

@keyframes glowFloat {
    0%, 100% { transform: translate(0,0) scale(1); }
    25% { transform: translate(30px,-20px) scale(1.05); }
    50% { transform: translate(-20px,30px) scale(0.95); }
    75% { transform: translate(10px,20px) scale(1.02); }
}

/* ─── Glass Panel ── */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    position: relative; z-index: 1;
}

/* ─── Header ── */
#app-header {
    position: relative; z-index: 2;
    text-align: center;
    padding: var(--sp-6) var(--sp-6) var(--sp-4);
}

.header-inner { max-width: 900px; margin: 0 auto; }

.back-link {
    display: inline-flex; align-items: center; gap: var(--sp-1);
    font-size: 0.78rem; color: var(--text-muted);
    text-decoration: none; margin-bottom: var(--sp-3);
    transition: color var(--duration-fast) ease;
}
.back-link:hover { color: var(--jason-red); }

/* Freddy VS Jason Title Bar */
.fvj-title-wrap {
    display: flex; align-items: center; justify-content: center;
    gap: var(--sp-4); margin-bottom: var(--sp-2);
}

.fighter-tag {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: 6px 16px; border-radius: var(--radius-xl);
    font-family: var(--font-horror); font-size: 1.4rem;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.jason-tag {
    background: linear-gradient(135deg, rgba(127,29,29,0.8), rgba(60,10,10,0.9));
    border: 1px solid var(--jason-red);
    color: #fca5a5;
    text-shadow: 0 0 10px var(--jason-red);
}

.freddy-tag {
    background: linear-gradient(135deg, rgba(21,128,61,0.8), rgba(6,78,59,0.9));
    border: 1px solid #22c55e;
    color: #86efac;
    text-shadow: 0 0 10px #22c55e;
}

.vs-badge-main {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, #b91c1c, #450a0a);
    border: 2px solid #ef4444;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-horror); font-size: 1.1rem; color: #fff;
    box-shadow: 0 0 20px var(--jason-red);
    animation: vsPulse 2s ease-in-out infinite;
}

@keyframes vsPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 15px var(--jason-red); }
    50% { transform: scale(1.1); box-shadow: 0 0 30px var(--jason-red), 0 0 45px #22c55e; }
}

.fvj-main-heading {
    font-family: var(--font-horror);
    font-size: 3.2rem; color: var(--text-primary);
    text-shadow: 0 0 15px rgba(139,0,0,0.6);
    line-height: 1;
}
.fvj-main-heading span { color: var(--jason-red); text-shadow: 0 0 25px var(--jason-glow); }
.fvj-main-heading em { color: #22c55e; font-style: normal; text-shadow: 0 0 25px var(--freddy-glow); }

.tagline {
    font-size: 0.85rem; color: var(--text-muted);
    font-style: italic; letter-spacing: 0.02em;
    margin-top: 4px;
}

/* ─── Step Progress Bar ── */
.step-progress {
    display: flex; align-items: center; justify-content: center;
    gap: var(--sp-3); padding: var(--sp-3) var(--sp-6);
    position: relative; z-index: 2;
}

.step-progress-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
}

.step-dot {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-horror); font-size: 1.2rem;
    background: var(--bg-elevated); color: var(--text-muted);
    border: 2px solid var(--border-medium);
    transition: all var(--duration-normal) var(--ease-out);
}

.step-progress-item.active .step-dot {
    background: var(--blood-dark); color: #fca5a5;
    border-color: var(--blood);
    box-shadow: 0 0 20px var(--blood-glow);
}

.step-progress-item.completed .step-dot {
    background: #166534; color: #4ade80;
    border-color: #22c55e;
}

.step-dot-label {
    font-size: 0.7rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.08em;
}

.step-progress-item.active .step-dot-label { color: var(--jason-red); }

.step-progress-line {
    width: 60px; height: 2px;
    background: var(--border-medium);
    margin-bottom: 18px;
}

/* ─── Main Layout ── */
#app-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--sp-6) var(--sp-12);
    position: relative; z-index: 2;
}

/* ─── Step Sections ── */
.step-section { display: none; animation: fadeSlideIn 0.4s var(--ease-out); }
.step-section.active-step { display: block; }

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

.step-indicator {
    display: flex; align-items: center; gap: var(--sp-4);
    margin-bottom: var(--sp-6);
}

.blood-badge {
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--jason-red), var(--jason-dark));
    font-family: var(--font-horror); font-size: 1.3rem; color: #fff;
    box-shadow: 0 0 20px var(--jason-glow);
    flex-shrink: 0;
}

.step-title {
    font-family: var(--font-horror);
    font-size: 1.8rem; color: var(--text-primary);
}
.step-title .subtitle {
    font-family: var(--font-sans); font-size: 0.85rem;
    color: var(--text-muted); font-weight: 400;
}

.step-actions {
    display: flex; justify-content: center; gap: var(--sp-4);
    margin-top: var(--sp-8);
}

/* ─── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 0.85rem; font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}
.btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--bg-hover); border-color: var(--border-subtle); }

.btn--sm { padding: var(--sp-1) var(--sp-3); font-size: 0.78rem; }
.btn--xs { padding: 2px var(--sp-2); font-size: 0.72rem; }

.btn--lg { padding: var(--sp-3) var(--sp-8); font-size: 1rem; font-weight: 700; }

.btn--primary {
    background: linear-gradient(135deg, var(--jason-red), var(--jason-dark));
    border-color: rgba(220,38,38,0.4); color: #fca5a5;
    box-shadow: 0 4px 15px var(--jason-glow);
}
.btn--primary:hover {
    background: linear-gradient(135deg, #ef4444, var(--jason-red));
    color: #fff; box-shadow: 0 4px 25px rgba(220,38,38,0.5);
    transform: translateY(-1px);
}
.btn--primary:disabled { transform: none; box-shadow: none; }

.btn--clash {
    background: linear-gradient(135deg, var(--jason-dark), var(--freddy-dark));
    border-color: rgba(220,38,38,0.5);
    color: #fff;
    box-shadow: 0 4px 20px rgba(220,38,38,0.3), 0 0 20px rgba(34,197,94,0.2);
}
.btn--clash:hover {
    background: linear-gradient(135deg, var(--jason-red), #16a34a);
    box-shadow: 0 6px 30px rgba(220,38,38,0.5), 0 0 30px rgba(34,197,94,0.4);
}

.btn--execute {
    background: linear-gradient(135deg, #7f1d1d, #064e3b);
    border: 2px solid #ef4444;
    color: #fff;
    font-family: var(--font-horror);
    font-size: 1.25rem;
    letter-spacing: 0.05em;
    padding: var(--sp-4) var(--sp-10);
    box-shadow: 0 0 30px rgba(127,29,29,0.5), 0 0 30px rgba(6,78,59,0.5);
    animation: executePulse 3s ease-in-out infinite;
}
.btn--execute:hover {
    background: linear-gradient(135deg, #b91c1c, #15803d);
    color: #fff;
    box-shadow: 0 0 45px rgba(220,38,38,0.7), 0 0 45px rgba(34,197,94,0.6);
    transform: scale(1.03);
}
.btn--execute:disabled { animation: none; transform: none; opacity: 0.4; }

@keyframes executePulse {
    0%, 100% { box-shadow: 0 0 20px rgba(127,29,29,0.4), 0 0 20px rgba(6,78,59,0.4); }
    50% { box-shadow: 0 0 40px rgba(220,38,38,0.6), 0 0 40px rgba(34,197,94,0.5); }
}

.btn--export-main {
    background: linear-gradient(135deg, var(--blood-dark), #5c0000);
    border-color: rgba(220,38,38,0.3); color: #fca5a5;
}
.btn--export-main:hover { color: #fff; }

.btn--export {
    width: 100%;
    padding: var(--sp-3) var(--sp-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    text-align: left;
    transition: all var(--duration-fast) ease;
}
.btn--export:hover {
    background: var(--bg-hover);
    border-color: var(--jason-red);
    color: #fca5a5;
}

/* ─── Upload Grid ── */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--sp-6);
    align-items: start;
}

.upload-card {
    padding: var(--sp-5);
    overflow: hidden;
    min-width: 0;
    transition: border-color var(--duration-normal) ease;
}

/* Jason Card Styling */
.card-jason {
    border-color: rgba(220,38,38,0.3);
    box-shadow: inset 0 0 20px rgba(127,29,29,0.1);
}
.card-jason:hover {
    border-color: var(--jason-red);
    box-shadow: 0 0 20px rgba(220,38,38,0.25), inset 0 0 25px rgba(127,29,29,0.2);
}

/* Freddy Card Styling */
.card-freddy {
    border-color: rgba(34,197,94,0.3);
    box-shadow: inset 0 0 20px rgba(6,78,59,0.1);
}
.card-freddy:hover {
    border-color: #22c55e;
    box-shadow: 0 0 20px rgba(34,197,94,0.25), inset 0 0 25px rgba(6,78,59,0.2);
}

.upload-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: var(--sp-4);
}

.file-label {
    font-family: var(--font-horror);
    font-size: 1.25rem;
    display: flex; align-items: center; gap: var(--sp-1);
}
.victim-a { color: #ef4444; text-shadow: 0 0 8px rgba(239,68,68,0.4); }
.victim-b { color: #4ade80; text-shadow: 0 0 8px rgba(74,222,128,0.4); }

.file-status {
    font-size: 0.72rem; color: var(--text-muted);
    padding: 2px 8px; border-radius: 20px;
    background: var(--bg-elevated);
    white-space: nowrap;
}
.file-status.loaded {
    color: #4ade80; background: rgba(34,197,94,0.1);
    border: 1px solid rgba(34,197,94,0.2);
}

.drop-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--sp-8) var(--sp-4);
    text-align: center;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    min-height: 140px;
}

.drop-zone-jason:hover, .drop-zone-jason.drag-active {
    border-color: var(--jason-red);
    background: rgba(220,38,38,0.08);
    box-shadow: inset 0 0 30px rgba(127,29,29,0.2);
}

.drop-zone-freddy:hover, .drop-zone-freddy.drag-active {
    border-color: #22c55e;
    background: rgba(34,197,94,0.08);
    box-shadow: inset 0 0 30px rgba(6,78,59,0.2);
}

/* Prevent child elements from causing dragleave events */
.drop-zone.drag-active .drop-zone-content,
.drop-zone.drag-active .drop-zone-content * {
    pointer-events: none;
}

.drop-zone-content {
    display: flex; flex-direction: column;
    align-items: center; gap: var(--sp-2);
    color: var(--text-muted);
}
.drop-zone-content svg {
    opacity: 0.4;
    transition: opacity var(--duration-fast) ease;
}
.drop-zone-jason:hover .drop-zone-content svg { opacity: 0.8; color: var(--jason-red); }
.drop-zone-freddy:hover .drop-zone-content svg { opacity: 0.8; color: #22c55e; }

.drop-text { font-size: 0.88rem; font-weight: 500; }
.drop-zone-content small { font-size: 0.72rem; opacity: 0.6; }

.drop-zone.loaded {
    border-color: rgba(34,197,94,0.3);
    background: rgba(34,197,94,0.03);
}

/* File Info */
.file-info {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: var(--sp-3); padding: var(--sp-2) var(--sp-3);
    background: var(--bg-elevated); border-radius: var(--radius-sm);
    min-width: 0;
}
.file-info.hidden { display: none; }
.file-info-details { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.file-name {
    font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-rows { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }

/* Preview Mini Table */
.file-preview-mini {
    margin-top: var(--sp-3);
    max-height: 160px;
    overflow: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}
.file-preview-mini table {
    width: max-content;
    min-width: 100%;
    font-size: 0.7rem;
    border-collapse: collapse;
}
.file-preview-mini th {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 4px 8px;
    text-align: left; white-space: nowrap;
    font-weight: 600;
    position: sticky; top: 0;
}
.file-preview-mini td {
    padding: 3px 8px; color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    white-space: nowrap; max-width: 150px;
    overflow: hidden; text-overflow: ellipsis;
}

/* Upload Divider */
.upload-divider {
    display: flex; align-items: center; justify-content: center;
    align-self: center;
}
.fvj-vs-circle {
    width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #450a0a, #022c22);
    border: 2px solid #ef4444;
    font-family: var(--font-horror); font-size: 1.2rem; color: #fff;
    box-shadow: 0 0 20px var(--jason-glow), 0 0 20px var(--freddy-glow);
    animation: vsPulse 2s ease-in-out infinite;
}

/* ─── Mapping Container ── */
.mapping-container {
    display: grid;
    grid-template-columns: 1fr 290px 1fr;
    gap: var(--sp-4);
    align-items: start;
}

.field-panel { padding: var(--sp-4); }

.field-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: var(--sp-3); padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem; font-weight: 600;
}

.field-panel-actions { display: flex; gap: var(--sp-1); }

.field-list { display: flex; flex-direction: column; gap: var(--sp-1); }

.field-item {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration-fast) ease;
    font-size: 0.82rem;
}
.field-item:hover { background: var(--bg-hover); }

/* Jason selection color */
.card-jason .field-item.selected { background: rgba(220,38,38,0.15); }
.card-jason .field-item input[type="checkbox"]:checked { background: var(--jason-red); border-color: var(--jason-red); }

/* Freddy selection color */
.card-freddy .field-item.selected { background: rgba(34,197,94,0.15); }
.card-freddy .field-item input[type="checkbox"]:checked { background: #22c55e; border-color: #22c55e; }

.field-item input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 16px; height: 16px; border-radius: 3px;
    border: 2px solid var(--border-medium);
    background: var(--bg-deep);
    cursor: pointer; flex-shrink: 0;
    position: relative;
    transition: all var(--duration-fast) ease;
}
.field-item input[type="checkbox"]:checked::after {
    content: '✓'; position: absolute;
    top: -1px; left: 2px;
    font-size: 0.7rem; color: #fff; font-weight: 900;
}

.field-item-label { color: var(--text-secondary); }
.field-item.selected .field-item-label { color: var(--text-primary); }

/* ─── Mapping Center ── */
.mapping-center { padding: var(--sp-4); text-align: center; }

.card-clash {
    border-color: rgba(220,38,38,0.3);
    box-shadow: 0 0 15px rgba(0,0,0,0.4);
}

.mapping-header {
    margin-bottom: var(--sp-4);
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border-subtle);
}
.mapping-header span { font-weight: 700; font-size: 0.9rem; }
.mapping-header small { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

.mapping-pairs {
    display: flex; flex-direction: column; gap: var(--sp-3);
    margin-bottom: var(--sp-4);
}

.mapping-pair {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-2); border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    animation: fadeSlideIn 0.3s var(--ease-out);
}

.mapping-pair select {
    flex: 1;
    padding: var(--sp-2) var(--sp-2);
    background: var(--bg-deep);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    cursor: pointer;
    min-width: 0;
}
.mapping-pair select:focus {
    outline: none; border-color: var(--jason-red);
}

.mapping-pair .mapping-arrow {
    color: var(--jason-red); font-size: 1rem; flex-shrink: 0;
    font-family: var(--font-horror);
}

.mapping-pair .btn-remove-mapping {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid var(--border-subtle);
    color: var(--text-muted); cursor: pointer;
    font-size: 0.72rem; flex-shrink: 0;
    transition: all var(--duration-fast) ease;
}
.mapping-pair .btn-remove-mapping:hover {
    background: rgba(239,68,68,0.15);
    border-color: var(--jason-red); color: var(--jason-red);
}

/* ─── Normalization Options Panel ─── */
.normalization-options-panel {
    margin-top: var(--sp-6);
    padding: var(--sp-5) var(--sp-6);
    border-color: rgba(220,38,38,0.25);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.norm-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: var(--sp-4);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--sp-2);
}

.norm-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.norm-header small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.norm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--sp-3);
}

.norm-toggle {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-3);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: all var(--duration-fast) ease;
}

.norm-toggle:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.3);
}

.norm-toggle input[type="checkbox"] {
    accent-color: var(--jason-red);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.norm-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.norm-toggle input[type="checkbox"]:checked + .norm-label {
    color: var(--text-primary);
}

/* ─── Results ── */
.results-stats {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-4); margin-bottom: var(--sp-4);
}

.stat-card {
    padding: var(--sp-4); text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-horror);
    font-size: 2.2rem;
    margin-bottom: 2px;
}

.stat-label { font-size: 0.75rem; color: var(--text-muted); }

.stat-total .stat-value { color: var(--text-primary); }
.stat-matched .stat-value { color: var(--match-green); text-shadow: 0 0 12px rgba(34,197,94,0.4); }
.stat-unmatched .stat-value { color: var(--no-match-red); text-shadow: 0 0 12px rgba(239,68,68,0.4); }
.stat-percent .stat-value { color: #facc15; text-shadow: 0 0 12px rgba(250,204,21,0.4); }

/* Results Toolbar */
.results-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-4);
}

.filter-tabs { display: flex; gap: var(--sp-1); }

.filter-tab {
    padding: var(--sp-2) var(--sp-4);
    background: transparent; border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted); font-size: 0.82rem; font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-fast) ease;
}
.filter-tab:hover { background: var(--bg-hover); color: var(--text-secondary); }
.filter-tab.filter-jason.active {
    background: rgba(220,38,38,0.2);
    border-color: var(--jason-red);
    color: #fca5a5;
}

.filter-tab.filter-freddy.active {
    background: rgba(34,197,94,0.2);
    border-color: #22c55e;
    color: #86efac;
}

.results-actions { display: flex; align-items: center; gap: var(--sp-3); }

.search-wrap {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-1) var(--sp-3);
    background: var(--bg-elevated); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-muted);
}
.search-wrap svg { flex-shrink: 0; }
.search-wrap input {
    background: none; border: none; color: var(--text-primary);
    font-family: var(--font-sans); font-size: 0.82rem;
    outline: none; width: 180px;
}
.search-wrap input::placeholder { color: var(--text-muted); }

/* Results Table */
.results-table-wrap { padding: 0; overflow: hidden; }
.results-table-scroll { overflow-x: auto; max-height: 600px; overflow-y: auto; }

.results-table {
    width: 100%; border-collapse: collapse;
    font-size: 0.8rem;
}

.results-table thead { position: sticky; top: 0; z-index: 2; }

.results-table th {
    padding: var(--sp-3) var(--sp-3);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-weight: 700; text-align: left;
    white-space: nowrap; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-medium);
}
.results-table th.col-a { color: #fca5a5; border-bottom-color: rgba(220,38,38,0.4); }
.results-table th.col-b { color: #86efac; border-bottom-color: rgba(34,197,94,0.4); }

.results-table td {
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    white-space: nowrap;
    max-width: 600px;
    transition: background var(--duration-fast) ease;
}

.results-table td:hover {
    overflow: visible;
    white-space: normal;
    word-break: break-word;
    background: var(--bg-elevated);
    z-index: 5;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.cell-content {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
}

.cell-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-copy-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0.25;
    transition: all var(--duration-fast) ease;
    flex-shrink: 0;
}

.results-table td:hover .btn-copy-cell,
.btn-copy-cell:hover {
    opacity: 1;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-medium);
}

.btn-copy-cell.copied {
    opacity: 1;
    color: #4ade80;
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
}

.cell-empty {
    color: var(--text-muted);
    opacity: 0.35;
    font-weight: 300;
}

.col-deemphasized {
    opacity: 0.45;
}

.results-table tr:hover td { background: var(--bg-hover); }

/* Row borders and backgrounds by match status */
.results-table tr.row-matched {
    border-left: 4px solid var(--match-green);
    background: rgba(34,197,94,0.02);
}
.results-table tr.row-matched td:first-child { color: var(--match-green); }

.results-table tr.row-unmatched-jason {
    border-left: 4px solid var(--jason-red);
    background: rgba(220,38,38,0.04);
}

.results-table tr.row-unmatched-freddy {
    border-left: 4px solid #22c55e;
    background: rgba(34,197,94,0.04);
}

.match-status {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.02em;
}

.match-status.matched {
    background: var(--match-green-bg);
    color: #4ade80;
    border: 1px solid rgba(34,197,94,0.3);
    box-shadow: 0 0 10px rgba(34,197,94,0.15);
}

.match-status.unmatched-jason {
    background: rgba(220,38,38,0.18);
    color: #fca5a5;
    border: 1px solid rgba(220,38,38,0.45);
    box-shadow: 0 0 10px rgba(220,38,38,0.2);
}

.match-status.unmatched-freddy {
    background: rgba(21,128,61,0.2);
    color: #86efac;
    border: 1px solid rgba(34,197,94,0.45);
    box-shadow: 0 0 10px rgba(34,197,94,0.2);
}
.match-status.unmatched {
    background: var(--no-match-red-bg);
    color: var(--no-match-red);
    border: 1px solid rgba(239,68,68,0.2);
}

/* Pagination */
.results-pagination {
    display: flex; justify-content: center; align-items: center;
    gap: var(--sp-2); padding: var(--sp-3);
}

.page-btn {
    padding: var(--sp-1) var(--sp-3);
    background: var(--bg-elevated); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: 0.78rem;
    cursor: pointer; transition: all var(--duration-fast) ease;
}
.page-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.page-btn.active {
    background: var(--jason-dark); color: #fca5a5;
    border-color: var(--jason-red);
}

/* ─── Modal ── */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-content { position: relative; width: 90%; max-width: 460px; padding: var(--sp-6); }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: var(--sp-5);
}
.modal-header h2 { font-family: var(--font-horror); font-size: 1.5rem; color: var(--jason-red); }
.export-options { display: flex; flex-direction: column; gap: var(--sp-3); }

.btn--export-jason {
    border-color: rgba(220, 38, 38, 0.4);
    color: #fca5a5;
}
.btn--export-jason:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: var(--jason-red);
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.3);
}

.btn--export-freddy {
    border-color: rgba(34, 197, 94, 0.4);
    color: #86efac;
}
.btn--export-freddy:hover {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

/* ─── Toast ── */
#toast-container {
    position: fixed; top: var(--sp-6); right: var(--sp-6);
    z-index: 9999; display: flex; flex-direction: column; gap: var(--sp-2);
}

.toast {
    display: flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    background: var(--bg-elevated); border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary); font-size: 0.85rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    animation: toastIn 0.3s var(--ease-spring);
}
.toast.leaving { animation: toastOut 0.3s ease-out forwards; }

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

/* ─── Footer ── */
#app-footer {
    position: relative; z-index: 2;
    text-align: center; padding: var(--sp-6) var(--sp-4);
    font-size: 0.78rem; color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--sp-8);
}
#app-footer nav { display: flex; justify-content: center; gap: var(--sp-6); align-items: center; }
.footer-back { color: var(--jason-red); text-decoration: none; font-weight: 500; }
.footer-back:hover { text-decoration: underline; }

/* ─── Responsive ── */
@media (max-width: 900px) {
    .upload-grid { grid-template-columns: 1fr; }
    .upload-divider { padding: var(--sp-2) 0; }
    .mapping-container { grid-template-columns: 1fr; }
    .results-stats { grid-template-columns: repeat(2, 1fr); }
    .fvj-title-wrap { flex-wrap: wrap; }
}

@media (max-width: 600px) {
    html { font-size: 14px; }
    .fvj-main-heading { font-size: 2.2rem; }
    .results-toolbar { flex-direction: column; gap: var(--sp-3); }
    .filter-tabs { width: 100%; justify-content: center; }
    .results-actions { width: 100%; justify-content: center; }
    .search-wrap input { width: 140px; }
    .step-actions { flex-direction: column; align-items: center; }
}

/* ─── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

::selection { background: rgba(239,68,68,0.35); color: white; }
