/* ═══════════════════════════════════════════════════════════════
   PHOTOBOOTH.IO - AESTHETIC KOREAN PHOTO BOOTH
   Inspired by photobooth-io.cc & Life4Cuts
   ═══════════════════════════════════════════════════════════════ */

:root {
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-display: 'Syne', sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Theme: Aesthetic Korean Pastel (Default) */
  --bg-app: #faf8f5;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f3efe9;
  --bg-accent: #ffe4e6;
  --bg-wine: #780d1d;

  --border-light: rgba(0, 0, 0, 0.08);
  --border-active: #780d1d;
  --border-focus: #f43f5e;

  --text-main: #1c1917;
  --text-muted: #78716c;
  --text-inverse: #ffffff;

  --primary: #780d1d;
  --primary-hover: #5c0a16;
  --primary-light: #fef2f2;
  --accent-pink: #fb7185;
  --accent-rose: #f43f5e;
  --accent-yellow: #fef08a;
  --accent-blue: #bae6fd;
  --accent-green: #bbf7d0;

  --radius-full: 9999px;
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-float: 0 16px 40px rgba(120, 13, 29, 0.15);
  --shadow-canvas: 0 20px 50px rgba(0, 0, 0, 0.16);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Studio Mode */
body.dark-theme {
  --bg-app: #121214;
  --bg-surface: #1a1a1e;
  --bg-card: #202024;
  --bg-subtle: #27272a;
  --bg-accent: #3f1a24;
  --border-light: rgba(255, 255, 255, 0.1);
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-light: #2d151c;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(120, 13, 29, 0.2);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  transition: background 0.3s ease;
}
body.dark-theme .app-header {
  background: rgba(26, 26, 30, 0.85);
}

.header-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-logo-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 3px 8px rgba(120, 13, 29, 0.25));
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.brand-link:hover .brand-logo-img {
  transform: rotate(-6deg) scale(1.08);
}

.brand-icon {
  display: none;
}

.ui-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke: currentColor;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -3px;
  transition: transform var(--transition-fast);
}
.ui-icon-sm {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke: currentColor;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -2px;
}
.ui-icon-lg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke: currentColor;
  display: inline-block;
  flex-shrink: 0;
}
button:hover .ui-icon {
  transform: scale(1.06);
}

.brand-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-title .tagline-korean {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-accent);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Stepper Tabs */
.stepper-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-full);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.step-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.step-btn .step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
}
.step-btn.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.step-btn.active .step-num {
  background: var(--primary);
  color: #fff;
}
.step-btn:hover:not(.active) {
  color: var(--text-main);
}

/* Header Utilities */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon-soft {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}
.btn-icon-soft:hover {
  background: var(--bg-subtle);
  transform: translateY(-1px);
}

.btn-gallery-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}
.btn-gallery-nav:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Container */
.main-wrapper {
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 70px);
}

/* Screen Transitions */
.screen-panel {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.screen-panel.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   STAGE 1: LAYOUT & FRAME SELECTION
   ═══════════════════════════════════════════════════════════════ */
.layout-header-section {
  text-align: center;
  max-width: 640px;
  margin: 10px auto 32px auto;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-accent);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.layout-header-section h1 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}
.layout-header-section p {
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Layout Grid */
.layout-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto 40px auto;
}

.layout-card {
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.layout-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--shadow-float);
}
.layout-card.featured-card {
  border-color: #780d1d;
  background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
  box-shadow: 0 10px 30px rgba(120, 13, 29, 0.12);
}
body.dark-theme .layout-card.featured-card {
  background: linear-gradient(180deg, #202024 0%, #291418 100%);
}

.layout-card-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  z-index: 2;
  box-shadow: 0 2px 6px rgba(120, 13, 29, 0.3);
}

.layout-preview-wrap {
  width: 100%;
  aspect-ratio: 9 / 14;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 14px;
}
.layout-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.layout-card:hover .layout-preview-wrap img {
  transform: scale(1.03);
}

