/* ==========================================================================
   ApexQR Studio — Clean, Modern & Accessible Design System
   ========================================================================== */

:root {
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Color Tokens - Dark Mode */
  --bg-app: #090B10;
  --bg-card: rgba(18, 22, 34, 0.75);
  --bg-card-hover: rgba(24, 30, 48, 0.88);
  --bg-input: rgba(13, 17, 28, 0.85);
  --bg-input-focus: rgba(17, 24, 40, 1);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(114, 72, 185, 0.6);
  --border-glow: rgba(168, 85, 247, 0.25);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  --accent-purple: #7248B9;
  --accent-purple-light: #9C27B0;
  --accent-indigo: #6366F1;
  --accent-cyan: #06B6D4;
  --accent-emerald: #10B981;

  --glow-color: rgba(114, 72, 185, 0.35);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

body.theme-light {
  --bg-app: #F1F5F9;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-input: rgba(241, 245, 249, 0.9);
  --bg-input-focus: #FFFFFF;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-active: rgba(114, 72, 185, 0.6);
  --border-glow: rgba(114, 72, 185, 0.2);

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  --glow-color: rgba(114, 72, 185, 0.15);
  --shadow-lg: 0 20px 35px -10px rgba(99, 102, 241, 0.12);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  position: relative;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Ambient Background Orbs */
.app-background {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.25;
  animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-1 {
  width: 500px;
  height: 500px;
  top: -100px;
  left: 10%;
  background: radial-gradient(circle, #7248B9 0%, transparent 70%);
}

.orb-2 {
  width: 600px;
  height: 600px;
  top: 30%;
  right: -100px;
  background: radial-gradient(circle, #6366F1 0%, transparent 70%);
  animation-delay: -5s;
}

.orb-3 {
  width: 450px;
  height: 450px;
  bottom: -50px;
  left: 30%;
  background: radial-gradient(circle, #06B6D4 0%, transparent 70%);
  animation-delay: -10s;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
  100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(9, 11, 16, 0.75);
  border-bottom: 1px solid var(--border-subtle);
}

body.theme-light .app-header {
  background: rgba(241, 245, 249, 0.8);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 12px rgba(114, 72, 185, 0.4));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-icon {
  transform: rotate(5deg) scale(1.05);
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.brand-text h1 span {
  background: linear-gradient(135deg, #A855F7, #6366F1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #C084FC;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.25);
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.loaded-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(114, 72, 185, 0.18);
  border: 1px solid rgba(114, 72, 185, 0.4);
  color: #E9D5FF;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

body.theme-light .loaded-pill {
  color: #7248B9;
  background: rgba(114, 72, 185, 0.08);
}

.indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #A855F7;
  box-shadow: 0 0 10px #A855F7;
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: rgba(255, 255, 255, 0.05);
}

/* Main Layout */
.main-layout {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 2rem;
  align-items: start;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Type Navigation */
.type-nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  scrollbar-width: none;
}

.type-nav::-webkit-scrollbar {
  display: none;
}

.type-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.type-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.type-btn.active {
  color: #FFFFFF;
  background: linear-gradient(135deg, #7248B9, #8B5CF6);
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 4px 15px rgba(114, 72, 185, 0.35);
}

/* Form Panes */
.form-pane {
  display: none;
}

.form-pane.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.quick-links {
  display: flex;
  gap: 0.35rem;
}

.btn-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-chip:hover, .btn-chip.active {
  color: #C084FC;
  background: rgba(114, 72, 185, 0.15);
  border-color: rgba(114, 72, 185, 0.4);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.9rem;
  font-size: 0.95rem;
  pointer-events: none;
  opacity: 0.7;
}

input[type="url"],
input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem; /* Prevents iOS auto-zoom (must be >= 16px) */
  padding: 0.75rem 1rem;
  padding-left: 2.5rem;
  transition: all 0.2s ease;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  touch-action: manipulation;
}

textarea,
select {
  padding-left: 1rem;
}

input:focus,
textarea:focus,
select:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--border-glow);
}

.btn-clear {
  position: absolute;
  right: 0.8rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.2s ease;
}

.btn-clear:hover {
  color: var(--text-primary);
}

.input-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.test-link {
  color: #C084FC;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.test-link:hover {
  color: #E9D5FF;
  text-decoration: underline;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.full-width {
  grid-column: span 2;
}

/* Customizer Tabs */
.customizer-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.custom-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.75rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.custom-tab-btn .tab-icon {
  font-size: 1.15rem;
}

.custom-tab-btn:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
  background: var(--bg-card-hover);
}

.custom-tab-btn.active {
  color: #FFFFFF;
  background: rgba(114, 72, 185, 0.25);
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: 0 4px 15px rgba(114, 72, 185, 0.2);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

.section-title {
  margin-bottom: 1.25rem;
}

.section-title h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

/* Option Grid: Dot Shapes */
.option-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.style-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.style-choice-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  color: var(--text-primary);
}

.style-choice-btn.active {
  background: rgba(114, 72, 185, 0.2);
  border-color: #A855F7;
  color: #FFFFFF;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.25);
}

.style-sample {
  width: 32px;
  height: 32px;
  background: #C084FC;
}

.sample-square { border-radius: 0; }
.sample-rounded { border-radius: 8px; }
.sample-dots { border-radius: 50%; }
.sample-diamond { transform: rotate(45deg) scale(0.75); border-radius: 3px; }

.row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Colors & Gradients */
.toggle-pills {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.25rem;
  margin-bottom: 1.25rem;
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill-btn.active {
  background: #7248B9;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(114, 72, 185, 0.4);
}

.gradient-presets {
  margin-bottom: 1.25rem;
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.presets-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.preset-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.preset-btn.active {
  border-color: #A855F7;
  background: rgba(114, 72, 185, 0.15);
  color: #FFFFFF;
}

.preset-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.color-inputs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.color-picker-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sub-toggle {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm);
}

.color-hex-text {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  padding: 0.4rem 0.6rem !important;
  max-width: 100px;
}

/* Logo Presets Grid */
.logo-presets-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.logo-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 0.35rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.logo-preset-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

.logo-preset-btn.active {
  background: rgba(114, 72, 185, 0.2);
  border-color: #A855F7;
  color: #FFFFFF;
}

.preset-icon-svg {
  font-size: 1.4rem;
  line-height: 1;
}

.file-input-hidden {
  display: none;
}

.upload-dropzone {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover {
  border-color: var(--accent-purple);
  background: rgba(114, 72, 185, 0.05);
}

.upload-icon {
  font-size: 1.8rem;
}

.upload-title {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.upload-desc {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-browse {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Sliders */
.slider-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.slider-value {
  color: #C084FC;
  font-family: var(--font-mono);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #A855F7;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
  border: 2px solid #FFFFFF;
  transition: transform 0.15s ease;
}

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

/* ==========================================================================
   RIGHT COLUMN: STICKY PREVIEW CARD
   ========================================================================== */

.sticky-preview-card {
  position: sticky;
  top: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.preview-tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.status-indicator.live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

.preview-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Canvas Stage */
.canvas-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.75rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}

body.theme-light .canvas-stage {
  background: rgba(226, 232, 240, 0.4);
}

.qr-ambient-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
  filter: blur(40px);
  pointer-events: none;
  transition: all 0.4s ease;
}

.canvas-wrapper {
  position: relative;
  background: #FFFFFF;
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.canvas-wrapper:hover {
  transform: scale(1.02);
}

#qrCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
}

/* Target Destination Box */
.target-link-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  gap: 0.5rem;
}

.target-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.target-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.target-url {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #C084FC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-open-link {
  background: rgba(114, 72, 185, 0.2);
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #E9D5FF;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-open-link:hover {
  background: #7248B9;
  color: #FFFFFF;
}

/* Action Buttons Grid */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.btn-primary {
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #7248B9 0%, #9C27B0 100%);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(114, 72, 185, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(114, 72, 185, 0.5);
}

.btn-secondary {
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-outline:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.2);
}



/* Built-in Verification Accordion */
.verify-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.85rem;
}

.verify-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.2s;
}

.verify-toggle:hover {
  color: var(--text-primary);
}

.verify-content {
  display: none;
  margin-top: 0.75rem;
}

.verify-section.open .verify-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-verify-now {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34D399;
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-verify-now:hover {
  background: rgba(16, 185, 129, 0.25);
}

.verify-result {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  word-break: break-all;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #181E2E;
  border: 1px solid rgba(168, 85, 247, 0.4);
  color: #FFFFFF;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 0.85rem;
  font-weight: 600;
  animation: slideToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideToast {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.5);
}

/* Print */
@media print {
  body {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  .app-background, .app-header, .controls-column, .premade-section, .verify-section, .action-grid, .target-link-box, .preview-header, .toast-container {
    display: none !important;
  }
  .main-layout { display: block !important; margin: 0 !important; padding: 0 !important; }
  .sticky-preview-card { border: none !important; box-shadow: none !important; background: none !important; position: static !important; }
  .canvas-stage { background: none !important; border: none !important; }
  .canvas-wrapper { box-shadow: none !important; padding: 0 !important; }
}

/* =========================================================================
   RESPONSIVE — Mobile-first optimizations
   ========================================================================= */

/* Tablet: single column, preview sticky at top */
@media (max-width: 1024px) {
  .main-layout {
    grid-template-columns: 1fr;
    /* Move preview column first on smaller screens */
    grid-template-areas:
      "preview"
      "controls";
    margin: 1rem auto 2rem;
    padding: 0 1rem;
    gap: 1.25rem;
  }

  .controls-column { grid-area: controls; }
  .preview-column  { grid-area: preview; }

  .sticky-preview-card {
    position: static;
    /* Show QR preview in a compact horizontal layout on tablets */
  }
}

/* Mobile: full optimizations for phones */
@media (max-width: 640px) {
  /* Compact header */
  .header-container {
    padding: 0.65rem 1rem;
  }

  .brand-text h1 { font-size: 1.1rem; }
  .badge-pill { display: none; } /* Hide pill on small screens */
  .loaded-pill .indicator-label { display: none; } /* Dot only */
  .loaded-pill { padding: 0.35rem 0.55rem; }

  /* Layout: full single-column, preview first */
  .main-layout {
    margin: 0.75rem auto 2rem;
    padding: 0 0.75rem;
    gap: 1rem;
  }

  /* Compact card padding */
  .card { padding: 1rem; }

  /* Type nav — horizontal scroll with snap */
  .type-nav {
    gap: 0.4rem;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .type-btn {
    scroll-snap-align: start;
    flex-shrink: 0;
    padding: 0.6rem 0.9rem;
    font-size: 0.8rem;
    min-height: 44px; /* Accessibility touch target */
  }

  /* Form grid: single column */
  .form-grid { grid-template-columns: 1fr; }
  .full-width { grid-column: span 1; }
  .row-2col { grid-template-columns: 1fr; }

  /* Larger touch targets for inputs */
  input[type="url"],
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  textarea,
  select {
    min-height: 48px;
    font-size: 1rem; /* Prevent iOS zoom */
  }

  textarea { min-height: 80px; }

  /* Customizer tabs: horizontal scroll instead of grid */
  .customizer-tabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 0.4rem;
    margin-top: 1rem;
    padding-bottom: 0.25rem;
    scrollbar-width: none;
  }

  .customizer-tabs::-webkit-scrollbar { display: none; }

  .custom-tab-btn {
    flex-direction: row;
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 0.55rem 0.9rem;
    font-size: 0.78rem;
    min-height: 44px;
    white-space: nowrap;
  }

  /* Dot style grid: 2 columns */
  .option-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Presets row: 2 columns */
  .presets-row { grid-template-columns: 1fr 1fr; }

  /* Logo presets: 3 per row */
  .logo-presets-grid { grid-template-columns: repeat(3, 1fr); }

  /* Color inputs: 2 column */
  .color-inputs-grid { grid-template-columns: 1fr 1fr; }

  /* Canvas: constrain to screen */
  .canvas-stage {
    padding: 1rem;
  }

  #qrCanvas {
    width: 100% !important;
    max-width: 280px;
  }

  /* Preview card: no sticky on mobile */
  .sticky-preview-card {
    position: static;
    gap: 0.85rem;
  }

  /* Action buttons: single column, large touch targets */
  .action-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .btn-primary,
  .btn-secondary {
    grid-column: span 1;
    min-height: 52px;
    font-size: 0.95rem;
  }

  .btn-outline {
    min-height: 48px;
  }

  /* Native share button — visible on mobile only */
  .btn-share-native {
    display: flex !important;
  }

  /* Upload dropzone: compact */
  .upload-dropzone {
    flex-direction: column;
    text-align: center;
    padding: 1rem;
    gap: 0.5rem;
  }

  /* Toast: full-width at bottom */
  .toast-container {
    bottom: 1rem;
    left: 0.75rem;
    right: 0.75rem;
  }

  .toast {
    width: 100%;
    justify-content: center;
  }

  /* Slider thumbs: bigger on mobile */
  input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  /* Section titles: smaller */
  .section-title h3 { font-size: 0.95rem; }
}

/* Very small phones */
@media (max-width: 375px) {
  .header-container { padding: 0.5rem 0.75rem; }
  .card { padding: 0.85rem; }
  .type-btn { font-size: 0.75rem; padding: 0.55rem 0.75rem; }
  .action-grid { gap: 0.4rem; }
  .logo-presets-grid { grid-template-columns: repeat(3, 1fr); }
}
