:root {
  --bg-dark: #09090b;
  --panel-bg: rgba(24, 24, 27, 0.78);
  --panel-border: rgba(255, 255, 255, 0.12);
  --accent: #38bdf8;
  --accent-purple: #a855f7;
  --accent-pink: #ec4899;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --safe-bottom: env(safe-area-inset-bottom, 20px);
}

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

body, html {
  width: 100%;
  background-color: var(--bg-dark);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
}

body:has(#app), html:has(#app) {
  height: 100%;
  overflow: hidden;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #000;
  overflow: hidden;
}

/* Viewfinder Area */
.viewfinder-container {
  position: relative;
  flex: 1;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  padding: 6px;
}

.viewfinder-stage {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: min(calc(100vw - 16px), calc((100vh - 120px) * (613 / 793)));
  max-height: calc(100vh - 120px);
  aspect-ratio: 613 / 793;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050507;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: aspect-ratio 0.3s ease;
}

#camera-feed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
}

/* Offscreen & Composite Canvases */
#capture-canvas, #composite-canvas {
  display: none;
}

/* Live Viewfinder Logo Overlay Preview */
.viewfinder-logo-overlay {
  position: absolute;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 10;
  max-width: 50%;
  max-height: 50%;
  display: none;
}

.viewfinder-logo-overlay.visible {
  display: block;
}

.viewfinder-logo-overlay img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

.viewfinder-text-overlay {
  position: absolute;
  pointer-events: none;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 2px 6px rgba(0,0,0,0.8);
  z-index: 10;
  padding: 8px 16px;
  display: none;
}

.viewfinder-text-overlay.visible {
  display: block;
}

/* Live Photobooth Frame Overlay */
.viewfinder-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  display: none;
  box-sizing: border-box;
}

.viewfinder-frame-overlay.visible {
  display: block;
}

