:root {
    --bg-color: #0d0d12;
    --card-bg: rgba(25, 25, 35, 0.4);
    --text-main: #f0f0f5;
    --text-muted: #9ca3af;
    --accent: #5e6ad2;
    --accent-hover: #7b85e0;
    --border-color: rgba(255, 255, 255, 0.08);
}

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

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

a, a:visited {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.article-mode {
    align-items: flex-start;
    padding: 3rem 1rem;
    overflow-y: auto;
}

.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: float 10s infinite ease-in-out alternate;
}

.orb-1 {
    width: 40vw;
    height: 40vw;
    background: #5e6ad2;
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 30vw;
    height: 30vw;
    background: #25a55f;
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, 50px); }
}

.container {
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.container.article-container {
    max-width: 850px;
    padding: 0.5rem;
}

.glass-effect {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    opacity: 0;
    animation: fadeUp 0.8s ease forwards;
}

.glass-effect.article-glass {
    text-align: left;
    padding: 3rem 3rem;
}

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

.logo {
    width: 80px;
    height: auto;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(0,0,0,0.3));
}

.title {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--accent);
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 2rem;
}

.bio {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.link-btn, .link-btn:visited {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.github-btn, .github-btn:visited {
    background-color: #ffffff;
    color: #000000 !important;
}

.github-btn:hover {
    background-color: #e5e5e5;
    color: #000000 !important;
    transform: translateY(-2px);
}

.manifesto-btn, .manifesto-btn:visited {
    background: linear-gradient(135deg, rgba(94, 106, 210, 0.3), rgba(94, 106, 210, 0.15));
    color: #ffffff !important;
    border: 1px solid var(--accent);
    box-shadow: 0 4px 14px rgba(94, 106, 210, 0.25);
}

.manifesto-btn:hover {
    background: var(--accent);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(94, 106, 210, 0.4);
}

/* Article Styling */
.article-nav {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-link, .back-link:visited {
    color: var(--accent) !important;
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.back-link:hover {
    color: var(--accent-hover) !important;
    text-decoration: underline;
}

.article-content h1 {
    font-size: 2.2rem;
    line-height: 1.25;
    margin-bottom: 1rem;
}

.article-content h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.article-content h3 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--accent);
}

.article-content p {
    color: #d1d5db;
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.7;
}

.article-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(94, 106, 210, 0.05);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    border-radius: 0 8px 8px 0;
}

.article-content pre {
    background: #050508;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #a78bfa;
}

.article-content code {
    font-family: 'JetBrains Mono', monospace;
    background: rgba(255, 255, 255, 0.08);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e0e7ff;
}

sup {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 0;
}

sup a, sup a:visited {
    color: var(--accent) !important;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    padding: 0 2px;
    text-decoration: none;
}

sup a:hover {
    color: #ffffff !important;
    background: var(--accent);
    border-radius: 3px;
}

/* Provenance & Methodology Disclaimer Component */
.provenance-disclaimer {
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem;
    background: rgba(94, 106, 210, 0.06);
    border: 1px solid rgba(94, 106, 210, 0.25);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.provenance-disclaimer .disclaimer-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent);
    text-transform: uppercase;
}

.provenance-disclaimer p {
    margin-bottom: 0 !important;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.provenance-disclaimer p strong {
    color: var(--text-main);
}

.provenance-disclaimer p em {
    color: #4ade80;
    font-style: normal;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88em;
}

/* Visual Diagram Components */
.consent-sandbox-visual {
    margin: 2rem 0;
    background: rgba(10, 10, 18, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.sandbox-header-badge {
    align-self: flex-start;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: rgba(94, 106, 210, 0.15);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(94, 106, 210, 0.3);
}

.sandbox-autonomous-zone {
    background: rgba(37, 165, 95, 0.08);
    border: 1px dashed rgba(37, 165, 95, 0.35);
    border-radius: 8px;
    padding: 1.25rem;
}

.zone-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: #4ade80;
    margin-bottom: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
}

.zone-list {
    margin-bottom: 0 !important;
    padding-left: 1.25rem !important;
    font-size: 0.95rem;
    color: #d1d5db;
}

.consent-gate-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    border-top: 2px solid #ef4444;
    border-bottom: 2px solid #ef4444;
    padding: 0.85rem 1.25rem;
    text-align: center;
    margin: 0.5rem 0;
    border-radius: 4px;
}

.gate-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #f87171;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.03em;
}

