/* =============================================
   PrivaDesign — Design System
   Dark mode default, light mode toggle
   ============================================= */

/* ---------- Tokens ---------- */
:root {
  /* Dark theme (default) */
  --bg: #0F0F13;
  --card: #1A1A22;
  --card2: #22222E;
  --ink: #EEEEF2;
  --ink2: #C0C0CC;
  --mut: #707088;
  --line: #2C2C3C;
  --soft: #181820;
  --acc: #7C6EFA;
  --acc2: #A896FF;
  --acc-soft: #1D1A3A;
  --acc-line: #3A3370;
  --warn: #E09540;
  --warn-soft: #2A1E0A;
  --red: #FF5A5A;
  --green: #4ADE80;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  /* Typography */
  --font-ui: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --font-disp: 'Bricolage Grotesque', sans-serif;
}

[data-theme="light"] {
  --bg: #F7F7FB;
  --card: #FFFFFF;
  --card2: #F2F2F8;
  --ink: #15151E;
  --ink2: #444455;
  --mut: #78789A;
  --line: #E2E2EE;
  --soft: #EFEFF7;
  --acc: #5B4EDB;
  --acc2: #7C6EFA;
  --acc-soft: #EEECFD;
  --acc-line: #C8C0FA;
  --warn: #B87530;
  --warn-soft: #FBF3E6;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  transition: background 0.3s, color 0.3s;
}

.hidden {
  display: none !important;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(15, 15, 19, 0.90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  transition: background 0.3s;
}

[data-theme="light"] .app-header {
  background: rgba(247, 247, 251, 0.92);
}

.header-inner {
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 18px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-disp);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.035em;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand:hover .brand-icon {
  transform: scale(1.1) rotate(-3deg);
}

.brand-svg {
  display: block;
  width: 28px;
  height: 28px;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin: 0 auto;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.tab-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--mut);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--acc);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124, 110, 250, 0.4);
}

.tab-btn:not(.active):hover {
  color: var(--ink);
  background: var(--soft);
}

.tab-icon {
  font-size: 15px;
}

.theme-btn {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 17px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.theme-btn:hover {
  background: var(--soft);
  transform: scale(1.05);
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 1260px;
  margin: 0 auto;
  padding: 24px 18px 120px;
}

.cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 900px) {
  .cols {
    grid-template-columns: minmax(360px, 420px) minmax(340px, 1fr);
    gap: 32px;
    align-items: start;
  }
}

.controls-col {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.preview-col {
  position: sticky;
  top: 75px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

.deck-col {}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}

.card-hd {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-bd {
  padding: 14px 16px;
}

/* ---------- Form Elements ---------- */
label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 0 0 6px;
}

.label-norm {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.field {
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hint {
  font-size: 11.5px;
  color: var(--mut);
  margin-top: 5px;
  line-height: 1.5;
}

input[type="text"],
input[type="email"],
textarea,
select {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.3s;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--mut) 50%),
    linear-gradient(135deg, var(--mut) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

input[type="file"] {
  font-size: 13px;
  color: var(--mut);
  cursor: pointer;
}

/* Color picker row */
.color-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.color-wrap:focus-within {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

input[type="color"] {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background: none;
  flex-shrink: 0;
}

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

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.color-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink2);
  font-family: monospace;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--acc);
  color: #fff;
  border: 1px solid transparent;
  box-shadow: 0 2px 8px rgba(124, 110, 250, 0.25);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 4px 16px rgba(124, 110, 250, 0.4);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink2);
  border: 1px solid var(--line);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--soft);
  color: var(--ink);
}

.btn-sm {
  font-size: 12px;
  padding: 6px 12px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none !important;
}

/* Undo/Redo */
.icon-btn {
  background: var(--card2);
  border: 1px solid var(--line);
  color: var(--ink2);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}

.icon-btn:hover:not(:disabled) {
  background: var(--soft);
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ---------- Preview Panel ---------- */
.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 10px;
}

.preview-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mut);
}

.undo-btns {
  display: flex;
  gap: 6px;
}

#posterBig {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  height: auto;
  object-fit: contain;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 auto;
}

