/* ==========================================================================
   DEBUNK.IT — Design System: "Quiet luxury meets the front page"
   Investigative Editorial Print & Haute Horlogerie Typography
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Inter:wght@400;500;600;700&family=Newsreader:ital,opsz,wght@0,6..72,400..700;1,6..72,400..700&display=swap');

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
    /* Newsprint Palette (Light Mode: default) */
    --paper: #E4E0D3;           /* Warm tactile newsprint paper */
    --paper-2: #D9D4C4;         /* Tactile surface/dossier card */
    --paper-3: #CDC7B5;         /* Hairline contrast / elevated card */
    --paper-inset: #DBD6C6;     /* Recessed text input paper */
    --ink: #1B1B1B;             /* Deep printer's carbon ink */
    --ink-muted: #545148;       /* Editorial caption / secondary (5.4:1 contrast) */
    --ink-dim: #767268;         /* Micro metadata / date stamps */

    /* Verdict Accent System */
    --red: #C8423B;             /* Brand / "Refuted" / "Fake" stamp */
    --red-text: #B32E27;        /* Accessible text on paper (5.2:1 contrast) */
    --red-tint: rgba(200, 66, 59, 0.12);

    --mint: #4EA874;            /* "Supported" / "True" verdict */
    --mint-text: #206E43;       /* Accessible text on paper (4.8:1 contrast) */
    --mint-tint: rgba(78, 168, 116, 0.14);

    --blush: #C76E62;           /* "Misleading" / "Suspicious" */
    --blush-text: #963F38;      /* Accessible text on paper (5.5:1 contrast) */
    --blush-tint: rgba(232, 169, 160, 0.22);

    --gold: #A88B4A;            /* Tiny luxury accents / hairline rules */
    --gold-text: #786028;       /* Accessible text on paper (4.8:1 contrast) */

    /* Highlighter Marker Token (Part A.3) */
    --highlight: #F2D45C;

    /* Canonical Verdict System Tokens (Part B.1) */
    --verdict-supported: var(--mint);
    --verdict-supported-text: var(--mint-text);
    --verdict-supported-tint: var(--mint-tint);

    --verdict-refuted: var(--red);
    --verdict-refuted-text: var(--red-text);
    --verdict-refuted-tint: var(--red-tint);

    --verdict-misleading: var(--blush);
    --verdict-misleading-text: var(--blush-text);
    --verdict-misleading-tint: var(--blush-tint);

    --verdict-low-cred: var(--gold);
    --verdict-low-cred-text: var(--gold-text);
    --verdict-low-cred-tint: rgba(168, 139, 74, 0.16);

    --verdict-insufficient: var(--ink-muted);
    --verdict-insufficient-text: var(--ink);
    --verdict-insufficient-tint: rgba(27, 27, 27, 0.08);

    /* Motion Easing Tokens (Non-negotiable) */
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

    /* Hairlines & Borders */
    --border: rgba(27, 27, 27, 0.16);
    --border-hairline: rgba(27, 27, 27, 0.10);
    --border-strong: rgba(27, 27, 27, 0.85);

    /* Typography Scale */
    --font-display: 'Anton', 'Bebas Neue', Impact, sans-serif;
    --font-serif: 'Newsreader', 'Georgia', serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Courier Prime', 'Courier New', monospace;

    /* Spacing Scale (4, 8, 12, 16, 24, 40, 64, 96px) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 40px;
    --space-7: 64px;
    --space-8: 96px;

    /* Print-like Geometry & Shadows: small radius, crisp offsets, no fuzzy glows */
    --radius-sm: 2px;
    --radius-md: 3px;
    --radius-lg: 4px;
    --shadow-press: 3px 3px 0 var(--ink);
    --shadow-subtle: 2px 2px 0 rgba(27, 27, 27, 0.14);
    --shadow-pop: 5px 5px 0 var(--ink);

    /* Backwards compatibility aliases for existing JS logic */
    --bg: var(--paper);
    --panel: var(--paper-2);
    --text: var(--ink);
    --text-dim: var(--ink-muted);
    --muted: var(--ink-muted);
    --accent: var(--ink);
    --accent-gold: var(--gold);
    --accent-green: var(--mint);
    --accent-orange: var(--blush);
    --accent-red: var(--red);
    --danger: var(--red);
    --success: var(--mint);
    --warn: var(--blush);
}

