* { box-sizing: border-box; }
body {
  margin: 0; background: #111; overflow: hidden;
  display: flex; height: 100vh;
  font: 13px/1.5 monospace; color: #ccc;
}
#canvas-wrap { flex: 1; position: relative; }
#canvas-wrap canvas { display: block; width: 100% !important; height: 100% !important; }

#info {
  position: absolute; top: 10px; left: 10px;
  color: #aaa; font-size: 12px;
  background: rgba(0,0,0,0.5); padding: 6px 10px; border-radius: 4px;
  pointer-events: none;
}
#tooltip {
  position: absolute; display: none;
  background: rgba(0,0,0,0.85); border: 1px solid #444;
  padding: 4px 8px; border-radius: 3px; font-size: 12px;
  pointer-events: none; white-space: nowrap;
}

/* ── Side panel ── */
#panel {
  width: 300px; min-width: 300px;
  background: #161616; border-left: 1px solid #2a2a2a;
  display: flex; flex-direction: column; overflow: hidden;
}
#panel-header {
  padding: 10px 12px 8px;
  border-bottom: 1px solid #2a2a2a;
  font-size: 12px; color: #888;
  display: flex; justify-content: space-between; align-items: center;
}
#panel-header span { font-size: 14px; font-weight: bold; color: #ccc; }

.section { padding: 10px 12px; border-bottom: 1px solid #222; }
.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #666; margin-bottom: 6px;
}

/* vertex list */
#sel-list {
  max-height: 180px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.sel-item {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 5px; border-radius: 3px;
  cursor: pointer; transition: background 0.1s;
}
.sel-item:hover { background: #222; }
.sel-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sel-label { flex: 1; }
.sel-remove { color: #555; cursor: pointer; }
.sel-remove:hover { color: #f66; }
#sel-empty { color: #444; font-size: 12px; padding: 4px 0; }

.btn {
  padding: 5px 10px; border: 1px solid #333; background: #222;
  color: #bbb; cursor: pointer; border-radius: 3px;
  font: 12px monospace; transition: all 0.15s;
}
.btn:hover { background: #2a2a2a; border-color: #555; color: #fff; }
.btn.danger:hover { border-color: #a33; background: #2a1010; color: #f88; }
.btn.primary { border-color: #06a; background: #0a2a3a; color: #4cf; }
.btn.primary:hover { background: #0d3348; border-color: #08c; }

/* analysis */
#analysis {
  font-size: 11px; line-height: 1.6;
  max-height: 200px; overflow-y: auto;
  white-space: pre-wrap; color: #aaa;
}

/* saved selections */
#saves-list { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; }
.save-row {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 4px; border-radius: 3px; border: 1px solid #222;
}
.save-row:hover { background: #1e1e1e; }
.save-name { flex: 1; color: #aaa; font-size: 12px; cursor: pointer; }
.save-name:hover { color: #4cf; }
.save-count { color: #555; font-size: 11px; }

.save-input-row { display: flex; gap: 6px; margin-top: 6px; }
#save-name-input {
  flex: 1; background: #1a1a1a; border: 1px solid #333;
  color: #ccc; padding: 4px 7px; border-radius: 3px; font: 12px monospace;
  outline: none;
}
#save-name-input:focus { border-color: #06a; }

/* scrollbars */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }

/* decomp */
.toggle-row { display:flex; align-items:center; gap:8px; margin-bottom:4px; }
.toggle-row label { flex:1; font-size:12px; cursor:pointer; }
input[type=range] { flex:1; accent-color:#08c; }
.swatch { width:10px; height:10px; border-radius:2px; flex-shrink:0; }
#decomp-cell-info { font-size:11px; color:#888; min-height:16px; margin-top:4px; white-space:pre; }