.a11y-note {
  font-size: 11.5px;
  color: var(--mut);
  margin-top: 10px;
  line-height: 1.55;
}

.a11y-note b {
  color: var(--ink);
}

/* ---------- Style Grid (Poster) ---------- */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.style-thumb {
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  background: var(--card2);
  overflow: hidden;
  font-family: var(--font-ui);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.style-thumb[aria-pressed="true"] {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

.style-thumb:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.style-thumb canvas {
  width: 100%;
  height: auto;
  display: block;
}

.style-thumb .sname {
  display: block;
  font-size: 10px;
  font-weight: 600;
  padding: 5px 4px;
  color: var(--mut);
  text-align: center;
  line-height: 1.2;
}

/* ---------- Carousel: Theme Chips ---------- */
.theme-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 6px;
}

.theme-chip {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  background: var(--card2);
  overflow: hidden;
  font-family: var(--font-ui);
  transition: all 0.15s;
}

.theme-chip[aria-pressed="true"] {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

.theme-chip .swatch {
  height: 36px;
  display: block;
}

.theme-chip .tname {
  font-size: 10px;
  font-weight: 600;
  padding: 5px 4px;
  color: var(--mut);
  display: block;
  text-align: center;
}

/* Accent swatches */
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.swatch-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.swatch-dot[aria-pressed="true"] {
  border-color: var(--ink);
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.swatch-dot:hover {
  transform: scale(1.1);
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.swatch:hover {
  transform: scale(1.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---------- Text Size Control ---------- */
.size-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}

.size-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink2);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  line-height: 1;
}

.size-btn:hover {
  background: var(--soft);
  color: var(--ink);
  border-color: var(--acc);
}

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

.size-track {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  cursor: default;
}

.size-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--acc);
  border-radius: 999px;
  transition: width 0.2s;
}

/* ---------- Carousel: Slide Deck ---------- */
.slide-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.slide-slot {
  position: relative;
  cursor: grab;
}

.slide-slot.dragging {
  opacity: 0.5;
}

.slide-slot canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  transition: box-shadow 0.15s;
}

.slide-slot:hover canvas {
  box-shadow: var(--shadow);
}

.slide-slot .slide-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--mut);
  gap: 8px;
}

.slide-slot .slide-kind {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 9.5px;
}

.slide-slot .slide-dl {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--acc);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}

.slide-slot .slide-dl:hover {
  opacity: 0.7;
}

.slide-slot .slide-img-btn {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--mut);
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  padding: 3px 8px;
  transition: all 0.15s;
}

.slide-slot .slide-img-btn:hover {
  background: var(--soft);
  color: var(--ink);
}

/* ---------- Sticky Download Bar ---------- */
.dl-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 19, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40;
  transition: background 0.3s;
}

[data-theme="light"] .dl-bar {
  background: rgba(247, 247, 251, 0.95);
}

.dl-bar-inner {
  max-width: 1260px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.dl-info {
  flex: 1;
  min-width: 0;
}

.dl-info-key {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mut);
}

.dl-info-val {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.fmt-select {
  width: auto;
  min-width: 88px;
  padding: 9px 28px 9px 10px;
  font-size: 13.5px;
  background-color: var(--card2);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ---------- Mode Panel ---------- */
.mode-panel {}

/* ---------- BG Remover Tab ---------- */
.bg-dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--card2);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.bg-dropzone:hover,
.bg-dropzone.drag-over {
  border-color: var(--acc);
  background: var(--acc-soft);
  transform: scale(1.01);
}

.bg-dropzone-icon {
  font-size: 36px;
  margin-bottom: 8px;
  color: var(--acc);
}

.bg-dropzone-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.bg-dropzone-sub {
  font-size: 12px;
  color: var(--mut);
}

.bg-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.bg-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--acc), #EC4899);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.bg-checkerboard-wrap {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: repeating-conic-gradient(var(--card2) 0% 25%, var(--card) 0% 50%) 50% / 20px 20px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  box-shadow: var(--shadow);
}

