:root {
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-input: #1a1a25;
    --border: #1e1e2e;
    --border-hover: #2a2a3e;
    --text: #e4e4ef;
    --text-dim: #8888a0;
    --text-faint: #555570;
    --accent: #7c5cfc;
    --accent-hover: #9b7fff;
    --accent-dim: #4a3a8c;
    --green: #4ade80;
    --red: #f87171;
    --yellow: #fbbf24;
    --radius: 12px;
    --mono: 'JetBrains Mono', monospace;
    --sans: 'Inter', system-ui, sans-serif
}

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

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 15, .8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.nav-logo {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer
}

.nav-logo svg {
    width: 28px;
    height: 28px
}

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

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color .2s
}

.nav-links a:hover {
    color: var(--text)
}

.nav-cta {
    background: var(--accent);
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: background .2s
}

.nav-cta:hover {
    background: var(--accent-hover)
}

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

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 92, 252, .15) 0%, transparent 60%);
    pointer-events: none
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 32px;
    position: relative
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .4
    }
}

.hero h1 {
    font-size: clamp(40px, 7vw, 72px);
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1.05;
    margin-bottom: 24px;
    position: relative;
    background: linear-gradient(135deg, #fff 0%, #a0a0c0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent
}

.hero h1 .accent {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent)
}

.hero p {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--text-dim);
    max-width: 600px;
    margin-bottom: 40px;
    position: relative
}

.hero-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    position: relative
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    padding: 14px 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    padding: 14px 32px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 16px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    background: var(--bg-input)
}

.features {
    padding: 80px 24px;
    max-width: 1200px;
    margin: 0 auto
}

.section-title {
    text-align: center;
    margin-bottom: 60px
}

.section-title h2 {
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 12px
}

.section-title p {
    color: var(--text-dim);
    font-size: 17px
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: border-color .2s
}

.feature-card:hover {
    border-color: var(--border-hover)
}

.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 22px
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px
}

.feature-card p {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6
}

.stats {
    padding: 60px 24px;
    max-width: 1000px;
    margin: 0 auto
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 24px;
    text-align: center
}

.stat {
    padding: 24px
}

.stat-num {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent)
}

.stat-label {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 4px
}

footer {
    border-top: 1px solid var(--border);
    padding: 40px 24px;
    text-align: center;
    color: var(--text-faint);
    font-size: 14px
}

footer a {
    color: var(--text-dim);
    text-decoration: none
}

.app-view {
    display: none;
    padding-top: 64px;
    min-height: 100vh
}

.app-view.active {
    display: flex
}

.app-sidebar {
    width: 260px;
    min-width: 260px;
    border-right: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
    max-height: calc(100vh - 64px)
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 64px)
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px
}

.sidebar-section {
    margin-bottom: 24px
}

.sidebar-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-faint);
    margin-bottom: 8px;
    font-weight: 600
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dim);
    transition: all .15s;
    margin-bottom: 2px
}

.sidebar-item:hover {
    background: var(--bg-card);
    color: var(--text)
}

.sidebar-item.active {
    background: var(--accent-dim);
    color: var(--text)
}

.sidebar-item .icon {
    font-size: 16px;
    width: 20px;
    text-align: center
}

.server-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px
}

.ws-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none
}

.mono-small {
    font-size: 12px;
    color: var(--text-faint);
    font-family: var(--mono)
}

.btn-small {
    width: 100%;
    margin-top: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer
}

.btn-small:hover {
    border-color: var(--border-hover)
}

.terminal-container {
    background: #0d0d14;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 130px);
    overflow: hidden
}

.terminal-header {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dim)
}

.terminal-header .dots {
    display: flex;
    gap: 6px
}

.terminal-header .dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%
}

.terminal-header .dots .r {
    background: #ff5f57
}

.terminal-header .dots .y {
    background: #febc2e
}

.terminal-header .dots .g {
    background: #28c840
}

.terminal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word
}

.terminal-output .cmd {
    color: var(--accent)
}

.terminal-output .err {
    color: var(--red)
}

.terminal-output .ok {
    color: var(--green)
}

.terminal-output .dim {
    color: var(--text-faint)
}

.terminal-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border)
}

.terminal-prompt {
    color: var(--accent);
    font-family: var(--mono);
    font-size: 13px
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px
}

.terminal-run-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer
}

.code-area {
    width: 100%;
    min-height: 200px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
    resize: vertical;
    outline: none;
    line-height: 1.6
}

.code-area:focus {
    border-color: var(--accent)
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px
}

.card h3 {
    font-size: 16px;
    margin-bottom: 12px
}

.field {
    margin-bottom: 12px
}

.field label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 4px
}

.field input,
.field textarea,
.field select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: var(--sans)
}

.field textarea {
    font-family: var(--mono);
    font-size: 13px;
    min-height: 80px;
    resize: vertical
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: var(--accent)
}

.receipt-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-family: var(--mono)
}

.receipt-row:last-child {
    border-bottom: none
}

.receipt-kind {
    color: var(--accent);
    font-weight: 600;
    min-width: 100px
}

.receipt-id {
    color: var(--text-faint)
}

.receipt-time {
    color: var(--text-faint);
    margin-left: auto
}

.artifact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px
}

.artifact-row:last-child {
    border-bottom: none
}

.artifact-name {
    font-weight: 600
}

.artifact-hash {
    color: var(--text-faint);
    font-family: var(--mono);
    font-size: 12px
}

.artifact-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    margin-left: auto
}

.memory-row {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px
}

.memory-row:last-child {
    border-bottom: none
}

.memory-topic {
    color: var(--accent);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase
}

.memory-content {
    color: var(--text);
    margin-top: 4px
}

.memory-meta {
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 4px
}

.tool-row {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 14px
}

.tool-row:last-child {
    border-bottom: none
}

.tool-name {
    font-weight: 600;
    color: var(--accent)
}

.tool-desc {
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 2px
}

.tool-mode {
    color: var(--text-faint);
    font-size: 12px;
    font-family: var(--mono)
}

.status-bar {
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-faint);
    font-family: var(--mono)
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green)
}

.status-dot.offline {
    background: var(--red)
}

.spin {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
    animation: slideIn .3s ease
}

.toast.ok {
    border-color: var(--green)
}

.toast.err {
    border-color: var(--red)
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0
    }

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

@media(max-width:768px) {
    .app-sidebar {
        display: none
    }

    .hero h1 {
        font-size: 36px
    }

    .feature-grid {
        grid-template-columns: 1fr
    }
}