/* ============================================
   Trace Draw — Styles
   ============================================ */

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

:root {
  --bg: #111111;
  --surface: #1a1a1a;
  --surface-hover: #242424;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #20808D;
  --accent-hover: #1a6b76;
  --radius: 10px;
  --toolbar-bg: rgba(12, 12, 12, 0.88);
  --toolbar-blur: 20px;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #000;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
}

.hidden {
  display: none !important;
}

/* ============================================
   Landing
   ============================================ */

.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  background: var(--bg);
}

.landing-content {
  text-align: center;
  max-width: 380px;
}

.logo {
  width: 260px;
  height: auto;
  color: var(--text);
  margin-bottom: 32px;
}

.landing-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.upload-btn:hover {
  background: var(--accent-hover);
}

.upload-btn:active {
  transform: scale(0.97);
}

.landing-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ============================================
   Editor
   ============================================ */

.editor {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
}

/* Camera feed — hidden by default, shown only when active */
#camera-feed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  display: none;
}

#camera-feed.camera-active {
  display: block;
}

/* Overlay canvas sits on top of everything */
#overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* ============================================
   Status Banner
   ============================================ */

.status-banner {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(12, 12, 12, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  z-index: 50;
  white-space: nowrap;
  transition: opacity 0.4s;
}

.status-banner.fade-out {
  opacity: 0;
}

/* ============================================
   Toolbar
   ============================================ */

.toolbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 14px);
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--toolbar-bg);
  backdrop-filter: blur(var(--toolbar-blur));
  -webkit-backdrop-filter: blur(var(--toolbar-blur));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  z-index: 100;
  transition: opacity 0.3s, transform 0.3s;
}

.toolbar.toolbar-hidden {
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
}

/* Buttons */
.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.tool-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

.tool-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tool-btn.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* Slider */
.slider-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.02em;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border: 2px solid rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.1s;
}

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

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--accent);
  border: 2px solid rgba(0, 0, 0, 0.4);
  border-radius: 50%;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

/* Toolbar actions */
.toolbar-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 480px) {
  .toolbar {
    left: 10px;
    right: 10px;
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 10px);
  }

  .toolbar-row {
    gap: 6px;
  }

  .tool-btn {
    width: 34px;
    height: 34px;
  }

  .toolbar-actions {
    gap: 3px;
  }
}
