/* FreeAR - Ultra-Minimal & Compact WebAR Tracing Stylesheet */

:root {
  --bg-dark: #090d16;
  --panel-bg: rgba(17, 24, 39, 0.82);
  --panel-bg-dense: rgba(17, 24, 39, 0.94);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-border-bright: rgba(255, 255, 255, 0.22);
  --panel-border-glow: rgba(59, 130, 246, 0.5);
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-gold: #f59e0b;
  --accent-gold-bg: rgba(245, 158, 11, 0.2);
  --accent-emerald: #10b981;
  --accent-emerald-bg: rgba(16, 185, 129, 0.2);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --radius-pill: 9999px;
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --safe-bottom: env(safe-area-inset-bottom, 12px);
  --safe-top: env(safe-area-inset-top, 12px);

  /* iOS 18 & Android 15 Fluid Spring Motion Physics */
  --spring-bouncy: cubic-bezier(0.32, 1.4, 0.6, 1);
  --spring-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --spring-snappy: cubic-bezier(0.2, 0.9, 0.2, 1);
  --glass-blur: blur(32px) saturate(190%);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  touch-action: none;
}

/* App Viewport Container */
#app-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 1. Camera Video Feed Layer */
#camera-feed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  background: #000000;
  transform-origin: center center;
  transition: transform 0.15s var(--spring-smooth);
}

/* Fallback Camera Placeholder */
#camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

#camera-placeholder.visible {
  display: flex;
}

.placeholder-icon {
  font-size: 44px;
  margin-bottom: 12px;
  opacity: 0.85;
}

.placeholder-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.placeholder-desc {
  font-size: 13px;
  max-width: 300px;
  line-height: 1.4;
}

/* Camera Error / Permission Banner */
#camera-error-banner {
  position: absolute;
  top: calc(var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: none;
  align-items: center;
  gap: 12px;
  background: rgba(220, 38, 38, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  max-width: 90vw;
}

#camera-error-banner.visible {
  display: flex;
}

.btn-banner-action {
  background: #ffffff;
  color: #991b1b;
  border: none;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

/* 2. AR Drawing Overlay Layer */
#overlay-viewport {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: none;
}

#overlay-container {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  will-change: transform, opacity;
  transform-origin: center center;
  pointer-events: auto;
  touch-action: none;
}

#overlay-canvas {
  display: block;
  max-width: 92vw;
  max-height: 82vh;
  pointer-events: none;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.4));
}

#overlay-container.is-locked {
  cursor: default;
}

/* Lock Notification Badge */
#lock-badge {
  position: absolute;
  top: calc(var(--safe-top) + 54px);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(245, 158, 11, 0.9);
  color: #1a1003;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#lock-badge.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#lock-badge.pulse {
  animation: badge-shake 0.4s ease;
}

@keyframes badge-shake {
  0%, 100% { transform: translateX(-50%) scale(1); }
  25% { transform: translateX(calc(-50% - 4px)) scale(1.04); }
  75% { transform: translateX(calc(-50% + 4px)) scale(1.04); }
}

/* 4-Corner Perspective Anchor Quad & Handles Layer */
.anchor-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.anchor-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.anchor-polygon {
  fill: rgba(56, 189, 248, 0.09);
  stroke: rgba(56, 189, 248, 0.85);
  stroke-width: 2;
  stroke-dasharray: 8 5;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.45));
}