.layout-info h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.layout-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.layout-info .shot-pill {
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.btn-select-layout {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.layout-card:hover .btn-select-layout,
.layout-card.featured-card .btn-select-layout {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ═══════════════════════════════════════════════════════════════
   STAGE 2: BOOTH & CAPTURE
   ═══════════════════════════════════════════════════════════════ */
.booth-layout-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  max-width: 1100px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .booth-layout-container {
    grid-template-columns: 1fr;
  }
}

.camera-main-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

/* Camera Top Controls */
.camera-top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.selected-layout-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}
.btn-change-layout {
  padding: 4px 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  cursor: pointer;
}

.camera-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cam-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.cam-pill-btn:hover {
  background: var(--bg-subtle);
}
.cam-pill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Camera Viewport */
.camera-viewport {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}

#webcamVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1); /* default mirror */
}
#webcamVideo.no-mirror {
  transform: scaleX(1);
}

/* Viewport Overlays */
.cam-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, 0.25);
  margin: 16px;
  border-radius: 12px;
}

.flash-screen {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-out;
  z-index: 50;
}
.flash-screen.trigger-flash {
  opacity: 0.95;
  transition: opacity 0.4s ease-out;
}

.countdown-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.countdown-overlay.show {
  opacity: 1;
}

.countdown-number {
  font-family: var(--font-display);
  font-size: 7rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: countdownPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite;
}
@keyframes countdownPop {
  0% { transform: scale(0.6); opacity: 0; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.countdown-subtext {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Camera Bottom Bar */
.camera-action-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.btn-shutter-main {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid var(--primary);
  background: var(--bg-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(120, 13, 29, 0.25);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0;
}
.btn-shutter-main .shutter-inner {
  width: 54px;
  height: 54px;
  background: var(--primary);
  border-radius: 50%;
  transition: all 0.15s ease;
}
.btn-shutter-main:hover {
  transform: scale(1.06);
}
.btn-shutter-main:hover .shutter-inner {
  transform: scale(0.92);
  background: var(--primary-hover);
}
.btn-shutter-main:active {
  transform: scale(0.95);
}

.btn-upload-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-upload-file:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
}

/* Right Reel Sidebar */
.booth-reel-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.reel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.reel-header h3 {
  font-size: 1rem;
  font-weight: 700;
}
.reel-counter-badge {
  background: var(--bg-accent);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

/* Reel Slots list */
.reel-slots-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.reel-slot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  transition: all var(--transition-fast);
}
.reel-slot-card.active-capture {
  border-color: var(--primary);
  background: var(--bg-accent);
}

.slot-thumb-box {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 0.85rem;
  font-weight: 700;
  color: #94a3b8;
  position: relative;
}
.slot-thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slot-info-box {
  flex: 1;
}
.slot-title {
  font-size: 0.82rem;
  font-weight: 700;
}
.slot-status {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-slot-retake {
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
}
.btn-slot-retake:hover {
  background: var(--bg-surface);
  color: var(--primary);
  border-color: var(--primary);
}

/* Proceed to Customize Button */
.btn-proceed-customize {
  margin-top: 20px;
  padding: 14px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(120, 13, 29, 0.3);
  transition: all var(--transition-fast);
}
.btn-proceed-customize:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
}
.btn-proceed-customize:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════
   STAGE 3: CUSTOMIZE STUDIO (EDITOR)
   ═══════════════════════════════════════════════════════════════ */
.customize-grid-container {
  display: grid;
  grid-template-columns: minmax(360px, 480px) 1fr;
  gap: 32px;
  max-width: 1280px;
  margin: 0 auto;
}

@media (max-width: 960px) {
  .customize-grid-container {
    grid-template-columns: 1fr;
  }
}

/* Canvas Preview Column */
.canvas-preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.canvas-viewport-wrapper {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-canvas);
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  touch-action: none;
}

#boothCanvas {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  display: block;
}

.canvas-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
}

/* Customizer Tool Drawer (Right column) */
.customizer-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Customizer Tab Buttons */
.custom-tabs-nav {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-surface);
}

.custom-tab-btn {
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.custom-tab-btn:hover {
  color: var(--text-main);
}
.custom-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg-subtle);
}