/* Dark Mode Tokens (Warm Charcoal #141412, paper-colored text, lightened accents >= 4.5:1) */
html[data-theme="dark"] {
    --paper: #141412;           /* Warm charcoal background */
    --paper-2: #1E1E1A;         /* Charcoal card surface */
    --paper-3: #282823;         /* Elevated surface */
    --paper-inset: #191916;     /* Dark recessed input area */
    --ink: #E4E0D3;             /* Paper-colored text */
    --ink-muted: #ABA698;       /* Muted text on charcoal (6.8:1 contrast) */
    --ink-dim: #7A766B;         /* Dark metadata */

    /* Accents lightened for 4.5:1 contrast on #141412 */
    --red: #E05D56;             /* 5.6:1 contrast */
    --red-text: #E05D56;
    --red-tint: rgba(224, 93, 86, 0.15);

    --mint: #6FCF97;            /* 8.5:1 contrast */
    --mint-text: #6FCF97;
    --mint-tint: rgba(111, 207, 151, 0.15);

    --blush: #F0B5AC;           /* 8.7:1 contrast */
    --blush-text: #F0B5AC;
    --blush-tint: rgba(240, 181, 172, 0.15);

    --gold: #D4B26F;            /* 7.4:1 contrast */
    --gold-text: #D4B26F;

    /* Highlighter Marker Token Dark (Part A.3) */
    --highlight: #C8A232;

    /* Canonical Verdict System Tokens Dark (Part B.1) */
    --verdict-supported: var(--mint);
    --verdict-supported-text: var(--mint-text);
    --verdict-supported-tint: var(--mint-tint);

    --verdict-refuted: var(--red);
    --verdict-refuted-text: var(--red-text);
    --verdict-refuted-tint: var(--red-tint);

    --verdict-misleading: var(--blush);
    --verdict-misleading-text: var(--blush-text);
    --verdict-misleading-tint: var(--blush-tint);

    --verdict-low-cred: var(--gold);
    --verdict-low-cred-text: var(--gold-text);
    --verdict-low-cred-tint: rgba(212, 178, 111, 0.20);

    --verdict-insufficient: var(--ink-muted);
    --verdict-insufficient-text: var(--ink);
    --verdict-insufficient-tint: rgba(228, 224, 211, 0.12);

    --border: rgba(228, 224, 211, 0.18);
    --border-hairline: rgba(228, 224, 211, 0.10);
    --border-strong: rgba(228, 224, 211, 0.85);

    --shadow-press: 3px 3px 0 rgba(0, 0, 0, 0.7);
    --shadow-subtle: 2px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-pop: 5px 5px 0 #000;

    --bg: var(--paper);
    --panel: var(--paper-2);
    --text: var(--ink);
    --text-dim: var(--ink-muted);
    --muted: var(--ink-muted);
    --accent: var(--ink);
    --accent-gold: var(--gold);
    --accent-green: var(--mint);
    --accent-orange: var(--blush);
    --accent-red: var(--red);
    --danger: var(--red);
    --success: var(--mint);
    --warn: var(--blush);
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] {
        --paper: #141412;
        --paper-2: #1E1E1A;
        --paper-3: #282823;
        --paper-inset: #191916;
        --ink: #E4E0D3;
        --ink-muted: #ABA698;
        --ink-dim: #7A766B;
        --red: #E05D56;
        --red-text: #E05D56;
        --red-tint: rgba(224, 93, 86, 0.15);
        --mint: #6FCF97;
        --mint-text: #6FCF97;
        --mint-tint: rgba(111, 207, 151, 0.15);
        --blush: #F0B5AC;
        --blush-text: #F0B5AC;
        --blush-tint: rgba(240, 181, 172, 0.15);
        --gold: #D4B26F;
        --gold-text: #D4B26F;

        /* Highlighter Marker Token Dark (Part A.3) */
        --highlight: #C8A232;

        /* Canonical Verdict System Tokens Dark (Part B.1) */
        --verdict-supported: var(--mint);
        --verdict-supported-text: var(--mint-text);
        --verdict-supported-tint: var(--mint-tint);

        --verdict-refuted: var(--red);
        --verdict-refuted-text: var(--red-text);
        --verdict-refuted-tint: var(--red-tint);

        --verdict-misleading: var(--blush);
        --verdict-misleading-text: var(--blush-text);
        --verdict-misleading-tint: var(--blush-tint);

        --verdict-low-cred: var(--gold);
        --verdict-low-cred-text: var(--gold-text);
        --verdict-low-cred-tint: rgba(212, 178, 111, 0.20);

        --verdict-insufficient: var(--ink-muted);
        --verdict-insufficient-text: var(--ink);
        --verdict-insufficient-tint: rgba(228, 224, 211, 0.12);
        --border: rgba(228, 224, 211, 0.18);
        --border-hairline: rgba(228, 224, 211, 0.10);
        --border-strong: rgba(228, 224, 211, 0.85);
        --shadow-press: 3px 3px 0 rgba(0, 0, 0, 0.7);
        --shadow-subtle: 2px 2px 0 rgba(0, 0, 0, 0.5);
        --shadow-pop: 5px 5px 0 #000;
        --bg: var(--paper);
        --panel: var(--paper-2);
        --text: var(--ink);
        --text-dim: var(--ink-muted);
        --muted: var(--ink-muted);
        --accent: var(--ink);
        --accent-gold: var(--gold);
        --accent-green: var(--mint);
        --accent-orange: var(--blush);
        --accent-red: var(--red);
        --danger: var(--red);
        --success: var(--mint);
        --warn: var(--blush);
    }
}