.corner-pin {
  position: absolute;
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
  user-select: none;
  z-index: 22;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.corner-pin:hover {
  filter: brightness(1.2);
}

.corner-pin:active,
.corner-pin.is-dragging {
  cursor: grabbing;
  z-index: 28;
  transform: translate(-50%, -50%) scale(1.18);
}

.pin-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid #38bdf8;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.6), inset 0 0 8px rgba(56, 189, 248, 0.25);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.corner-pin:active .pin-ring,
.corner-pin.is-dragging .pin-ring {
  border-color: #7dd3fc;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.85), inset 0 0 12px rgba(56, 189, 248, 0.45);
}

.pin-crosshair-h {
  position: absolute;
  width: 22px;
  height: 1.5px;
  background: rgba(56, 189, 248, 0.9);
  pointer-events: none;
}

.pin-crosshair-v {
  position: absolute;
  width: 1.5px;
  height: 22px;
  background: rgba(56, 189, 248, 0.9);
  pointer-events: none;
}

.pin-center-dot {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px #38bdf8;
  pointer-events: none;
}

.pin-label {
  position: absolute;
  bottom: -18px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #7dd3fc;
  background: rgba(15, 23, 42, 0.85);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  pointer-events: none;
}

/* Touch Offset / Magnifier Loupe */
.anchor-magnifier {
  position: absolute;
  width: 76px;
  height: 76px;
  transform: translate(-50%, -100%) translateY(-26px);
  pointer-events: none;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: center;
}

.magnifier-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid #38bdf8;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.65), 0 0 18px rgba(56, 189, 248, 0.45);
}

.magnifier-crosshair-h {
  position: absolute;
  width: 34px;
  height: 1.5px;
  background: #38bdf8;
  z-index: 2;
}

.magnifier-crosshair-v {
  position: absolute;
  width: 1.5px;
  height: 34px;
  background: #38bdf8;
  z-index: 2;
}

.magnifier-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px #38bdf8;
  z-index: 3;
}

.magnifier-coords {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #f0f9ff;
  background: rgba(15, 23, 42, 0.92);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 4;
}

/* Plane Angle Calibration Grid in Adjust Popover */
.angle-sliders-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

.angle-slider-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.angle-slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Active Anchor button glowing states */
#btn-anchor-mode.active,
#dock-btn-anchor.active {
  background: rgba(56, 189, 248, 0.25);
  border-color: #38bdf8;
  color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.4);
}

/* Floating Clean Mode Restore Button */
.clean-mode-pill {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: 14px;
  z-index: 40;
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(17, 24, 39, 0.76);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border-bright);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.25s var(--spring-bouncy), background 0.2s ease, box-shadow 0.2s ease;
}

.clean-mode-pill:active {
  transform: scale(0.92);
  background: rgba(30, 41, 59, 0.9);
}

.clean-mode-pill.visible {
  display: flex;
  animation: clean-pill-enter 0.35s var(--spring-bouncy) forwards;
}

@keyframes clean-pill-enter {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 3. Sleek Floating Micro-HUD */
#hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  transition: opacity 0.28s var(--spring-smooth), transform 0.32s var(--spring-smooth);
  padding: calc(var(--safe-top) + 8px) 12px calc(var(--safe-bottom) + 8px) 12px;
}

#hud.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
}

/* Top Floating Bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  pointer-events: auto;
  gap: 8px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.25s var(--spring-bouncy);
}

.brand-badge:active {
  transform: scale(0.94);
}

.brand-icon {
  font-size: 14px;
}

.brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Minimalist Codelogiic Link-Back Badge */
.codelogiic-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.25s var(--spring-bouncy), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.codelogiic-badge:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--panel-border-bright);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.codelogiic-badge:active {
  transform: scale(0.92);
}

.codelogiic-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  opacity: 0.88;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  transition: transform 0.25s var(--spring-bouncy), opacity 0.2s ease;
}

.codelogiic-badge:hover .codelogiic-icon {
  transform: scale(1.1);
  opacity: 1;
}

