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

body {
  display: flex;
  height: 100vh;
  overflow: hidden;
  font-family: 'Space Mono', monospace;
  background: #0a0a0a;
  color: #e0e0e0;
}

/* ── Canvas area ── */
#canvas-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
  overflow: hidden;
}

#canvas-container canvas {
  display: block;
}

#drop-zone {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #666;
  font-size: 13px;
  pointer-events: none;
  z-index: 5;
  transition: opacity 0.3s;
}

#drop-zone.hidden {
  opacity: 0;
  pointer-events: none;
}

#drop-zone .arrow {
  font-size: 28px;
  opacity: 0.4;
}

.drag-over #drop-zone {
  opacity: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 2px dashed #444;
}

/* ── Resize handle ── */
#resize-handle {
  width: 5px;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s;
  flex-shrink: 0;
}
#resize-handle:hover,
#resize-handle.active {
  background: #444;
}

/* ── Sidebar controls ── */
#controls {
  width: 280px;
  min-width: 200px;
  max-width: 40vw;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 16px 14px;
  background: #111;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

#controls::-webkit-scrollbar {
  width: 4px;
}

#controls::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 2px;
}

.tool-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: #fff;
}

.tool-sub {
  font-size: 9px;
  color: #555;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.section-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #555;
  margin-top: 12px;
  margin-bottom: 2px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.control-row label {
  font-size: 10px;
  color: #999;
  flex-shrink: 0;
  min-width: 70px;
}

.control-row .val {
  font-size: 10px;
  color: #666;
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── Range sliders ── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  background: #333;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: none;
  cursor: pointer;
}

/* ── Text input ── */
input[type="text"] {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 18px;
  text-align: center;
  padding: 6px 8px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus {
  border-color: #666;
}

/* ── Color input ── */
input[type="color"] {
  width: 32px;
  height: 32px;
  border: 2px solid #333;
  border-radius: 50%;
  cursor: pointer;
  background: none;
  padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
  border-radius: 50%;
  border: none;
}

input[type="color"]::-moz-color-swatch {
  border-radius: 50%;
  border: none;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.color-row label {
  font-size: 10px;
  color: #999;
}

/* ── Buttons ── */
button {
  padding: 8px 0;
  width: 100%;
  border: 1px solid #333;
  border-radius: 6px;
  background: #1a1a1a;
  color: #e0e0e0;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.5px;
}

button:hover {
  background: #222;
  border-color: #555;
}

.btn-primary {
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 700;
}

.btn-primary:hover {
  background: #ddd;
  border-color: #ddd;
}

.btn-row {
  display: flex;
  gap: 6px;
}

.btn-row button {
  flex: 1;
}

/* ── Toggle buttons ── */
.mode-toggle {
  display: flex;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.mode-btn {
  border: none !important;
  border-radius: 0 !important;
  flex: 1;
  font-size: 10px;
  padding: 6px 0;
  min-height: 30px;
}

.mode-btn.active {
  background: #fff !important;
  color: #000 !important;
}

.mode-btn:not(.active) {
  background: #1a1a1a !important;
  color: #888 !important;
}

.divider {
  border: none;
  border-top: 1px solid #1e1e1e;
  margin: 6px 0;
}

.info-text {
  font-size: 9px;
  color: #444;
  line-height: 1.5;
  margin-top: 4px;
}

/* ── Video controls ── */
.video-section {
  display: none;
}

.video-section.visible {
  display: block;
}

.video-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #666;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.video-playback-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.video-playback-row button {
  width: 36px;
  min-width: 36px;
  padding: 6px 0;
  font-size: 14px;
  text-align: center;
  flex-shrink: 0;
}

.video-playback-row input[type="range"] {
  flex: 1;
}

.btn-record {
  position: relative;
}

.btn-record.recording {
  background: #ff3333 !important;
  color: #fff !important;
  border-color: #ff3333 !important;
  animation: pulse-rec 1s ease-in-out infinite;
}

@keyframes pulse-rec {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* ── Image export section ── */
.image-export-section {
  display: block;
}

.image-export-section.hidden {
  display: none;
}

/* ── Video export section ── */
.video-export-section {
  display: none;
}

.video-export-section.visible {
  display: block;
}

.rec-settings {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.rec-settings select {
  flex: 1;
  background: #1a1a1a;
  color: #fff;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  outline: none;
}

.rec-progress-wrap {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.rec-progress-wrap.active {
  display: flex;
}

.rec-progress-bar {
  width: 100%;
  height: 4px;
  background: #222;
  border-radius: 2px;
  overflow: hidden;
}

.rec-progress-fill {
  height: 100%;
  background: #fff;
  width: 0%;
  transition: width 0.15s;
}

.rec-progress-text {
  font-size: 9px;
  color: #888;
  text-align: center;
}