#bgRemoverCanvas {
  max-width: 100%;
  max-height: calc(100vh - 170px);
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* ---------- App Store & Play Store Mode ---------- */
.store-deck {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.store-slot {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
}

.store-slot:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--acc-line);
}

.store-slot.active {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc-soft);
}

.store-slot canvas {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  background: var(--card2);
  margin-bottom: 8px;
}

.store-slot-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--mut);
  gap: 6px;
}

.store-slot-num {
  font-weight: 700;
  color: var(--ink2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
}

/* ---------- Responsive Breakpoints ---------- */

/* Laptop & Medium Desktops (900px - 1200px) */
@media (min-width: 900px) and (max-width: 1199px) {
  .wrap {
    padding: 20px 16px 120px;
  }

  .cols {
    grid-template-columns: minmax(320px, 380px) minmax(320px, 1fr);
    gap: 24px;
  }

  .style-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

/* Tablet & Smaller Screens (< 900px) */
@media (max-width: 899px) {
  .wrap {
    padding: 16px 16px 110px;
  }

  .cols {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .preview-col {
    order: -1;
    position: relative;
    top: 0;
    width: 100%;
    margin-bottom: 8px;
    z-index: 10;
  }

  #posterBig,
  #bgRemoverCanvas {
    max-height: 50vh;
    max-width: 100%;
    margin: 0 auto;
  }

  .slide-deck,
  .store-deck {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
  }
}

/* Mobile Screens (< 640px) */
@media (max-width: 639px) {
  .app-header {
    height: 56px;
  }

  .header-inner {
    padding: 0 12px;
    height: 56px;
    gap: 10px;
  }

  .brand-name {
    display: none;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
  }

  .mode-tabs {
    padding: 3px;
    gap: 2px;
  }

  .tab-btn {
    padding: 6px 12px;
    font-size: 12.5px;
  }

  .tab-icon {
    font-size: 14px;
  }

  .theme-btn {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .brand-kit-btn-label,
  .install-btn-label {
    display: none;
  }

  .wrap {
    padding: 12px 10px 105px;
  }

  .card {
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
  }

  .card-bd {
    padding: 12px;
  }

  .card-hd {
    padding: 10px 12px;
    font-size: 12px;
  }

  .style-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
  }

  .style-thumb .sname {
    font-size: 9px;
    padding: 4px 2px;
  }

  .slide-deck,
  .store-deck {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
  }

  .slide-slot .slide-meta,
  .store-slot-meta {
    font-size: 10px;
    flex-wrap: wrap;
    gap: 4px;
  }

  .slide-slot .slide-img-btn {
    font-size: 9.5px;
    padding: 2px 6px;
  }

  .theme-chips {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .dl-bar {
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }

  .dl-info-key {
    font-size: 9px;
  }

  .dl-info-val {
    font-size: 12.5px;
  }

  .fmt-select {
    min-width: 72px;
    padding: 7px 22px 7px 8px;
    font-size: 12px;
  }

  .btn {
    padding: 8px 13px;
    font-size: 12.5px;
  }

  .btn-sm {
    padding: 5px 10px;
    font-size: 11.5px;
  }

  #posterBig,
  #bgRemoverCanvas {
    max-height: 44vh;
  }

  #ytSimViewSearch .yt-card {
    flex-direction: column !important;
  }

  #ytSimViewSearch .yt-thumb-box {
    width: 100% !important;
  }
}

/* Very Small Mobile (< 420px) */
@media (max-width: 419px) {
  .row2 {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .tab-btn {
    padding: 5px 8px;
    font-size: 11.5px;
  }

  .tab-icon {
    font-size: 13px;
  }

  .dl-info {
    display: none;
  }

  .dl-bar-inner {
    justify-content: flex-end;
    width: 100%;
  }

  #posterDlControls,
  #carouselDlControls {
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 6px;
  }

  #posterDlControls .btn,
  #carouselDlControls .btn {
    flex: 1;
    justify-content: center;
  }

  .swatches {
    gap: 6px;
  }

  .swatch-dot {
    width: 26px;
    height: 26px;
  }

  .swatch {
    width: 24px;
    height: 24px;
  }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

