.bar [data-tool-icon] {
  display: inline-grid;
  place-items: center;
  gap: 2px;
  min-width: 36px;
  padding: 4px 6px;
  font-size: 10px;
  white-space: nowrap;
}
[data-tool-icon] > svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.bar [data-tool-icon]:disabled { opacity: .43; }
.bar .selection-material { display: flex; gap: 3px; }
.bar .selection-material button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 11px; }
.bar .selection-material [aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.selection-material kbd { font: 10px var(--font-num); color: var(--muted); }
.material-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 1px solid var(--accent); }
.material-hole { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--muted) 2px 3px); border-color: var(--muted); }
#selection-rectangle { position: absolute; z-index: 7; pointer-events: none; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.box-select-mode #cv { cursor: crosshair; }
#view.box-select-mode :is(#handles *, #rotation-overlay .ring-hit, #rotation-input, #deform-handles *, #ruler-labels *, #note-markers *) { pointer-events: none; }
#b-box-select[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.palette-tools { gap: 4px; margin-bottom: 12px; }
.palette-tools [data-tool-icon] {
  padding: 6px 0;
  border-radius: 6px;
  font-size: 11px;
}
.palette-tools [data-tool-icon] svg { width: 28px; height: 28px; }
.palette-tools [data-tool-icon]:hover, .palette-tools [aria-pressed="true"] { background: var(--accent-soft); }
.palette-filter, .shelf-drawing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-block: 10px 7px;
}
.palette-filter select { min-width: 0; padding: 6px; font: inherit; }
#palette-search { padding: 6px; }
.shelf-drawing { grid-template-columns: repeat(2,minmax(0,1fr)); }
.shelf-drawing .btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px; min-width: 0; font-size: 11px; }
.shelf-drawing svg { flex: none; width: 15px; height: 15px; }
.shape-card { position: relative; min-width: 0; }
.shape-favorite {
  position: absolute; top: 1px; right: 1px; width: 24px; height: 24px;
  padding: 1px; border: 0; border-radius: 6px;
  background: var(--surface); color: #778998; cursor: pointer; opacity: 0;
}
.shape-card:hover .shape-favorite, .shape-favorite:focus-visible, .shape-favorite[aria-pressed="true"] { opacity: 1; }
.shape-favorite[aria-pressed="true"] { color: #976309; background: #fff2c6; }
.shape-empty { padding: 10px 2px; font-size: 12px; color: var(--muted); }
.shelf-toggle { position: absolute; top: 16px; right: 9px; z-index: 9; padding: 2px 6px; font-size: 23px; line-height: 1; }
main.shelf-closed { grid-template-columns: minmax(0, 1fr) 0; }
.shelf-closed .panel { right: 40px; }
#note-markers { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 6; }
.note-marker {
  pointer-events: auto; position: absolute; transform: translate(6px, calc(-100% - 6px));
  max-width: 155px; border: 1px solid #c59138; border-radius: 5px 5px 5px 0; padding: 4px 8px;
  background: #fff1cc; color: #583f1a; font: inherit;
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden; cursor: pointer;
}
#note-editor {
  width: min(420px, calc(100vw - 30px)); padding: 18px;
  color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
#note-editor::backdrop { background: #253d5350; }
#note-editor form { display: grid; gap: 10px; }
#note-editor h3 { margin: 0; }
#note-editor .row { justify-content: flex-end; }
#note-editor textarea { resize: vertical; }
@media (hover: none) { .shape-favorite { opacity: 1; } }
@media (max-width: 820px) {
  .palette-tools [data-tool-icon] { font-size: 10px; }
  .palette-tools [data-tool-icon] svg { width: 20px; height: 20px; }
}
@media (max-width: 540px) {
  .palette-tools [data-tool-icon] { font-size: 9px; }
  .shelf-drawing { grid-template-columns: 1fr; }
  .bar [data-tool-icon] { min-width: 33px; }
}
