/* ============================================================
   ARGUS — Premium Editorial Design System
   Inspired by Stitch-generated components
   ============================================================ */

/* ── Tokens ── */
:root {
    --bg: #FAFAF7;
    --bg-card: #FFFFFF;
    --bg-hover: #F5F3EF;
    --bg-code: #F8F7F4;
    --border: #E5E2DB;
    --border-hover: #D0CCC3;
    --text: #1a1a1a;
    --text-mid: #4a4a4a;
    --text-muted: #8a8a8a;
    --accent: #7C5CFC;
    --accent-hover: #6A48E6;
    --accent-light: #EDE9FE;
    --accent-text: #5B3FD6;
    --danger: #E55353;
    --danger-bg: #FEF2F2;
    --success: #16A34A;
    --success-bg: #F0FDF4;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --font: 'Inter', -apple-system, sans-serif;
    --font-serif: 'Newsreader', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ============================================================
   Gate Overlay — API Key Validation Screen (Editorial Theme)
   ============================================================ */
.gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
    overflow: hidden;
}

.gate-overlay.unlocking {
    opacity: 0;
    transform: scale(1.03);
    pointer-events: none;
}

.gate-overlay.hidden {
    display: none;
}

.gate-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 52px 48px;
    max-width: 440px;
    width: 90%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: gateCardIn 0.7s var(--spring);
}

@keyframes gateCardIn {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gate-logo {
    font-family: var(--font-serif);
    font-size: 2.6rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -1px;
    margin-bottom: 6px;
}

.gate-tagline {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 24px;
}

.gate-divider {
    width: 48px;
    height: 2px;
    background: var(--accent);
    margin: 0 auto 28px;
    border-radius: 1px;
}

.gate-desc {
    font-size: 0.92rem;
    color: var(--text-mid);
    line-height: 1.65;
    margin-bottom: 28px;
}

.gate-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.gate-input-icon {
    position: absolute;
    left: 14px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

.gate-input {
    width: 100%;
    padding: 14px 44px 14px 40px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.gate-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.gate-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-card);
}

.gate-input.shake {
    animation: gateShake 0.5s var(--ease);
}

@keyframes gateShake {

    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-8px);
    }

    30% {
        transform: translateX(7px);
    }

    45% {
        transform: translateX(-6px);
    }

    60% {
        transform: translateX(4px);
    }

    75% {
        transform: translateX(-2px);
    }
}

.gate-toggle-vis {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 4px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.gate-toggle-vis:hover {
    opacity: 0.8;
}

.gate-error {
    min-height: 20px;
    font-size: 0.8rem;
    color: var(--danger);
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s, transform 0.25s;
}

.gate-error.visible {
    opacity: 1;
    transform: translateY(0);
}

.gate-btn {
    width: 100%;
    padding: 14px 24px;
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all 0.25s var(--ease);
    box-shadow: 0 2px 10px rgba(124, 92, 252, 0.25);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.gate-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 24px rgba(124, 92, 252, 0.35);
}

.gate-btn:hover:not(:disabled)::before {
    opacity: 1;
}

.gate-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
    box-shadow: 0 2px 10px rgba(124, 92, 252, 0.25);
}

.gate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gate-btn-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.gate-btn.loading .gate-btn-text {
    opacity: 0.5;
}

.gate-btn.loading .gate-btn-spinner {
    display: inline-block;
}

.gate-hint {
    margin-top: 24px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.gate-hint a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.gate-hint a:hover {
    color: var(--accent-hover);
}

/* Gate Decorative Bars — matches hero visual */
.gate-decor {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 32px;
}

.gate-bar {
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-light), var(--accent));
    opacity: 0.5;
}

.gate-bar:nth-child(1) {
    width: 120px;
}

.gate-bar:nth-child(2) {
    width: 80px;
    opacity: 0.35;
}

.gate-bar:nth-child(3) {
    width: 48px;
    opacity: 0.2;
}

/* Gate Floating Particles */
.gate-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.gate-particle {
    position: absolute;
    border-radius: 50%;
    background: var(--accent-light);
    opacity: 0;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 0.4;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* Success state */
.gate-overlay.success .gate-content {
    border-color: rgba(22, 163, 74, 0.3);
    box-shadow: 0 8px 32px rgba(22, 163, 74, 0.1);
}

.gate-overlay.success .gate-btn {
    background: var(--success);
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.3);
}

/* ============================================================
   Navigation — Stitch: minimal top navigation bar
   ============================================================ */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 247, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 226, 219, 0.5);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    transition: color 0.2s var(--ease);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width 0.3s var(--ease);
}

.nav-link:hover {
    color: var(--text);
}

.nav-link:hover::after {
    width: 100%;
}

