:root {
    color-scheme: dark;
    --bg: #080b12;
    --surface: rgba(15, 23, 36, .88);
    --surface-strong: #121a28;
    --surface-soft: rgba(255, 255, 255, .055);
    --text: #eef4ff;
    --muted: #9aa8bf;
    --line: rgba(151, 164, 190, .2);
    --green: #39d98a;
    --blue: #6ea8ff;
    --active: rgba(57, 217, 138, .12);
    --shadow: 0 24px 80px rgba(0, 0, 0, .32);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    background:
        radial-gradient(circle at 12% 0, rgba(57, 217, 138, .16), transparent 30%),
        radial-gradient(circle at 88% 12%, rgba(110, 168, 255, .18), transparent 28%),
        linear-gradient(135deg, #080b12 0%, #101827 56%, #0a1020 100%);
    color: var(--text);
    font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

button, input { font: inherit; }

.app {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    min-height: 100vh;
}

.side {
    position: relative;
    z-index: 2;
    overflow: auto;
    padding: 18px;
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.mobile-toggle { display: none; }

.brand {
    margin: 0 0 3px;
    font-size: 18px;
    font-weight: 800;
}

.creator {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 12px;
}

.project-card {
    display: grid;
    gap: 5px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .03));
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}

.project-card span,
.hint,
.breadcrumb,
.footer {
    color: var(--muted);
    font-size: 12px;
}

.search {
    width: 100%;
    margin-bottom: 14px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    outline: none;
    background: rgba(255, 255, 255, .06);
    color: var(--text);
}

.search:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(110, 168, 255, .12);
}

.nav { display: grid; gap: 8px; }

.nav button,
.tool button,
.mobile-toggle {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: var(--text);
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.nav button {
    padding: 9px 11px;
    text-align: left;
}

.nav button:hover,
.tool button:hover,
.mobile-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(110, 168, 255, .55);
    background: rgba(110, 168, 255, .1);
}

.nav button.active {
    border-color: var(--green);
    background: var(--active);
    box-shadow: 0 0 0 4px rgba(57, 217, 138, .08);
}

.tree {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.tree strong {
    display: block;
    margin-bottom: 8px;
}

.tree details {
    margin: 8px 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .035);
}

.tree summary {
    cursor: pointer;
    font-weight: 700;
}

.tree a {
    display: block;
    padding: 6px 0 4px 14px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
}

.tree a:hover,
.tree a.active {
    color: var(--green);
    background: rgba(57, 217, 138, .08);
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}

.stat {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .04);
}

.stat b {
    display: block;
    font-size: 18px;
}

.stat span {
    color: var(--muted);
    font-size: 11px;
}

.main {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-width: 0;
}

.top {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(10, 15, 25, .78);
    backdrop-filter: blur(16px);
}

.breadcrumb { margin-bottom: 3px; }

.title {
    font-size: 18px;
    font-weight: 800;
}

.tool {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.tool button {
    min-width: 40px;
    padding: 8px 10px;
    text-align: center;
}

.canvas {
    position: relative;
    overflow: hidden;
    cursor: grab;
}

.canvas.dragging { cursor: grabbing; }

.stage {
    position: absolute;
    top: 0;
    left: 0;
    padding: 24px;
    transform-origin: 0 0;
    transition: transform .08s linear;
}

.stage svg {
    display: block;
    width: 1180px;
    max-width: none;
    height: auto;
    filter: drop-shadow(0 24px 60px rgba(0, 0, 0, .22));
}

.minimap {
    position: absolute;
    right: 18px;
    bottom: 18px;
    width: 180px;
    height: 110px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(8, 12, 20, .72);
    box-shadow: var(--shadow);
}

.minimap svg {
    width: 100%;
    height: 100%;
    opacity: .62;
}

.footer {
    padding: 10px 18px;
    border-top: 1px solid var(--line);
    background: rgba(10, 15, 25, .62);
}

@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }

    .side {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(88vw, 340px);
        transform: translateX(-105%);
        transition: transform .22s ease;
    }

    .side.open { transform: translateX(0); }

    .mobile-toggle {
        display: block;
        margin-bottom: 12px;
        padding: 8px 10px;
    }

    .top {
        align-items: flex-start;
        flex-direction: column;
    }

    .tool { justify-content: flex-start; }
    .stage svg { width: 980px; }
    .minimap { display: none; }
}