/* --------------------------------------------------------------------------
   2. RESET, ACCESSIBILITY & TEXTURE OVERLAYS
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--paper);
    color: var(--ink);
    font-family: var(--font-serif);
    font-weight: 400;
    overflow-x: hidden;
    position: relative;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Subtle SVG Noise Texture Overlay (~6-7% opacity for authentic print grain) */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
    opacity: 0.065;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Keyboard Navigation: Explicit Focus Rings */
:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    touch-action: manipulation;
}

a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

a:hover {
    opacity: 0.8;
}

/* Canvas background positioning */
#canvas-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   3. APP CONTAINER & EDITORIAL BUREAU SIDEBAR
   -------------------------------------------------------------------------- */
.app-container {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 290px 1fr;
    min-height: 100vh;
    width: 100vw;
}

.sidebar {
    background: var(--paper-2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-5) var(--space-4);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--ink);
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--ink);
}

.brand-lockup img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--paper);
    padding: 2px;
}

.brand-lockup h1 {
    font-family: var(--font-display);
    font-size: 1.55rem;
    line-height: 1;
    letter-spacing: 0.03em;
    margin: 0;
    text-transform: uppercase;
}

.brand-lockup p {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 3px 0 0 0;
}

.server-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding: 3px 8px;
    background: var(--paper);
    border: 1px solid var(--border-hairline);
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mint);
    display: inline-block;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    background: transparent;
    border: 1px solid transparent;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease;
    border-radius: var(--radius-sm);
}

.nav-btn:hover {
    background: var(--paper);
    border-color: var(--border);
}

.nav-btn.active {
    background: var(--paper);
    border: 1px solid var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
}

.nav-btn svg, .nav-btn .icon-svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    flex-shrink: 0;
}

/* User Menu & Auth in Sidebar */
.user-menu {
    position: relative;
    margin-top: auto;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-hairline);
}

.user-btn {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--paper);
    border: 1px solid var(--border);
    padding: var(--space-2) var(--space-3);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
}

.user-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--paper);
    border: 1px solid var(--ink);
    box-shadow: var(--shadow-press);
    padding: var(--space-2);
    z-index: 100;
    border-radius: var(--radius-sm);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 40px;
    padding: 6px var(--space-3);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    color: var(--ink);
}

.dropdown-item:hover {
    background: var(--paper-2);
}

/* --------------------------------------------------------------------------
   4. MAIN STAGE & EDITORIAL WORKSPACE
   -------------------------------------------------------------------------- */
.main-stage {
    padding: var(--space-5) var(--space-6);
    overflow-y: auto;
    max-height: 100vh;
}

.view-section {
    display: none;
}

.view-section.active {
    display: block;
    animation: fadeInStage 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.view-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.5vw, 3rem);
    line-height: 0.95;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0 0 var(--space-4) 0;
    color: var(--ink);
}

/* --------------------------------------------------------------------------
   5. SCANNER / ANALYZER HERO & METRICS
   -------------------------------------------------------------------------- */
.dashboard-hero {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: var(--space-5);
    background: var(--paper-2);
    border: 1px solid var(--border);
    border-top: 3px solid var(--ink);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-subtle);
    border-radius: var(--radius-sm);
}

.hero-copy .eyebrow {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold-text);
    margin-bottom: var(--space-2);
}

.hero-copy h2 {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 2.8vw, 2.4rem);
    line-height: 1.05;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    margin: 0 0 var(--space-3) 0;
}

.hero-copy p {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--ink-muted);
    margin: 0 0 var(--space-4) 0;
    max-width: 580px;
}

.hero-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

/* Clean Editorial Button Hierarchy */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    box-shadow: 2px 2px 0 var(--ink);
    transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out);
    border-radius: var(--radius-sm);
}

@media (hover: hover) and (pointer: fine) {
    .btn:hover {
        transform: translate(-1px, -1px);
        box-shadow: 3px 3px 0 var(--ink);
        opacity: 1;
    }
}

.btn:active {
    transform: scale(0.97) translate(2px, 2px);
    box-shadow: 0 0 0 var(--ink);
    transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out);
}

.btn.hero-secondary,
.btn.muted-btn {
    background: var(--paper);
    color: var(--ink);
    border-color: var(--ink);
}

.btn.muted-btn:hover {
    background: var(--paper-2);
}