/* Virtual Backdrops */
.bg-none { background: #09090b !important; }
.bg-studio { background: radial-gradient(circle at 50% 35%, #334155 0%, #1e293b 50%, #090d16 100%) !important; }
.bg-neon { background: linear-gradient(180deg, #0f051d 0%, #20083b 60%, #3b0764 100%) !important; }
.bg-golden { background: linear-gradient(135deg, #fdba74 0%, #fb923c 50%, #431407 100%) !important; }
.bg-chroma { background: #00ff00 !important; }
.bg-blur { background: radial-gradient(circle, #3f3f46 0%, #18181b 80%) !important; filter: blur(6px); }

/* Live Photobooth Frame Overlay System (10 Presets) */
.viewfinder-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  display: none;
  box-sizing: border-box;
}

.viewfinder-frame-overlay.visible {
  display: block;
}

/* 1. Classic Polaroid */
.frame-polaroid-box {
  position: absolute;
  inset: 0;
  border-top: 18px solid #ffffff;
  border-left: 18px solid #ffffff;
  border-right: 18px solid #ffffff;
  border-bottom: 74px solid #ffffff;
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.frame-polaroid-text {
  position: absolute;
  bottom: -56px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: cursive, 'Segoe Script', sans-serif;
  font-style: italic;
  font-weight: 700;
  font-size: 16px;
  color: #1e293b;
  letter-spacing: 0.5px;
}

/* 2. VIP Golden Summit */
.frame-summit-box {
  position: absolute;
  inset: 14px;
  border: 4px solid #f59e0b;
  box-shadow: inset 0 0 0 4px rgba(245, 158, 11, 0.3), 0 0 16px rgba(245, 158, 11, 0.4);
  display: flex;
  justify-content: center;
}
.frame-summit-badge {
  position: absolute;
  top: -14px;
  background: rgba(9, 9, 11, 0.95);
  border: 2px solid #f59e0b;
  color: #fbbf24;
  padding: 3px 18px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
  white-space: nowrap;
}

/* 3. Cyberpunk Neon 2077 */
.frame-neon-box {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 24px rgba(56, 189, 248, 0.3);
}
.neon-corner {
  position: absolute;
  width: 44px;
  height: 44px;
  border: 4px solid #38bdf8;
  filter: drop-shadow(0 0 8px #38bdf8);
}
.neon-corner.tl { top: 16px; left: 16px; border-right: none; border-bottom: none; }
.neon-corner.tr { top: 16px; right: 16px; border-left: none; border-bottom: none; border-color: #f43f5e; filter: drop-shadow(0 0 8px #f43f5e); }
.neon-corner.bl { bottom: 100px; left: 16px; border-right: none; border-top: none; }
.neon-corner.br { bottom: 100px; right: 16px; border-left: none; border-top: none; border-color: #38bdf8; }
.neon-label {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  color: #38bdf8;
  font-family: monospace;
  font-weight: 800;
  font-size: 12px;
  background: rgba(9, 9, 11, 0.85);
  padding: 3px 12px;
  border-radius: 4px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  white-space: nowrap;
}

/* 4. 35mm Vintage Film */
.frame-film-box {
  position: absolute;
  inset: 0;
}
.film-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 44px;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-sizing: border-box;
}
.film-bar.top { top: 0; border-bottom: 2px solid #1f2937; }
.film-bar.bottom { bottom: 0; border-top: 2px solid #1f2937; }
.film-label {
  color: #f59e0b;
  font-family: monospace;
  font-weight: 700;
  font-size: 11px;
}

/* 5. Vogue Magazine */
.frame-magazine-box {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.mag-masthead {
  font-family: 'Didot', 'Playfair Display', serif;
  font-size: clamp(38px, 9vw, 56px);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 2px;
  text-shadow: 0 4px 16px rgba(0,0,0,0.85);
  margin-top: 14px;
}
.mag-sub {
  color: #fbbf24;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
.mag-barcode {
  position: absolute;
  bottom: 85px;
  right: 18px;
  background: #ffffff;
  color: #000000;
  padding: 4px 8px;
  font-family: monospace;
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 800;
  border-radius: 4px;
}

/* 6. Royal Gala */
.frame-gala-box {
  position: absolute;
  inset: 14px;
  border: 2px solid #eab308;
  box-shadow: inset 0 0 12px rgba(234, 179, 8, 0.3);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.gala-corner {
  position: absolute;
  color: #fef08a;
  font-size: 20px;
  filter: drop-shadow(0 0 4px #ca8a04);
}
.gala-corner.tl { top: -2px; left: 4px; }
.gala-corner.tr { top: -2px; right: 4px; }
.gala-corner.bl { bottom: 6px; left: 4px; }
.gala-corner.br { bottom: 6px; right: 4px; }
.gala-title {
  color: #fef08a;
  font-family: 'Cinzel', 'Playfair Display', serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 74px;
  background: rgba(9, 9, 11, 0.85);
  padding: 3px 14px;
  border-radius: 12px;
  border: 1px solid rgba(234, 179, 8, 0.4);
}

/* 7. Sports Trading Card */
.frame-card-box {
  position: absolute;
  inset: 0;
  border: 14px solid #e11d48;
  box-sizing: border-box;
  display: flex;
  align-items: flex-end;
}
.card-rookie {
  position: absolute;
  top: 14px;
  left: 14px;
  background: #fbbf24;
  color: #000000;
  font-weight: 900;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.card-plate {
  width: 100%;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-top: 3px solid #e11d48;
  color: #ffffff;
  font-family: 'Impact', sans-serif;
  font-size: 20px;
  text-align: center;
  padding: 6px 0;
  letter-spacing: 1px;
  margin-bottom: 60px;
}

/* 8. Retro 90s Camcorder VHS */
.frame-vhs-box {
  position: absolute;
  inset: 0;
  padding: 18px;
  box-sizing: border-box;
}
.vhs-rec {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #ffffff;
  font-family: monospace;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-shadow: 0 0 6px #000000;
}
.rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: vhsBlink 1s infinite;
}
@keyframes vhsBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }
.vhs-sp {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #ffffff;
  font-family: monospace;
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 0 6px #000000;
}
.vhs-date {
  position: absolute;
  bottom: 84px;
  left: 20px;
  color: #22c55e;
  font-family: monospace;
  font-weight: 800;
  font-size: 15px;
  text-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

/* 9. Minimalist Gallery */
.frame-minimal-box {
  position: absolute;
  inset: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.minimal-title {
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  margin-bottom: 74px;
  background: rgba(9, 9, 11, 0.7);
  padding: 3px 12px;
  border-radius: 4px;
}

/* Custom Image Frame */
.viewfinder-frame-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Rule of Thirds Grid */
.camera-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.camera-grid.active {
  opacity: 0.35;
}

.camera-grid::before, .camera-grid::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.4);
}

/* Vertical grid lines */
.camera-grid::before {
  top: 0;
  bottom: 0;
  left: 33.333%;
  width: 1px;
  box-shadow: calc(33.333vw) 0 0 0 rgba(255, 255, 255, 0.4);
}

/* Horizontal grid lines */
.camera-grid::after {
  left: 0;
  right: 0;
  top: 33.333%;
  height: 1px;
  box-shadow: 0 calc(33.333vh) 0 0 rgba(255, 255, 255, 0.4);
}

/* Shutter Flash Animation */
.shutter-flash {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 30;
}

.shutter-flash.flash-anim {
  animation: flashEffect 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes flashEffect {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* Top Control Bar */
.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.3) 70%, transparent 100%);
  z-index: 25;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
}

.brand-badge span.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

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

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(24, 24, 27, 0.65);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

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

.icon-btn.active {
  background: var(--accent);
  color: #09090b;
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* Bottom Controls */
.bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 14px max(26px, calc(env(safe-area-inset-bottom, 20px) + 12px));
  background: linear-gradient(0deg, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.78) 60%, rgba(0,0,0,0.3) 90%, transparent 100%);
  z-index: 25;
  box-sizing: border-box;
}

/* Quick Camera Mode Dock */
.camera-mode-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding: 2px 6px;
  scrollbar-width: none;
}
.camera-mode-dock::-webkit-scrollbar {
  display: none;
}

.mode-pill {
  background: rgba(24, 24, 27, 0.7);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.mode-pill:hover, .mode-pill.active {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

/* Direct On-Screen Frame Carousel */
.frame-carousel-container {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  max-width: 100%;
  padding: 4px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.frame-carousel-container::-webkit-scrollbar {
  display: none;
}

.frame-carousel-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  flex-shrink: 0;
  transition: transform 0.18s ease, filter 0.18s ease;
  outline: none;
}

.frame-carousel-item .frame-thumb-box {
  width: 52px;
  height: 68px;
  min-width: 52px;
  min-height: 68px;
  border-radius: 10px;
  background: rgba(24, 24, 27, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.frame-carousel-item .frame-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.frame-carousel-item .frame-thumb-none {
  background: rgba(30, 41, 59, 0.6);
  color: #94a3b8;
}

.frame-carousel-item .frame-carousel-label {
  font-size: 11px;
  font-weight: 700;
  color: #a1a1aa;
  white-space: nowrap;
  letter-spacing: 0.2px;
  transition: color 0.18s ease;
}

.frame-carousel-item.active .frame-thumb-box {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.6), inset 0 0 8px rgba(56, 189, 248, 0.3);
  transform: translateY(-2px);
}

.frame-carousel-item.active .frame-carousel-label {
  color: #38bdf8;
  font-weight: 800;
}

.frame-carousel-item:active {
  transform: scale(0.94);
}

.shutter-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  max-width: 360px;
  margin-bottom: 2px;
  flex-shrink: 0;
}

/* Shutter Button */
.shutter-btn {
  position: relative;
  width: 76px;
  height: 76px;
  min-width: 76px;
  min-height: 76px;
  max-width: 76px;
  max-height: 76px;
  border-radius: 50%;
  background: transparent;
  border: 4px solid #ffffff;
  padding: 4px;
  cursor: pointer;
  outline: none;
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.shutter-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #ffffff;
  transition: all 0.15s ease;
}

.shutter-btn:hover .shutter-inner {
  transform: scale(0.94);
  background: #f1f5f9;
}

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

.shutter-btn:active .shutter-inner {
  transform: scale(0.85);
  background: var(--accent);
}

/* Video Mode Shutter Styles */
.shutter-btn.video-mode {
  border-color: #ef4444;
}

.shutter-btn.video-mode .shutter-inner {
  background: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shutter-btn.recording {
  border-color: rgba(239, 68, 68, 0.4);
}

.shutter-btn.recording .shutter-inner {
  transform: scale(0.55);
  border-radius: 10px;
  background: #ef4444;
  animation: pulseRecording 1s infinite alternate ease-in-out;
}

@keyframes pulseRecording {
  0% { transform: scale(0.52); filter: drop-shadow(0 0 6px #ef4444); }
  100% { transform: scale(0.60); filter: drop-shadow(0 0 14px #ef4444); }
}

.shutter-progress-ring {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  transform: rotate(-90deg);
  pointer-events: none;
}

.shutter-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 4;
}

.shutter-ring-fill {
  fill: none;
  stroke: #ef4444;
  stroke-width: 4;
  stroke-dasharray: 238.76;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.08s linear;
}

.mode-pill[data-mode="video"].active {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.7) !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.3) !important;
}

/* Gallery Thumbnail Button */
.gallery-btn {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(39, 39, 42, 0.8);
  cursor: pointer;
}

.gallery-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-btn .photo-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-pink);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 10px;
}

/* Universal Drawer Backdrop */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 45;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Drawers & Tool Panels (Centered Responsive Bottom Sheet) */
.drawer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(105%);
  width: 100%;
  max-width: 500px;
  background: var(--panel-bg);
  backdrop-filter: blur(28px);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 20px 24px calc(var(--safe-bottom) + 20px);
  z-index: 50;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s, visibility 0.25s;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.85);
  max-height: 85vh;
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.drawer-title {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-main);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

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

.control-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

.chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.chip {
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.15);
}

.chip.active {
  background: var(--accent);
  color: #09090b;
  border-color: var(--accent);
}

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

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

/* Upload Action Button */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #09090b;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  width: 100%;
  justify-content: center;
  transition: opacity 0.2s;
}

.upload-btn:hover {
  opacity: 0.92;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(24px);
  z-index: 50;
  display: none;
  flex-direction: column;
  padding: 12px 16px;
  box-sizing: border-box;
}

.modal.active {
  display: flex;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  flex-shrink: 0;
}

.modal-body {
  flex: 1;
  min-height: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  padding: 6px 8px;
}

.modal-preview-img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
  object-fit: contain !important;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85);
}

.modal-footer {
  padding: 10px 0 max(8px, env(safe-area-inset-bottom, 12px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  flex-shrink: 0;
}

.modal-footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
}

.btn {
  padding: 12px 20px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary {
  background: #ffffff;
  color: #09090b;
}

.btn-accent {
  background: linear-gradient(135deg, #a855f7, #ec4899);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 4px 20px rgba(236, 72, 153, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1px solid var(--panel-border);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn:active {
  transform: scale(0.96);
}

/* AI Split Comparison Slider */
.comparison-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 65vh;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.comp-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.comp-modified {
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
  transition: clip-path 0.05s ease-out;
}

.comp-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  background: #ffffff;
  cursor: ew-resize;
  transform: translateX(-50%);
  z-index: 10;
  box-shadow: 0 0 12px rgba(0,0,0,0.7);
}

.comp-handle::after {
  content: '⟷';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  background: #ffffff;
  color: #09090b;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 10px 0;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--panel-border);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item .item-del-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.88);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.6);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  z-index: 10;
  touch-action: manipulation;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.gallery-item .item-del-btn:hover,
.gallery-item .item-del-btn:active {
  transform: scale(1.18);
  background: #dc2626;
  color: #ffffff;
  border-color: #ef4444;
}

/* Spinner / Loading Overlay */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(12px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  border-radius: 16px;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Prompt input field and dropdowns */
.text-input {
  width: 100%;
  padding: 12px 16px;
  background: #18181b;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
  margin-top: 8px;
}

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

select.text-input,
select {
  background-color: #18181b !important;
  color: #f4f4f5 !important;
  cursor: pointer;
}

select.text-input option,
select option {
  background-color: #18181b !important;
  color: #f4f4f5 !important;
  padding: 10px 14px;
}

/* Voice Recognition Badge */
.voice-badge {
  position: absolute;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 185, 129, 0.22);
  border: 1px solid rgba(16, 185, 129, 0.6);
  color: #34d399;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  display: none;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(14px);
  z-index: 20;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
  transition: all 0.2s ease;
}

.voice-badge.active {
  display: flex;
}

.pulse-mic {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.4); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Countdown Overlay with Cancel button */
.countdown-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 35;
}

.countdown-number {
  font-size: 110px;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 0 30px rgba(56, 189, 248, 0.8);
}

.btn-cancel-countdown {
  margin-top: 16px;
  padding: 8px 20px;
  background: rgba(239, 68, 68, 0.85);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
  transition: transform 0.15s, background 0.15s;
}
.btn-cancel-countdown:hover {
  transform: scale(1.05);
  background: #dc2626;
}

/* Desktop Responsive Layout (Modern Workstation & Side Panel) */
@media (min-width: 860px) {
  body {
    background: #050507;
  }
  #app {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
    position: relative;
  }
  .viewfinder-container {
    padding: 8px 16px;
    height: 100%;
  }
  .viewfinder-stage {
    max-height: calc(100vh - 110px) !important;
    height: calc(100vh - 110px) !important;
    max-width: min(calc(100vw - 32px), calc((100vh - 110px) * (613 / 793))) !important;
    border-radius: 20px;
  }
  .drawer {
    position: absolute;
    top: 68px;
    bottom: 92px;
    right: 20px;
    left: auto;
    width: 370px;
    max-width: 370px;
    max-height: calc(100% - 160px);
    border-radius: 20px;
    border: 1px solid var(--panel-border);
    transform: translateX(120%);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
    background: rgba(18, 18, 22, 0.92);
    backdrop-filter: blur(28px);
    z-index: 40;
  }
  .drawer.open {
    transform: translateX(0);
  }
  .drawer-backdrop {
    display: none !important;
  }
}

/* Mobile Phone Portrait Responsiveness (Phones & Small Devices <= 640px) */
@media (max-width: 640px) {
  #app {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .top-bar {
    padding: 10px 14px;
    gap: 8px;
    background: linear-gradient(180deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.4) 80%, transparent 100%);
  }

  .brand-badge {
    padding: 6px 10px;
    font-size: 12px;
    gap: 6px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.12);
  }

  .top-actions {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
  }

  .icon-btn svg {
    width: 22px;
    height: 22px;
  }

  /* On personal phones, hide non-essential top clutter to avoid crowding */
  #btn-grid, #btn-install, #btn-kiosk-toggle {
    display: none !important;
  }

  .bottom-bar {
    padding: 6px 10px max(24px, calc(env(safe-area-inset-bottom, 20px) + 8px));
    gap: 6px;
    background: linear-gradient(0deg, rgba(0,0,0,0.98) 0%, rgba(0,0,0,0.85) 60%, rgba(0,0,0,0.3) 90%, transparent 100%);
  }

  .camera-mode-dock {
    gap: 8px;
    padding: 4px 6px;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    justify-content: flex-start;
  }
  .camera-mode-dock::-webkit-scrollbar {
    display: none;
  }

  .mode-pill {
    font-size: 12px;
    padding: 6px 14px;
    scroll-snap-align: center;
    white-space: nowrap;
    border-radius: 18px;
  }

  .frame-carousel-container {
    gap: 10px;
    padding: 4px 8px;
  }

  .frame-carousel-item .frame-thumb-box {
    width: 52px;
    height: 68px;
    min-width: 52px;
    min-height: 68px;
  }

  .frame-carousel-item .frame-carousel-label {
    font-size: 11px;
    font-weight: 700;
  }

  .shutter-row {
    width: 100%;
    max-width: 380px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 4px 0;
  }

  .shutter-btn {
    width: 82px;
    height: 82px;
    min-width: 82px;
    min-height: 82px;
  }

  .gallery-btn {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
  }

  #btn-flip-bottom {
    width: 50px;
    height: 50px;
    min-width: 50px;
    min-height: 50px;
  }

  #btn-flip-bottom svg {
    width: 24px;
    height: 24px;
  }

  .viewfinder-container {
    padding: 0 4px !important;
    padding-top: calc(env(safe-area-inset-top, 0px) + 54px) !important;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 165px) !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
  }

  .viewfinder-stage {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 613 / 793 !important;
    border-radius: 16px !important;
    margin: auto !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.1) !important;
  }

  /* Bottom sheet drawers on mobile */
  .drawer {
    border-radius: 24px 24px 0 0;
    max-height: 82vh;
    padding: 16px 16px max(24px, env(safe-area-inset-bottom, 24px));
  }

  /* Mobile review modal */
  .modal-preview-img {
    max-height: 56vh !important;
  }

  .modal-footer {
    padding: 8px 0 max(12px, env(safe-area-inset-bottom, 14px));
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .brand-badge span:not(.dot) {
    display: none;
  }
  .brand-badge {
    padding: 6px;
  }
  .icon-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }
  .icon-btn svg {
    width: 20px;
    height: 20px;
  }
  .shutter-btn {
    width: 76px;
    height: 76px;
    min-width: 76px;
    min-height: 76px;
  }
  .frame-carousel-item .frame-thumb-box {
    width: 48px;
    height: 62px;
    min-width: 48px;
    min-height: 62px;
  }
}

/* In-App Browser Warning Banner */
.in-app-browser-alert {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 20px);
  max-width: 520px;
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.96), rgba(194, 65, 12, 0.96));
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}
.in-app-browser-alert .alert-content {
  display: flex;
  align-items: center;
  gap: 8px;
}
.in-app-browser-alert .alert-dismiss {
  background: none;
  border: none;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  opacity: 0.85;
}
.in-app-browser-alert .alert-dismiss:hover {
  opacity: 1;
}

/* ========================================================
   9. Autonomous Entrance Kiosk Mode (Tall Display & Hands-Free)
   ======================================================== */
#app.kiosk-mode {
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
  background: #000 !important;
}

