/* ================================================================
   The Others Inside — Portfolio CSS
   Design System: shadcn/ui Dark Token Pattern (Vanilla CSS)
   ================================================================ */

/* === Font Imports === */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ================================================================
   1. CSS CUSTOM PROPERTIES (shadcn/ui Token Pattern)
   ================================================================ */
:root {
    /* === Base (Dark) === */
    --background: #09090B;
    --background-elevated: #0F0F12;
    --foreground: #FAFAFA;

    /* === Card === */
    --card: #18181B;
    --card-hover: #1F1F23;
    --card-foreground: #FAFAFA;

    /* === Muted === */
    --muted: #27272A;
    --muted-foreground: #A1A1AA;

    /* === Accent (Crimson) === */
    --accent: #DC2626;
    --accent-dark: #B91C1C;
    --accent-glow: rgba(220, 38, 38, 0.15);
    --accent-foreground: #FAFAFA;

    /* === Border === */
    --border: #2E2E33;
    --border-light: #3F3F46;

    /* === Code === */
    --code-blue: #60A5FA;
    --code-green: #4ADE80;
    --code-bg: #1E1E22;

    /* === Semantic === */
    --amber: #F59E0B;
    --slate: #94A3B8;
    --disabled: #71717A;

    /* === Typography === */
    --font-sans: 'Pretendard Variable', 'Pretendard', -apple-system, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* === Radius (shadcn ref) === */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;

    /* === Shadow (Dark env) === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.08);

    /* === Layout === */
    --max-width: 1140px;
    --section-padding: 100px 0;
    --container-padding: 0 24px;
    --nav-height: 60px;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--background);
    color: #D4D4D8;
    font-size: 16px;
    line-height: 1.8;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

/* Visually hidden (a11y) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ================================================================
   3. LAYOUT UTILITIES
   ================================================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--container-padding);
}

.section {
    padding: var(--section-padding);
}

.section--elevated {
    background: var(--background-elevated);
}

.section--base {
    background: var(--background);
}

/* ================================================================
   4. NAVIGATION BAR
   ================================================================ */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    height: var(--nav-height);
    display: flex;
    align-items: center;
}

.navbar .container.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
}

.nav-links a {
    color: var(--muted-foreground);
    font-size: 15px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}

.nav-links a:hover {
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.04);
}

.nav-links a.active {
    color: var(--foreground);
    background: rgba(255, 255, 255, 0.06);
}

/* ================================================================
   5. HERO SECTION
   ================================================================ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px 24px 80px;
    background: var(--background);
    overflow: hidden;
}

.hero-media {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.hero-media-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.42;
    filter: saturate(0.9) contrast(1.05) brightness(0.75);
    transform: scale(1.02);
}

.hero-media-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 20%, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.78) 62%, rgba(0, 0, 0, 0.92)),
        linear-gradient(to bottom, rgba(9, 9, 11, 0.70), rgba(9, 9, 11, 0.94));
}

/* Subtle crimson radial gradient */
.hero::before {
    content: '';
    position: absolute;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 120%;
    height: 80%;
    background: radial-gradient(ellipse at 50% 0%, rgba(220, 38, 38, 0.06), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.hero-tech-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.hero-tech-badge .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--muted-foreground);
}

.hero h1 {
    font-size: 52px;
    font-weight: 800;
    color: var(--foreground);
    line-height: 1.15;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.hero-title-logo {
    width: min(720px, 92vw);
    height: auto;
    margin: 0 auto 12px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.55));
    opacity: 0.96;
}

.hero .subtitle {
    font-size: 17px;
    color: var(--muted-foreground);
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.hero .description {
    font-size: 16px;
    color: var(--muted-foreground);
    max-width: 560px;
    margin: 0 auto 40px;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 34px;
    position: relative;
    z-index: 1;
}

.hero-actions .btn-primary,
.hero-actions .btn-ghost {
    padding: 11px 18px;
    border-radius: 999px;
}

.hero-actions svg {
    width: 18px;
    height: 18px;
}

/* Meta Cards */
.meta-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 60px;
    position: relative;
    z-index: 1;
}