/* ---------- Selection ---------- */
::-selection {
  background: var(--acc);
  color: #fff;
}

/* =============================================
   MODALS (Brand Kit & Resizer)
   ============================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-dialog {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 90vh;
  animation: modalZoomIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog-lg {
  max-width: 960px;
}

@keyframes modalZoomIn {
  from {
    transform: scale(0.96);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

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

.modal-bd {
  padding: 20px;
  overflow-y: auto;
}

.modal-ft {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--card2);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--mut);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.modal-close-btn:hover {
  color: var(--ink);
  background: var(--card2);
}

/* Brand Kit Preview Badge */
.bk-preview-badge {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--acc);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.bk-avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--acc);
}

.bk-avatar-fallback {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.bk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* =============================================
   INFOGRAPHICS & COMPARISON STYLES
   ============================================= */
.info-tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
}

.info-tpl-btn {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  transition: all 0.15s ease;
  text-align: left;
}

.info-tpl-btn:hover {
  border-color: var(--acc2);
}

.info-tpl-btn.active {
  border-color: var(--acc);
  background: var(--acc-soft);
  color: var(--acc2);
}

.info-tpl-icon {
  font-size: 15px;
}

.info-tpl-name {
  line-height: 1.25;
}

.info-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.info-theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}

.info-theme-btn:hover {
  border-color: var(--acc2);
}

.info-theme-btn.active {
  border-color: var(--acc);
  background: var(--acc-soft);
}

.info-theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.info-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

#infographicCanvas {
  max-width: 100%;
  max-height: 58vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}

/* =============================================
   MULTI-PLATFORM RESIZER STYLES
   ============================================= */
.resizer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.resizer-card {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.resizer-card-hd {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.resizer-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.resizer-icon {
  font-size: 16px;
}

.resizer-canvas-preview-wrap {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  background: repeating-conic-gradient(#181820 0% 25%, #131318 0% 50%) 50% / 12px 12px;
}

.resizer-preview-img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* =============================================
   INVOICE & QUOTATION STUDIO STYLES
   ============================================= */
.invoice-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: var(--soft);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-sizing: border-box;
}

#invoiceCanvas {
  max-width: 100%;
  width: 100%;
  height: auto;
  aspect-ratio: 1240 / 1754;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  background: #FFFFFF;
  display: block;
}

.inv-items-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inv-item-card {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.inv-item-card:hover {
  border-color: var(--acc-line);
}

.inv-item-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.inv-item-desc-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 500;
}

.inv-del-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mut);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.inv-del-btn:hover:not([disabled]) {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  transform: scale(1.04);
}

.inv-item-card-bottom {
  display: grid;
  grid-template-columns: minmax(60px, 1fr) minmax(90px, 1.3fr) minmax(100px, 1.4fr);
  gap: 8px;
  align-items: end;
}

.inv-subfield {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.inv-sublabel {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mut);
  margin-bottom: 4px;
}

.inv-num-input {
  width: 100%;
  padding: 7px 8px;
  font-size: 13.5px;
  text-align: right;
  border-radius: var(--radius-sm);
}

.inv-subfield-total {
  text-align: right;
}

.inv-item-calc-total {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  padding: 0 8px;
  background: var(--soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  white-space: nowrap;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mode-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    scrollbar-width: none;
  }

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

  .preview-col {
    position: static;
    margin-top: 16px;
  }

  .inv-item-card-bottom {
    grid-template-columns: 1fr 1fr;
  }

  .inv-subfield-total {
    grid-column: span 2;
  }
}

/* =============================================
   BARCODE & SHOP LABEL STUDIO STYLES
   ============================================= */
.barcode-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: var(--card2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-sizing: border-box;
  min-height: 280px;
  overflow: auto;
}

#barcodeCanvas {
  max-width: 100%;
  max-height: 480px;
  height: auto;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  background: #FFFFFF;
  display: block;
}

.bc-type-btn,
.bc-mode-btn {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.2s ease;
  text-align: left;
  width: 100%;
}

.bc-type-btn:hover,
.bc-mode-btn:hover {
  background: var(--soft);
  border-color: var(--acc);
  transform: translateY(-1px);
}

