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

:root {
    --bg: #050508;
    --accent: #c2185b;
    --accent2: #e91e8a;
    --cyan: #06b6d4;
    --green: #22c55e;
    --indigo: #6366f1;
    --magenta: #c2185b;
    --orange: #ff6d3a;
    --text: #f0f0f2;
    --text-sec: #b0b0be;
    --text-dim: #7a7a8e;
    --surface: #0a0a10;
    --border: rgba(255,255,255,0.06);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Sora', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.labs-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 24px 40px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(to bottom, rgb(5 5 8) 0%, rgb(5 5 8 / 90%) 70%, transparent 100%);
}

.nav-wordmark {
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgb(255 255 255 / 35%);
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.nav-wordmark:hover {
    color: rgb(255 255 255 / 60%);
    text-shadow: 0 0 20px rgb(230 50 38 / 30%);
}

.nav-sep {
    width: 1px;
    height: 14px;
    background: rgb(255 255 255 / 12%);
}

.nav-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.6rem, 0.55rem + 0.25vw, 0.75rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #e63226;
    text-decoration: none;
}

.nav-tabs {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.nav-tab {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.6rem, 0.55rem + 0.25vw, 0.75rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgb(122 122 142);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 100px;
    border: 1px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.nav-tab:hover {
    color: rgb(176 176 190);
    border-color: rgb(255 255 255 / 6%);
}

.nav-tab--active {
    color: var(--accent);
    border-color: var(--accent);
}

.hero-tabs {
    display: none;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: nowrap;
}

.hero-tabs a {
    font-family: 'JetBrains Mono', monospace;
    font-size: clamp(0.6rem, 0.55rem + 0.25vw, 0.75rem);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgb(122 122 142);
    text-decoration: none;
    padding: 5px 4px;
    border-radius: 100px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.hero-tabs a.active {
    color: var(--accent);
    border-color: var(--accent);
}

.tab-sep {
    width: 1px;
    height: 12px;
    background: rgb(255 255 255 / 10%);
    flex-shrink: 0;
}

.nav-mini-tabs {
    display: none;
    margin-left: auto;
    gap: 6px;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-mini-tabs.visible {
    opacity: 1;
    pointer-events: auto;
}

.mini-tab {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    color: rgb(122 122 142);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.mini-tab--active {
    color: var(--accent);
    border-color: var(--accent);
}

.hero {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px 24px;
    position: relative;
    overflow: hidden;
}

.hero-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(194, 24, 91, 0.15), transparent);
    position: relative;
}

.hero-divider::after {
    content: '';
    position: absolute;
    inset: -15px 0;
    background: linear-gradient(90deg, transparent, rgba(194, 24, 91, 0.04), transparent);
    filter: blur(10px);
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 40%, rgba(194,24,91,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 30% 60%, rgba(6,182,212,0.04) 0%, transparent 60%);
    pointer-events: none;
}

.hero-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeUp 0.8s 0.2s forwards;
}

.hero-title {
    font-size: clamp(2.5rem, 4vw + 1rem, 5rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    background: linear-gradient(180deg, #ffffff 20%, #555555 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    animation: fadeUp 0.8s 0.4s forwards;
}

.hero-sub {
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    color: var(--text-sec);
    max-width: 640px;
    line-height: 1.6;
    text-wrap: balance;
    opacity: 0;
    animation: fadeUp 0.8s 0.6s forwards;
}

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

.section {
    padding: clamp(60px, 8vw, 120px) 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 12px;
}

.section-title {
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #ffffff 30%, #666666 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-desc {
    font-size: 15px;
    color: var(--text-sec);
    max-width: 560px;
    line-height: 1.6;
    text-wrap: balance;
    margin-bottom: 48px;
}

.canvas-wrap {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

.canvas-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: pan-y;
}

.hud-label {
    position: absolute;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text-dim);
    pointer-events: none;
}

.hud-tl { top: 16px; left: 16px; }
.hud-tr { top: 16px; right: 16px; }
.hud-bl { bottom: 16px; left: 16px; }
.hud-br { bottom: 16px; right: 16px; }

.hud-accent { color: var(--accent); }
.hud-green { color: var(--green); }
.hud-red { color: var(--accent); }

.match-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    align-items: center;
    margin-top: 48px;
}

.match-panel {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
}

.match-connector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 24px;
}

.match-connector svg { opacity: 0.4; }

.match-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text-dim);
    text-align: center;
    text-transform: uppercase;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 48px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 4px;
}

