:root {
    --bg-deep: #0a0e17;
    --bg-card: rgba(18, 26, 42, 0.85);
    --bg-card-hover: rgba(24, 36, 58, 0.95);
    --accent: #22d3ee;
    --accent-dim: #0891b2;
    --accent-glow: rgba(34, 211, 238, 0.25);
    --text: #e8edf5;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.15);
    --success: #34d399;
    --warning: #fbbf24;
}

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

html {
    scroll-behavior: smooth;
}

body.landing-body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-deep);
    overflow-x: hidden;
}

.landing-body a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.landing-body a:hover {
    color: #67e8f9;
}

/* Navbar */
.landing-nav {
    background: rgba(10, 14, 23, 0.75);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s, box-shadow 0.3s;
}

.landing-nav.scrolled {
    background: rgba(10, 14, 23, 0.95);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.landing-nav .navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.06em;
    color: var(--text) !important;
}

.landing-nav .navbar-brand span {
    color: var(--accent);
}

.landing-nav .nav-link {
    color: var(--text-muted) !important;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.85rem !important;
}

.landing-nav .nav-link:hover,
.landing-nav .nav-link.active {
    color: var(--accent) !important;
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-dim), var(--accent));
    color: #0a0e17 !important;
    font-weight: 600;
    border: none;
    padding: 0.55rem 1.25rem;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px var(--accent-glow);
    color: #0a0e17 !important;
}

.btn-outline-accent {
    border: 1px solid var(--accent);
    color: var(--accent) !important;
    background: transparent;
    font-weight: 500;
    border-radius: 8px;
    padding: 0.55rem 1.25rem;
}

.btn-outline-accent:hover {
    background: var(--accent-glow);
    color: var(--accent) !important;
}

/* Hero */
.hero-section {
    position: relative;
    min-height: 92vh;
    display: flex;
    align-items: center;
    padding: 7rem 0 4rem;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(34, 211, 238, 0.18), transparent),
        radial-gradient(ellipse 50% 40% at 90% 60%, rgba(8, 145, 178, 0.12), transparent),
        radial-gradient(ellipse 40% 35% at 10% 80%, rgba(52, 211, 153, 0.08), transparent),
        var(--bg-deep);
    z-index: 0;
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
    opacity: 0.4;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.hero-badge .pulse {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.hero-title {
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, #fff 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-lead {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 42rem;
    margin-bottom: 1.25rem;
}

.hero-tech-stack,
.pipeline-tech-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.75rem;
}

.tech-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 999px;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.hero-stat strong {
    display: block;
    font-size: clamp(0.95rem, 2.5vw, 1.25rem);
    color: var(--accent);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.2rem;
}

.hero-stat span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Sections */
.section-block {
    padding: 5rem 0;
    position: relative;
}

.section-block.alt-bg {
    background: rgba(12, 18, 30, 0.6);
}

/* AI training / LLMOps highlight */
.section-ai-training {
    overflow: hidden;
    background:
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(34, 211, 238, 0.12), transparent),
        rgba(8, 12, 22, 0.95);
}

.section-ai-training-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.35;
    pointer-events: none;
}

.section-ai-training .container {
    position: relative;
    z-index: 1;
}

.feature-card-ai {
    position: relative;
    background: rgba(10, 16, 28, 0.9);
    border: 1px solid transparent;
    background-clip: padding-box;
}

.feature-card-ai::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 13px;
    padding: 1px;
    background: conic-gradient(
        from var(--ai-border-angle, 0deg),
        var(--accent-dim),
        var(--accent),
        rgba(52, 211, 153, 0.6),
        var(--accent-dim)
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 0;
    animation: aiBorderSpin 6s linear infinite;
}

@property --ai-border-angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

@keyframes aiBorderSpin {
    to {
        --ai-border-angle: 360deg;
    }
}

.feature-card-ai > * {
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .feature-card-ai::before {
        animation: none;
        background: linear-gradient(135deg, var(--accent-dim), var(--accent));
    }
}

.section-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    margin-bottom: 1rem;
}

.section-desc {
    color: var(--text-muted);
    max-width: 40rem;
    margin-bottom: 2.5rem;
}

