:root {
  --bg-main: #090D16;
  --bg-sidebar: #0F172A;
  --bg-surface: #1E293B;
  --bg-surface-hover: #334155;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-active: #6366F1;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --accent: #38BDF8;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
}

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

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #6366F1 0%, #A855F7 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.logo-icon svg {
  width: 20px;
  height: 20px;
}

.brand-text h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-text .badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(56, 189, 248, 0.15);
  color: #38BDF8;
  font-weight: 600;
}

.topbar-center .res-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

.res-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.res-btn.active {
  background: var(--bg-surface);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
}
.btn-ghost:hover {
  background: var(--bg-surface);
  color: #fff;
}
.btn-ghost svg { width: 16px; height: 16px; }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  padding: 8px 14px;
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}
.btn-secondary svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #fff;
  padding: 8px 18px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}
.btn-primary:hover {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.5);
}
.btn-primary svg { width: 16px; height: 16px; }

/* --- Workspace Layout --- */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- Left Sidebar --- */
.sidebar {
  width: 380px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
  flex: 1;
  padding: 12px 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: all 0.2s ease;
}

.tab-btn svg { width: 17px; height: 17px; }

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}
.tab-content.active {
  display: block;
}

.panel-section {
  margin-bottom: 22px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.section-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  line-height: 1.4;
}

/* --- 50 Templates Drawer --- */
.template-search-box {
  margin-bottom: 12px;
}
.template-search-box input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
}
.template-search-box input:focus {
  border-color: var(--primary);
}

.cat-filter-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.cat-filter-pills::-webkit-scrollbar { height: 4px; }
.cat-filter-pills::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.cat-pill {
  padding: 5px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.templates-50-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.t50-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.t50-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}
.t50-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
  background: rgba(99, 102, 241, 0.12);
}

.t50-preview {
  width: 100%;
  height: 100px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
}

.t50-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  font-weight: 700;
}