/* ============================================================
   Hero — Stitch: two-column split layout
   ============================================================ */
.hero {
    padding: 80px 0 60px;
}

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 64px;
    align-items: center;
}

.hero-heading {
    font-family: var(--font-serif);
    font-size: 3.2rem;
    font-weight: 500;
    line-height: 1.15;
    color: var(--text);
    letter-spacing: -1px;
    margin-bottom: 20px;
}

.hero-sub {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 480px;
    margin-bottom: 32px;
}

/* ── Primary Button — Stitch: purple primary button ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: 0.92rem;
    font-weight: 600;
    padding: 13px 30px;
    border: none;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.25);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 92, 252, 0.35);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.25);
}

.btn-arrow {
    transition: transform 0.25s var(--ease);
}

.btn-primary:hover .btn-arrow {
    transform: translateX(4px);
}

/* Hero Visual */
.hero-visual {
    position: relative;
    height: 340px;
}

.visual-card {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.visual-card-1 {
    top: 0;
    left: 0;
    width: 280px;
    padding: 0;
}

.visual-card-header {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.dot-red,
.dot-yellow,
.dot-green {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red {
    background: #FF6B6B;
}

.dot-yellow {
    background: #FFD93D;
}

.dot-green {
    background: #6BCB77;
}

.visual-code {
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-mid);
}

.vc-kw {
    color: var(--accent);
    font-weight: 500;
}

.vc-fn {
    color: #D97706;
}

.visual-card-2 {
    top: 80px;
    right: 0;
    width: 200px;
    padding: 20px;
}

.visual-badge {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 16px;
}

.visual-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v-bar {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-light), var(--accent));
    opacity: 0.7;
}

/* ============================================================
   Analyze Section
   ============================================================ */
.section-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
}

.analyze-section {
    padding: 40px 0 60px;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.controls-left,
.controls-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Mode Tabs — Stitch: pill-shaped toggles */
.mode-tabs {
    display: flex;
    background: var(--bg);
    border-radius: 20px;
    padding: 3px;
    border: 1px solid var(--border);
}

.mode-tab {
    padding: 7px 16px;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    white-space: nowrap;
}

.mode-tab:hover {
    color: var(--text);
}

.mode-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.3);
}

.lang-select {
    padding: 7px 12px;
    font-family: var(--font);
    font-size: 0.82rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.lang-select:focus {
    border-color: var(--accent);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group input[type="range"] {
    width: 80px;
    accent-color: var(--accent);
}

.ngram-val {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    min-width: 18px;
    text-align: center;
}

.api-key-input {
    width: 140px;
    padding: 6px 10px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.2s;
}

.api-key-input:focus {
    border-color: var(--accent);
}

/* ============================================================
   Editor Grid — Stitch: clean analysis workspace
   ============================================================ */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 140px 1fr;
    gap: 20px;
    align-items: stretch;
}

.editor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.editor-card:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.editor-card-wide {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.editor-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.dot-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-a {
    background: var(--accent);
}

.dot-b {
    background: #D97706;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.char-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Ghost Button */
.btn-ghost {
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: 1px solid var(--accent-light);
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.btn-ghost:hover {
    background: var(--accent-light);
    border-color: var(--accent);
    transform: translateY(-1px);
}

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

textarea {
    flex: 1;
    min-height: 320px;
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg-code);
    border: none;
    outline: none;
    resize: vertical;
    tab-size: 4;
}

textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.editor-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

/* Centre Column */
.centre-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px 0;
}

.gauge-wrap {
    position: relative;
}

.gauge-track {
    fill: none;
    stroke: var(--border);
    stroke-width: 6;
}

.gauge-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s var(--ease);
}

.gauge-pct {
    font-family: var(--font);
    font-size: 1.4rem;
    font-weight: 700;
    fill: var(--text);
    text-anchor: middle;
    dominant-baseline: central;
}

.gauge-sub {
    font-family: var(--font);
    font-size: 0.5rem;
    font-weight: 600;
    fill: var(--text-muted);
    text-anchor: middle;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.vs-badge {
    font-family: var(--font-serif);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 2px;
}

/* Scan Button — Stitch: purple primary button */
.btn-scan {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    letter-spacing: 1px;
    transition: all 0.25s var(--ease);
    box-shadow: 0 2px 10px rgba(124, 92, 252, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-scan::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.btn-scan:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 24px rgba(124, 92, 252, 0.4);
}

.btn-scan:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-scan:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(124, 92, 252, 0.3);
}

.btn-scan:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-scan-wide {
    width: 100%;
    max-width: 280px;
    margin-top: 20px;
}

.btn-icon {
    font-size: 1rem;
    transition: transform 0.3s var(--spring);
}

.btn-scan:hover:not(:disabled) .btn-icon {
    transform: rotate(15deg) scale(1.2);
}

/* ============================================================
   Upload Cards — Stitch: drag-and-drop upload zone
   ============================================================ */
.upload-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 48px 32px;
    text-align: center;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.25s var(--ease);
}

.upload-card.drag-over,
.upload-card:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 4px rgba(124, 92, 252, 0.08);
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.upload-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

.upload-sub {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.upload-browse {
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: rgba(124, 92, 252, 0.3);
    transition: text-decoration-color 0.2s;
}

.upload-browse:hover {
    text-decoration-color: var(--accent);
}

.upload-req {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.single-editor-wrap {
    max-width: 800px;
    margin: 0 auto;
}

/* ============================================================
   Toast Notifications — Pop animations
   ============================================================ */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px) scale(0.9);
    padding: 14px 28px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: none;
    box-shadow: var(--shadow-lg);
}

.toast.pop-in {
    animation: toastPopIn 0.4s var(--spring) forwards;
}

.toast.pop-out {
    animation: toastPopOut 0.35s var(--ease) forwards;
}

@keyframes toastPopIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.7);
    }

    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(4px) scale(1.03);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes toastPopOut {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px) scale(0.85);
    }
}

