:root {
    --bg: #060911;
    --card-bg: rgba(12, 18, 32, 0.85);
    --border: rgba(255, 255, 255, 0.08);
    --accent: #38bdf8;
    --green: #10b981;
    --amber: #f59e0b;
    --rose: #f43f5e;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.glow-bg {
    position: fixed;
    top: -20%;
    left: 30%;
    width: 50vw;
    height: 40vh;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.1) 0%, rgba(16, 185, 129, 0.03) 60%, transparent 80%);
    filter: blur(90px);
    pointer-events: none;
    z-index: 0;
}

header {
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    background: rgba(6, 9, 17, 0.85);
}

.brand h1 {
    font-size: 1.35rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 40%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-accent {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.3);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 14px;
}

.speed-controls {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    gap: 4px;
}

.ctrl-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-right: 4px;
}

.speed-btn {
    padding: 4px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.speed-btn.active {
    background: var(--accent);
    color: #060911;
}

.btn {
    padding: 6px 14px;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.canvas-container {
    position: relative;
    flex: 1;
    width: 100%;
    overflow: hidden;
}

#threeCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.telemetry-card {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
}

.text-accent { color: var(--accent); font-weight: 700; }
.text-green { color: var(--green); font-weight: 700; }
.text-amber { color: var(--amber); font-weight: 700; }

.progress-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--green));
    transition: width 0.1s linear;
}

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

.brain-hud {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
}

#brainCanvas {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    border: 1px solid var(--border);
    width: 100%;
    height: 180px;
}

.brain-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.legend-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
}

.legend-dot.green { background: var(--green); }
.legend-dot.red { background: var(--rose); }

footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 10px;
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: rgba(6, 9, 17, 0.85);
}

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