/* ========== Cream theme tokens ========== */
:root {
  --cream:        #F5EFE5;
  --cream-warm:   #F0E9DB;
  --cream-card:   #FAF5EC;
  --ink:          #1E1B17;
  --ink-soft:     #3A3530;
  --ink-muted:    #6F6457;
  --brand:        #3b28cc;
  --brand-dark:   #2a1d9e;
  --brand-soft:   rgba(59,40,204,0.08);
  --rule:         #E6DECB;
}

/* ========== RESET & BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body, body.cream-body {
  font-family: 'Inter', sans-serif;
  background: var(--cream);
  color: var(--ink);
  display: flex; flex-direction: column;
}

/* ========== Floating pill nav (shared with index/models) ========== */
.pill-nav-shell {
  position: relative; z-index: 100;
  padding: 0.75rem 1.4rem 0;
  flex: 0 0 auto;
}
.pill-nav {
  max-width: 1500px; margin: 0 auto;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 100px;
  padding: 0.55rem 0.75rem 0.55rem 1.4rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 6px 24px -10px rgba(30,27,23,0.12);
}
.pn-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.05rem; }
.pn-logo img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: transparent; }
.pn-links { flex: 1; display: flex; justify-content: center; gap: 1.6rem; }
.pn-links a { text-decoration: none; color: var(--ink-soft); font-size: 0.92rem; font-weight: 500; padding: 0.35rem 0.2rem; border-bottom: 2px solid transparent; }
.pn-links a:hover { color: var(--ink); }
.pn-links a.active { color: var(--brand); border-bottom-color: var(--brand); }
.btn-pill { display: inline-flex; align-items: center; gap: 8px; padding: 0.85rem 1.5rem; border-radius: 100px; font-family: inherit; font-size: 0.95rem; font-weight: 600; text-decoration: none; cursor: pointer; border: 1.5px solid transparent; white-space: nowrap; transition: background .15s, transform .15s; }
.btn-pill:hover { transform: translateY(-1px); }
.btn-pill-primary { background: var(--brand); color: white; box-shadow: 0 8px 20px -8px rgba(59,40,204,0.55); }
.btn-pill-primary:hover { background: var(--brand-dark); color: white; }
.btn-pill-tiny { padding: 0.45rem 0.95rem; font-size: 0.78rem; }

@media (max-width: 720px) {
  .pn-links { display: none; }
  .pn-logo span { display: none; }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(59,40,204,0.25); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(59,40,204,0.5); }