.toast-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(229, 83, 83, 0.2);
}

.toast-error::before {
    content: '⚠ ';
}

.toast-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.toast-success::before {
    content: '✓ ';
}

/* ============================================================
   Results — Stitch: clean data cards + table
   ============================================================ */
.results-section {
    padding: 0 0 60px;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Verdict Card */
.verdict-card {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    animation: slideUp 0.5s var(--ease);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

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

.verdict-icon {
    font-size: 2rem;
}

.verdict-body {
    flex: 1;
}

.verdict-text {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 2px;
}

.verdict-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.verdict-score {
    text-align: right;
}

.verdict-pct {
    font-family: var(--font);
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.verdict-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 4px;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    animation: slideUp 0.5s var(--ease);
}

.stat-card h3 {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-mid);
    border-bottom: 1px solid rgba(229, 226, 219, 0.5);
}

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

.stat-row .val {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text);
}

.stat-separator {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.stat-card-full {
    grid-column: 1 / -1;
}

/* ============================================================
   Batch Table — Stitch: clean data table
   ============================================================ */
.batch-section {
    animation: slideUp 0.5s var(--ease);
}

.batch-title {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.batch-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(229, 226, 219, 0.4);
    color: var(--text-mid);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr {
    transition: background 0.15s var(--ease);
}

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

.similarity-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-high {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-moderate {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-low {
    background: var(--success-bg);
    color: var(--success);
}

.btn-detail {
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: 1px solid var(--accent-light);
    padding: 5px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.btn-detail:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

/* AI Single Result */
.ai-single-result {
    max-width: 550px;
    margin: 2rem auto 0;
}

.ai-verdict-card {
    text-align: center;
    padding: 3rem;
}

.ai-single-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.ai-single-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.ai-single-sub {
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* ============================================================
   Investigation Drawer — Stitch: side drawer
   ============================================================ */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(2px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
}

.drawer-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 201;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.06);
}

.drawer.open {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.drawer-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 500;
}

.drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.drawer-close:hover {
    background: var(--bg);
    color: var(--text);
    border-color: var(--border-hover);
    transform: rotate(90deg);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.drawer-section {
    margin-bottom: 24px;
}

.drawer-section-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.drawer-pair {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 8px;
}

.drawer-pair .vs-text {
    color: var(--text-muted);
    font-weight: 400;
    margin: 0 6px;
}

.drawer-big-pct {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 4px;
}

.drawer-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.82rem;
    color: var(--text-mid);
    border-bottom: 1px solid rgba(229, 226, 219, 0.5);
}

.drawer-stat-row:last-child {
    border-bottom: none;
}

.drawer-stat-row .val {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--text);
}

.drawer-reasoning {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 0.82rem;
    color: var(--text-mid);
    line-height: 1.65;
}

/* ============================================================
   About Section — Stitch: responsive grid
   ============================================================ */
.about-section {
    padding: 80px 0;
    border-top: 1px solid var(--border);
}

.about-inner {
    text-align: center;
}

.about-heading {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 500;
    margin-bottom: 48px;
    color: var(--text);
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    text-align: left;
}

.about-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s var(--ease);
}

.about-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.about-num {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 12px;
    opacity: 0.6;
}

.about-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.about-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
    padding: 28px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
    .hero-inner {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .hero-heading {
        font-size: 2.4rem;
    }

    .hero-visual {
        display: none;
    }

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

    .centre-col {
        flex-direction: row;
        gap: 24px;
        padding: 12px 0;
    }

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

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

    .controls-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}