.meta-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    min-width: 140px;
}

.meta-card .label {
    font-size: 13px;
    font-weight: 500;
    color: var(--disabled);
}

.meta-card .value {
    font-size: 15px;
    font-weight: 600;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Status dot */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--code-green);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Scroll indicator */
.scroll-indicator {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--disabled);
    font-size: 13px;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.scroll-indicator .line {
    width: 1px;
    height: 32px;
    background: linear-gradient(to bottom, var(--disabled), transparent);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 1; height: 32px; }
    50% { opacity: 0.3; height: 20px; }
}

/* ================================================================
   6. SECTION HEADER (Label + Title + Desc)
   ================================================================ */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.section-title {
    font-size: 38px;
    font-weight: 800;
    color: var(--foreground);
    line-height: 1.2;
    margin-bottom: 12px;
}

.section-desc {
    font-size: 17px;
    color: var(--muted-foreground);
    line-height: 1.7;
    max-width: 640px;
    margin-bottom: 40px;
}

/* ================================================================
   7. CARDS
   ================================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 28px;
    transition: all 0.25s ease;
}

.card:hover {
    background: var(--card-hover);
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    margin-bottom: 16px;
}

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

.card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--card-foreground);
    margin-bottom: 10px;
    line-height: 1.4;
}

.card p {
    font-size: 15px;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 16px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ================================================================
   7.1 FLOW SUMMARY (Roles)
   ================================================================ */
.flow-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.flow-card {
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.06), transparent 52%), var(--card);
    border: 1px solid rgba(220, 38, 38, 0.18);
    border-radius: var(--radius-xl);
    padding: 26px 26px 22px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.flow-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: rgba(220, 38, 38, 0.28);
    background: linear-gradient(180deg, rgba(220, 38, 38, 0.085), transparent 56%), var(--card-hover);
}

.flow-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.flow-step {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.16em;
    color: rgba(250, 250, 250, 0.75);
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.flow-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    background: rgba(220, 38, 38, 0.10);
    border: 1px solid rgba(220, 38, 38, 0.18);
}

.flow-icon svg {
    width: 20px;
    height: 20px;
}

.flow-card h3 {
    font-size: 18px;
    font-weight: 750;
    color: var(--card-foreground);
    margin-bottom: 8px;
    line-height: 1.35;
}

.flow-card p {
    font-size: 15px;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 14px;
}

.flow-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.roles-cta {
    margin-top: 22px;
}

.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(220, 38, 38, 0.25);
    background: rgba(220, 38, 38, 0.10);
    color: var(--foreground);
    font-weight: 650;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-cta:hover {
    transform: translateY(-1px);
    background: rgba(220, 38, 38, 0.14);
    border-color: rgba(220, 38, 38, 0.35);
}

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

/* ================================================================
   8. BADGES & TAGS
   ================================================================ */
.badge-accent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}

