:root {
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --bg: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 16px;
  --radius-md: 10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: #f8fafc;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #f8fafc;
  color: #0f172a;
  line-height: 1.5;
  min-height: 100vh;
}

/* =========================================================================
   Hero Section
   ========================================================================= */
.hero-sec {
  max-width: 960px;
  margin: 2.2rem auto 1.25rem auto;
  padding: 0 1.25rem;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #7c3aed;
  background: #f5f3ff;
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 0.75rem;
  border: 1px solid #ddd6fe;
}
.hero-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.hero-sub {
  font-size: 0.95rem;
  color: #64748b;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.6;
}

/* =========================================================================
   Studio Grid & Panels (Clean Minimalist White Architecture)
   ========================================================================= */
.studio-grid {
  max-width: 1280px;
  margin: 1.5rem auto 3.5rem auto;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 1.75rem;
  align-items: start;
}
@media (max-width: 960px) {
  .studio-grid { grid-template-columns: 1fr; }
}

.panel-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
}

.sec-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.sec-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sec-badge {
  font-size: 0.72rem;
  color: #7c3aed;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 700;
}

.form-group {
  margin-bottom: 0.75rem;
}
.form-group:last-child {
  margin-bottom: 0;
}
.form-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.35rem;
}
.form-input {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #0f172a;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.88rem;
  outline: none;
  transition: all 0.2s ease;
}
.form-input:focus {
  background: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.input-with-color {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.color-picker-btn {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.color-picker-btn:hover {
  border-color: #8b5cf6;
  transform: scale(1.05);
}
.color-picker-btn input[type="color"] {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 60px;
  height: 60px;
  opacity: 0;
  cursor: pointer;
}
.color-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.15);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* =========================================================================
   Avatar Upload Box
   ========================================================================= */
.avatar-upload-box {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  background: #f8fafc;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 0.75rem;
}
.avatar-thumb-wrap {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.35rem;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
  position: relative;
}
.avatar-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}
.avatar-btn-row {
  display: flex;
  gap: 6px;
}

.btn-sm {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.btn-sm:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}
.btn-sm.active {
  background: #8b5cf6;
  border-color: #8b5cf6;
  color: white;
}

/* =========================================================================
   Color Swatches & Background Presets
   ========================================================================= */
.color-swatches-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}
.text-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 1.5px solid #cbd5e1;
  transition: transform 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.text-swatch:hover {
  transform: scale(1.2);
  border-color: #8b5cf6;
}

.color-presets-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
}
.bg-chip {
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.15);
}
.bg-chip:hover {
  transform: scale(1.12);
  z-index: 2;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}
.bg-chip.active {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.4), 0 3px 8px rgba(15, 23, 42, 0.25);
  transform: scale(1.08);
}

/* =========================================================================
   Preview Stage & Canvas (Clean White Aesthetic with Transparency Checkerboard)
   ========================================================================= */
.stage-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 560px;
  position: sticky;
  top: 90px;
  box-shadow: 0 4px 24px -2px rgba(15, 23, 42, 0.08);
}
.canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
                    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
                    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  padding: 14px;
  border-radius: 14px;
}
#cardCanvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 20px 48px -10px rgba(15, 23, 42, 0.22);
  border-radius: 12px;
  display: block;
}

.stage-actions-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.btn-download {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: white;
  font-weight: 800;
  padding: 0.85rem 1.8rem;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-download-no-bg {
  background: #ffffff;
  color: #334155;
  font-weight: 700;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  font-size: 0.95rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease;
}
.btn-download-no-bg:hover {
  background: #f8fafc;
  color: #8b5cf6;
  border-color: #8b5cf6;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

/* Verified Badge Type Selector */
.badge-select-box {
  display: inline-flex;
  align-items: center;
}
.badge-select-control {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.32rem 0.65rem;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}
.badge-select-control:focus {
  background: #ffffff;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}