:root{
    --bg:#000;
    --fg:#9fd3ff;
    --panel:#0e0e0e;
    --muted:#7aa9c4;
    --border:#1b1b1b;
    --accent:#3be3ff;
    --accentgaq:#00ff00;
}

*{box-sizing:border-box}

html,body{
    height:100%;
    max-width:100%;
    overflow-x:hidden;
}

body{
    margin:0;
    background:var(--bg);
    color:var(--fg);
    font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
}

.app{
    display:grid;
    grid-template-columns:1fr;
    grid-template-rows:auto 1fr;
    gap:12px;
    min-height:100vh;
    width:100%;
}

header{
    grid-column:1/-1;
    padding:14px 18px;
    border-bottom:1px solid var(--border);
    background:linear-gradient(180deg,#050505,#000);
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    flex-wrap:wrap;
    position:fixed;
    top:0;
    left:0;
    right:0;
    z-index:1000;
}

header h1{
    margin:0;
    font-size:18px;
    font-weight:700;
    letter-spacing:.4px;
}

.controls{
    display:flex;
    gap:8px;
    align-items:center;
    flex-wrap:wrap;
}

.btn{
    padding:8px 12px;
    border:1px solid var(--border);
    background:#0a0a0a;
    color:var(--fg);
    border-radius:10px;
    cursor:pointer;
}

.btn-gaq{
    display:inline-block;
    padding:6px 12px;
    border:1px solid var(--accentgaq);
    border-radius:6px;
    color:var(--accentgaq);
    text-decoration:none;
    font-weight:600;
    transition:all .2s ease;
    background:rgba(00,255,00,.05);
    line-height:1;
}

.btn-gaq:hover, .btn-gaq:focus {
    background: var(--accentgaq);
    color: #000;
    box-shadow: 0 0 12px var(--accentgaq);
}

.btn.primary{
    background:#0b1a25;
    border-color:#153043;
}

.panel{
    background:var(--panel);
    border:1px solid var(--border);
    border-radius:16px;
    padding:12px;
}

.left{
    display:grid;
    grid-template-rows:220px auto;
    gap:12px;
    padding:12px;
    padding-top:0;
    margin-top:90px;
}

.console{
    display:flex;
    flex-direction:column;
    overflow:hidden;
}

.console-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:2px 6px 8px 6px;
    border-bottom:1px solid var(--border);
    margin-bottom:8px;
}

.console-title{
    font-weight:700;
    color:var(--muted);
}

.log{
    flex:1;
    background:#000;
    color:var(--fg);
    border-radius:10px;
    padding:10px;
    overflow:auto;
    font-family:ui-monospace,Consolas,monospace;
    border:1px solid #0a0a0a;
}

.charts{
    display:grid;
    grid-template-columns:1fr;
    gap:12px;
}

.chart{
    background:#05090e;
    border:1px solid var(--border);
    border-radius:14px;
    padding:8px;
    position:relative;
    max-width:100%;
}

#chart2d,
#rgb3d{
    width:100%;
    max-width:100%;
}

#rgb3d{
    height:720px;
}

.kv-inline{
    display:flex;
    gap:6px;
    align-items:center;
}

.kv-inline label{
    color:#a8d3f4;
    font-size:12px;
}

.kv-inline input{
    width:110px;
    padding:8px 10px;
    background:#060606;
    color:var(--fg);
    border:1px solid var(--border);
    border-radius:10px;
}

.btn-accent{
    display:inline-block;
    padding:6px 12px;
    border:1px solid var(--accent);
    border-radius:6px;
    color:var(--accent);
    text-decoration:none;
    font-weight:600;
    transition:all .2s ease;
    background:rgba(59,227,255,.05);
    line-height:1;
}

.btn-accent:hover,
.btn-accent:focus{
    background:var(--accent);
    color:#000;
    box-shadow:0 0 12px var(--accent);
}

.graph-toggle{
    position:absolute;
    top:10px;
    right:14px;
    display:inline-flex;
    border-radius:999px;
    border:1px solid var(--border);
    overflow:hidden;
    background:#020509;
    z-index:5;
}

.toggle-btn{
    padding:4px 10px;
    font-size:11px;
    border:none;
    background:transparent;
    color:var(--muted);
    cursor:pointer;
    font-family:inherit;
}

.toggle-btn.active{
    background:var(--accent);
    color:#000;
}

.vtf-preview{
    position:fixed;
    left:12px;
    bottom:12px;
    background:rgba(0,0,0,0.85);
    padding:8px 10px;
    border:1px solid #3a3a3a;
    border-radius:6px;
    z-index:999;
    display:none;
    transform:scale(2);
    transform-origin:bottom left;
    max-width:220px;
}

.vtf-preview-title{
    font-size:12px;
    color:var(--muted);
    margin-bottom:4px;
}

.vtf-preview-name{
    font-size:13px;
    margin-bottom:4px;
    word-break:break-all;
}

.vtf-preview-meta{
    font-size:11px;
    color:var(--muted);
    margin-bottom:6px;
}

.vtf-preview img{
    width:100%;
    max-height:180px;
    object-fit:contain;
    background:#000;
    border-radius:8px;
}

footer{
    margin:26px 18px 40px;
    color:var(--muted);
    font-size:12px;
    display:flex;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:10px;
    background:radial-gradient(800px 400px at 20% 120%, #0f1923 0%, #000 55%) no-repeat;
    padding:20px;
    border-radius:16px;
}

.sig{
    opacity:.8;
}