.tab-pane-content {
  padding: 20px;
  display: none;
  flex-direction: column;
  gap: 18px;
}
.tab-pane-content.active {
  display: flex;
}

/* Option Sections */
.opt-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* Swatches Grid */
.swatches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 10px;
}

.color-swatch-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.color-swatch-btn:hover {
  transform: scale(1.1);
}
.color-swatch-btn.selected {
  border-color: var(--text-main);
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--primary);
}

/* Pattern Buttons */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pattern-btn {
  padding: 10px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}
.pattern-btn:hover {
  border-color: var(--primary);
}
.pattern-btn.selected {
  background: var(--bg-accent);
  color: var(--primary);
  border-color: var(--primary);
}

/* Sliders */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
}
.slider-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
  outline: none;
}
.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Filters Grid */
.filters-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.filter-card-btn {
  padding: 8px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition-fast);
}
.filter-card-btn:hover {
  border-color: var(--primary);
}
.filter-card-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Sticker Categories & Drawer */
.sticker-category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.sticker-cat-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.sticker-cat-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.stickers-shelf {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
}

.sticker-shelf-item {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  font-size: 1.6rem;
  transition: transform var(--transition-fast);
}
.sticker-shelf-item:hover {
  transform: scale(1.12);
  border-color: var(--primary);
}
.sticker-shelf-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Doodle Controls */
.doodle-palette {
  display: flex;
  align-items: center;
  gap: 8px;
}
.doodle-sizes {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-brush-size {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.btn-brush-size.active {
  border-color: var(--primary);
  background: var(--bg-accent);
}
.dot-preview {
  background: var(--text-main);
  border-radius: 50%;
}

.doodle-actions {
  display: flex;
  gap: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   EXPORT & ACTION BAR
   ═══════════════════════════════════════════════════════════════ */
.export-sticky-bar {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.export-btn-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-export-primary {
  padding: 12px 24px;
  border-radius: var(--radius-full);
  border: none;
  background: var(--primary);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(120, 13, 29, 0.25);
  transition: all var(--transition-fast);
}
.btn-export-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-export-secondary {
  padding: 11px 18px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.btn-export-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--bg-subtle);
}

/* Notification Toast */
.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background: var(--text-main);
  color: var(--text-inverse);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-msg.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   CUSTOM FRAME UPLOAD MODAL & CONTROLS
   ═══════════════════════════════════════════════════════════════ */
.btn-add-layout-hero {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 2px dashed var(--primary);
  color: var(--primary);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 14px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.btn-add-layout-hero:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.layout-card.upload-trigger-card {
  border: 2px dashed var(--primary);
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  min-height: 280px;
}
.layout-card.upload-trigger-card:hover {
  background: var(--primary-light);
}
.upload-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-accent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal-overlay.active {
  display: flex !important;
}

.modal-dialog {
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-xl);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 100000;
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}
.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-close-modal:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.dropzone-area {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-subtle);
  transition: all var(--transition-fast);
}
.dropzone-area:hover, .dropzone-area.dragover {
  border-color: var(--primary);
  background: var(--bg-accent);
}

.frame-preview-box {
  width: 100%;
  max-height: 280px;
  background: #2a2a2a;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 10px;
}
.frame-preview-box canvas {
  max-height: 260px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.slot-config-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.slot-pill-btn {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.slot-pill-btn:hover {
  border-color: var(--primary);
}
.slot-pill-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-delete-custom-frame {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: all var(--transition-fast);
}
.btn-delete-custom-frame:hover {
  background: #dc2626;
  transform: scale(1.15);
}

/* ═══════════════════════════════════════════════════════════════
   PRINT STYLESHEET
   ═══════════════════════════════════════════════════════════════ */
@media print {
  body * {
    visibility: hidden;
  }
  .print-sheet, .print-sheet * {
    visibility: visible;
  }
  .print-sheet {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: flex !important;
    justify-content: center;
    gap: 20px;
    padding: 20px;
  }
  .print-sheet img {
    height: 9.5in;
    object-fit: contain;
  }
}