/* Hero Stat Cards — Dark Ink Focal Panel (Part B.2) */
.hero-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    align-content: center;
    background: #111110;
    color: #E4E0D3;
    padding: var(--space-4);
    border: 1px solid rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-press);
}

.hero-stat-card {
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(228, 224, 211, 0.14);
    padding: var(--space-2) 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.hero-stat-card:last-child {
    border-bottom: none;
}

.hero-stat-card .stat-label {
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ABA698;
}

.hero-stat-card strong {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: #E4E0D3;
    font-variant-numeric: tabular-nums;
}

/* Quick Action Strip */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.quick-card {
    background: var(--paper-2);
    border: 1px solid var(--border);
    padding: var(--space-3) var(--space-4);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 44px;
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.quick-card:hover {
    background: var(--paper);
    border-color: var(--ink);
}

.quick-card svg {
    width: 20px;
    height: 20px;
    stroke: var(--ink);
    fill: none;
    margin-bottom: 2px;
}

.quick-card strong {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink);
}

.quick-card small {
    font-family: var(--font-serif);
    font-size: 0.88rem;
    color: var(--ink-muted);
    line-height: 1.35;
}

/* Example Claim Strip */
.example-strip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    padding: var(--space-2) var(--space-3);
    background: var(--paper-2);
    border: 1px solid var(--border-hairline);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.example-strip span {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.example-strip button {
    background: var(--paper);
    border: 1px solid var(--border);
    padding: 4px 10px;
    font-family: var(--font-serif);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--ink);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.example-strip button:hover {
    border-color: var(--ink);
    background: var(--ink);
    color: var(--paper);
}

/* --------------------------------------------------------------------------
   6. SCANNER INPUT & VERDICT STAMP (THE PRODUCT CORE)
   -------------------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: var(--space-5);
}

.scanner-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.glass-panel {
    background: var(--paper-2);
    border: 1px solid var(--border);
    padding: var(--space-5);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-subtle);
}

.panel-heading-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-hairline);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
}

.panel-heading-row.compact {
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
}

.dynamic-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1;
    margin: 0;
}

.mode-hint {
    font-family: var(--font-serif);
    font-size: 0.92rem;
    font-style: italic;
    color: var(--ink-muted);
    margin: 4px 0 0 0;
}

.scanner-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 3px 8px;
    background: var(--paper);
    border: 1px solid var(--border);
}

/* Input Mode Tabs */
.tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.tab-btn {
    min-height: 38px;
    padding: 6px var(--space-4);
    background: var(--paper);
    border: 1px solid var(--border);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
    transition: all 0.15s ease;
    border-radius: var(--radius-sm);
}

.tab-btn:hover {
    color: var(--ink);
    border-color: var(--ink);
}

.tab-btn.active {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}

/* Paper-Textured Input Area */
.input-section {
    display: none;
    margin-bottom: var(--space-4);
}

.input-section.active {
    display: block;
}

.input-box {
    width: 100%;
    background: var(--paper-inset);
    border: 1px solid var(--border-strong);
    color: var(--ink);
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-serif);
    font-size: 1.08rem;
    line-height: 1.5;
    border-radius: var(--radius-sm);
    resize: vertical;
    min-height: 130px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-box.single-line {
    min-height: 48px;
    height: 48px;
}

.input-box:focus {
    border-color: var(--ink);
    box-shadow: 2px 2px 0 var(--ink);
    outline: none;
}

.input-box::placeholder {
    color: var(--ink-dim);
    font-style: italic;
}

/* Scan Progress Bar */
.scan-container {
    width: 100%;
    height: 4px;
    background: var(--paper-3);
    margin-bottom: var(--space-3);
    display: none;
    overflow: hidden;
}

.scan-container.active {
    display: block;
}

.scan-bar {
    width: 40%;
    height: 100%;
    background: var(--ink);
    animation: scanHairline 1.2s infinite ease-in-out;
}

@keyframes scanHairline {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.scanner-actions {
    display: flex;
    gap: var(--space-3);
}

/* Empty State */
.result-empty {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    background: var(--paper-2);
    border: 1px dashed var(--border);
    padding: var(--space-5);
}

.result-empty .empty-icon {
    font-size: 2.2rem;
    color: var(--ink-muted);
}

.result-empty h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    margin: 0 0 var(--space-1) 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.result-empty p {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    color: var(--ink-muted);
    margin: 0;
    line-height: 1.45;
}

/* --------------------------------------------------------------------------
   VERDICT STAMP: PHYSICAL RUBBER STAMP ON NEWSPRINT (scale 1.08 -> 1 thud)
   -------------------------------------------------------------------------- */
.upgraded-result {
    background: var(--paper);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-press);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
}

/* Verdict Report Header — Dark Ink Focal Panel (Part B.2) */
.result-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111110;
    color: #E4E0D3;
    border: 1px solid rgba(228, 224, 211, 0.14);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-press);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-4);
    --success: #6FCF97;
    --warn: #F0B5AC;
    --danger: #FF6B64;
}

