:root {
  --bg: #0f0c29;
  --bg-2: rgba(19, 23, 44, 0.88);
  --bg-3: rgba(31, 37, 66, 0.82);
  --border: rgba(143, 154, 208, 0.28);
  --text: #e9eeff;
  --dim: #9da9d4;
  --primary: #64ffda;
  --primary-2: #4facfe;
  --warn: #ff7b72;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(900px 580px at 15% -10%, rgba(79, 172, 254, 0.25), transparent 60%),
    radial-gradient(860px 520px at 85% 0%, rgba(100, 255, 218, 0.18), transparent 65%),
    linear-gradient(135deg, #0f0c29 0%, #1f1b45 45%, #161730 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(16, 21, 40, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.brand { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.brand span { color: var(--primary); }
.desc { margin-top: 4px; font-size: 12px; color: var(--dim); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: rgba(16, 21, 40, 0.72);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.sep { width: 1px; height: 22px; background: var(--border); }

button, input, select {
  border-radius: 8px;
  border: 1px solid var(--border);
}

button {
  height: 36px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0 12px;
  background: linear-gradient(90deg, var(--primary-2), var(--primary));
  color: #0f1833;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

.ghost-btn {
  background: rgba(79, 172, 254, 0.14);
  color: #b9dcff;
  border: 1px solid rgba(79, 172, 254, 0.35);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-name {
  color: var(--dim);
  font-size: 12px;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.label-inline {
  font-size: 12px;
  color: var(--dim);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-bar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(16, 21, 40, 0.68);
}

.status {
  color: var(--dim);
  font-size: 12px;
}

.status.error { color: var(--warn); }

.workspace {
  height: calc(100vh - 140px);
  min-height: 440px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 10px;
  padding: 10px;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-3);
  min-height: 0;
  overflow: hidden;
}

.stats-panel {
  padding: 12px;
  overflow: auto;
}

.panel-title {
  font-size: 14px;
  color: #c5d2ff;
  margin-bottom: 10px;
}

.panel-subtitle {
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 12px;
  color: #b6c6f8;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(8, 12, 28, 0.55);
  padding: 8px;
}

.item span {
  display: block;
  font-size: 11px;
  color: var(--dim);
}

.item b {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.color-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(8, 12, 28, 0.55);
  padding: 8px;
  font-size: 12px;
}

.color-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 0;
}

.color-chip {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
}

.color-list.empty { color: var(--dim); }

.hint {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 8px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.6;
}

.canvas-panel {
  position: relative;
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #0b1024;
  cursor: grab;
}

#canvas.dragging {
  cursor: grabbing;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 270px 1fr;
    height: auto;
  }

  .brand { font-size: 18px; }
  .desc { display: none; }
}