.badge-muted {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--muted);
    color: var(--muted-foreground);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.badge-code {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(96, 165, 250, 0.1);
    color: var(--code-blue);
    border: 1px solid rgba(96, 165, 250, 0.2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.badge-code:hover {
    background: rgba(96, 165, 250, 0.18);
    border-color: rgba(96, 165, 250, 0.35);
}

.badge-code svg {
    width: 14px;
    height: 14px;
}

.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

@media (max-width: 860px) {
    .flow-grid {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   9. CODE BLOCKS
   ================================================================ */
.code-block {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.65;
    color: #D4D4D8;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: left;
    text-align-last: left;
}

.code-block .keyword { color: #C084FC; }
.code-block .type    { color: #60A5FA; }
.code-block .string  { color: #4ADE80; }
.code-block .comment { color: #71717A; }
.code-block .func    { color: #FBBF24; }
.code-block .macro   { color: #F472B6; }

/* ================================================================
   10. TAB BUTTONS
   ================================================================ */
.tab-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    position: sticky;
    top: var(--nav-height);
    z-index: 50;
    background: rgba(9, 9, 11, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 0;
    margin-left: -4px;
    padding-left: 4px;
    transition: box-shadow 0.2s ease;
}

.tab-group.stuck {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.btn-tab {
    padding: 8px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--muted-foreground);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-tab:hover {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--border-light);
}

.btn-tab.active {
    background: var(--accent);
    color: var(--accent-foreground);
    border-color: var(--accent);
}

/* Tab content panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ================================================================
   11. BUTTONS
   ================================================================ */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-foreground);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--accent-dark);
    box-shadow: var(--shadow-glow);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--muted-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-ghost:hover {
    background: var(--muted);
    color: var(--foreground);
    border-color: var(--border-light);
}

/* ================================================================
   12. PIPELINE / FLOW
   ================================================================ */
.pipeline {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 48px;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--card);
    min-width: 160px;
    text-align: center;
    transition: all 0.25s ease;
}

.pipeline-step:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.pipeline-step .step-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
}

.pipeline-step .step-icon svg {
    width: 26px;
    height: 26px;
}

.pipeline-step .step-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--foreground);
}

.pipeline-step .step-desc {
    font-size: 13px;
    color: var(--muted-foreground);
    line-height: 1.5;
}

.pipeline-arrow {
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: var(--disabled);
}

.pipeline-arrow svg {
    width: 20px;
    height: 20px;
}

/* ================================================================
   13. DETAIL GRID (two-column: info + visual)
   ================================================================ */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.detail-info h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 12px;
}

.detail-info p {
    font-size: 15px;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 20px;
}

.detail-visual {
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--code-bg);
}

/* ================================================================
   14. ANNOTATION ROWS (Feature points)
   ================================================================ */
.annotation-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.annotation-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--background-elevated);
    border-radius: var(--radius-md);
}

.annotation-row .anno-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--code-blue);
}

.annotation-row .anno-icon svg {
    width: 18px;
    height: 18px;
}

.annotation-row span {
    font-size: 14px;
    color: #D4D4D8;
    line-height: 1.5;
}

.annotation-row .inline-code {
    color: var(--code-blue);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 500;
}

/* in card context */
.card .annotation-row {
    background: rgba(255, 255, 255, 0.03);
}

/* ================================================================
   15. MODAL / POPUP
   ================================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 32px;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    position: relative;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--muted);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--border-light);
    color: var(--foreground);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-badge {
    margin-bottom: 16px;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 8px;
}

.modal-title svg {
    width: 24px;
    height: 24px;
}

.modal-desc {
    font-size: 15px;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 20px;
}

.modal-source-meta {
    border: 1px solid var(--border);
    background: var(--background-elevated);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    margin-bottom: 16px;
}

.modal-source-row {
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.modal-source-row + .modal-source-row {
    margin-top: 6px;
}

.meta-label {
    min-width: 72px;
    color: var(--muted-foreground);
    font-size: 12px;
    letter-spacing: 0.02em;
}

.meta-value {
    color: var(--foreground);
    font-family: var(--font-mono);
    font-size: 12px;
    word-break: break-all;
}

.modal .code-block {
    margin-bottom: 20px;
}

.modal .annotation-list {
    gap: 6px;
}

.modal .annotation-row {
    background: var(--background-elevated);
}

/* Scrollbar for modal */
.modal::-webkit-scrollbar {
    width: 6px;
}
.modal::-webkit-scrollbar-track {
    background: transparent;
}
.modal::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

/* ================================================================
   16. DIAGRAM AREA
   ================================================================ */
.diagram-container {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    overflow-x: auto;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-placeholder {
    color: var(--muted-foreground);
    font-size: 15px;
    text-align: center;
}

/* Clickable diagram nodes */
.diagram-node {
    cursor: pointer;
    transition: all 0.2s;
}

.diagram-node:hover {
    filter: brightness(1.15);
}

/* ================================================================
   17. CHALLENGE CARDS (Problem/Solution)
   ================================================================ */
.challenge-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    margin-bottom: 20px;
}

