* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    background: #0a1128; 
    color: #00ffff; 
    font-family: monospace; 
    overflow: hidden;
}
canvas { 
    display: block; 
    margin-right: 240px;
    margin-top: 50px;
    background: radial-gradient(ellipse at center, #0f1a3a 0%, #0a0f20 50%, #000000 100%);
    filter: brightness(1.1);
    touch-action: none;
    transition: margin-right 0.25s ease, margin-bottom 0.3s ease;
}

@media (max-width: 768px) {
    canvas {
        margin-right: 0;
        margin-bottom: 0;
        transition: margin-bottom 0.3s ease;
    }
    canvas.drawer-open {
        margin-bottom: 60vh;
    }
}
#filter-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 240px;
    height: 50px;
    background: rgba(10, 17, 40, 0.95);
    border-bottom: 2px solid rgba(0, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    z-index: 12;
    transition: right 0.25s ease;
}

@media (max-width: 768px) {
    #filter-bar {
        right: 0;
    }
}
.filter-btn {
    background: rgba(0, 136, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
    color: #00ffff;
    padding: 8px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 11px;
    font-family: monospace;
    font-weight: bold;
    white-space: nowrap;
    transition: all 0.2s;
}
.filter-btn:hover {
    background: rgba(0, 255, 255, 0.15);
    border-color: #00ffff;
}
.filter-btn.active {
    background: linear-gradient(135deg, #0088ff, #00ffff);
    border-color: #00ffff;
    color: #000;
    text-shadow: none;
}

/* Mobile bottom sheet (Material-style) */
.drawer-scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 18;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.drawer-scrim.is-open {
    display: block;
    opacity: 1;
}
@media (min-width: 769px) {
    .drawer-scrim { display: none !important; }
}

.bottom-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #0f1a30;
    border-radius: 24px 24px 0 0;
    height: 50vh;
    max-height: 50vh;
    z-index: 20;
    flex-direction: column;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

.bottom-drawer.open {
    display: flex;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .bottom-drawer {
        display: flex;
        flex-direction: column;
        transform: translateY(calc(100% - 48px));
        height: 60vh;
        max-height: 60vh;
    }
    .bottom-drawer.open {
        transform: translateY(0);
        height: 70vh;
        max-height: 70vh;
    }
    .bottom-drawer .drawer-filters {
        display: none;
    }
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 16px 12px;
    flex-shrink: 0;
    position: relative;
}
.drawer-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    flex-shrink: 0;
}
.drawer-toggle-btn {
    display: none;
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #00ffff;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.drawer-toggle-btn:hover { background: rgba(0, 255, 255, 0.2); }
@media (max-width: 768px) {
    .drawer-toggle-btn { display: flex; }
}

.share-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.share-modal-overlay.is-open { display: flex; }
.share-modal {
    background: #0f1a30;
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0, 255, 255, 0.15);
}
.share-modal h3 { padding: 16px 20px 8px; color: #00ffff; font-size: 14px; margin: 0; }
.share-modal .share-preview {
    padding: 12px 20px;
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    white-space: pre-wrap;
    word-break: break-all;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.share-modal .share-preview a {
    color: #00ffff;
    text-decoration: underline;
}
.share-modal .share-preview a:hover {
    color: #66ffff;
}
.share-modal .share-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 255, 255, 0.2);
}
.share-modal .share-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.share-modal .share-actions .btn-copy {
    background: rgba(0, 255, 255, 0.2);
    color: #00ffff;
}
.share-modal .share-actions .btn-share {
    background: linear-gradient(135deg, #0088ff, #00ffff);
    color: #000;
}
.share-modal .share-actions .btn-close {
    background: transparent;
    color: #888;
}

.drawer-filters {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(0, 255, 255, 0.2);
}

.drawer-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 20px 24px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#drawerDetails {
    color: rgba(255, 255, 255, 0.9);
    font-size: 10px;
    line-height: 1.7;
    padding-bottom: 24px;
}
#drawerDetails .drawer-detail-heading { color: #00ffff; font-size: 15px; margin: 0 0 8px 0; font-weight: bold; }
#drawerDetails .drawer-detail-name { margin-bottom: 4px; color: #ffff99; font-weight: bold; }
#drawerDetails .drawer-detail-name img { width: 100%; height: auto; border-radius: 8px; margin-bottom: 8px; }
#drawerDetails .drawer-detail-type { font-size: 10px; color: #00ffff; margin: 4px 0; }
#drawerDetails .drawer-detail-desc { margin: 6px 0 8px 0; color: #aaa; font-style: italic; line-height: 1.7; }
#drawerDetails .drawer-detail-connections-heading { color: #00ffff; font-weight: bold; margin: 0 0 4px 0; font-size: 10px; }
#drawerDetails .drawer-detail-connections { font-size: 9px; color: #888; }
#drawerDetails .drawer-detail-connections div { margin: 4px 0; }

/* Show drawer on mobile only */
@media (max-width: 768px) {
    #detailPanel {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .bottom-drawer {
        display: none !important;
    }
}
#info {
    --panel-gap: 14px;
    --panel-divider: 1px solid rgba(0, 255, 255, 0.25);
    position: fixed;
    right: 0;
    top: 0;
    width: 240px;
    height: 100vh;
    background: rgba(10, 17, 40, 0.98);
    padding: 14px 16px;
    border-left: 2px solid rgba(0, 255, 255, 0.6);
    font-size: 11px;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.1);
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    gap: 0;
    transition: transform 0.25s ease, width 0.25s ease;
}

