* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #16171a;
  color: #e6e6e6;
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body { display: flex; }

#sidebar {
  width: 240px;
  flex: none;
  padding: 16px;
  background: #1e1f23;
  border-right: 1px solid #2c2e33;
  overflow-y: auto;
}

h1 { font-size: 16px; margin: 0 0 14px; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #888; margin: 20px 0 8px; }

.muted { color: #888; }
.small { font-size: 11px; }

button, .button, select {
  font: inherit;
  color: inherit;
  background: #2a2c31;
  border: 1px solid #383a40;
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
}
button:hover, .button:hover { background: #33353b; }
.button { display: inline-block; }
.primary { background: #3b6cf6; border-color: #3b6cf6; color: #fff; }
.primary:hover { background: #4a78f7; }
.primary.pulse { animation: pulse .6s ease 2; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(59, 108, 246, .4); } }

#library { list-style: none; margin: 0; padding: 0; }
#library li {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
#library li:hover { background: #26282d; }
#library li.active { border-color: #3b6cf6; background: #232838; }
#library .thumb {
  width: 64px;
  height: 40px;
  flex: none;
  border-radius: 4px;
  background: #2a2c31 center / cover no-repeat;
}
#library .meta { min-width: 0; flex: 1; }
#library .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#library .progress { height: 3px; background: #2a2c31; border-radius: 2px; margin-top: 4px; overflow: hidden; }
#library .progress > div { height: 100%; background: #3b6cf6; width: 0; transition: width .2s; }

#stage { position: relative; flex: 1; min-width: 0; }

#canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#stage.tool-draw #canvas { cursor: crosshair; }
#stage.tool-select #canvas { cursor: default; }
#stage.panning #canvas { cursor: grabbing; }

#toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: none;
}
#toolbar .group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(30, 31, 35, .92);
  border: 1px solid #2c2e33;
  border-radius: 8px;
  pointer-events: auto;
}
#toolbar label { display: flex; align-items: center; gap: 6px; }
.tool.active { background: #3b6cf6; border-color: #3b6cf6; color: #fff; }

#tooltip {
  position: absolute;
  pointer-events: none;
  padding: 3px 7px;
  background: rgba(0, 0, 0, .8);
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}

#toast {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  background: #3b2a2a;
  border: 1px solid #6b3a3a;
  border-radius: 8px;
}

#preview {
  position: absolute;
  right: 16px;
  bottom: 48px;
  width: 420px;
  background: #1e1f23;
  border: 1px solid #383a40;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.preview-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; }
.preview-head button { padding: 2px 8px; }
#preview video { display: block; width: 100%; background: #000; }

#hints {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  color: #777;
  font-size: 11px;
  pointer-events: none;
}
