:root {
    --bg: #0b0f14;
    --panel: #111826;
    --text: #e6eef7;
    --muted: #9db0c7;
    --accent: #6aa5ff;
    --accent-2: #7cf1c8;
    --accent-3: #ff6b9d;
    --accent-4: #ffd93d;
    --math-accent: #b794f6;
    --ring: rgba(106,165,255,.35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
    background: radial-gradient(1200px 800px at 20% -10%, rgba(124,241,200,.06), transparent 60%),
                radial-gradient(1200px 800px at 120% 10%, rgba(106,165,255,.06), transparent 60%),
                var(--bg);
    color: var(--text);
    line-height: 1.5;
}
.wrap {
    max-width: 1400px;
    margin: 48px auto;
    padding: 0 20px 40px;
}
header {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}
h1 { font-size: clamp(24px, 3vw, 34px); margin: 0; }
p.lead { color: var(--muted); margin: 0; }

.card {
    background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.02));
    border: 1px solid rgba(148,163,184,.12);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25), 0 0 0 1px rgba(106,165,255,.05) inset;
}

/* Tree using <details> */
details {
    border-left: 2px solid rgba(157,176,199,.22);
    padding-left: 14px;
    margin: 6px 0 2px 0;
}
summary {
    list-style: none;
    cursor: pointer;
    position: relative;
    padding: 8px 10px 8px 28px;
    border-radius: 12px;
    transition: background .15s ease, box-shadow .15s ease;
}
summary::-webkit-details-marker { display: none; }
summary:before {
    content: "▸";
    position: absolute;
    left: 6px; top: 8px;
    width: 18px;
    text-align: center;
    color: var(--accent);
    transition: transform .2s ease;
}
details[open] > summary:before { transform: rotate(90deg); }
summary:hover { background: rgba(106,165,255,.08); }
details[open] > summary { background: rgba(124,241,200,.06); box-shadow: 0 0 0 2px var(--ring); }

.tag {
    display: inline-block;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(157,176,199,.25);
    color: var(--muted);
    margin-left: 8px;
}
.tag.hot { background: rgba(255,107,157,.15); border-color: var(--accent-3); color: var(--accent-3); }
.tag.emerging { background: rgba(255,217,61,.15); border-color: var(--accent-4); color: var(--accent-4); }
.tag.math { background: rgba(183,148,246,.15); border-color: var(--math-accent); color: var(--math-accent); }

.branch { color: var(--accent-2); font-weight: 600; }
.model { color: var(--accent); }
.desc { color: var(--muted); font-size: 14px; margin-left: 28px; margin-bottom: 8px; }
.math-desc { 
    color: var(--math-accent); 
    font-size: 14px; 
    margin-left: 28px; 
    margin-bottom: 8px; 
    font-family: 'Courier New', monospace;
    background: rgba(183,148,246,.08);
    padding: 8px;
    border-radius: 6px;
    border-left: 3px solid var(--math-accent);
}

.legend { display:flex; gap:12px; flex-wrap:wrap; margin:10px 0 16px; }
.pill{padding:4px 10px;border-radius:999px;border:1px solid rgba(157,176,199,.25);color:var(--muted);font-size:12px}

footer { margin-top: 22px; color: var(--muted); font-size: 13px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

ul { margin: 8px 0; padding-left: 20px; }
li { margin: 3px 0; }
li.model { color: var(--accent); }
li.math-concept { color: var(--math-accent); font-style: italic; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 16px 0;
    padding: 16px;
    background: rgba(17,24,38,.6);
    border-radius: 12px;
    border: 1px solid rgba(148,163,184,.08);
}
.stat-item {
    text-align: center;
}
.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-2);
}
.stat-label {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.math-formula {
    background: rgba(183,148,246,.1);
    border: 1px solid rgba(183,148,246,.3);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    font-family: 'Courier New', monospace;
    color: var(--math-accent);
    font-size: 13px;
    overflow-x: auto;
}

.backbone-section {
    background: linear-gradient(135deg, rgba(183,148,246,.08), rgba(183,148,246,.03));
    border: 1px solid rgba(183,148,246,.2);
    border-radius: 12px;
    margin: 16px 0;
}