.sandbox-escalation-zone {
    background: rgba(239, 68, 68, 0.05);
    border: 1px dashed rgba(239, 68, 68, 0.25);
    border-radius: 8px;
    padding: 1.25rem;
}

.sandman-visual-pipeline {
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.sandman-stage {
    width: 100%;
    background: rgba(20, 20, 32, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.2s ease;
}

.stage-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
}

.crowd-stage .stage-badge {
    background: rgba(94, 106, 210, 0.15);
    color: var(--accent);
    border: 1px solid rgba(94, 106, 210, 0.3);
}

.perimeter-stage .stage-badge {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.intercept-stage .stage-badge {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.stage-body {
    flex: 1;
}

.stage-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
}

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

.pipeline-arrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 700;
}

.pipeline-arrow.danger-arrow {
    color: #f87171;
}

/* Responsive Equation Pipeline Component */
.equation-pipeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 1.75rem 0;
    padding: 1.25rem 1.5rem;
    background: rgba(10, 10, 15, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    flex-wrap: wrap;
}

.equation-card {
    flex: 1;
    min-width: 170px;
    background: rgba(94, 106, 210, 0.08);
    border: 1px solid rgba(94, 106, 210, 0.25);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    text-align: center;
}

.equation-card.result-card {
    background: rgba(37, 165, 95, 0.1);
    border-color: rgba(37, 165, 95, 0.35);
}

.equation-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.equation-sub {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
}

.result-card .equation-sub {
    color: #4ade80;
}

.equation-op {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    padding: 0 0.25rem;
}

.article-content ul, .article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    color: #d1d5db;
}

.article-content li {
    margin-bottom: 0.5rem;
}

/* Table Responsive Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.article-content th, .article-content td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.article-content th {
    background: rgba(94, 106, 210, 0.15);
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
}

.article-content td {
    background: rgba(255, 255, 255, 0.02);
}

.table-link, .table-link:visited {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(94, 106, 210, 0.2);
    border: 1px solid var(--accent);
    color: #ffffff !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.table-link:hover {
    background: var(--accent);
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* Table Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.status-published {
    background: rgba(37, 165, 95, 0.15);
    border-color: rgba(37, 165, 95, 0.4);
    color: #4ade80;
}

.status-progress {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.status-pending {
    background: rgba(156, 163, 175, 0.1);
    border-color: rgba(156, 163, 175, 0.2);
    color: var(--text-muted);
}

/* Mobile Responsive Table Transformation (< 850px) */
@media (max-width: 850px) {
    .glass-effect.article-glass {
        padding: 1.5rem 1rem;
    }
    
    .equation-pipeline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .equation-op {
        text-align: center;
        padding: 0.25rem 0;
    }

    /* Transform Table to Stacked Cards */
    .article-content table, 
    .article-content tbody, 
    .article-content tr, 
    .article-content td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
    }

    .article-content thead {
        display: none !important; /* Hide header row on mobile */
    }

    .article-content tr {
        background: rgba(20, 20, 32, 0.6);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 1rem;
        padding: 1rem 1.25rem;
    }

    .article-content td {
        border: none !important;
        padding: 0.4rem 0 !important;
        background: transparent !important;
    }

    .article-content td:nth-child(1) {
        display: none !important; /* Hide index number on card header */
    }

    .article-content td:nth-child(2) {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--text-main);
        margin-bottom: 0.3rem;
    }

    .article-content td:nth-child(3) {
        color: var(--text-muted);
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }

    .article-content td:nth-child(4) {
        border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
        padding-top: 0.75rem !important;
        display: flex;
        justify-content: flex-end;
    }
}

/* Extra Mobile Padding & Scaling (< 480px) */
@media (max-width: 480px) {
    body.article-mode {
        padding: 1.25rem 0.5rem;
    }
    
    .glass-effect.article-glass {
        padding: 1.25rem 0.85rem;
        border-radius: 12px;
    }
    
    .article-content h1 {
        font-size: 1.75rem;
    }

    .article-content h2 {
        font-size: 1.3rem;
    }
    
    .article-content p {
        font-size: 0.98rem;
        line-height: 1.65;
    }
}