#app.kiosk-mode .top-bar,
#app.kiosk-mode .bottom-bar,
#app.kiosk-mode .drawer,
#app.kiosk-mode .drawer-backdrop,
#app.kiosk-mode .voice-badge {
  display: none !important;
}

/* Dedicated Autonomous Kiosk Top Header Bar */
.kiosk-header {
  height: 52px;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 60;
  box-sizing: border-box;
}

.kiosk-vision-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 18, 22, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #4ade80;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.kiosk-vision-badge.pointing-mode {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  color: #fbbf24;
}
.kiosk-vision-badge.pointing-mode .pulse-dot {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
}

/* Dedicated Exit Button for Kiosk / Fullscreen Mode */
.btn-kiosk-exit {
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #fca5a5;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  backdrop-filter: blur(10px);
}
.btn-kiosk-exit:hover {
  background: rgba(239, 68, 68, 0.45);
  color: #ffffff;
  border-color: #ef4444;
  transform: translateY(-1px);
}
.btn-kiosk-exit:active {
  transform: scale(0.95);
}

/* Kiosk Gesture Frame Switch Toast */
.kiosk-gesture-toast {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  border: 1.5px solid #38bdf8;
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(56, 189, 248, 0.4);
  z-index: 100;
  pointer-events: none;
  animation: fadeInDownToast 0.25s ease-out;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
@keyframes fadeInDownToast {
  from { opacity: 0; transform: translate(-50%, -12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

#app.kiosk-mode .viewfinder-container {
  padding: 12px 24px !important;
  background: #050507;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100vw;
  height: calc(100vh - 52px);
  box-sizing: border-box;
  overflow: hidden;
}

#app.kiosk-mode .viewfinder-stage {
  max-width: min(calc(100vw - 250px), calc((100vh - 76px) * (613 / 793))) !important;
  max-height: calc(100vh - 76px) !important;
  width: 100% !important;
  height: calc(100vh - 76px) !important;
  aspect-ratio: 613 / 793 !important;
  border-radius: 18px !important;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.95), 0 0 0 2px rgba(255, 255, 255, 0.12) !important;
  position: relative;
  overflow: hidden;
}

#app.kiosk-mode.kiosk-aspect-tall .viewfinder-stage {
  max-width: 100vw !important;
  max-height: 100vh !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  aspect-ratio: unset !important;
  box-shadow: none !important;
}