.t50-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.t50-name {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t50-meta {
  font-size: 10px;
  color: var(--text-muted);
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.04);
  border-radius: var(--radius-md);
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: scale(1.01);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.dropzone-content svg {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.dropzone-content span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.dropzone-content .subtext {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: normal;
}

/* Uploaded Images Grid */
.images-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.img-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.img-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.img-thumb {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
}

.img-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.img-name {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.img-btn-del {
  background: transparent;
  color: #ef4444;
  border: none;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
}
.img-btn-del:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Controls & Inputs */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 13px;
}

.control-row label {
  color: var(--text-secondary);
}

.control-row select, .control-row input[type="text"] {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  outline: none;
}

.control-row input[type="range"] {
  width: 140px;
  accent-color: var(--primary);
}

.radio-group {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px;
  border-radius: var(--radius-sm);
}

.radio-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.radio-btn.active {
  background: var(--bg-surface);
  color: #fff;
}

/* Color Palettes */
.color-palette-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.pal-card {
  height: 48px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.pal-card:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.pal-card.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-wrapper input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.quick-colors {
  display: flex;
  gap: 4px;
}

.swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.align-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.align-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.align-btn.active, .align-btn:hover {
  background: var(--bg-surface-hover);
  color: #fff;
}

.full-width {
  width: 100%;
  margin-top: 10px;
  justify-content: center;
}

/* --- Center Stage / Canvas --- */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at 50% 20%, #151d30 0%, #080c14 100%);
  overflow: hidden;
  position: relative;
}

.stage-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.cards-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.card-pill {
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.card-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.btn-pill-add {
  padding: 6px 14px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px dashed rgba(56, 189, 248, 0.4);
  color: #38BDF8;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-pill-add:hover {
  background: rgba(56, 189, 248, 0.25);
}

/* Carousel Track */
.carousel-container {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 30px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}

.cards-track {
  display: flex;
  gap: 28px;
  margin: 0 auto;
}

/* --- Play Store Card Container --- */
.playstore-card {
  width: 320px;
  height: 568px; /* 9:16 approx */
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  padding: 24px 20px 0 20px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
  perspective: 1000px;
}

.playstore-card.active {
  box-shadow: 0 25px 50px -10px rgba(0, 0, 0, 0.8), 0 0 0 2px var(--primary);
}

.playstore-card.tall-res {
  height: 640px; /* 9:20 approx */
}

/* Card Header Text (Editable) */
.card-text-container {
  z-index: 10;
  margin-bottom: 14px;
  position: relative;
}

.editable-headline {
  outline: none;
  font-weight: 700;
  line-height: 1.18;
  margin-bottom: 6px;
  word-break: break-word;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.2s;
  cursor: text;
}
.editable-headline:hover, .editable-headline:focus {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.editable-subhead {
  outline: none;
  line-height: 1.35;
  word-break: break-word;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.2s;
  cursor: text;
}
.editable-subhead:hover, .editable-subhead:focus {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

/* --- Floating Callout Feature Badges --- */
.feature-badge {
  position: absolute;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  z-index: 35;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Device Area */
.card-device-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: visible;
}

/* --- Realistic Device Finish Group in Sidebar --- */
.device-finish-group {
  display: flex;
  gap: 8px;
  align-items: center;
}
.finish-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}
.finish-swatch:hover {
  transform: scale(1.15);
}
.finish-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

/* --- High-Fidelity Realistic Phone Mockups --- */
.pixel-phone {
  width: 250px;
  height: 520px;
  background: #000;
  border-radius: 38px;
  border: 4px solid #1e293b;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom center;
}

/* 1. Samsung Galaxy S24/S25 Ultra (Sharp Edges) */
.pixel-phone.model-samsung-s24-ultra {
  border-radius: 14px;
  border-width: 4px;
}

/* 2. Google Pixel 9/10 Pro (Curved Aluminum) */
.pixel-phone.model-pixel-10-pro {
  border-radius: 42px;
  border-width: 4px;
}

/* 3. Modern Android Flagship */
.pixel-phone.model-android-flagship {
  border-radius: 36px;
  border-width: 3px;
}

/* 4. 3D Minimalist Clay (Ceramic Matte) */
.pixel-phone.model-clay-minimal {
  border-radius: 40px;
  border-width: 7px;
  border-color: #f1f5f9;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.4);
}

/* 5. iPhone 16/17 Pro (Dynamic Island) */
.pixel-phone.model-iphone-17-pro {
  border-radius: 48px;
  border-width: 4px;
}

.pixel-phone.screen-only {
  border: none !important;
  border-radius: 18px !important;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5) !important;
}

/* --- Finishes --- */
.pixel-phone.finish-titanium-black {
  border-color: #27272A;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.pixel-phone.finish-titanium-silver {
  border-color: #E4E4E7;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px #FFFFFF;
}
.pixel-phone.finish-bay-blue {
  border-color: #2563EB;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px #93C5FD;
}
.pixel-phone.finish-emerald {
  border-color: #14532D;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px #86EFAC;
}
.pixel-phone.finish-clay-white {
  border-color: #F8FAFC;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

/* Speaker slit */
.pixel-speaker-slit {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 3px;
  background: #334155;
  border-radius: 2px;
  z-index: 26;
}

/* Dot Camera Cutout */
.pixel-camera {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  background: radial-gradient(circle at 35% 35%, #2a3b53 0%, #080c14 70%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  z-index: 25;
}

/* Dynamic Island */
.pixel-dynamic-island {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 66px;
  height: 18px;
  background: #000;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 25;
}

/* Screen Image */
.pixel-screen {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #0f172a;
}

/* Screen Glass Highlight */
.pixel-gloss {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0) 65%);
  pointer-events: none;
  z-index: 20;
}
.no-glare .pixel-gloss {
  display: none;
}
.no-shadow .pixel-phone {
  box-shadow: none !important;
}

/* On-Phone Quick Switch Button */
.btn-switch-screen {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 30;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.pixel-phone:hover .btn-switch-screen,
.card-device-container:hover .btn-switch-screen {
  opacity: 1;
  pointer-events: auto;
}
.btn-switch-screen:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translate(-50%, -50%) scale(1.05);
}

/* Floating Card Action Toolbar */
.card-floating-actions {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  display: flex;
  gap: 6px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  padding: 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  z-index: 50;
  transition: all 0.2s ease;
}

.playstore-card:hover .card-floating-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.btn-card-action {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 6px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-card-action:hover {
  background: var(--bg-surface-hover);
  color: #fff;
}
.btn-card-action svg { width: 15px; height: 15px; }

/* --- Multi-Phone & Single Phone Layout Transforms --- */
/* 1. Showcase */
.card-layout-showcase .pixel-phone,
.card-layout-showcase .phone-3d-wrapper {
  transform: rotate(-7deg) translateY(24px) scale(1.05);
}

/* 2. Hero */
.card-layout-hero .pixel-phone,
.card-layout-hero .phone-3d-wrapper {
  transform: translateY(14px) scale(1.03);
}

/* 3. Dynamic */
.card-layout-dynamic .pixel-phone,
.card-layout-dynamic .phone-3d-wrapper {
  transform: rotate(-14deg) translateY(40px) scale(1.1);
}

/* 4. Copy-Below */
.card-layout-copy-below {
  flex-direction: column-reverse;
  padding-bottom: 24px;
}
.card-layout-copy-below .pixel-phone,
.card-layout-copy-below .phone-3d-wrapper {
  transform: translateY(-20px);
}

/* 5. Minimal */
.card-layout-minimal .pixel-phone,
.card-layout-minimal .phone-3d-wrapper {
  transform: scale(1.15) translateY(20px);
}
.card-layout-minimal .card-text-container {
  display: none;
}

/* --- Multi-Phone: Duo Depth --- */
.card-layout-duo-depth .card-device-container {
  position: relative;
}
.card-layout-duo-depth .phone-back {
  position: absolute;
  left: 20px;
  bottom: 0;
  transform: rotate(-11deg) translateY(20px) scale(0.85);
  z-index: 5;
  filter: brightness(0.92);
}
.card-layout-duo-depth .phone-front {
  position: relative;
  right: -25px;
  bottom: 0;
  transform: rotate(5deg) translateY(14px) scale(0.98);
  z-index: 10;
}

/* --- Multi-Phone: Duo Twins --- */
.card-layout-duo-twins .phone-left {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: rotate(6deg) translateY(20px) scale(0.88);
  z-index: 5;
}
.card-layout-duo-twins .phone-right {
  position: absolute;
  right: 0;
  bottom: 0;
  transform: rotate(-6deg) translateY(20px) scale(0.88);
  z-index: 6;
}

/* --- Multi-Phone: Trio Cascade --- */
.card-layout-trio-cascade .phone-step-1 {
  position: absolute;
  left: -20px;
  bottom: -40px;
  transform: rotate(-10deg) scale(0.72);
  z-index: 4;
}
.card-layout-trio-cascade .phone-step-2 {
  position: absolute;
  left: 35px;
  bottom: 0;
  transform: rotate(-6deg) scale(0.86);
  z-index: 7;
}
.card-layout-trio-cascade .phone-step-3 {
  position: absolute;
  right: -15px;
  bottom: 40px;
  transform: rotate(0deg) scale(0.94);
  z-index: 10;
}

/* --- Multi-Phone: Trio Fan --- */
.card-layout-trio-fan .phone-fan-left {
  position: absolute;
  left: -15px;
  bottom: 10px;
  transform: rotate(-14deg) scale(0.82);
  z-index: 5;
}
.card-layout-trio-fan .phone-fan-center {
  position: relative;
  bottom: 10px;
  transform: scale(0.98);
  z-index: 10;
}
.card-layout-trio-fan .phone-fan-right {
  position: absolute;
  right: -15px;
  bottom: 10px;
  transform: rotate(14deg) scale(0.82);
  z-index: 5;
}

/* --- Multi-Phone: Panorama 2-Card Split --- */
.card-layout-panorama-part1 .pixel-phone,
.card-layout-panorama-part1 .phone-3d-wrapper {
  transform: rotate(-9deg) translateX(70px) translateY(30px) scale(1.15);
}
.card-layout-panorama-part2 .pixel-phone,
.card-layout-panorama-part2 .phone-3d-wrapper {
  transform: rotate(-9deg) translateX(-190px) translateY(30px) scale(1.15);
}

/* --- Quick Image Picker Modal --- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  width: 540px;
  max-width: 90vw;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
}
.modal-close:hover { color: #fff; }

.modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.picker-item {
  background: var(--bg-surface);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.picker-item:hover {
  border-color: var(--primary);
  transform: scale(1.03);
}

.picker-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
}

.picker-item span {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========================================================
   3D Realistic Phone Models & Model-First Flow Styling
   ======================================================== */

.btn-gradient {
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-gradient:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 6px 22px rgba(168, 85, 247, 0.55);
}
.model-badge-chip {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
}

.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.active-model-indicator {
  font-size: 11px;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.4);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 50 Models Grid in Sidebar */
.models-50-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
  max-height: calc(100vh - 290px);
  overflow-y: auto;
  padding-right: 4px;
}

.m50-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.m50-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  background: var(--bg-surface-hover);
}

.m50-card.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.14);
  box-shadow: 0 0 0 1px #6366f1, 0 8px 20px rgba(99, 102, 241, 0.35);
}

