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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #111;
  color: #fff;
  overflow: hidden;
  height: 100vh;
}

#app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
#sidebar {
  width: 300px;
  min-width: 300px;
  background: #1a1a1a;
  border-right: 1px solid #2a2a2a;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #2a2a2a;
}

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 11px;
  color: #666;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-content {
  flex: 1;
  padding: 20px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid #2a2a2a;
}

.divider {
  border: none;
  border-top: 1px solid #2a2a2a;
  margin: 20px 0;
}

/* Upload */
.upload-btn {
  display: block;
  text-align: center;
  padding: 12px 16px;
  background: #2a2a2a;
  border: 1px dashed #444;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  font-size: 13px;
  color: #ccc;
}

.upload-btn:hover {
  background: #333;
  border-color: #666;
  color: #fff;
}

.filename {
  font-size: 11px;
  color: #555;
  margin-top: 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Aspect ratio buttons */
.ratio-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.ratio-btn {
  padding: 8px 6px;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #888;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}

.ratio-btn:hover {
  background: #333;
  color: #ccc;
}

.ratio-btn.active {
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 600;
}

/* Sliders */
.control-group {
  margin-bottom: 18px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 12px;
  color: #aaa;
}

.slider-value {
  font-variant-numeric: tabular-nums;
  color: #ddd;
  font-size: 12px;
  min-width: 30px;
  text-align: right;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #333;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* Export */
.export-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.export-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.export-btn:not(:disabled):hover {
  opacity: 0.9;
}

/* Zoom controls */
#zoomControls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 4px 8px;
}

.zoom-btn {
  width: 28px;
  height: 28px;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 4px;
  color: #ccc;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}

.zoom-btn:hover {
  background: #444;
  color: #fff;
}

.zoom-level {
  font-size: 11px;
  color: #888;
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Main area */
#main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  position: relative;
  overflow: hidden;
}

#canvasWrap {
  display: none;
}

#canvasWrap.visible {
  display: block;
}

#canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  object-fit: contain;
}

#placeholder {
  color: #444;
  font-size: 14px;
  text-align: center;
}

#placeholder.hidden {
  display: none;
}
