:root {
  --bg-primary: #09090b;
  --bg-secondary: #18181b;
  --bg-card: rgba(39, 39, 42, 0.6);
  --border-color: #27272a;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --accent-gold: #d97706;
  /* Lightroom Amber */
  --accent-amber: #f59e0b;
  --font-family: 'Outfit', sans-serif;
  --header-height: 56px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.editor-app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

/* Header */
.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  flex-shrink: 0;
}

.app-header h2 {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hud-back-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.export-btn {
  background: var(--accent-gold);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

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

/* Viewport and screens */
.app-viewport {
  flex-grow: 1;
  position: relative;
  overflow: hidden;
}

.editor-view {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  display: flex;
  flex-direction: column;
}

.editor-view.active {
  opacity: 1;
  pointer-events: auto;
}

/* 1. Upload screen container */
.upload-container {
  margin: auto;
  width: 85%;
  max-width: 320px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.upload-art {
  font-size: 64px;
  filter: drop-shadow(0 4px 15px rgba(217, 119, 6, 0.3));
}

.upload-container h3 {
  font-size: 18px;
  font-weight: 800;
}

.upload-container p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.upload-box {
  width: 100%;
  height: 160px;
  border: 2px dashed var(--border-color);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  background: var(--bg-secondary);
  transition: border-color 0.2s;
}

.upload-box:hover {
  border-color: var(--accent-gold);
}

.upload-plus {
  font-size: 32px;
  color: var(--accent-gold);
}

/* 2. Workspace Layout */
.canvas-workspace-area {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #030303;
}

.canvas-layers-container {
  position: relative;
  background: #111;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

#editing-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

/* STICKERS / TEXT OVERLAYS LAYER - CRITICAL POINTER FIX */
.stickers-overlays-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Prevent blocking clicks under the stickers panel */
  overflow: hidden;
  z-index: 5;
}

.sticker-drag-item {
  position: absolute;
  user-select: none;
  cursor: move;
  font-size: 32px;
  line-height: 1;
  pointer-events: auto;
  /* Re-enable clicks specifically on the sticker */
  padding: 6px;
  border: 1px dashed transparent;
  display: inline-block;
  transform-origin: center;
}

.sticker-drag-item.selected {
  border-color: var(--accent-gold);
  background: rgba(217, 119, 6, 0.15);
}

.sticker-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--accent-gold);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  font-size: 10px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sticker-drag-item.selected .sticker-delete-btn {
  display: flex;
}

/* Bottom drawers */
.workspace-drawer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 16px;
  min-height: 140px;
  flex-shrink: 0;
}

.drawer-tab {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.drawer-tab.active {
  display: flex;
}

/* Sliders */
.sliders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.edit-slider {
  width: 100%;
  height: 5px;
  background: var(--border-color);
  border-radius: 3px;
  outline: none;
}

.edit-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-gold);
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Filters Scrollable */
.filters-scroller {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0;
}

.filters-scroller::-webkit-scrollbar {
  display: none;
}

.preset-card {
  flex-shrink: 0;
  width: 70px;
  height: 70px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: #111;
  transition: border-color 0.2s;
}

.preset-card.active {
  border-color: var(--accent-gold);
}

.preset-preview.norm {
  background: linear-gradient(135deg, #333, #666);
  color: #fff;
}

.preset-preview.vint {
  background: sepia(0.6);
  color: #ffeb3b;
}

.preset-preview.cyb {
  background: hue-rotate(280deg);
  color: #00ffff;
}

.preset-preview.gray {
  background: grayscale(1);
  color: #ccc;
}

.preset-preview.inv {
  background: invert(1);
  color: #000;
}

.preset-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Stickers tray */
.stickers-scroller {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0;
}

.stickers-scroller::-webkit-scrollbar {
  display: none;
}

.sticker-opt {
  font-size: 32px;
  cursor: pointer;
  transition: transform 0.2s;
}

.sticker-opt:active {
  transform: scale(1.3);
}

.text-watermark-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.text-watermark-row input {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
}

.text-watermark-row input:focus {
  border-color: var(--accent-gold);
}

.action-btn-small {
  background: var(--accent-gold);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-family);
  font-size: 12px;
  cursor: pointer;
}

/* Drawer menu navigations */
.drawer-nav {
  height: 48px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
}

.drawer-nav-tab {
  flex-grow: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-nav-tab.active {
  color: var(--accent-gold);
  background: rgba(255, 255, 255, 0.01);
  border-top: 2px solid var(--accent-gold);
}