.codelogiic-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.codelogiic-badge:hover .codelogiic-text {
  color: #ffffff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Lens Toggle Pill (0.5x / 1x) */
.lens-toggle-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  min-height: 38px;
  min-width: 54px;
  justify-content: center;
  transition: transform 0.25s var(--spring-bouncy), background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.lens-toggle-pill:active {
  transform: scale(0.92);
}

.lens-toggle-pill.active-ultrawide {
  background: rgba(6, 182, 212, 0.22);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.lens-icon {
  font-size: 13px;
}

.lens-label {
  letter-spacing: 0.5px;
}

/* Camera Zoom Pill [🔍 1.0x] */
.camera-zoom-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  min-height: 38px;
  min-width: 58px;
  justify-content: center;
  transition: transform 0.25s var(--spring-bouncy), background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.camera-zoom-pill:active {
  transform: scale(0.92);
}

.camera-zoom-pill.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--accent-blue);
  color: #93c5fd;
  box-shadow: 0 0 14px rgba(59, 130, 246, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.zoom-icon {
  font-size: 13px;
}

.zoom-label {
  letter-spacing: 0.5px;
}

/* Expandable Camera Zoom Drawer (Below Top Bar) */
.camera-zoom-drawer {
  display: none;
  pointer-events: auto;
  align-self: center;
  margin-top: 8px;
  width: min(94vw, 420px);
  background: var(--panel-bg-dense);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  padding: 12px 14px;
  animation: zoom-drawer-enter 0.28s var(--spring-bouncy) forwards;
  z-index: 36;
}

.camera-zoom-drawer.open {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@keyframes zoom-drawer-enter {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.zoom-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zoom-drawer-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

.zoom-drawer-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease;
}

.zoom-drawer-close:active {
  transform: scale(0.9);
}

.zoom-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.zoom-chips-row::-webkit-scrollbar {
  display: none;
}

.zoom-chip-btn {
  flex: 1;
  min-height: 36px;
  min-width: 44px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease, border-color 0.15s ease;
}

.zoom-chip-btn:active {
  transform: scale(0.92);
}

.zoom-chip-btn.active {
  background: rgba(59, 130, 246, 0.3);
  border-color: var(--accent-blue);
  color: #93c5fd;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.35);
}

.zoom-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-zoom-step {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: transform 0.15s var(--spring-bouncy), background 0.15s ease;
}

.btn-zoom-step:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.2);
}

.zoom-val-badge {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #93c5fd;
  min-width: 38px;
  text-align: right;
}

/* Top action icon buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  border-radius: var(--radius-pill);
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 0.25s var(--spring-bouncy), background 0.15s ease, border-color 0.15s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--panel-border-bright);
}

.btn-icon:active {
  transform: scale(0.92);
}

.btn-icon.active {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-gold);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

/* 4. Popovers Layer (Compact Drawer Cards) */
#popovers-container {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 120px);
  left: 50%;
  transform: translateX(-50%);
  width: min(94vw, 420px);
  pointer-events: none;
  z-index: 35;
}

.dock-popover {
  display: none;
  pointer-events: auto;
  background: var(--panel-bg-dense);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border-bright);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  padding: 14px;
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  transform-origin: bottom center;
  transition: opacity 0.26s var(--spring-smooth), transform 0.32s var(--spring-bouncy);
}

.dock-popover.open {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.popover-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-main);
}

.popover-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease, color 0.15s ease;
}

.popover-close:active {
  transform: scale(0.92);
}

.popover-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Tool sections inside Transform popover */
.popover-tool-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 50px;
}

.tool-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
}

.btn-action {
  flex: 1;
  min-height: 36px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease, border-color 0.15s ease;
}

.btn-action:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.18);
}

.btn-action.active {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--accent-blue);
  color: #93c5fd;
}

.btn-action-accent {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

.tool-section-header {
  display: flex;
  flex-direction: column;
  min-width: 68px;
}

.section-hint {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.2px;
}

.btn-zoom-hold {
  min-height: 42px;
  font-size: 16px;
  font-weight: 700;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.popover-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 4px;
}

/* Filter pills grid inside Filters popover */
.filter-pills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.btn-filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 6px;
  min-height: 52px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-filter .filter-icon {
  font-size: 16px;
}

.btn-filter:active {
  transform: scale(0.92);
}

.btn-filter.active {
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--accent-blue);
  color: var(--text-main);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
}

/* Filter sensitivity slider */
#filter-settings {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#filter-settings.visible {
  display: flex;
}

.filter-slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-setting-label {
  font-size: 11px;
  color: var(--text-muted);
}

.filter-val-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
}

/* Image & Samples Popover */
.upload-button-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(37, 99, 235, 0.3) 100%);
  border: 1px dashed rgba(59, 130, 246, 0.6);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease;
}