.stat-value.cyan { color: var(--cyan); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--accent); }
.stat-value.indigo { color: var(--indigo); }
.stat-value.orange { color: var(--orange); }

.stat-label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.flow-section {
    padding: clamp(60px, 8vw, 120px) 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.flow-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    margin-top: 48px;
}

.flow-step {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 32px 24px;
    position: relative;
}

.flow-step:first-child { border-radius: 12px 0 0 12px; }
.flow-step:last-child { border-radius: 0 12px 12px 0; }

.flow-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--cyan);
    letter-spacing: 2px;
    margin-bottom: 12px;
}

.flow-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.flow-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.flow-arrow {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    color: var(--text-dim);
    font-size: 14px;
}

/* Deploy grid */
.deploy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 48px;
}

.deploy-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.deploy-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 8px;
}

.deploy-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.deploy-stats {
    margin-bottom: 16px;
}

.deploy-stats div {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-sec);
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.deploy-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

/* Vertical DB flow */
.db-flow-vertical {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.db-node {
    border: 1px solid;
    border-radius: 8px;
    padding: 20px 24px;
    width: 100%;
    max-width: 320px;
    background: var(--surface);
    text-align: center;
}

.db-node-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.db-node-title { font-size: 14px; color: var(--text-sec); margin-bottom: 4px; }
.db-node-sub { font-size: 12px; color: var(--text-dim); }
.db-arrow-down { display: flex; justify-content: center; padding: 4px 0; }

.db-hub {
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px 16px;
    width: 100%;
    max-width: 320px;
    background: rgba(255,255,255,0.02);
}

.db-hub-header {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-dim);
    text-align: center;
    margin-bottom: 16px;
}

.db-hub-item {
    border: 1px solid;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.01);
}

.db-hub-item:last-child { margin-bottom: 0; }

.db-hub-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 4px;
}

.db-hub-detail { font-size: 11px; color: var(--text-dim); }

@media (max-width: 768px) {
    .labs-nav { padding: 16px 20px; }
    .nav-tabs { display: none; }
    .nav-mini-tabs { display: flex; }
    .hero-tabs { display: flex; }
    .hero { padding: 60px 16px 40px; min-height: 40vh; justify-content: flex-start; }
    .hero-title { margin-top: 60px; }
    .hero-sub { font-size: 15px; }
    .section, .flow-section { padding: clamp(40px, 6vw, 80px) 16px; }
    .section-desc { font-size: 14px; margin-bottom: 32px; }
    .canvas-wrap { height: 380px !important; }
    .canvas-wrap[style*="height: 600px"] { height: 450px !important; }
    .canvas-wrap[style*="height: 500px"] { height: 420px !important; }
    .canvas-wrap[style*="height: 520px"] { height: 500px !important; }
    .hud-label { font-size: 8px; letter-spacing: 0.5px; }
    .hud-tl, .hud-bl { left: 10px; }
    .hud-tr, .hud-br { right: 10px; }
    .hud-tl, .hud-tr { top: 10px; }
    .hud-bl, .hud-br { bottom: 10px; }
    .flow-steps { grid-template-columns: 1fr !important; }
    .flow-step { border-radius: 0 !important; }
    .flow-step:first-child { border-radius: 12px 12px 0 0 !important; }
    .flow-step:last-child { border-radius: 0 0 12px 12px !important; }
    .flow-arrow { display: none; }
    .match-grid { grid-template-columns: 1fr; gap: 24px; }
    .match-connector { flex-direction: row; padding: 12px 0; justify-content: center; gap: 12px; }
    .match-panel { height: 280px !important; }
    .stats-row { grid-template-columns: 1fr !important; gap: 12px; }
    .stat-card { padding: 20px; }
    .stat-card[style*="grid-column"] { grid-column: auto !important; }
    .stat-value { font-size: 24px; }
    .deploy-grid { grid-template-columns: 1fr; }
    .db-flow-horizontal { display: none !important; }
    .db-flow-vertical { display: flex !important; }
}

@media (max-width: 480px) {
    .hero-title { font-size: 2rem; }
    .section-title { font-size: 1.5rem; }
    .canvas-wrap { height: 260px !important; border-radius: 12px; }
    .canvas-wrap[style*="height: 600px"] { height: 320px !important; }
    .canvas-wrap[style*="height: 520px"] { height: 420px !important; }
    .match-panel { height: 220px !important; }
    .stat-value { font-size: 20px; }
    .flow-step { padding: 24px 16px; }
}