.challenge-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.challenge-card h3 svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.challenge-label {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.challenge-label.problem {
    color: var(--accent);
}

.challenge-label.solution {
    color: var(--code-green);
}

.challenge-text {
    font-size: 15px;
    color: #D4D4D8;
    line-height: 1.7;
    margin-bottom: 16px;
}

/* ================================================================
   18. FOOTER
   ================================================================ */
.footer {
    border-top: 1px solid var(--border);
    padding: 48px 24px;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted-foreground);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--foreground);
}

.footer-links a svg {
    width: 16px;
    height: 16px;
}

.footer-copy {
    font-size: 13px;
    color: var(--disabled);
}

/* ================================================================
   19. SCROLL REVEAL ANIMATION
   ================================================================ */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered children */
.reveal-stagger > .reveal {
    transition-delay: calc(var(--i, 0) * 0.08s);
}

/* ================================================================
   20. SUB TABLE (Compact data display)
   ================================================================ */
.data-table-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.data-table-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
}

.data-table-card:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.data-table-card h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 6px;
}

.data-table-card .key-info {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 6px;
}

.data-table-card .key-info span {
    color: var(--code-blue);
}

.data-table-card p {
    font-size: 13px;
    color: var(--muted-foreground);
    line-height: 1.5;
}

/* ================================================================
   21. OVERVIEW CARDS (Compact info cards)
   ================================================================ */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.overview-card {
    display: flex;
    gap: 16px;
    padding: 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    transition: all 0.25s ease;
}

.overview-card:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.overview-card .ov-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    border-radius: var(--radius-md);
    color: var(--accent);
}

.overview-card .ov-icon svg {
    width: 22px;
    height: 22px;
}

.overview-card h4 {
    font-size: 17px;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 4px;
}

.overview-card p {
    font-size: 14px;
    color: var(--muted-foreground);
    line-height: 1.6;
}

/* ================================================================
   21.1 OVERVIEW CARD BULLET POINTS
   ================================================================ */
.ov-points {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ov-points li {
    position: relative;
    padding-left: 14px;
    font-size: 13px;
    color: var(--muted-foreground);
    line-height: 1.65;
    margin-bottom: 4px;
}

.ov-points li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.ov-points li:last-child {
    margin-bottom: 0;
}

.ov-points code {
    font-size: 12px;
}

/* ================================================================
   21.2 SYSTEM SUMMARY (Roles Section)
   ================================================================ */
.system-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.system-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    cursor: pointer;
}

.system-item:hover {
    background: var(--card-hover);
    border-color: var(--border-light);
    transform: translateX(4px);
}

.system-item-bar {
    flex-shrink: 0;
    width: 4px;
    height: 48px;
    border-radius: 2px;
    background: var(--item-color, var(--accent));
}

.system-item-content {
    flex: 1;
    min-width: 0;
}

.system-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.system-item-header h4 {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
    white-space: nowrap;
}

.system-item-header h4 svg {
    width: 16px;
    height: 16px;
    color: var(--item-color, var(--accent));
}

.system-item-classes {
    display: inline-flex;
    gap: 6px;
    flex-wrap: wrap;
}

.system-item-classes code {
    font-size: 11px;
    padding: 1px 6px;
}

.system-item-content p {
    font-size: 13.5px;
    color: var(--muted-foreground);
    line-height: 1.6;
    margin: 0;
}

.system-item-arrow {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--disabled);
    transition: color 0.2s, transform 0.2s;
}

.system-item:hover .system-item-arrow {
    color: var(--item-color, var(--accent));
    transform: translateX(2px);
}

/* ================================================================
   21.3 NAVBAR BRAND
   ================================================================ */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-brand {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--foreground);
    text-decoration: none;
    letter-spacing: 0.04em;
    white-space: nowrap;
    opacity: 0.85;
    transition: opacity 0.2s;
}