.upload-button-compact:active {
  transform: scale(0.92);
  background: rgba(59, 130, 246, 0.4);
}

.samples-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 4px;
}

.samples-pill-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.sample-pill-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease, border-color 0.15s ease;
}

.sample-pill-btn:active {
  transform: scale(0.92);
}

.sample-pill-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--accent-emerald);
  color: #6ee7b7;
}

.upload-hint {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.8;
  margin-top: 2px;
}

/* 5. Bottom Floating Micro-Deck */
.bottom-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  pointer-events: none;
}

/* Slim Tactile Opacity Bar */
.opacity-pill-bar {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(94vw, 420px);
  min-height: 38px;
  padding: 4px 12px;
  background: var(--panel-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.25s var(--spring-bouncy), border-color 0.2s ease;
}

.opacity-icon {
  font-size: 13px;
  opacity: 0.85;
}

.slider-mode-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease, border-color 0.15s ease;
}

.slider-mode-btn:active {
  transform: scale(0.9);
}

.slider-mode-btn.mode-scale {
  background: rgba(59, 130, 246, 0.25);
  border-color: var(--accent-blue);
}

.slider-container {
  flex: 1;
  display: flex;
  align-items: center;
}

/* Custom range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), box-shadow 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.35);
  box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.28), 0 4px 12px rgba(0, 0, 0, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), box-shadow 0.2s ease;
}

input[type="range"]::-moz-range-thumb:active {
  transform: scale(1.35);
  box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.28), 0 4px 12px rgba(0, 0, 0, 0.6);
}

.opacity-val-badge {
  font-size: 11px;
  font-weight: 700;
  min-width: 32px;
  text-align: right;
  color: var(--text-main);
}

.opacity-presets {
  display: flex;
  align-items: center;
  gap: 3px;
}

.preset-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 0.2s var(--spring-bouncy), background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.preset-pill:active {
  transform: scale(0.92);
}

.preset-pill.active {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* Compact Quick Actions Micro-Dock */
.micro-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: min(94vw, 360px);
  min-height: 52px;
  padding: 4px 6px;
  background: var(--panel-bg-dense);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border-bright);
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateZ(0);
}

.dock-btn {
  flex: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  border-radius: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: transform 0.25s var(--spring-bouncy), background 0.15s ease, color 0.15s ease;
  padding: 4px 2px;
}

.dock-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.dock-btn:active {
  transform: scale(0.92);
}

.dock-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

.dock-icon {
  font-size: 16px;
  line-height: 1;
}

.dock-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Lock Button glowing state & liquid aura pulse */
@keyframes lock-pulse-aura {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6), 0 0 12px rgba(245, 158, 11, 0.35);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(245, 158, 11, 0), 0 0 20px rgba(245, 158, 11, 0.6);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0), 0 0 12px rgba(245, 158, 11, 0.35);
  }
}

.btn-lock-toggle.is-locked {
  background: rgba(245, 158, 11, 0.24);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.7);
  animation: lock-pulse-aura 2.4s infinite cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-lock-toggle.is-locked .dock-label {
  color: #fbbf24;
}

/* Ultrawide dock indicator state */
#dock-btn-lens.active-ultrawide {
  color: #38bdf8;
  background: rgba(6, 182, 212, 0.22);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}

/* 6. Drag and Drop Overlay Indicator */
#drop-zone {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(9, 13, 22, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 3px dashed var(--accent-blue);
  color: var(--text-main);
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#drop-zone.active {
  display: flex;
}

.drop-zone-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.drop-zone-text {
  font-size: 16px;
  font-weight: 600;
}

/* 7. Toast Pill Notification */
#toast {
  position: absolute;
  top: calc(var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%) translateY(-12px) scale(0.95);
  z-index: 60;
  background: rgba(17, 24, 39, 0.94);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--panel-border-bright);
  color: var(--text-main);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--spring-smooth), transform 0.3s var(--spring-bouncy);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* Screen size adjustments */
@media (max-width: 360px) {
  .dock-label {
    display: none;
  }
  .dock-btn {
    min-height: 40px;
  }
  .opacity-presets {
    display: none;
  }
}