/* Kiosk Scrollable Frame Selector Plate (Right Plate) */
.kiosk-frame-plate {
  width: 200px;
  max-height: calc(100vh - 76px);
  height: calc(100vh - 76px);
  background: rgba(18, 18, 22, 0.88);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  box-sizing: border-box;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
  z-index: 40;
  flex-shrink: 0;
}

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

.kiosk-plate-title {
  font-size: 13px;
  font-weight: 700;
  color: #f4f4f5;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.kiosk-plate-count {
  font-size: 11px;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.kiosk-plate-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}

.kiosk-plate-scroll::-webkit-scrollbar {
  width: 4px;
}
.kiosk-plate-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.kiosk-frame-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.kiosk-frame-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

.kiosk-frame-card.active {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.kiosk-frame-card.active::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 6px;
  background: #38bdf8;
  color: #000;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kiosk-frame-thumb {
  width: 80px;
  height: 104px;
  object-fit: contain;
  margin-bottom: 6px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.kiosk-frame-label {
  font-size: 11px;
  font-weight: 600;
  color: #e4e4e7;
  text-align: center;
  line-height: 1.25;
}

/* Floating Sleek Kiosk Prompt Banner (Down at Bottom Edge) */
.kiosk-prompt-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(92%, 460px);
  background: rgba(10, 15, 29, 0.90);
  backdrop-filter: blur(20px);
  border: 1.5px solid rgba(56, 189, 248, 0.6);
  border-radius: 30px;
  padding: 8px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.75), 0 0 16px rgba(56, 189, 248, 0.25);
  z-index: 35;
  pointer-events: none;
  animation: kioskPulseGlow 3s infinite alternate ease-in-out;
  white-space: nowrap;
}

