:root{
  --bg: #0b0e11;
  --bg-2:#0e1217;
  --panel: rgba(255,255,255,.03);
  --border: rgba(255,255,255,.08);
  --muted:#9aa4b2;
  --text:#e7edf5;
  --headline:#f9fbff;
  --accent:#E63946;
  --accent-2:#cf3441;
  --ring: 0 0 0 2px #E6394659;
  --radius-lg:14px; --radius-md:10px; --radius-sm:8px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; color:var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, #141b2a 0%, transparent 60%) fixed,
    linear-gradient(180deg, var(--bg), var(--bg-2));
  font:14px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial;
}

.topbar{
  position:sticky; top:0; z-index:30;
  display:flex; flex-direction:column; gap:10px;
  padding:12px 16px;
  background: rgba(11,14,17,.7);
  backdrop-filter: blur(10px) saturate(120%);
  border-bottom:1px solid var(--border);
}
.brandwrap{ display:flex; align-items:center; gap:10px }
.brand{ width:28px; height:28px; object-fit:contain; border-radius:8px }
.title{ font-weight:700; color:var(--headline); letter-spacing:.2px }

.toolbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
}

.btn{
  appearance:none; border:1px solid var(--border);
  background: var(--panel);
  color:var(--text); padding:8px 12px;
  border-radius: var(--radius-sm);
  font-weight:600; cursor:pointer;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover{ background: rgba(255,255,255,.05); transform: translateY(-1px) }
.btn:active{ transform: translateY(0) scale(.98) }
.btn.outline{ border-color: #E6394673; color: var(--accent) }
.btn.ghost{ background: transparent }
.btn.file{ border-style:dashed }
.btn:focus-visible{ outline:none; box-shadow: var(--ring) }
.spacer{ flex:1 }

.workspace{
  display:grid; grid-template-columns: 1fr 340px; gap:16px;
  padding:16px; height: calc(100vh - 76px);
}

.stage{
  position:relative; border:1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow:hidden; min-height: 640px;
}
.canvas, canvas{ width:100%; height:100%; display:block }
.hud{
  position:absolute; left:12px; bottom:12px;
  color:var(--muted); font-size:12px;
  background: rgba(15,18,24,.55);
  border:1px solid var(--border);
  border-radius:10px; padding:6px 10px;
}

.sidebar{
  border:1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow:auto;
}
.card{ padding:14px }
.group{ margin-top:12px }
.row{ display:flex; align-items:center; justify-content:space-between; gap:10px; margin:8px 0 }
.checkbox{ display:flex; align-items:center; gap:8px; color:var(--muted) }

.slider{ gap:12px }
.slider span:first-child{ color:var(--text); font-weight:600; width:84px }
.mono{ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; color:var(--muted); width:44px; text-align:right }

input[type="range"]{
  -webkit-appearance:none; appearance:none; width:100%; height:6px;
  background:#0f1724; border:1px solid var(--border); border-radius:999px;
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; width:16px; height:16px; border-radius:50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #0b0e11;
  border:0;
}
input[type="checkbox"]{ width:16px; height:16px; accent-color: var(--accent) }

.sidebar.closed{ width:0; min-width:0; border-color:transparent; padding:0; overflow:hidden }
.workspace.collapsed{ grid-template-columns: 1fr 0 }

@media (max-width: 1100px){
  .workspace{ grid-template-columns: 1fr 300px }
}
@media (max-width: 900px){
  .workspace{ grid-template-columns: 1fr }
  .sidebar{ order:2; margin-top:12px; max-height: 46vh }
  .stage{ order:1; min-height: 60vh }
}