/* Cards */
.feature-card,
.mode-card,
.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.feature-card:hover,
.mode-card:hover,
.step-card:hover {
    border-color: rgba(34, 211, 238, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.feature-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    border-radius: 10px;
    font-size: 1.4rem;
    color: var(--accent);
    margin-bottom: 1rem;
}

.feature-card h3,
.mode-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p,
.mode-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.mode-card p,
.mode-card li,
.mode-card .mode-card-list {
    color: #c5d0de;
}

.mode-card strong {
    color: var(--text);
}

/* Pipeline chain (5 steps, full width) */
.pipeline-chain {
    width: 100%;
}

.pipeline-chain-track {
    display: grid;
    grid-template-columns: 1fr 2.25rem 1fr 2.25rem 1fr 2.25rem 1fr 2.25rem 1fr;
    align-items: stretch;
    gap: 0;
    width: 100%;
}

.pipeline-step {
    text-align: center;
    min-width: 0;
    animation: pipelineStepIn 0.55s ease-out backwards;
}

.pipeline-step:nth-child(1) { animation-delay: 0.05s; }
.pipeline-step:nth-child(3) { animation-delay: 0.15s; }
.pipeline-step:nth-child(5) { animation-delay: 0.25s; }
.pipeline-step:nth-child(7) { animation-delay: 0.35s; }
.pipeline-step:nth-child(9) { animation-delay: 0.45s; }

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

.step-card {
    text-align: center;
    height: 100%;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-dim), var(--accent));
    color: #0a0e17;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.step-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    flex: 1;
}

.pipeline-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 100%;
    padding: 0 0.15rem;
}

.pipeline-arrow-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    margin-top: -1px;
    background: linear-gradient(90deg, transparent, var(--accent-dim), var(--accent), var(--accent-dim), transparent);
    background-size: 200% 100%;
    animation: pipelineFlowLine 2.2s ease-in-out infinite;
    opacity: 0.85;
}

@keyframes pipelineFlowLine {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

.pipeline-arrow-icon {
    position: relative;
    z-index: 1;
    font-size: 1.35rem;
    color: var(--accent);
    background: var(--bg-deep);
    border-radius: 50%;
    padding: 0.15rem;
    animation: pipelineArrowPulse 1.8s ease-in-out infinite;
}

.pipeline-arrow:nth-child(2) .pipeline-arrow-icon { animation-delay: 0s; }
.pipeline-arrow:nth-child(4) .pipeline-arrow-icon { animation-delay: 0.35s; }
.pipeline-arrow:nth-child(6) .pipeline-arrow-icon { animation-delay: 0.7s; }
.pipeline-arrow:nth-child(8) .pipeline-arrow-icon { animation-delay: 1.05s; }

@keyframes pipelineArrowPulse {
    0%, 100% {
        opacity: 0.55;
        transform: translateX(0);
        filter: drop-shadow(0 0 0 transparent);
    }
    50% {
        opacity: 1;
        transform: translateX(3px);
        filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.45));
    }
}

@media (max-width: 991.98px) {
    .pipeline-chain-track {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .pipeline-arrow {
        min-height: auto;
        padding: 0.5rem 0;
        flex-direction: column;
    }

    .pipeline-arrow-line {
        width: 2px;
        height: 1.5rem;
        left: 50%;
        right: auto;
        top: 0;
        bottom: 0;
        margin: 0 0 0 -1px;
        background: linear-gradient(180deg, transparent, var(--accent-dim), var(--accent), var(--accent-dim), transparent);
        background-size: 100% 200%;
        animation-name: pipelineFlowLineVertical;
    }

    @keyframes pipelineFlowLineVertical {
        0% { background-position: 0 100%; }
        100% { background-position: 0 -100%; }
    }

    .pipeline-arrow-icon {
        transform: rotate(90deg);
        animation-name: pipelineArrowPulseDown;
    }

    @keyframes pipelineArrowPulseDown {
        0%, 100% {
            opacity: 0.55;
            transform: rotate(90deg) translateX(0);
        }
        50% {
            opacity: 1;
            transform: rotate(90deg) translateX(3px);
        }
    }
}

@media (prefers-reduced-motion: reduce) {
    .pipeline-step,
    .pipeline-arrow-line,
    .pipeline-arrow-icon {
        animation: none;
    }
}

/* Risk list */
.risk-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.risk-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.risk-list li:last-child {
    border-bottom: none;
}

.risk-list .bi-check-circle-fill {
    color: var(--success);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

/* Status grid */
.status-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    font-size: 0.88rem;
}

.status-item.ok .bi {
    color: var(--success);
}

.status-item.no .bi {
    color: var(--text-muted);
}

.status-item.no span {
    color: var(--text-muted);
}

/* CTA */
.cta-section {
    padding: 5rem 0;
    text-align: center;
}

.cta-box {
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.2), rgba(34, 211, 238, 0.08));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 3rem 2rem;
    max-width: 640px;
    margin: 0 auto;
}