.bc-type-btn.active,
.bc-mode-btn.active {
  background: var(--acc-soft);
  border-color: var(--acc);
  color: var(--acc);
  box-shadow: 0 0 0 2px var(--acc-line);
}

.bc-chip {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mut);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.bc-chip:hover {
  color: var(--ink);
  background: var(--soft);
  border-color: var(--acc);
}

.bc-chip.active {
  background: var(--acc);
  border-color: var(--acc);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(124, 110, 250, 0.3);
}

/* =============================================
   YOUTUBE THUMBNAIL STUDIO STYLES
   ============================================= */
.thumbnail-canvas-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: var(--card2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-sizing: border-box;
}

#thumbnailCanvas {
  max-width: 100%;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  background: #000000;
  display: block;
}

/* YouTube Feed Simulator Styles */
.yt-feed-sim {
  width: 100%;
  background: #0F0F0F;
  color: #F1F1F1;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 14px;
  box-sizing: border-box;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.yt-feed-search {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #121212;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 4px 12px;
  width: 180px;
  color: #AAA;
}

.yt-pill-btn {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
}

.yt-notif-dot {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #CC0000;
  color: #FFF;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 10px;
}

.yt-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #FFF;
  flex-shrink: 0;
}

.yt-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
}

.yt-chips-row::-webkit-scrollbar {
  display: none;
}

.yt-chip {
  background: rgba(255, 255, 255, 0.1);
  color: #F1F1F1;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

.yt-chip.active {
  background: #F1F1F1;
  color: #0F0F0F;
  font-weight: 700;
}

.yt-feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.yt-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
}

.btn.active {
  background: var(--accent) !important;
  color: #FFF !important;
  border-color: var(--accent) !important;
}

.yt-active-card {
  position: relative;
  border-radius: 12px;
  box-shadow: 0 0 0 2px #F87171, 0 4px 16px rgba(248, 113, 113, 0.18);
  padding: 6px;
  background: rgba(239, 68, 68, 0.10);
  transition: all 0.2s ease;
}

.yt-feed-sim.yt-theme-light .yt-active-card {
  background: #FFE4E6 !important;
  box-shadow: 0 0 0 2px #FDA4AF, 0 4px 16px rgba(244, 63, 94, 0.15) !important;
}

.yt-thumb-controls {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 3;
}

.yt-thumb-ctrl-btn {
  background: rgba(0, 0, 0, 0.75);
  color: #FFF;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  padding: 0;
}

.yt-your-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #FFF;
  font-size: 8px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.yt-thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: #181818;
}

.yt-real-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.yt-mock-thumb {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.yt-mock-time {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0, 0, 0, 0.82);
  color: #FFF;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
}

.yt-card-meta {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.yt-card-title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  color: #F1F1F1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.yt-card-sub {
  font-size: 10.5px;
  color: #AAAAAA;
  margin-top: 2px;
}

/* Light Theme Mode for YouTube Simulator */
.yt-feed-sim.yt-theme-light {
  background: #FFFFFF;
  color: #0F0F0F;
  border-color: #E5E5E5;
}

.yt-feed-sim.yt-theme-light .yt-feed-header,
.yt-feed-sim.yt-theme-light .yt-feed-sim-bar {
  border-color: #E5E5E5;
}

.yt-feed-sim.yt-theme-light .yt-feed-search {
  background: #F8F8F8;
  border-color: #CCCCCC;
  color: #606060;
}

.yt-feed-sim.yt-theme-light .yt-pill-btn,
.yt-feed-sim.yt-theme-light .yt-chip {
  background: #F2F2F2;
  color: #0F0F0F;
}

.yt-feed-sim.yt-theme-light .yt-chip.active {
  background: #0F0F0F;
  color: #FFFFFF;
}

.yt-feed-sim.yt-theme-light .yt-card-title {
  color: #0F0F0F;
}

.yt-feed-sim.yt-theme-light .yt-card-sub {
  color: #606060;
}

/* A/B Test Variations Card */
.yt-var-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.yt-var-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 110, 250, 0.2);
}