.nav-brand:hover {
    opacity: 1;
}

/* ================================================================
   21.4 SCROLL TO TOP BUTTON
   ================================================================ */
.scroll-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 90;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(9, 9, 11, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--muted-foreground);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.3s, transform 0.3s, color 0.2s, border-color 0.2s, background 0.2s;
}

.scroll-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.scroll-top:hover {
    color: var(--foreground);
    border-color: var(--accent);
    background: rgba(220, 38, 38, 0.12);
}

.scroll-top svg {
    width: 20px;
    height: 20px;
}

/* ================================================================
   21.5 FOOTER TEXT (non-clickable)
   ================================================================ */
.footer-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted-foreground);
    font-size: 14px;
    font-weight: 500;
}

.footer-text svg {
    width: 16px;
    height: 16px;
}

/* ================================================================
   22. INLINE CODE
   ================================================================ */
code {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--code-blue);
    background: rgba(96, 165, 250, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ================================================================
   23. RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    :root {
        --section-padding: 80px 0;
    }
    
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .data-table-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .pipeline {
        flex-direction: column;
    }

    .pipeline-arrow {
        transform: rotate(90deg);
    }
}

@media (max-width: 768px) {
    :root {
        --section-padding: 60px 0;
        --nav-height: 52px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero-title-logo {
        width: min(520px, 92vw);
        margin-bottom: 10px;
    }

    .hero .subtitle {
        font-size: 15px;
    }

    .section-title {
        font-size: 28px;
    }

    .section-desc {
        font-size: 15px;
    }

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

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

    .data-table-grid {
        grid-template-columns: 1fr;
    }

    .meta-cards {
        flex-direction: column;
        align-items: center;
    }

    .meta-card {
        width: 100%;
        max-width: 280px;
    }

    .nav-brand {
        display: none;
    }

    .nav-container {
        justify-content: center;
    }

    .nav-links {
        gap: 4px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 8px;
    }

    .nav-links a {
        font-size: 13px;
        padding: 6px 10px;
    }

    .system-item {
        padding: 14px 16px;
        gap: 12px;
    }

    .system-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .system-item-arrow {
        display: none;
    }

    .scroll-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    .tab-group {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        padding-top: 12px;
    }

    .modal {
        padding: 24px;
        max-height: 90vh;
        border-radius: var(--radius-xl);
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 28px;
    }

    .pipeline-step {
        min-width: 120px;
        padding: 16px 20px;
    }

    .card {
        padding: 20px;
    }
}

/* ================================================================
   24. CLASS DIAGRAM SYSTEM
   ================================================================ */
.cd-canvas {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cd-layer-wrapper {
    padding: 20px 16px;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.cd-layer-title {
    text-align: center;
    margin-bottom: 16px;
}

.cd-layer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 14px;
    border-radius: var(--radius-sm);
}

.cd-layer-badge--core {
    background: rgba(220, 38, 38, 0.12);
    color: var(--accent);
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.cd-layer-badge--subsystem {
    background: rgba(96, 165, 250, 0.12);
    color: var(--code-blue);
    border: 1px solid rgba(96, 165, 250, 0.25);
}

.cd-layer-badge--component {
    background: rgba(74, 222, 128, 0.12);
    color: var(--code-green);
    border: 1px solid rgba(74, 222, 128, 0.25);
}

.cd-layer-badge--interaction {
    background: rgba(192, 132, 252, 0.12);
    color: #C084FC;
    border: 1px solid rgba(192, 132, 252, 0.25);
}

.cd-layer-badge--data {
    background: rgba(245, 158, 11, 0.12);
    color: var(--amber);
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.cd-layer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* --- Class Node --- */
.cd-node {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 230px;
    max-width: 300px;
    flex: 1 1 230px;
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
}

.cd-node:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.cd-node-header {
    padding: 10px 14px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cd-node-stereotype {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    font-family: var(--font-mono);
}

.cd-node-name {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.cd-node-parent {
    font-size: 11px;
    color: var(--disabled);
    font-family: var(--font-mono);
}

.cd-node-body {
    padding: 6px 14px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.cd-node-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}

.cd-member {
    font-size: 11px;
    font-family: var(--font-mono);
    color: #D4D4D8;
    line-height: 1.55;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cd-member--prop { color: var(--code-blue); }
.cd-member--method { color: #FBBF24; }
.cd-member--delegate { color: #F472B6; }
.cd-member--enum { color: #C084FC; }

.cd-node-footer {
    padding: 6px 14px 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--disabled);
}

.cd-node-footer svg {
    width: 12px;
    height: 12px;
}

/* Node color variants */
.cd-node--core .cd-node-header { border-top: 3px solid var(--accent); }
.cd-node--core .cd-node-name { color: #FCA5A5; }
.cd-node--core:hover { border-color: rgba(220, 38, 38, 0.4); box-shadow: 0 4px 20px rgba(220, 38, 38, 0.08); }

.cd-node--subsystem .cd-node-header { border-top: 3px solid var(--code-blue); }
.cd-node--subsystem .cd-node-name { color: var(--code-blue); }
.cd-node--subsystem:hover { border-color: rgba(96, 165, 250, 0.4); box-shadow: 0 4px 20px rgba(96, 165, 250, 0.08); }

.cd-node--component .cd-node-header { border-top: 3px solid var(--code-green); }
.cd-node--component .cd-node-name { color: var(--code-green); }
.cd-node--component:hover { border-color: rgba(74, 222, 128, 0.4); box-shadow: 0 4px 20px rgba(74, 222, 128, 0.08); }

.cd-node--interaction .cd-node-header { border-top: 3px solid #C084FC; }
.cd-node--interaction .cd-node-name { color: #C084FC; }
.cd-node--interaction:hover { border-color: rgba(192, 132, 252, 0.4); box-shadow: 0 4px 20px rgba(192, 132, 252, 0.08); }

.cd-node--data .cd-node-header { border-top: 3px solid var(--amber); }
.cd-node--data .cd-node-name { color: var(--amber); }
.cd-node--data:hover { border-color: rgba(245, 158, 11, 0.4); box-shadow: 0 4px 20px rgba(245, 158, 11, 0.08); }

.cd-node--interface .cd-node-header { border-top: 3px solid #94A3B8; }
.cd-node--interface .cd-node-name { color: #94A3B8; }

/* --- Flow Arrow (Between Layers) --- */
.cd-flow-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 6px 0;
}

.cd-arrow-line {
    width: 2px;
    height: 16px;
    background: var(--border-light);
}

.cd-arrow-head {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--border-light);
}

.cd-flow-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--muted-foreground);
    text-align: center;
    padding: 3px 14px;
    background: var(--card);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
    white-space: nowrap;
}

/* --- Relationship Badges (inside layers) --- */
.cd-rel {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--disabled);
    padding: 4px 8px;
    align-self: center;
}

.cd-rel-arrow {
    color: var(--border-light);
}

/* --- Mini Node (for enums/structs) --- */
.cd-node--mini {
    min-width: 160px;
    max-width: 220px;
    flex: 0 1 180px;
}

.cd-node--mini .cd-node-header {
    padding: 8px 12px 6px;
}

.cd-node--mini .cd-node-name {
    font-size: 12px;
}

.cd-node--mini .cd-node-body {
    padding: 4px 12px 8px;
}

.cd-node--mini .cd-member {
    font-size: 10px;
}

/* --- Legend --- */
.cd-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 16px 0 8px;
}

.cd-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--muted-foreground);
}

.cd-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

.cd-legend-dot--core { background: var(--accent); }
.cd-legend-dot--subsystem { background: var(--code-blue); }
.cd-legend-dot--component { background: var(--code-green); }
.cd-legend-dot--interaction { background: #C084FC; }
.cd-legend-dot--data { background: var(--amber); }

/* --- Horizontal connector within a layer --- */
.cd-h-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 2px;
    color: var(--border-light);
    font-size: 16px;
    font-weight: 300;
    align-self: center;
}

/* --- Stage lifecycle flow --- */
.cd-lifecycle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.cd-lifecycle-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 120px;
    text-align: center;
    transition: all 0.2s ease;
}

.cd-lifecycle-step:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.cd-lifecycle-num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    color: var(--foreground);
}

.cd-lifecycle-num--blue { background: rgba(96, 165, 250, 0.2); color: var(--code-blue); }
.cd-lifecycle-num--green { background: rgba(74, 222, 128, 0.2); color: var(--code-green); }
.cd-lifecycle-num--red { background: rgba(220, 38, 38, 0.2); color: var(--accent); }
.cd-lifecycle-num--purple { background: rgba(192, 132, 252, 0.2); color: #C084FC; }
.cd-lifecycle-num--amber { background: rgba(245, 158, 11, 0.2); color: var(--amber); }

.cd-lifecycle-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--foreground);
    font-family: var(--font-mono);
}

.cd-lifecycle-desc {
    font-size: 11px;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.cd-lifecycle-arrow {
    color: var(--disabled);
    display: flex;
    align-items: center;
    padding: 0 2px;
}

.cd-lifecycle-arrow svg {
    width: 18px;
    height: 18px;
}

/* --- Branch box (decision point) --- */
.cd-branch {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.cd-branch-path {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    min-width: 140px;
    text-align: center;
}

.cd-branch-path--correct {
    background: rgba(74, 222, 128, 0.06);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.cd-branch-path--wrong {
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

.cd-branch-label {
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-mono);
}

.cd-branch-label--correct { color: var(--code-green); }
.cd-branch-label--wrong { color: var(--accent); }

.cd-branch-desc {
    font-size: 11px;
    color: var(--muted-foreground);
    line-height: 1.4;
}

/* --- Data map grid --- */
.cd-data-map {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}

.cd-data-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.cd-data-row:hover {
    border-color: var(--border-light);
    background: var(--card-hover);
}

.cd-data-src {
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--amber);
    min-width: 110px;
}

.cd-data-arrow {
    color: var(--disabled);
    flex-shrink: 0;
}

.cd-data-arrow svg {
    width: 14px;
    height: 14px;
}

.cd-data-dst {
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--code-blue);
}

.cd-data-desc {
    font-size: 11px;
    color: var(--muted-foreground);
    margin-left: auto;
}

/* --- Section subtitle within diagram --- */
.cd-subtitle {
    font-size: 14px;
    font-weight: 600;
    color: var(--foreground);
    text-align: center;
    margin: 20px 0 12px;
}

.cd-subtitle-desc {
    font-size: 12px;
    color: var(--muted-foreground);
    text-align: center;
    margin-bottom: 16px;
}

/* --- Responsive Diagram --- */
@media (max-width: 768px) {
    .cd-node {
        min-width: 180px;
        max-width: 100%;
    }

    .cd-node--mini {
        min-width: 140px;
    }

    .cd-lifecycle {
        flex-direction: column;
    }

    .cd-lifecycle-arrow {
        transform: rotate(90deg);
    }

    .cd-data-map {
        grid-template-columns: 1fr;
    }

    .cd-branch {
        flex-direction: column;
    }
}

/* ================================================================
   SCREENSHOT GALLERY
   ================================================================ */
.screenshot-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 20px;
}

.screenshot-gallery.single-col {
    grid-template-columns: 1fr;
}

.screenshot-gallery.screenshot-gallery--single {
    grid-template-columns: 1fr;
    max-width: 640px;
}

.screenshot-item {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--code-bg);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.screenshot-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(220, 38, 38, 0.15), 0 4px 16px rgba(0, 0, 0, 0.4);
    border-color: rgba(220, 38, 38, 0.35);
}

.screenshot-item.wide {
    grid-column: 1 / -1;
}

.screenshot-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}

.screenshot-item:hover img {
    transform: scale(1.02);
}

.screenshot-caption {
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.85));
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.screenshot-caption > .caption-icon + span {
    flex: 1;
    min-width: 0;
}