.result-kicker {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #ABA698;
    margin-bottom: var(--space-1);
}

/* Physical Verdict Stamp styling (Physical Rubber Stamp on Dark Ink Focal Header) */
.res-verdict {
    display: inline-block;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 6px 16px;
    border: 3px solid rgba(228, 224, 211, 0.4);
    border-radius: var(--radius-sm);
    color: #E4E0D3;
    background: rgba(228, 224, 211, 0.08);
    transform: rotate(-2deg);
    animation: stampThud 220ms var(--ease-out) forwards;
}

@keyframes stampThud {
    0% {
        opacity: 0;
        transform: scale(1.15) rotate(-6deg);
    }
    85% {
        opacity: 1;
        transform: scale(1) rotate(-2deg) translateY(0);
    }
    92% {
        transform: scale(1) rotate(-2deg) translateY(1px); /* paper bump */
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(-2deg) translateY(0);
    }
}

/* Verdict Stamp Colors in Focal Ink Header — High-contrast print stamps (Part B.1) */
.res-verdict.verdict-SUPPORTED {
    color: #6FCF97;
    border-color: #4EA874;
    background: rgba(111, 207, 151, 0.16);
}

.res-verdict.verdict-REFUTED {
    color: #FF6B64;
    border-color: #E05D56;
    background: rgba(224, 93, 86, 0.16);
}

.res-verdict.verdict-MISLEADING {
    color: #F0B5AC;
    border-color: #C76E62;
    background: rgba(240, 181, 172, 0.16);
}

.res-verdict.verdict-LOW-CREDIBILITY {
    color: #E2BF72;
    border-color: #A88B4A;
    background: rgba(212, 178, 111, 0.16);
}

.res-verdict.verdict-INSUFFICIENT-EVIDENCE {
    color: #E4E0D3;
    border-color: #ABA698;
    background: rgba(228, 224, 211, 0.14);
}

.res-verdict.res-error {
    color: #FF6B64;
    border-color: #E05D56;
    background: rgba(224, 93, 86, 0.16);
}

/* Fallback canonical tokens for generic .verdict-* classes */
.verdict-SUPPORTED {
    color: var(--verdict-supported-text);
    border-color: var(--verdict-supported);
    background: var(--verdict-supported-tint);
}

.verdict-REFUTED {
    color: var(--verdict-refuted-text);
    border-color: var(--verdict-refuted);
    background: var(--verdict-refuted-tint);
}

.verdict-MISLEADING {
    color: var(--verdict-misleading-text);
    border-color: var(--verdict-misleading);
    background: var(--verdict-misleading-tint);
}

.verdict-LOW-CREDIBILITY {
    color: var(--verdict-low-cred-text);
    border-color: var(--verdict-low-cred);
    background: var(--verdict-low-cred-tint);
}

.verdict-INSUFFICIENT-EVIDENCE {
    color: var(--verdict-insufficient-text);
    border-color: var(--verdict-insufficient);
    background: var(--verdict-insufficient-tint);
}

/* Verdict History Tags — Small filled tags with top rules (Part B.1) */
.verdict-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    border: 1px solid currentColor;
    border-top: 2px solid currentColor;
    line-height: 1.3;
}

.verdict-tag.verdict-SUPPORTED {
    color: var(--verdict-supported-text);
    border-color: var(--verdict-supported);
    background: var(--verdict-supported-tint);
}

.verdict-tag.verdict-REFUTED {
    color: var(--verdict-refuted-text);
    border-color: var(--verdict-refuted);
    background: var(--verdict-refuted-tint);
}

.verdict-tag.verdict-MISLEADING {
    color: var(--verdict-misleading-text);
    border-color: var(--verdict-misleading);
    background: var(--verdict-misleading-tint);
}

.verdict-tag.verdict-LOW-CREDIBILITY {
    color: var(--verdict-low-cred-text);
    border-color: var(--verdict-low-cred);
    background: var(--verdict-low-cred-tint);
}

.verdict-tag.verdict-INSUFFICIENT-EVIDENCE {
    color: var(--verdict-insufficient-text);
    border-color: var(--verdict-insufficient);
    background: var(--verdict-insufficient-tint);
}

/* Confidence Card: Hairline ruled bar + serif percentage */
.confidence-card {
    text-align: right;
    min-width: 170px;
}

.confidence-card span {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: #E4E0D3;
    display: block;
    margin-bottom: var(--space-2);
    font-variant-numeric: tabular-nums;
}