.kiosk-prompt-banner .kiosk-icon {
  font-size: 20px;
  display: inline-block;
  animation: kioskWaveHand 2s infinite ease-in-out;
  transform-origin: 70% 70%;
  flex-shrink: 0;
}

@keyframes kioskWaveHand {
  0%, 100% { transform: rotate(0deg) scale(1); }
  20%, 60% { transform: rotate(14deg) scale(1.15); }
  40%, 80% { transform: rotate(-14deg) scale(1.15); }
}

@keyframes kioskPulseGlow {
  0% {
    box-shadow: 0 8px 24px rgba(56, 189, 248, 0.35);
    border-color: rgba(56, 189, 248, 0.6);
  }
  100% {
    box-shadow: 0 12px 40px rgba(56, 189, 248, 0.6), 0 0 20px rgba(129, 140, 248, 0.4);
    border-color: rgba(129, 140, 248, 0.9);
  }
}

.kiosk-main-prompt {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
}

.kiosk-timer-tag {
  font-size: 11px;
  font-weight: 700;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  padding: 2px 8px;
  border-radius: 12px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 10px #4ade80;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

@media (max-width: 900px) {
  #app.kiosk-mode .viewfinder-container {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 8px 12px !important;
  }
  #app.kiosk-mode .viewfinder-stage {
    max-height: calc(100vh - 180px) !important;
    height: calc(100vh - 180px) !important;
    max-width: 100vw !important;
  }
  .kiosk-frame-plate {
    width: 100% !important;
    height: 108px !important;
    max-height: 108px !important;
    flex-direction: row !important;
    padding: 8px 12px !important;
  }
  .kiosk-plate-header {
    display: none !important;
  }
  .kiosk-plate-scroll {
    flex-direction: row !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
  }
  .kiosk-frame-card {
    flex-direction: row !important;
    gap: 8px !important;
    padding: 4px 10px !important;
    min-width: 130px !important;
  }
  .kiosk-frame-thumb {
    width: 40px !important;
    height: 52px !important;
    margin-bottom: 0 !important;
  }
  .kiosk-prompt-banner {
    bottom: 8px;
    padding: 6px 14px;
    gap: 8px;
  }
  .kiosk-main-prompt {
    font-size: 11px;
  }
}