@media (max-width: 768px) {
    #info {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: auto;
        width: 100%;
        height: auto;
        min-height: 60vh;
        max-height: 70vh;
        border-left: none;
        border-top: 2px solid rgba(0, 255, 255, 0.6);
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #info.open {
        transform: translateY(0);
    }
    #panel-toggle {
        display: none !important;
    }
}
#info.collapsed {
    transform: translateX(100%);
    pointer-events: none;
}
#panel-toggle {
    position: fixed;
    right: 240px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 11;
    width: 36px;
    height: 56px;
    border: 2px solid #00ffff;
    border-right: none;
    border-radius: 8px 0 0 8px;
    background: rgba(10, 17, 40, 0.95);
    color: #00ffff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
    transition: right 0.25s ease, background 0.2s;
}
#panel-toggle:hover { background: rgba(0, 136, 255, 0.3); }
#info.collapsed ~ #panel-toggle { right: 0; }
#info .panel-top { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: var(--panel-gap); }
#info .panel-top .panel-top-content { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: var(--panel-gap); }
#info .panel-top .panel-buttons { flex: 0 0 auto; }
#info .accordion-body-actions .panel-buttons { padding-top: 8px; border-top: none; }
#info .panel-legend { flex: 0 0 auto; padding-top: var(--panel-gap); border-top: var(--panel-divider); }
.panel-header { margin-bottom: 2px; }
.panel-header h3 { margin: 0 0 4px 0; color: #00ffff; font-size: 15px; text-shadow: 0 0 12px #00ffff; font-weight: bold; }
.panel-header .tagline { color: #0088ff; font-size: 9px; margin: 0; }
.panel-status { font-size: 11px; margin: 0; min-height: 1.4em; }
.panel-status .stat { color: #ffff88; font-weight: bold; text-shadow: 0 0 8px #ffff88; }
.panel-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 10px; color: #0088ff; margin: 0; }
.panel-meta .stat { color: #00ffff; font-weight: bold; }
h3 { margin: 0 0 6px 0; color: #00ffff; font-size: 12px; text-shadow: 0 0 10px #00ffff; font-weight: bold; }
p { margin: 0; line-height: 1.5; }
button.primary {
    background: linear-gradient(135deg, #0088ff, #00ffff);
    color: #000;
    padding: 8px 12px;
    border: 0;
    cursor: pointer;
    border-radius: 4px;
    font-weight: bold;
    font-size: 11px;
    font-family: monospace;
    transition: all 0.2s;
    width: 100%;
    box-shadow: 0 0 8px rgba(0, 136, 255, 0.5);
}
button.primary:hover {
    background: linear-gradient(135deg, #00ffff, #00ffff);
    box-shadow: 0 0 18px #00ffff;
    transform: scale(1.02);
}
button.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}
.stat { color: #00ffff; font-weight: bold; text-shadow: 0 0 10px #00ffff; }
.desc { color: #0088ff; font-size: 9px; }
.collapsible-trigger {
    background: none;
    border: none;
    color: #00ffff;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: left;
    padding: 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: inherit;
    margin: 0;
}
.collapsible-trigger:hover { text-shadow: 0 0 8px #00ffff; color: #00ffff; }
.collapsible-body { max-height: 0; overflow: hidden; transition: max-height 0.2s ease; }
.collapsible-body.open { max-height: 120px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.collapsible-body.open.legend-open { max-height: 140px; }
.collapsible-body.timeline-body.open { max-height: min(320px, 50vh); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.accordion-body-detail.open { max-height: min(400px, 50vh); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.accordion-body-actions.open { max-height: 180px; overflow: visible; }
#detailPanel {
    flex: 1 1 auto;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    padding-top: var(--panel-gap);
    border-top: var(--panel-divider);
    -webkit-overflow-scrolling: touch;
}
#detailPanel.is-empty {
    display: none;
}
#detailPanel .detail-inner { font-size: 10px; line-height: 1.7; }
.panel-buttons {
    padding-top: var(--panel-gap);
    border-top: var(--panel-divider);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.filter-section { padding-top: var(--panel-gap); border-top: var(--panel-divider); }
.filter-toggle {
    background: none;
    border: none;
    color: #00ffff;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    text-align: left;
    padding: 6px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: inherit;
    margin: 0;
}
.filter-toggle:hover { text-shadow: 0 0 10px #00ffff; }
.filter-list { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.filter-list.open { max-height: 240px; overflow-y: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
.filter-category { margin-top: 10px; }
.filter-category h4 { font-size: 10px; color: #0088ff; margin-bottom: 4px; text-transform: uppercase; }
.filter-node {
    display: block;
    width: 100%;
    text-align: left;
    padding: 5px 8px;
    margin: 2px 0;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    background: rgba(0, 255, 255, 0.06);
    color: inherit;
    transition: background 0.2s;
}
.filter-node:hover { background: rgba(0, 255, 255, 0.18); }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 9px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