.cta-box h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.cta-box p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Telegram section */
.tg-highlight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.5rem 1.35rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tg-highlight-card:hover {
    border-color: rgba(34, 211, 238, 0.3);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.tg-highlight-accent {
    border-color: rgba(34, 211, 238, 0.25);
    background: linear-gradient(160deg, rgba(8, 145, 178, 0.12), var(--bg-card));
}

.tg-highlight-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    border-radius: 10px;
    font-size: 1.25rem;
    color: var(--accent);
    margin-bottom: 0.85rem;
}

.tg-highlight-card h3 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.tg-highlight-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tg-mini-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.88rem;
    color: #c5d0de;
}

.tg-mini-list li {
    position: relative;
    padding-left: 1rem;
    margin-bottom: 0.45rem;
}

.tg-mini-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

.tg-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.tg-flow-step {
    background: rgba(34, 211, 238, 0.08);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
}

.tg-flow-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    margin-right: 0.35rem;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-deep);
    font-size: 0.75rem;
    font-weight: 700;
}

.tg-flow-arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Telegram Mini App mock */
.tg-webapp-mock {
    display: flex;
    justify-content: center;
    align-items: stretch;
    min-height: 100%;
}

.tg-webapp-frame {
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    background: #0a0f1a;
    border: 2px solid rgba(148, 163, 184, 0.2);
    border-radius: 28px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
    font-size: 0.78rem;
}

.tg-webapp-statusbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem 0.35rem;
    background: #111827;
    color: var(--text-muted);
    font-size: 0.7rem;
}

.tg-webapp-title {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.75rem;
}

.tg-webapp-signal {
    width: 2.2rem;
    height: 0.45rem;
    border-radius: 2px;
    background: rgba(148, 163, 184, 0.25);
}

.tg-webapp-screen {
    flex: 1;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    background: linear-gradient(180deg, #0f1524 0%, #0a0e17 100%);
}

.tg-webapp-pair-card {
    background: rgba(24, 36, 58, 0.85);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.65rem 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.15rem 0.5rem;
    align-items: center;
}

.tg-webapp-pair-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    grid-column: 1;
}

.tg-webapp-pair-name {
    font-size: 0.95rem;
    color: var(--text);
    grid-column: 1;
}

.tg-webapp-pair-side {
    font-size: 0.7rem;
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
}

.tg-webapp-killswitch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: 10px;
}

.tg-webapp-toggle {
    width: 2.4rem;
    height: 1.35rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    position: relative;
    margin-left: auto;
}

.tg-webapp-toggle-on {
    background: rgba(52, 211, 153, 0.45);
}

.tg-webapp-toggle-knob {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.tg-webapp-toggle-label {
    color: var(--success);
    font-weight: 600;
    font-size: 0.72rem;
}

.tg-webapp-balance {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
}

.tg-webapp-balance strong {
    font-size: 1.1rem;
    color: var(--text);
    width: 100%;
}

.tg-webapp-pnl {
    font-size: 0.68rem;
}

.tg-webapp-chart {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.4rem 0.5rem 0.35rem;
    min-height: 4.5rem;
}

.tg-webapp-chart svg {
    width: 100%;
    height: 3.2rem;
    display: block;
}

.tg-webapp-chart-caption {
    display: block;
    text-align: center;
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.tg-webapp-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: #111827;
    border-top: 1px solid var(--border);
    padding: 0.35rem 0 0.5rem;
}

.tg-webapp-tab {
    text-align: center;
    font-size: 0.58rem;
    color: var(--text-muted);
    padding: 0.25rem 0.15rem;
    line-height: 1.2;
}

.tg-webapp-tab-active {
    color: var(--accent);
    font-weight: 600;
}

/* Footer */
.landing-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.landing-footer .brand {
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.06em;
}

/* Doc nav (tech.php) */
.doc-top-nav {
    max-width: 48rem;
    margin: 0 auto 1rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e293b;
    border-radius: 8px 8px 0 0;
    font-family: system-ui, sans-serif;
}

.doc-top-nav a {
    color: #22d3ee;
    font-size: 0.9rem;
    font-weight: 500;
}

.doc-top-nav .brand {
    color: #e8edf5;
    font-weight: 700;
    letter-spacing: 0.05em;
}

@media (max-width: 767px) {
    .hero-section {
        min-height: auto;
        padding: 6rem 0 3rem;
    }

    .hero-stats {
        gap: 1.25rem;
    }

    .hero-stat {
        flex: 1 1 calc(50% - 0.75rem);
        min-width: 140px;
    }

    .pipeline-row .step-card {
        max-width: 100%;
        flex: 1 1 100%;
    }
}