/* Dedicated Autonomous Kiosk Big-Screen QR Results Screen */
.kiosk-results-screen {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 30%, #1e1b4b 0%, #09090b 85%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  padding: 24px;
  box-sizing: border-box;
  animation: fadeInKiosk 0.35s ease-out;
  backdrop-filter: blur(24px);
}

@keyframes fadeInKiosk {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.kiosk-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 16px;
}

.kiosk-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.6);
  color: #fbbf24;
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.2);
}

.timer-dot {
  width: 8px;
  height: 8px;
  background: #fbbf24;
  border-radius: 50%;
  box-shadow: 0 0 8px #fbbf24;
  animation: pulseGreen 1s infinite;
}

.kiosk-results-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  min-height: 0;
}

.kiosk-photo-box {
  flex: 1;
  max-height: 52vh;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.kiosk-photo-box img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.kiosk-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 380px;
}

@media (min-width: 768px) and (min-aspect-ratio: 1/1) {
  .kiosk-results-body {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 48px !important;
    padding: 0 32px;
  }
  .kiosk-photo-box {
    max-height: 82vh !important;
    max-width: calc(82vh * (613 / 793)) !important;
    flex: 1.2 !important;
  }
  .kiosk-qr-box {
    flex: 1 !important;
    max-width: 440px !important;
  }
}

