/* SSB5G – scoped styles */
#ssb5g-root {
    font-family: 'Courier New', monospace;
    color: #e0e0e0;
    background: #111;
    border-radius: 6px;
    max-width: 800px;
    padding: 10px;
    box-sizing: border-box;
}
#ssb5g-root *, #ssb5g-root *::before, #ssb5g-root *::after { box-sizing: border-box; }

/* ---------- Tabs ---------- */
#ssb5g-root .ssb-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    background: #222;
    padding: 4px 4px 0;
    border-radius: 6px 6px 0 0;
}
#ssb5g-root .ssb-tab {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 6px 10px;
    border: none;
    background: #333;
    color: #aaa;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    transition: background .15s, color .15s;
}
#ssb5g-root .ssb-tab:hover { background: #444; color: #fff; }
#ssb5g-root .ssb-tab.active { background: #1a1a2e; color: #60a5fa; border-bottom: 2px solid #60a5fa; }

#ssb5g-root .ssb-tab-panel {
    display: none;
    background: #1a1a2e;
    padding: 10px;
    border-radius: 0 0 6px 6px;
    min-height: 200px;
}
#ssb5g-root .ssb-tab-panel.active { display: block; }

/* ---------- Control panel ---------- */
#ssb5g-root .ssb-ctrl {
    background: #1e1e2e;
    padding: 8px;
    border-radius: 6px;
    margin-bottom: 8px;
}
#ssb5g-root .ssb-ctrl-title {
    font-size: 12px;
    font-weight: bold;
    color: #60a5fa;
    margin-bottom: 6px;
}
#ssb5g-root .ssb-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}
#ssb5g-root .ssb-row label {
    font-size: 11px;
    min-width: 110px;
    color: #ccc;
}
#ssb5g-root .ssb-row select,
#ssb5g-root .ssb-row input[type=text],
#ssb5g-root .ssb-row input[type=number] {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    background: #2a2a3a;
    color: #fff;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 4px;
}
#ssb5g-root .ssb-row select { min-width: 80px; }
#ssb5g-root .ssb-row .ssb-val {
    font-size: 11px;
    color: #fbbf24;
    min-width: 30px;
    text-align: right;
}
#ssb5g-root .ssb-row input[type=range] {
    flex: 1;
    max-width: 180px;
    accent-color: #60a5fa;
}
#ssb5g-root .ssb-row input[type=text] { width: 160px; }

/* ---------- Buttons ---------- */
#ssb5g-root .ssb-btn {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    padding: 4px 10px;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s;
}
#ssb5g-root .ssb-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
#ssb5g-root .ssb-btn-primary:hover { background: #1d4ed8; }
#ssb5g-root .ssb-btn-action { background: #333; color: #e0e0e0; }
#ssb5g-root .ssb-btn-action:hover { background: #444; }

/* ---------- Canvas ---------- */
#ssb5g-root .ssb-canvas-wrap {
    background: #000;
    border: 1px solid #333;
    border-radius: 4px;
    margin-top: 6px;
    text-align: center;
    overflow-x: auto;
}
#ssb5g-root .ssb-canvas-wrap canvas { display: block; margin: 0 auto; }

/* ---------- Legend ---------- */
#ssb5g-root .ssb-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
    font-size: 11px;
}
#ssb5g-root .ssb-legend-item { display: flex; align-items: center; gap: 4px; }
#ssb5g-root .ssb-swatch {
    display: inline-block;
    width: 14px; height: 14px;
    border: 1px solid #666;
    border-radius: 2px;
}

/* ---------- Info panel ---------- */
#ssb5g-root .ssb-info {
    background: #1e1e2e;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 6px;
    line-height: 1.5;
    color: #ccc;
}
#ssb5g-root .ssb-info b { color: #60a5fa; }
#ssb5g-root .ssb-info .ssb-hl { color: #fbbf24; font-weight: bold; }

/* ---------- Stats grid ---------- */
#ssb5g-root .ssb-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 4px;
    margin-top: 6px;
}
#ssb5g-root .ssb-stat-card {
    background: #222;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 10px;
}
#ssb5g-root .ssb-stat-card .ssb-stat-label { color: #888; }
#ssb5g-root .ssb-stat-card .ssb-stat-value { color: #60a5fa; font-weight: bold; font-size: 12px; }

/* ---------- Constellation ---------- */
#ssb5g-root .ssb-const-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
}
#ssb5g-root .ssb-const-box {
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 4px;
    text-align: center;
}
#ssb5g-root .ssb-const-box .ssb-const-title { font-size: 11px; color: #e0e0e0; margin-bottom: 2px; }
#ssb5g-root .ssb-const-box canvas { background: #0a0a1a; border-radius: 3px; }

/* ---------- Tooltip ---------- */
#ssb5g-root .ssb-tooltip {
    position: absolute;
    background: rgba(0,0,0,.85);
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 3px;
    pointer-events: none;
    z-index: 99;
    white-space: nowrap;
    display: none;
}

/* ---------- Custom scrollbars ---------- */
#ssb5g-root ::-webkit-scrollbar { width: 6px; height: 6px; }
#ssb5g-root ::-webkit-scrollbar-track { background: #1a1a2e; border-radius: 3px; }
#ssb5g-root ::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
#ssb5g-root ::-webkit-scrollbar-thumb:hover { background: #666; }
#ssb5g-root ::-webkit-scrollbar-corner { background: #1a1a2e; }
#ssb5g-root { scrollbar-color: #444 #1a1a2e; scrollbar-width: thin; }
#ssb5g-root .ssb-canvas-wrap { scrollbar-color: #444 #000; scrollbar-width: thin; }
#ssb5g-root .ssb-canvas-wrap::-webkit-scrollbar-track { background: #000; }
