*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #f0ede8;
}

/* ── Top Bar ── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 100;
  background: rgba(254, 249, 240, 0.98);
  border-bottom: 1px solid #e8dece;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Brand ── */
#brand {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  pointer-events: none;
}

#brand-icon {
  flex-shrink: 0;
}

#brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

#brand-title {
  font-size: 14px;
  font-weight: 600;
  font-family: system-ui, sans-serif;
  color: #2a2a2a;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

#brand-desc {
  font-size: 11px;
  font-family: system-ui, sans-serif;
  color: #a09988;
  line-height: 1.2;
}

/* ── Canvas Area ── */
#canvas-area {
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

/* ── Canvas ── */
#canvas {
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ── Toolbar ── */
#toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 40px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10), 0 1px 3px rgba(0, 0, 0, 0.06);
  user-select: none;
}

/* ── Divider ── */
#divider {
  width: 1px;
  height: 28px;
  background: #e0ddd8;
  flex-shrink: 0;
}

/* ── Brush Sizes ── */
#sizes {
  display: flex;
  align-items: center;
  gap: 6px;
}

.size-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
  outline: none;
}

.size-btn:hover {
  background: #f0ede8;
}

.size-btn.active {
  border-color: #4361ee;
  background: #eef0fd;
}

.size-dot {
  display: block;
  border-radius: 50%;
  background: #1a1a1a;
  flex-shrink: 0;
}

/* ── Clear Button ── */
#clear-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  transition: background 0.15s ease, color 0.15s ease;
  outline: none;
}

#clear-btn:hover {
  background: #fde8e8;
  color: #e63946;
}

#clear-btn:active {
  background: #fcc;
}

/* ── Export Button ── */
#export-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888;
  transition: background 0.15s ease, color 0.15s ease;
  outline: none;
}

#export-btn:hover {
  background: #e8f4fd;
  color: #4361ee;
}

#export-btn:active {
  background: #cce0fa;
}

/* ── Colour Button ── */
#color-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  outline: none;
}

#color-btn:hover {
  background: #f0ede8;
}

#color-btn-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  pointer-events: none;
}

/* ── Colour Panel ── */
#color-panel {
  position: fixed;
  display: none;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.08);
  z-index: 300;
  transform: translateX(-50%);
}

#color-panel.open {
  display: flex;
}

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

.panel-swatches {
  display: flex;
  gap: 6px;
}

.panel-sep {
  height: 1px;
  background: #ede9e4;
}

/* ── Pen Swatches ── */
.pen-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pen-swatch:hover {
  transform: scale(1.15);
}

.pen-swatch.active {
  border-color: #333;
  transform: scale(1.2);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.pen-swatch[data-color="#ffffff"] {
  border-color: #ccc;
}

.pen-swatch[data-color="#ffffff"].active {
  border-color: #555;
}

/* ── Background Chips ── */
.bg-chip {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
  outline: none;
}

.bg-chip:hover {
  transform: scale(1.1);
}

.bg-chip.active {
  border-color: #4361ee;
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.25);
}