.kiosk-qr-card {
  background: #ffffff;
  color: #09090b;
  padding: 20px 24px;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.95);
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.kiosk-qr-wrapper {
  width: 240px;
  height: 240px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.kiosk-qr-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.kiosk-qr-instructions .scan-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.kiosk-qr-instructions .scan-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  line-height: 1.4;
}

.kiosk-progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.kiosk-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  transition: width 0.1s linear;
}

@media (min-width: 900px) and (orientation: landscape) {
  .kiosk-results-body {
    flex-direction: row;
    gap: 40px;
  }
  .kiosk-photo-box {
    flex: 1.2;
    max-height: 78vh;
  }
  .kiosk-qr-box {
    flex: 0.8;
  }
}

/* =========================================================
   Interactive Sticker Studio & Canvas Decorator Styles
   ========================================================= */
.sticker-workspace {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.85);
  user-select: none;
  -webkit-user-select: none;
  background: #111;
}

.sticker-base-img {
  max-width: 100%;
  max-height: 52vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.sticker-overlay-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.canvas-sticker {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  z-index: 10;
  padding: 4px;
}

.canvas-sticker:active {
  cursor: grabbing;
}

.canvas-sticker.selected {
  outline: 2px dashed #38bdf8;
  outline-offset: 4px;
  border-radius: 8px;
}

.canvas-sticker .sticker-del-btn,
.canvas-sticker .sticker-transform-handle {
  display: none;
}

.canvas-sticker.selected .sticker-del-btn {
  display: flex;
  position: absolute;
  top: -12px;
  right: -12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  border: 2px solid #fff;
  font-size: 13px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  box-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.canvas-sticker.selected .sticker-transform-handle {
  display: flex;
  position: absolute;
  bottom: -12px;
  right: -12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #38bdf8;
  color: #09090b;
  border: 2px solid #fff;
  font-size: 13px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  cursor: nwse-resize;
  z-index: 25;
  box-shadow: 0 2px 8px rgba(0,0,0,0.7);
}

.sticker-emoji {
  font-size: 54px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}

.sticker-badge {
  font-weight: 800;
  font-size: 16px;
  padding: 6px 14px;
  border-radius: 10px;
  border: 2px solid currentColor;
  box-shadow: 0 4px 14px rgba(0,0,0,0.6);
  white-space: nowrap;
}

.sticker-bubble {
  background: #ffffff;
  color: #09090b;
  font-weight: 800;
  font-size: 15px;
  padding: 8px 16px;
  border-radius: 14px;
  border: 2.5px solid #09090b;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  white-space: nowrap;
}

.sticker-img {
  width: 140px;
  max-width: 190px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.65));
  pointer-events: none;
  user-select: none;
}

.sticker-tray-thumb {
  width: auto;
  max-width: 88px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  display: block;
}

.sticker-tray-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(24, 24, 27, 0.95);
  border-top: 1px solid var(--panel-border);
  padding: 10px 14px;
  border-radius: 16px 16px 0 0;
}

.sticker-category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.sticker-category-tabs::-webkit-scrollbar { display: none; }

.sticker-tab-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--panel-border);
  color: #d4d4d8;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.sticker-tab-btn.active {
  background: #f59e0b;
  color: #09090b;
  border-color: #f59e0b;
  font-weight: 700;
}

.sticker-items-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 6px 2px;
  scrollbar-width: none;
  align-items: center;
}
.sticker-items-carousel::-webkit-scrollbar { display: none; }

.sticker-tray-item {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 10px;
  min-width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  flex-shrink: 0;
}
.sticker-tray-item:hover, .sticker-tray-item:active {
  transform: scale(1.15);
  background: rgba(255, 255, 255, 0.15);
  border-color: #f59e0b;
}