.confidence-track {
    width: 100%;
    height: 7px;
    background: rgba(228, 224, 211, 0.22);
    border: 1px solid rgba(228, 224, 211, 0.3);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--ink);
    width: 0%;
    transition: width 600ms var(--ease-out);
    will-change: width;
}

/* Report Action Buttons */
.result-actions-row {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.copy-report-btn,
.download-report-btn {
    min-height: 38px;
    padding: 4px 12px;
    background: var(--paper-2);
    border: 1px solid var(--border);
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.copy-report-btn:hover,
.download-report-btn:hover {
    border-color: var(--ink);
    background: var(--paper);
}

/* Result Cards: Readable Newsreader Serif Paragraphs */
.result-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

.result-card {
    background: var(--paper-2);
    border: 1px solid var(--border);
    border-top: 2px solid var(--ink);
    border-radius: var(--radius-sm);
    padding: var(--space-3) var(--space-4);
}

.res-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin-bottom: var(--space-2);
}

.result-card p {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--ink);
    margin: 0;
}

.sources-card {
    background: var(--paper-2);
    border: 1px solid var(--border-hairline);
    padding: var(--space-3) var(--space-4);
    margin-top: var(--space-3);
}

#res-sources {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.source-item {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    padding: 6px 10px;
    background: var(--paper);
    border: 1px solid var(--border-hairline);
}

/* --------------------------------------------------------------------------
   7. SIDEBAR PANELS (SYSTEM BRIEF & RECENT ANALYSES)
   -------------------------------------------------------------------------- */
.dashboard-side {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.mini-panel {
    background: var(--paper-2);
    border: 1px solid var(--border);
    padding: var(--space-4);
    border-radius: var(--radius-sm);
}

.mini-panel h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 var(--space-3) 0;
}

.brief-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.brief-list div {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-hairline);
    font-size: 0.82rem;
}

.brief-list span {
    font-family: var(--font-sans);
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.brief-list strong {
    font-family: var(--font-serif);
    font-weight: 600;
}

.mini-link {
    background: transparent;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 0;
}

.recent-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.recent-item {
    padding: var(--space-2);
    background: var(--paper);
    border: 1px solid var(--border-hairline);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.recent-item:hover {
    border-color: var(--ink);
}

.recent-item-header {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 3px;
}

.recent-item-text {
    font-family: var(--font-serif);
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   8. HISTORY VIEW (DATABASE LEDGER) & TELEMETRY
   -------------------------------------------------------------------------- */
.history-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    gap: var(--space-3);
    flex-wrap: wrap;
}

.history-toolbar button {
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
}

.danger-action {
    background: var(--paper);
    border: 1px solid var(--red);
    color: var(--red-text);
}

.danger-action:hover {
    background: var(--red);
    color: var(--paper);
}

.accent-action {
    background: var(--ink);
    border: 1px solid var(--ink);
    color: var(--paper);
}

.history-filter-panel {
    background: var(--paper);
    border: 1px solid var(--border);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.history-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.history-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-filter-item label {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.history-filter-item input,
.history-filter-item select {
    min-height: 40px;
    padding: 6px 10px;
    background: var(--paper-2);
    border: 1px solid var(--border);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--ink);
    border-radius: var(--radius-sm);
}

.history-filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--ink-muted);
}

/* History Ledger Table — Ruled-Paper Feel & Row Stagger (Part B.4) */
.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-3);
    font-family: var(--font-serif);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 39px,
        var(--border-hairline) 39px,
        var(--border-hairline) 40px
    );
}

.history-table th {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 2px solid var(--ink);
    background: var(--paper-2);
}

.history-table td {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-hairline);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.history-table tr:hover td {
    background: var(--paper);
    cursor: pointer;
}

.ledger-row-enter {
    opacity: 0;
    transform: translateY(4px);
    animation: ledgerRowIn 220ms var(--ease-out) forwards;
    animation-delay: var(--row-delay, 0ms);
}

@keyframes ledgerRowIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --------------------------------------------------------------------------
   TELEMETRY VISUALS (Part B.2 & B.3)
   -------------------------------------------------------------------------- */
.telemetry-summary {
    background: #111110;
    color: #E4E0D3;
    border: 1px solid rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-press);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
}

.telemetry-summary-item {
    border-left: 2px solid rgba(228, 224, 211, 0.2);
    padding-left: var(--space-3);
}

.telemetry-summary-label {
    display: block;
    font-family: var(--font-sans);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #ABA698;
    margin-bottom: var(--space-1);
}

.telemetry-summary-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    line-height: 1;
    color: #E4E0D3;
    font-variant-numeric: tabular-nums;
}

.telemetry-visual-card {
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.telemetry-card-title {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 0 0 var(--space-3) 0;
}

.telemetry-bar {
    width: 100%;
    height: 32px;
    background: var(--paper-3);
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    border: 1.5px solid var(--ink);
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.15);
}