.screenshot-caption .caption-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.screenshot-caption .caption-icon svg {
    width: 18px;
    height: 18px;
}

.screenshot-caption span {
    font-size: 13px;
    color: #d4d4d8;
    line-height: 1.5;
}

.screenshot-caption .caption-highlight {
    color: var(--accent);
    font-weight: 600;
}

.screenshot-caption .caption-code {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--code-blue);
    background: rgba(96, 165, 250, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
}

/* Zoom overlay badge */
.screenshot-item::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d4d4d8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='15 3 21 3 21 9'%3E%3C/polyline%3E%3Cpolyline points='9 21 3 21 3 15'%3E%3C/polyline%3E%3Cline x1='21' y1='3' x2='14' y2='10'%3E%3C/line%3E%3Cline x1='3' y1='21' x2='10' y2='14'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screenshot-item:hover::after {
    opacity: 1;
}

/* ── Lightbox ── */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 32px;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-overlay img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    animation: lightboxIn 0.3s ease;
}

@keyframes lightboxIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.5);
    color: #d4d4d8;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 301;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
}

/* Debug info card inside anomaly section */
.debug-info-card {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.06), rgba(96, 165, 250, 0.04));
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: var(--radius-xl);
    padding: 24px 28px;
    margin-top: 24px;
}

