:root{
  --bg: #0b0c10;
  --panel: rgba(255,255,255,0.06);
  --panel2: rgba(255,255,255,0.08);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);
  --border: rgba(255,255,255,0.12);
  --border2: rgba(255,255,255,0.18);
  --radius: 16px;
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:
    radial-gradient(1100px 650px at 15% -10%, rgba(120,80,255,0.25), transparent 60%),
    radial-gradient(900px 650px at 110% 0%, rgba(0,220,255,0.18), transparent 50%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(11,12,16,0.92), rgba(11,12,16,0.68));
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom: 10px;
}

.logo{
  width: 42px; height: 42px;
  border-radius: 14px;
  display:grid; place-items:center;
  font-weight: 850;
  background: linear-gradient(135deg, rgba(255,255,255,0.20), rgba(255,255,255,0.06));
  border: 1px solid var(--border2);
}

.title{ font-weight: 800; letter-spacing: 0.2px; }
.subtitle{ color: var(--muted); font-size: 13px; margin-top: 2px; }

.legend{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}

.legend-empty, .legend-more{
  color: var(--muted);
  font-size: 12px;
}

.legend-item{
  display:inline-flex;
  gap:8px;
  align-items:center;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.20);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 10px;
  cursor: pointer;
}
.legend-item:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.22);
}

.swatch{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--sw);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

.name{
  font-size: 12.5px;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage{
  height: calc(100vh - 120px);
  display:grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
  padding: 12px;
}

.canvas-wrap{
  position: relative;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
}

canvas{
  width: 100%;
  height: 100%;
  display:block;
}

.hud{
  position:absolute;
  left: 12px;
  bottom: 12px;
  display:flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.hud-row{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill{
  font-size: 12px;
  color: rgba(255,255,255,0.88);
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
}

.hint{
  font-size: 12px;
  color: var(--muted);
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  padding: 8px 10px;
}

.inspector{
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  overflow: hidden;
  display:flex;
  flex-direction: column;
  min-width: 280px;
}

.inspector-head{
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.22);
}

.inspector-title{
  font-weight: 800;
  overflow:hidden;
  white-space:nowrap;
  text-overflow: ellipsis;
}

.xbtn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 7px 10px;
  cursor:pointer;
}
.xbtn:hover{ background: rgba(255,255,255,0.10); }

.inspector-body{
  padding: 12px;
  overflow:auto;
}

.muted{ color: var(--muted); }

.kv{
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 10px;
  background: rgba(0,0,0,0.20);
}
.k{ color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.v{ font-size: 13px; line-height: 1.35; word-break: break-word; white-space: pre-wrap; }

.tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top: 8px;
}

.tag{
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(0,0,0,0.18);
}
.tag::before{
  content:"";
  width: 9px; height: 9px;
  border-radius: 999px;
  display:inline-block;
  margin-right: 7px;
  background: var(--c, rgba(255,255,255,0.55));
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
  vertical-align: -1px;
}

a.link{
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255,255,255,0.30);
}
a.link:hover{ border-bottom-color: rgba(255,255,255,0.60); }

@media (max-width: 980px){
  .stage{
    grid-template-columns: 1fr;
    height: auto;
  }
  .canvas-wrap{ height: 60vh; }
}