.telemetry-seg {
    height: 100%;
    transform-origin: left center;
    transition: transform 500ms var(--ease-out);
    position: relative;
    border-right: 1px solid rgba(27, 27, 27, 0.25);
}

.telemetry-seg.seg-supported {
    background: var(--verdict-supported);
}

.telemetry-seg.seg-refuted {
    background: var(--verdict-refuted);
}

.telemetry-seg.seg-misleading {
    background: var(--verdict-misleading);
}

.telemetry-seg.seg-low-credibility {
    background: var(--verdict-low-cred);
}

.telemetry-seg.seg-insufficient-evidence {
    background: var(--verdict-insufficient);
}

.telemetry-ledger-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-4);
    font-family: var(--font-serif);
}

.telemetry-ledger-table th {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 2px solid var(--ink);
}

.telemetry-ledger-table td {
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border-hairline);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.telemetry-legend-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.telemetry-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.25);
}

/* --------------------------------------------------------------------------
   EDITORIAL EMPTY & LOADING STATES (Part B.5)
   -------------------------------------------------------------------------- */
.editorial-state-card {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    border: 1px dashed var(--border);
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--radius-sm);
    margin: var(--space-3) 0;
}

.editorial-instruction {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.05rem;
    line-height: 1.5;
    color: var(--ink-muted);
    margin: 0;
}

.ruled-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: var(--space-3) auto 0;
    width: 64px;
    opacity: 0.55;
}

.ruled-line {
    display: block;
    height: 1px;
    background: var(--ink-dim);
    width: 100%;
}

.ruled-line:nth-child(2) {
    width: 75%;
}

.ruled-line:nth-child(3) {
    width: 48%;
}

/* --------------------------------------------------------------------------
   HIGHLIGHTER SWIPE MARKS (Part A.3)
   -------------------------------------------------------------------------- */
mark.hl {
    background-color: transparent;
    background-image: linear-gradient(var(--highlight), var(--highlight));
    background-repeat: no-repeat;
    background-position: left bottom;
    background-size: 100% 88%;
    color: var(--ink);
    padding: 0.08em 0.22em;
    margin: 0;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    border-radius: var(--radius-sm);
}

html.js-ready mark.hl {
    background-size: 0% 88%;
    transition: background-size 500ms var(--ease-out), color 200ms var(--ease-out);
}

html.js-ready mark.hl.is-highlighted {
    background-size: 100% 88%;
}

/* In dark mode: ensure dark carbon ink on top of highlight with high contrast (>= 7:1) */
html[data-theme="dark"] mark.hl {
    color: inherit;
}

html[data-theme="dark"] mark.hl.is-highlighted,
html[data-theme="dark"]:not(.js-ready) mark.hl {
    color: #111110 !important;
    font-weight: 600;
}

@media (prefers-color-scheme: dark) {
    html[data-theme="system"] mark.hl {
        color: inherit;
    }
    html[data-theme="system"] mark.hl.is-highlighted,
    html[data-theme="system"]:not(.js-ready) mark.hl {
        color: #111110 !important;
        font-weight: 600;
    }
}

@media (prefers-reduced-motion: reduce) {
    html.js-ready mark.hl {
        background-size: 100% 88%;
        transition: none;
    }
    .ledger-row-enter {
        opacity: 1;
        transform: none;
        animation: none;
    }
    .telemetry-seg {
        transform: none !important;
        transition: none !important;
    }
}

/* --------------------------------------------------------------------------
   9. MODALS & NOTIFICATIONS
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 18, 16, 0.65);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal-box {
    background: var(--paper);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-press);
    max-width: 520px;
    width: 100%;
    padding: var(--space-5);
    position: relative;
    border-radius: var(--radius-sm);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid var(--ink);
    padding-bottom: var(--space-3);
    margin-bottom: var(--space-4);
}

.modal-header h3 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--ink);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

.modal-body {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: var(--space-5);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

.modal-btn {
    min-height: 44px;
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: var(--radius-sm);
}

.modal-btn.cancel {
    background: var(--paper);
    border: 1px solid var(--ink);
    color: var(--ink);
}

.modal-btn.confirm {
    background: var(--ink);
    border: 1px solid var(--ink);
    color: var(--paper);
}

/* Floating Notification Toast */
.debunk-toast {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    background: var(--ink);
    color: var(--paper);
    border: 1px solid var(--paper);
    box-shadow: var(--shadow-press);
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    z-index: 10000;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border-radius: var(--radius-sm);
}