.m50-preview {
  height: 84px;
  border-radius: var(--radius-sm);
  background: radial-gradient(circle at 50% 30%, #1e293b 0%, #090d16 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.m50-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  z-index: 10;
}

.m50-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.m50-name {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m50-meta {
  font-size: 9.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m50-apply-btn {
  margin-top: 2px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e2e8f0;
  font-size: 9.5px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  text-align: center;
  transition: all 0.2s ease;
}
.m50-card:hover .m50-apply-btn {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.m50-card.active .m50-apply-btn {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

/* Modal styling for 50 Models */
.modal-lg {
  max-width: 980px;
  width: 92vw;
}
.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}
.modal-filter-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.modal-search {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}
.modal-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}
.modal-models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 6px;
}

/* --- Unified Photorealistic Phone & 3D Shadow Styles --- */
.pixel-phone {
  width: 250px;
  height: 520px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
  transform-origin: bottom center;
  flex-shrink: 0;
}

/* Mini preview phone in template & model cards */
.mini-3d-phone {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.mini-screen {
  width: 44px;
  height: 76px;
  background: #0f172a;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  border: 1.5px solid #334155;
}
.mini-screen-dot {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  background: #64748b;
  border-radius: 50%;
}
.mini-screen-island {
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 3px;
  background: #000;
  border-radius: 3px;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(99, 102, 241, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(99, 102, 241, 0.35);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