/* ========== HEADER ========== */
.main-header {
  background: rgba(244, 246, 254, 0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(59,40,204,0.08);
  flex: 0 0 auto;
}
.header-inner {
  max-width: 1600px; margin: 0 auto;
  padding: 0.7rem 1.5rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.logo-area { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-icon { width: 38px; height: 38px; border-radius: 12px; overflow: hidden; background: #3b28cc; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 18px -8px rgba(59,40,204,0.5); }
.logo-icon img { width: 100%; height: 100%; object-fit: cover; }
.logo-text { font-size: 1.35rem; font-weight: 800; background: linear-gradient(135deg, #1E1B4B, #3b28cc); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -0.02em; }
.logo-text span { color: #6D28D9; background: none; -webkit-text-fill-color: #6D28D9; }
nav ul { display: flex; gap: 1.6rem; list-style: none; }
nav a { text-decoration: none; font-weight: 500; color: #4B5478; font-size: 0.9rem; transition: color .2s; }
nav a:hover, nav a.active { color: #3b28cc; }

/* ========== MAIN ========== */
main {
  flex: 1; min-height: 0;
  max-width: 1600px; width: 100%;
  margin: 0 auto;
  padding: 0.85rem 1.5rem 1rem;
  display: flex; flex-direction: column;
  gap: 0.85rem;
}

/* ========== TOP TOOLBAR ========== */
.top-toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 0.6rem;
}
.back-link {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: white; padding: 0.45rem 0.95rem;
  border-radius: 100px; text-decoration: none;
  color: #1f2a4e; font-weight: 500; font-size: 0.8rem;
  border: 1px solid #E2E8F8; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: all .2s;
}
.back-link:hover { transform: translateX(-2px); border-color: #3b28cc; color: #3b28cc; }

.toolbar-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.autosave-pill {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 100px;
  font-size: 0.74rem; font-weight: 500;
  color: #15803D;
}
.autosave-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #22C55E; animation: pulse 2s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.folder-pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  background: white;
  border: 1px solid #E2E8F8;
  border-radius: 100px;
  font-size: 0.74rem; font-weight: 500;
  color: #4B5478; cursor: pointer;
  transition: all .2s;
}
.folder-pill:hover { border-color: #3b28cc; color: #3b28cc; }
.folder-pill.active { background: rgba(59,40,204,0.08); color: #3b28cc; border-color: rgba(59,40,204,0.3); }
.folder-pill .folder-name { font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== STUDIO LAYOUT (fills viewport) ========== */
.studio-layout {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr);
  gap: 1rem;
}

/* ========== CANVAS AREA (fixed left) ========== */
.canvas-area {
  background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFE 100%);
  border-radius: 28px;
  padding: 1.1rem 1.1rem 0.95rem;
  border: 1px solid #ECEFFB;
  box-shadow: 0 1px 3px rgba(15,18,38,0.04), 0 12px 38px -14px rgba(59,40,204,0.12);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.view-tabs {
  display: inline-flex;
  align-self: center;
  background: #F2F4FC;
  padding: 4px;
  border-radius: 100px;
  margin-bottom: 0.85rem;
  gap: 2px;
}
.view-tab {
  padding: 0.4rem 1rem;
  border-radius: 100px;
  font-size: 0.78rem; font-weight: 600;
  color: #5A6584; cursor: pointer;
  border: none; background: transparent;
  transition: all .15s;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
.view-tab.active {
  background: white;
  color: #3b28cc;
  box-shadow: 0 1px 3px rgba(15,18,38,0.06), 0 4px 12px -4px rgba(59,40,204,0.15);
}

.canvas-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  container-type: size;
}

/* 2D canvas — sizes to whichever container dimension is the binding constraint.
   --canvas-aspect-h is the canvas's pixel height for the current phone model
   (width is always 350). --case-scale is the S/M/L visual scale applied via
   transform so it never overflows the layout box (no collisions with the
   view-tab strip above or the canvas-footer below). */
.canvas-container {
  --canvas-aspect-h: 640;
  --case-scale: 1;
  background: repeating-linear-gradient(45deg, #F9FAFE 0 12px, #F4F6FC 12px 24px);
  width: min(100cqw, calc(100cqh * 350 / var(--canvas-aspect-h)));
  height: min(100cqh, calc(100cqw * var(--canvas-aspect-h) / 350));
  border-radius: 28px;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.6),
    0 25px 50px -20px rgba(59,40,204,0.25);
  cursor: crosshair;
  transform: scale(var(--case-scale));
  transform-origin: center center;
  transition: transform .25s ease, width .25s ease, height .25s ease;
}
#phoneCanvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
#phoneCanvasOverlay {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* 3D viewer */
.viewer-3d {
  display: none;
  width: min(100cqw, calc(100cqh * 350 / 640));
  height: min(100cqh, calc(100cqw * 640 / 350));
  border-radius: 28px;
  background:
    radial-gradient(circle at 30% 20%, #F1E8FF 0%, transparent 50%),
    radial-gradient(circle at 70% 80%, #E0EAFF 0%, transparent 50%),
    #FAFBFF;
  position: relative;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.8),
    0 25px 50px -20px rgba(59,40,204,0.25);
}
.viewer-3d canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer-hint {
  position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center; font-size: 0.68rem; color: #6D28D9;
  pointer-events: none; font-weight: 500;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}

/* Zoom controls — sit inside the 3D viewer card */
.zoom-controls {
  position: absolute;
  bottom: 12px; right: 12px;
  display: flex; flex-direction: column;
  gap: 6px;
  z-index: 5;
}
.zoom-btn {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(59,40,204,0.15);
  border-radius: 10px;
  color: #1E1B4B;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(15,18,38,0.1);
  transition: all .15s;
  font-size: 0.85rem;
  padding: 0;
}
.zoom-btn:hover { border-color: #3b28cc; color: #3b28cc; transform: translateY(-1px); }
.zoom-btn:active { transform: translateY(0); }

.canvas-footer {
  flex: 0 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 0.7rem; gap: 0.5rem; flex-wrap: wrap;
}
.canvas-hint { font-size: 0.7rem; color: #6F7898; display: inline-flex; align-items: center; gap: 6px; }
.canvas-hint i { color: #3b28cc; }
.action-buttons { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.btn-small {
  background: white;
  border: 1px solid #E2E8F8;
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 500;
  color: #4B5478;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all .15s;
}
.btn-small:hover { background: #3b28cc; color: white; border-color: #3b28cc; }
.btn-small.primary { background: #3b28cc; color: white; border-color: #3b28cc; }

/* ========== TOOLS AREA (right, with tabs) ========== */
.tools-area {
  background: #FAFBFE;
  border-radius: 28px;
  border: 1px solid #ECEFFB;
  box-shadow: 0 1px 3px rgba(15,18,38,0.04), 0 12px 38px -14px rgba(59,40,204,0.12);
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Tabs styled as a pill switcher rather than underline tabs */
.tools-tabs {
  flex: 0 0 auto;
  display: flex;
  margin: 0.9rem 1rem 0.5rem;
  padding: 4px;
  background: #F2F4FC;
  border-radius: 100px;
  gap: 4px;
}
.tools-tab {
  flex: 1;
  padding: 0.55rem 0.8rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.82rem; font-weight: 600;
  color: #6F7898;
  border-radius: 100px;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-family: inherit;
  transition: all .18s;
}
.tools-tab:hover:not(.active) { color: #3b28cc; }
.tools-tab.active {
  background: white;
  color: #3b28cc;
  box-shadow: 0 1px 3px rgba(15,18,38,0.06), 0 4px 12px -4px rgba(59,40,204,0.18);
}

.tools-scroll {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.1rem 0.5rem;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.tools-footer {
  flex: 0 0 auto;
  padding: 0.7rem 1.1rem;
  border-top: 1px solid #ECEFFB;
  background: linear-gradient(to top, white, rgba(255,255,255,0.96));
}
.pinned-size-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem;
}
.pinned-size-label { font-weight: 600; color: #1E1B4B; margin-right: 4px; }

.section-title {
  display: flex; align-items: center; gap: 0.45rem;
  font-weight: 600; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #4B5478;
  margin: 1rem 0 0.6rem;
}
.section-title:first-child { margin-top: 0; }
.section-title .badge {
  background: #F2F4FC; color: #6D28D9;
  padding: 2px 8px; border-radius: 100px;
  font-size: 0.62rem; font-weight: 600; letter-spacing: 0;
}

/* Templates — bigger cards now they have their own tab */
.templates-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
}
.template-card {
  position: relative;
  aspect-ratio: 350/640;
  border-radius: 16px;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid transparent;
  transition: all .2s;
  background: #F4F6FC;
  box-shadow: 0 2px 6px rgba(15,18,38,0.05);
}
.template-card:hover {
  transform: translateY(-2px);
  border-color: #3b28cc;
  box-shadow: 0 8px 20px -6px rgba(59,40,204,0.3);
}
.template-card canvas { width: 100%; height: 100%; display: block; }
.template-card .template-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: white; padding: 10px 6px 6px;
  font-size: 0.72rem; font-weight: 600;
  text-align: center;
}

/* Color picker */
.color-row { display: flex; align-items: center; gap: 0.7rem; }
.color-picker {
  width: 50px; height: 50px;
  border-radius: 14px;
  border: 2px solid white;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1), inset 0 0 0 1px #E2E8F8;
  padding: 0; overflow: hidden;
  flex: 0 0 auto;
}
.color-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.color-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid white;
  box-shadow: 0 2px 6px rgba(15,18,38,0.18);
  transition: transform .15s, box-shadow .15s;
}
.color-dot:hover { transform: scale(1.15); box-shadow: 0 4px 10px rgba(15,18,38,0.22); }
.color-dot.active {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px #3b28cc, 0 2px 6px rgba(15,18,38,0.18);
}

/* ===== Skeleton loading (shimmer) ===== */
.skel {
  background: linear-gradient(90deg, #EEF1FB 0%, #F8FAFF 50%, #EEF1FB 100%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
  pointer-events: none;
}
@keyframes skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/* Sticker-style square skeleton */
.skel-square { aspect-ratio: 1; border-radius: 12px; }
/* Saved/community card-style skeleton matching the .saved-card aspect */
.skel-card { aspect-ratio: 350/640; border-radius: 12px; }
/* Tall list-row skeleton (orders / notifications) */
.skel-row { height: 96px; border-radius: 16px; margin-bottom: 0.5rem; }
.skel-line { height: 10px; border-radius: 100px; margin: 6px 0; }

/* ===== Customize tab — card grid ===== */
.cust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
  align-items: start;
}
.cust-card {
  background: #FFFFFF;
  border: 1px solid #ECEFFB;
  border-radius: 18px;
  padding: 1rem 1.1rem 0.95rem;
  box-shadow: 0 1px 2px rgba(15,18,38,0.04);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  position: relative;
}
.cust-card:hover {
  border-color: #DBE2F5;
  box-shadow: 0 6px 20px -10px rgba(59,40,204,0.18), 0 1px 2px rgba(15,18,38,0.04);
}
.cust-card--wide { grid-column: 1 / -1; }

/* Per-card pastel tints so the studio reads as distinct sections at a
   glance. Detected via :has() on the head icon class so no HTML changes
   are needed. Tints stay soft (~6% saturation) so foreground inputs +
   chips still pop. */
.cust-card:has(.fa-mobile-screen) { background: #F1EBFF; border-color: #E0D4FF; } /* Phone model — lavender */
.cust-card:has(.fa-palette)       { background: #E8F7EE; border-color: #C8EAD3; } /* Case color   — mint */
.cust-card:has(.fa-camera)        { background: #E5F1FB; border-color: #C7DFF2; } /* Camera bump  — sky */
.cust-card:has(.fa-shapes)        { background: #FCEFE2; border-color: #F2D9BF; } /* Pattern style— peach */
.cust-card:has(.fa-image)         { background: #FBF5DA; border-color: #EFE3A8; } /* Upload image — lemon */
.cust-card:has(.fa-star)          { background: #FCEAF1; border-color: #F2C6D7; } /* Stickers     — pink */
.cust-card:has(.fa-paintbrush)    { background: #F4E9FA; border-color: #E0CCEC; } /* Artistic     — lilac */
.cust-card:has(.fa-layer-group)   { background: #FBF5EC; border-color: #EFE3CC; } /* Layers       — cream */
/* The how-to-card uses a different class, no override needed. */

/* Accent the Selected card so the contextual editor pops (kept on top
   of the per-card pastels via higher specificity). */
#selectedTools.cust-card,
.cust-card:has(.fa-crosshairs) {
  background: linear-gradient(135deg, #FFFFFF, #F4F0FF);
  border-color: #3b28cc;
  box-shadow: 0 8px 24px -10px rgba(59,40,204,0.35);
}

.cust-card-head {
  display: flex; align-items: center; gap: 0.5rem;
  font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: #1E1B4B;
  margin-bottom: 0.8rem;
}
.cust-card-head i {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #EEF1FF, #E3EAFF);
  color: #3b28cc;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem;
  flex: 0 0 auto;
}
.cust-card-head .badge {
  margin-left: auto;
  background: #F2F4FC; color: #6D28D9;
  padding: 3px 9px; border-radius: 100px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0;
  text-transform: none;
}

/* Internal spacing tweaks */
.cust-card .style-chips { margin: 0; }
.cust-card .color-row { flex-wrap: wrap; gap: 0.65rem; align-items: center; }
.cust-card .color-picker { width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto; }
.cust-card .color-presets { gap: 8px; }
.cust-card .color-dot { width: 30px; height: 30px; }
.cust-card .upload-area { padding: 0.9rem; border-radius: 12px; }
.cust-card .input-field { margin: 0.25rem 0; padding: 0.7rem 0.95rem; }
.cust-card #timeSlotOptions { margin-top: 0.35rem; }

/* Sticker grid lives inside a card now — tighten + cap height with scroll */
.cust-card #stickerGrid {
  max-height: 360px; overflow-y: auto;
  padding: 4px; margin: 4px -4px -4px;
  background: #F8F9FE; border-radius: 12px;
}

/* Reservation card: vertical inputs feel airier with a small subhead */
.cust-card .input-field { background: #FAFBFE; border-color: #ECEFFB; font-size: 0.88rem; }

/* ===== Per-axis W/H sliders (shapes only) ===== */
.wh-label {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: #6F7898;
  margin-top: 0.55rem;
}
.wh-label span:last-child { color: #1E1B4B; font-weight: 600; }

/* Case Size chips removed in v2.1 — phone size now follows the picked
   model's real width via JS-driven --case-scale on .canvas-container. */

/* ===== Selected-element toolbar (Flip / Front / Back / Delete) ===== */
.selected-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.sel-btn {
  display: inline-flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px;
  padding: 0.55rem 0.4rem 0.5rem;
  border-radius: 14px;
  border: 1.5px solid #E2E8F8;
  background: white;
  color: #1f2a4e;
  font-family: inherit; font-size: 0.74rem; font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.1;
}
.sel-btn i { font-size: 1.05rem; color: #3b28cc; }
.sel-btn span { letter-spacing: 0.01em; }
.sel-btn:hover {
  border-color: #3b28cc;
  color: #3b28cc;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -8px rgba(59,40,204,0.4);
}
.sel-btn:active { transform: translateY(0); }
.sel-btn.danger { color: #B91C1C; border-color: rgba(220,38,38,0.3); }
.sel-btn.danger i { color: #DC2626; }
.sel-btn.danger:hover { background: #DC2626; color: white; border-color: #DC2626; box-shadow: 0 6px 14px -8px rgba(220,38,38,0.5); }
.sel-btn.danger:hover i { color: white; }

/* ===== Artistic tools (shapes / text / color) ===== */
.artistic-row {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed #ECEFFB;
}
.artistic-row:first-of-type { border-top: 0; padding-top: 0.2rem; }
.artistic-label {
  font-size: 0.74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: #6F7898;
  flex: 0 0 80px;
}
.artistic-shape-grid {
  display: flex; gap: 0.4rem; flex: 1; flex-wrap: wrap;
}
.art-shape-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1.5px solid #E2E8F8;
  background: #FAFBFE;
  color: #3b28cc;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
  font-family: inherit;
}
.art-shape-btn:hover {
  border-color: #3b28cc; background: white;
  transform: translateY(-1px);
}
.artistic-text-row {
  flex: 1; display: flex; gap: 0.5rem; min-width: 0;
}
.art-text-input {
  flex: 1; min-width: 0;
  padding: 0.6rem 0.9rem;
  border: 1.5px solid #E2E8F8;
  border-radius: 12px;
  background: #FAFBFE;
  color: #1E1B4B;
  font-family: inherit; font-size: 0.9rem;
}
.art-text-input:focus { outline: none; border-color: #3b28cc; background: white; }
.art-add-text { flex: 0 0 auto; white-space: nowrap; }
.art-color-row {
  flex: 1; display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap;
}
.art-color-row .color-presets { gap: 6px; }
.art-color-row .color-dot { width: 26px; height: 26px; }

.art-font-select {
  flex: 1; padding: 0.55rem 0.85rem;
  border: 1.5px solid #E2E8F8; border-radius: 12px;
  background: #FAFBFE; color: #1E1B4B;
  font-family: inherit; font-size: 0.88rem; font-weight: 500;
  cursor: pointer;
}
.art-font-select:focus { outline: none; border-color: #3b28cc; background: white; }

/* B / I / U text style toggles */
.text-style-row { display: flex; gap: 0.4rem; flex: 1; }
.text-style-btn {
  width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid #E2E8F8;
  background: white; color: #1f2a4e;
  border-radius: 12px;
  font-family: serif; font-size: 1.05rem;
  cursor: pointer;
  transition: all .15s;
}
.text-style-btn:hover { border-color: #3b28cc; color: #3b28cc; }
.text-style-btn.active {
  background: #3b28cc; color: white; border-color: #3b28cc;
  box-shadow: 0 6px 14px -6px rgba(59,40,204,0.5);
}
.text-style-btn strong { font-weight: 900; }
.text-style-btn em { font-style: italic; }
.text-style-btn u { text-decoration: underline; text-underline-offset: 3px; }

.art-pen-row { display: flex; gap: 0.35rem; flex: 1; flex-wrap: wrap; align-items: center; }
.art-pen-btn {
  padding: 0.45rem 0.8rem;
  border: 1.5px solid #E2E8F8;
  background: #FAFBFE;
  color: #4B5478;
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  border-radius: 100px;
  cursor: pointer;
  transition: all .15s;
}
.art-pen-btn:hover { border-color: #C7D4FF; color: #1E1B4B; }
.art-pen-btn.active {
  background: #3b28cc; color: white; border-color: #3b28cc;
  box-shadow: 0 6px 14px -6px rgba(59,40,204,0.5);
}
.art-pen-stop {
  margin-left: auto;
  color: #B91C1C;
  border-color: rgba(220,38,38,0.3);
  padding: 0.45rem 0.7rem;
}
.art-pen-stop:hover { background: #DC2626; color: white; border-color: #DC2626; }

/* ===== Phone model picker — brand chips + model select ===== */
.phone-brand-chips {
  display: flex; gap: 0.45rem; flex-wrap: wrap;
  margin: 0.35rem 0 0.85rem;
}
.phone-brand-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.5rem 0.95rem;
  border-radius: 100px;
  border: 1.5px solid #E2E8F8;
  background: white;
  color: #4B5478;
  font-family: inherit; font-size: 0.82rem; font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.phone-brand-chip i { font-size: 0.92rem; opacity: 0.7; }
.phone-brand-chip:hover { border-color: #C7D4FF; color: #1E1B4B; }
.phone-brand-chip.active {
  background: #3b28cc; color: white; border-color: #3b28cc;
  box-shadow: 0 6px 14px -6px rgba(59,40,204,0.5);
}
.phone-brand-chip.active i { opacity: 1; }

.phone-model-row {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.phone-model-label {
  font-size: 0.78rem; color: #6F7898; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.phone-model-select {
  flex: 1 1 200px; min-width: 0;
  padding: 0.65rem 0.95rem;
  border: 1.5px solid #E2E8F8; border-radius: 12px;
  background: #FAFBFE; color: #1E1B4B;
  font-family: inherit; font-size: 0.92rem; font-weight: 600;
  cursor: pointer;
}
.phone-model-select:focus { outline: none; border-color: #3b28cc; background: white; }
.phone-browse-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0.6rem 0.95rem;
  border-radius: 100px;
  border: 1.5px solid #E2E8F8;
  color: #6F7898;
  text-decoration: none;
  font-size: 0.8rem; font-weight: 600;
  background: white;
}
.phone-browse-link:hover { color: #3b28cc; border-color: #3b28cc; }

.phone-hint {
  margin-top: 0.55rem;
  font-size: 0.78rem; color: #6F7898;
  display: flex; align-items: center; gap: 6px;
  padding: 0.45rem 0.7rem;
  background: #F4F6FE;
  border-radius: 10px;
}
.phone-hint i { color: #3b28cc; }
.phone-hint:empty { display: none; }

/* ===== How-to-use guide card ===== */
.how-to-card {
  background: linear-gradient(135deg, rgba(59,40,204,0.04), rgba(109,40,217,0.04));
  border: 1px solid #DBE2F5;
  border-radius: 18px;
  padding: 0;
  margin-bottom: 1.1rem;
  overflow: hidden;
}
.how-to-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.95rem 1.2rem;
  display: flex; align-items: center; gap: 10px;
  font-size: 0.95rem; color: #1E1B4B;
  user-select: none;
}
.how-to-card > summary::-webkit-details-marker { display: none; }
.how-to-card > summary > i:first-child {
  color: #3b28cc; font-size: 1.1rem;
}
.how-to-card > summary > span { flex: 1; }
.how-to-card > summary .chev {
  color: #6F7898; font-size: 0.8rem;
  transition: transform .2s ease;
}
.how-to-card[open] > summary .chev { transform: rotate(180deg); }
.how-to-body {
  padding: 0 1.2rem 1.2rem;
  border-top: 1px solid rgba(59,40,204,0.10);
  padding-top: 0.9rem;
}
.how-to-list {
  margin: 0 0 0.7rem 1.1rem;
  padding: 0;
  font-size: 0.88rem; line-height: 1.55; color: #2a2f4a;
}
.how-to-list > li { margin-bottom: 0.55rem; }
.how-to-list > li > strong { color: #1E1B4B; }
.how-to-list ul {
  margin: 0.25rem 0 0.3rem 1.2rem;
  padding: 0;
  font-size: 0.86rem; color: #4B5478;
}
.how-to-list ul li { margin-bottom: 0.2rem; list-style: disc; }
.how-to-list em { color: #3b28cc; font-style: normal; font-weight: 600; }
.how-to-tip {
  margin-top: 0.5rem;
  padding: 0.6rem 0.85rem;
  background: white;
  border-left: 3px solid #6D28D9;
  border-radius: 8px;
  font-size: 0.84rem; color: #2a2f4a;
}
.how-to-tip i { color: #6D28D9; margin-right: 4px; }

/* Compact sticky bottom bar for pricing/CTA on mobile-feel */
.tab-panel .price-summary { margin-top: 0.8rem; }
.tab-panel .btn-proceed   { margin-top: 0.6rem; }

@media (max-width: 480px) {
  .cust-grid { gap: 0.65rem; }
  .cust-card { padding: 0.85rem 0.95rem; border-radius: 16px; }
  .cust-card-head i { width: 24px; height: 24px; }
  .cust-card #stickerGrid { max-height: 280px; }
}

/* Inline checkbox toggle row */
.toggle-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.84rem; color: #1E1B4B; font-weight: 500;
  cursor: pointer; padding: 0.4rem 0;
}
.toggle-row input[type="checkbox"] { accent-color: #3b28cc; width: 18px; height: 18px; cursor: pointer; }
.toggle-row .toggle-text { user-select: none; }

/* Style chips */
.style-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.style-chip {
  background: white; padding: 0.45rem 0.95rem;
  border-radius: 100px; cursor: pointer;
  font-size: 0.78rem; font-weight: 600;
  color: #4B5478;
  transition: all .15s;
  border: 1px solid #ECEFFB;
  user-select: none;
}
.style-chip:hover { border-color: #3b28cc; color: #3b28cc; transform: translateY(-1px); }
.style-chip.active {
  background: linear-gradient(135deg, #3b28cc, #6D28D9);
  color: white; border-color: transparent;
  box-shadow: 0 4px 12px -3px rgba(59,40,204,0.4);
}
.style-chip.active:hover { color: white; transform: translateY(-1px); }

/* Sticker grid */
.sticker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
@media (min-width: 480px) { .sticker-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 720px) { .sticker-grid { grid-template-columns: repeat(7, 1fr); } }
.sticker-item {
  background: white;
  border-radius: 12px;
  text-align: center;
  cursor: grab;
  font-size: 1.45rem;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  border: 1px solid #ECEFFB;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
}
.sticker-item:hover {
  transform: translateY(-2px) scale(1.04);
  border-color: #3b28cc;
  box-shadow: 0 8px 14px -6px rgba(59,40,204,0.25);
}
.sticker-item:active { cursor: grabbing; transform: scale(0.98); }
.sticker-item.sticker-img { padding: 4px; }
.sticker-item.sticker-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none; /* clicks pass through to the .sticker-item parent */
}

/* Upload */
.upload-area {
  border: 2px dashed #DBE2F5;
  border-radius: 14px;
  padding: 0.9rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #FAFBFE;
  display: block;
}
.upload-area:hover { border-color: #3b28cc; background: rgba(59,40,204,0.03); }
.upload-area i { font-size: 1.3rem; color: #3b28cc; margin-bottom: 4px; display: block; }
.upload-area .upload-text { font-size: 0.75rem; color: #4B5478; font-weight: 500; }
.upload-area input { display: none; }

/* Selected element controls */
#selectedTools {
  background: linear-gradient(135deg, rgba(59,40,204,0.05), rgba(109,40,217,0.05));
  border: 1px solid rgba(59,40,204,0.15);
  border-radius: 16px;
  padding: 0.8rem 0.95rem;
  margin: 0.5rem 0;
}
#selectedTools label {
  display: flex; justify-content: space-between;
  font-size: 0.76rem; color: #4B5478; font-weight: 500;
  margin-bottom: 4px;
}
.resize-slider { width: 100%; margin: 6px 0 8px; accent-color: #3b28cc; }

/* Size controls: -  [42]px  + */
.size-controls {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
}
.size-step {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: white;
  border: 1px solid #E2E8F8;
  color: #1E1B4B;
  font-size: 1.1rem; font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: all .15s;
}
.size-step:hover { border-color: #3b28cc; color: #3b28cc; }
.size-step:active { transform: scale(0.95); }
.size-input {
  flex: 1; min-width: 0;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid #E2E8F8;
  background: white;
  font-size: 0.9rem; font-weight: 600;
  color: #1E1B4B;
  text-align: center;
  font-family: inherit;
}
.size-input:focus { outline: none; border-color: #3b28cc; box-shadow: 0 0 0 2px rgba(59,40,204,0.1); }
.size-input::-webkit-outer-spin-button, .size-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.size-unit { font-size: 0.75rem; color: #8B92AC; }

/* Layers panel */
.layers-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #ECEFFB;
  border-radius: 12px;
  background: #FAFBFE;
  padding: 4px;
}
.layers-empty { padding: 1rem; text-align: center; font-size: 0.75rem; color: #8B92AC; }
.layer-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 2px;
}
.layer-row:hover { background: rgba(59,40,204,0.06); }
.layer-row.active {
  background: rgba(59,40,204,0.12);
  outline: 1px solid rgba(59,40,204,0.3);
}
.layer-preview {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  overflow: hidden;
  border: 1px solid #ECEFFB;
}
.layer-preview img {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  pointer-events: none;
}
.layer-label {
  font-size: 0.78rem;
  color: #4B5478;
  font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-transform: capitalize;
}
.layer-actions { display: flex; gap: 2px; }
.layer-btn {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: #6F7898;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  padding: 0;
  transition: all .12s;
}
.layer-btn:hover:not(:disabled) { background: white; color: #3b28cc; }
.layer-btn.danger:hover:not(:disabled) { background: #DC2626; color: white; }
.layer-btn:disabled { opacity: 0.3; cursor: default; }

/* Saved designs */
.saved-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.saved-card {
  position: relative;
  aspect-ratio: 350/640;
  border-radius: 11px;
  overflow: hidden;
  cursor: pointer;
  background: #F4F6FC;
  border: 1px solid #ECEFFB;
  transition: all .2s;
}
.saved-card:hover { transform: translateY(-2px); box-shadow: 0 8px 16px -4px rgba(59,40,204,0.2); border-color: #3b28cc; }
.saved-card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.saved-card .saved-name {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  color: white; padding: 12px 4px 4px;
  font-size: 0.62rem; font-weight: 500;
  text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.saved-card .saved-delete {
  position: absolute; top: 4px; right: 4px;
  background: rgba(220, 38, 38, 0.9);
  color: white;
  border: none; width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 0.65rem;
  cursor: pointer;
  display: none;
}
.saved-card:hover .saved-delete { display: flex; align-items: center; justify-content: center; }

/* Share toggle on saved-design cards */
.saved-card .saved-share {
  position: absolute; top: 4px; left: 4px;
  background: rgba(255,255,255,0.9);
  color: #6F7898;
  border: none; width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 0.62rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: all .15s;
}
.saved-card .saved-share:hover { color: #3b28cc; transform: scale(1.1); }
.saved-card .saved-share.active { background: #3b28cc; color: white; }
.saved-empty { font-size: 0.74rem; color: #8B92AC; text-align: center; padding: 0.8rem; grid-column: 1 / -1; }

/* Form inputs */
.input-field {
  width: 100%; padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #E2E8F8;
  margin: 0.2rem 0;
  font-size: 0.85rem;
  font-family: inherit;
  background: #FAFBFE;
  transition: all .15s;
}
.input-field:focus { outline: none; border-color: #3b28cc; background: white; box-shadow: 0 0 0 3px rgba(59,40,204,0.1); }

.time-option {
  display: flex; align-items: center; gap: 0.6rem;
  margin: 0.3rem 0; background: #F8F9FE;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  font-size: 0.8rem;
  border: 1px solid transparent;
}
.time-option:hover { background: #ECEFFB; }
.time-option.selected { background: #3b28cc; color: white; border-color: #3b28cc; }
.time-option small { display: block; opacity: 0.8; font-size: 0.68rem; margin-top: 1px; }

/* Price summary — a hero-style gradient card with big total */
.price-summary {
  background: linear-gradient(135deg, #F4F0FF 0%, #E9EFFF 60%, #DBE5FF 100%);
  border: 1px solid rgba(59,40,204,0.18);
  border-radius: 18px;
  padding: 1.05rem 1.15rem;
  margin-bottom: 0.85rem;
  font-size: 0.92rem;
  box-shadow: 0 6px 18px -10px rgba(59,40,204,0.25);
}
.price-summary .price-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 5px 0;
  color: #4B5478;
}
.price-summary .price-row em { font-style: normal; color: #8B92AC; font-size: 0.82rem; margin-left: 4px; }
.price-summary .price-row.total {
  margin-top: 8px; padding-top: 10px;
  border-top: 1px dashed rgba(59,40,204,0.25);
  color: #1E1B4B; font-weight: 800; font-size: 1.15rem;
}
.price-summary .price-row.total span:last-child {
  background: linear-gradient(135deg, #3b28cc, #6D28D9);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Big proceed button — now shows the live total */
.btn-proceed {
  background: linear-gradient(135deg, #3b28cc, #6D28D9);
  color: white; width: 100%;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  font-weight: 700; font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all .2s;
  box-shadow: 0 10px 24px -8px rgba(59,40,204,0.55), inset 0 1px 0 rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.btn-proceed:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -8px rgba(59,40,204,0.65), inset 0 1px 0 rgba(255,255,255,0.15); }
.btn-proceed:active { transform: translateY(0); }
.btn-proceed #proceedTotal { font-weight: 800; font-size: 1.05rem; }

.btn-secondary {
  background: white;
  color: #3b28cc;
  width: 100%;
  padding: 0.6rem;
  border-radius: 10px;
  font-weight: 600; font-size: 0.82rem;
  border: 1px solid #DBE2F5;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin-top: 0.4rem;
}
.btn-secondary:hover { background: #F2F4FC; border-color: #3b28cc; }

/* Selected floating indicator */
.selected-indicator {
  position: fixed; bottom: 16px; right: 16px;
  background: #1E1B4B; color: white;
  padding: 0.45rem 0.95rem;
  border-radius: 100px;
  font-size: 0.74rem; font-weight: 500;
  display: none;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4);
  z-index: 99;
}

/* Toast */
.toast-container {
  position: fixed; top: 70px; right: 16px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: white;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px -8px rgba(15,18,38,0.2);
  font-size: 0.82rem; font-weight: 500;
  color: #1E1B4B;
  border-left: 3px solid #3b28cc;
  display: inline-flex; align-items: center; gap: 0.5rem;
  animation: slideIn .25s ease-out;
  pointer-events: auto;
  max-width: 300px;
}
.toast.success { border-left-color: #22C55E; }
.toast.error { border-left-color: #DC2626; }
.toast i { color: #3b28cc; }
.toast.success i { color: #22C55E; }
.toast.error i { color: #DC2626; }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 960px) {
  /* Let the page scroll naturally — the desktop flex/sticky tricks fight
     mobile viewports and end up collapsing the canvas to 0 height. */
  html, body { overflow: auto; height: auto; }
  body { display: block; }
  main { display: block; flex: none; height: auto; padding-bottom: 2rem; }

  .studio-layout {
    display: block;
    grid-template-columns: none;
    height: auto; min-height: 0;
  }

  .canvas-area {
    display: block;
    height: auto; max-height: none;
    margin-bottom: 1rem;
  }
  /* Disable container-query sizing on mobile — use plain aspect-ratio.
     The desktop rule uses cqw/cqh which need the stage to have a
     definite size; in a stacked layout it doesn't. */
  .canvas-stage {
    container-type: normal !important;
    display: block;
    width: 100%;
    height: auto;
    max-width: 360px;
    margin: 0 auto;
  }
  .canvas-container, .viewer-3d {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 350/640 !important;
  }

  .tools-area {
    position: static;
    height: auto; max-height: none;
    overflow: visible;
  }
  .tools-scroll {
    overflow: visible;
    max-height: none;
  }

  .sticker-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 560px) {
  main { padding: 0.6rem 0.8rem 0.8rem; }
  .templates-grid { grid-template-columns: repeat(2, 1fr); }
  .sticker-grid { grid-template-columns: repeat(5, 1fr); }
  .saved-grid { grid-template-columns: repeat(3, 1fr); }
  .top-toolbar { gap: 0.4rem; }
  .toolbar-right { width: 100%; }
}