.debug-info-card h4 {
    font-size: 17px;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-info-card h4 svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.debug-info-card p {
    font-size: 14px;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 12px;
}

.debug-info-card .debug-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.debug-info-card .debug-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.debug-info-card .debug-step-num {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    background: rgba(220, 38, 38, 0.15);
    color: var(--accent);
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.debug-info-card .debug-step span {
    font-size: 13px;
    color: #d4d4d8;
    line-height: 1.5;
}

/* ── Stage Flow Table ── */
.stage-flow-table {
    overflow-x: auto;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--card);
}

.stage-flow-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stage-flow-table thead th {
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
    font-size: 13px;
    color: var(--foreground);
    text-align: left;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.stage-flow-table tbody td {
    padding: 12px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--muted-foreground);
    line-height: 1.6;
    vertical-align: middle;
}

.stage-flow-table tbody tr:last-child td {
    border-bottom: none;
}

.stage-flow-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.stage-flow-table code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--code-blue);
}

.flow-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    white-space: nowrap;
}

.flow-badge.flow-start {
    background: rgba(96, 165, 250, 0.15);
    color: #60A5FA;
    border: 1px solid rgba(96, 165, 250, 0.25);
}

.flow-badge.flow-clear {
    background: rgba(74, 222, 128, 0.15);
    color: #4ADE80;
    border: 1px solid rgba(74, 222, 128, 0.25);
}

.flow-badge.flow-transition {
    background: rgba(250, 204, 21, 0.15);
    color: #FACC15;
    border: 1px solid rgba(250, 204, 21, 0.25);
}

.flow-badge.flow-complete {
    background: rgba(192, 132, 252, 0.15);
    color: #C084FC;
    border: 1px solid rgba(192, 132, 252, 0.25);
}

.flow-badge.flow-fail {
    background: rgba(220, 38, 38, 0.15);
    color: var(--accent);
    border: 1px solid rgba(220, 38, 38, 0.25);
}

.flow-badge.flow-death {
    background: rgba(244, 114, 182, 0.15);
    color: #F472B6;
    border: 1px solid rgba(244, 114, 182, 0.25);
}

@media (max-width: 860px) {
    .screenshot-gallery {
        grid-template-columns: 1fr;
    }

    .detail-layout {
        grid-template-columns: 1fr;
    }

    .stage-flow-table {
        font-size: 13px;
    }

    .stage-flow-table thead th,
    .stage-flow-table tbody td {
        padding: 10px 12px;
    }
}
