html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0f1115;
  color: #e6e6e6;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

#app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 48px 1fr;
  grid-template-columns: 1fr;
}

#topbar {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid #232531;
  background: #141724;
}

#topbar .btn {
  background: #2a2e3f;
  border: 1px solid #3a3f55;
  color: #e6e6e6;
  padding: 6px 10px;
  margin-right: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  position: relative;
  overflow: hidden;
}

.divider { display: inline-block; width: 1px; height: 22px; background: #3a3f55; margin: 0 8px 0 4px; vertical-align: middle; }
.toggle-group .toggle { margin-right: 0; border-radius: 6px 0 0 6px; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
.toggle-group .toggle + .toggle { border-left: none; border-radius: 0 6px 6px 0; }
.toggle-group .toggle.active {
  background: #3a4a7a;
  border-color: #7aa2ff;
  box-shadow: 0 0 0 2px rgba(122,162,255,0.25) inset;
  color: #ffffff;
}

#topbar .btn input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

#topbar .hint {
  opacity: 0.8;
  font-size: 12px;
}

#canvas {
  grid-row: 2;
  position: relative;
  width: 100%;
  height: calc(100vh - 48px);
}

canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

#sidebar {
  position: absolute;
  top: 56px;
  right: 10px;
  z-index: 10;
}

.panel {
  position: absolute;
  top: 56px;
  left: 10px;
  width: 240px;
  max-height: calc(100vh - 66px);
  overflow: hidden;
  z-index: 10;
  background: rgba(20, 23, 36, 0.92);
  border: 1px solid #2a2e3f;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}

.panel-header {
  padding: 8px 10px;
  font-weight: 600;
  border-bottom: 1px solid #2a2e3f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.panel-header .select-all {
  font-weight: 400;
  font-size: 12px;
  opacity: 0.9;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.panel-body {
  overflow: auto;
  max-height: calc(100vh - 110px);
}

.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  border-bottom: 1px solid #1e2230;
}
.card-check { margin-right: 6px; cursor: pointer; }
.card-item:hover { background: #1a1e2b; }
.card-item.selected { background: #232a3f; }
.card-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-actions { display: flex; gap: 6px; opacity: 0.85; }
.icon-btn { background: #2a2e3f; border: 1px solid #3a3f55; color: #e6e6e6; border-radius: 6px; font-size: 11px; padding: 3px 6px; cursor: pointer; }
.icon-btn:hover { background: #32364a; }

.selection-outline {
  outline: 2px dashed #7aa2ff;
}