/* --------------------------------------------------------------------------
   10. RESPONSIVE BREAKPOINTS (1440, 1024, 768, 375px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 240px 1fr;
    }
    .dashboard-hero {
        grid-template-columns: 1fr;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .history-filter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    .sidebar {
        height: auto;
        position: relative;
        padding: var(--space-4);
    }
    .main-stage {
        padding: var(--space-4);
        max-height: none;
    }
    .quick-actions {
        grid-template-columns: 1fr;
    }
    .result-top {
        flex-direction: column;
        align-items: flex-start;
    }
    .confidence-card {
        text-align: left;
        width: 100%;
    }
    .history-filter-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 375px) {
    .main-stage {
        padding: var(--space-3);
    }
    .btn {
        width: 100%;
    }
    .scanner-actions {
        flex-direction: column;
    }
    .view-title {
        font-size: 1.8rem;
    }
}

/* prefers-reduced-motion fallback */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

/* ==========================================================================
   /* MOTION */
   Global motion tokens, page transitions & reduced motion accessibility
   ========================================================================== */

/* Page-to-page navigation: 150ms opacity fade only */
body {
    opacity: 1;
    transition: opacity 150ms var(--ease-out);
}

body.page-leaving {
    opacity: 0;
}

/* Reduced motion accessibility contract */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    body {
        transition: none !important;
    }
    .res-verdict {
        animation: none !important;
        transform: rotate(-2deg) !important;
        opacity: 1 !important;
    }
    .confidence-fill {
        transition: none !important;
    }
}

/* ==========================================================================
   VIEW TRANSITION / EDITION SWITCH TRANSITIONS
   ========================================================================== */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 2;
}

/* Fallback smooth transition when View Transition API is not active */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 420ms cubic-bezier(0.23, 1, 0.32, 1),
                color 350ms cubic-bezier(0.23, 1, 0.32, 1),
                border-color 350ms cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 350ms cubic-bezier(0.23, 1, 0.32, 1),
                fill 350ms cubic-bezier(0.23, 1, 0.32, 1),
                stroke 350ms cubic-bezier(0.23, 1, 0.32, 1) !important;
    transition-delay: 0s !important;
}

/* ==========================================================================
   APP MOTION: scan progress, result reveal, telemetry spotlight
   ========================================================================== */

/* Scan progress: a light sweeps the card while the stages tick over */
.result-loading {
    position: relative;
    overflow: hidden;
}

.scan-sweep {
    position: absolute;
    inset: 0 auto 0 0;
    width: 28%;
    background: linear-gradient(90deg, transparent, rgba(27, 27, 27, 0.09), transparent);
    animation: scanSweep 1.8s linear infinite;
    pointer-events: none;
}

@keyframes scanSweep {
    from { transform: translateX(-100%); }
    to { transform: translateX(360%); }
}

.scan-stages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2) var(--space-4);
    list-style: none;
    margin: var(--space-3) 0 0;
    padding: 0;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.scan-stages li {
    opacity: 0.45;
    transition: opacity 200ms var(--ease-out), color 200ms var(--ease-out);
}

.scan-stages li.is-done {
    opacity: 0.7;
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

.scan-stages li.is-current {
    opacity: 1;
    color: var(--ink);
}

.scan-stages li.is-current::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--red);
    animation: stagePulse 900ms ease-in-out infinite alternate;
}

@keyframes stagePulse {
    from { opacity: 0.35; }
    to { opacity: 1; }
}

/* Result reveal: header stamps first, then the report builds beneath it */
.result-panel.reveal-run .result-actions-row,
.result-panel.reveal-run .result-card,
.result-panel.reveal-run .sources-card {
    animation: resultRise 300ms var(--ease-out) both;
}

.result-panel.reveal-run .result-actions-row { animation-delay: 280ms; }
.result-panel.reveal-run .result-card:nth-child(1) { animation-delay: 340ms; }
.result-panel.reveal-run .result-card:nth-child(2) { animation-delay: 400ms; }
.result-panel.reveal-run .result-card:nth-child(3) { animation-delay: 460ms; }
.result-panel.reveal-run .sources-card { animation-delay: 520ms; }

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

/* Telemetry: hover a legend row or segment to spotlight that verdict */
.telemetry-seg,
.telemetry-visual-card tbody tr {
    transition: transform 500ms var(--ease-out), opacity 160ms var(--ease-out);
}

.telemetry-visual-card.has-focus .telemetry-seg:not(.is-focus),
.telemetry-visual-card.has-focus tbody tr:not(.is-focus) {
    opacity: 0.35;
}

@media (hover: hover) and (pointer: fine) {
    .nav-btn svg { transition: transform 160ms var(--ease-out); }
    .nav-btn:hover svg { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
    .scan-sweep { display: none; }
    .scan-stages li.is-current::before { animation: none; }
    .result-panel.reveal-run .result-actions-row,
    .result-panel.reveal-run .result-card,
    .result-panel.reveal-run .sources-card { animation: none; }
}
