/* =====================================================================
   css/studio.css — PULSE Profile & Post Customization Studio (Phase 1)
   Uses v2 ds-* tokens so Light, Warm, Dim & OLED themes all look native.
   ===================================================================== */

@keyframes psPatFloat {
  0%, 100% { transform: translate(-50%, -50%) translateY(0px) scale(1); }
  50% { transform: translate(-50%, -50%) translateY(-5px) scale(1.06); }
}
@keyframes psPatPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.38; }
}
@keyframes psRingSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ---------- Scoped Profile Header Layers ---------- */
.ps-profile-scope {
  position: relative;
}
.ps-profile-scope[data-ps-active="true"] > *:not(.ps-canvas-bg):not(.ps-pattern-layer):not(.ps-stickers-layer) {
  position: relative;
  z-index: 2;
}
.ps-canvas-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.ps-pattern-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.ps-stickers-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 4;
}
.ps-pat-node {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ps-pat-node svg {
  width: 100%;
  height: 100%;
}
.ps-sticker-node {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .35));
}
.ps-sticker-node svg {
  width: 100%;
  height: 100%;
}
.ps-sticker-del {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  background: var(--error);
  color: #fff;
  border: 1.5px solid #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: pointer;
}
.ps-custom-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ps-custom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
  transition: transform 120ms ease, opacity 120ms ease;
}
.ps-custom-btn:hover { opacity: .9; }
.ps-custom-btn:active { transform: scale(.96); }
.ps-custom-btn-ico {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ps-custom-btn-ico svg { width: 14px; height: 14px; }

/* Own profile subtle edit design bar */
.ps-edit-design-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.ps-edit-design-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--link);
  padding: 4px 0;
  cursor: pointer;
}
.ps-edit-design-link:hover { text-decoration: underline; }
.ps-edit-design-link svg { width: 15px; height: 15px; }

/* ---------- Shell Expansion for Wide Desktop & Full-Screen Mobile Studio ---------- */
@media (min-width: 768px) {
  body.route-studio:not(.mobile-sim) #desktopGrid {
    grid-template-columns: 72px minmax(0, 1fr) !important;
    max-width: 1440px !important;
    width: 100% !important;
    min-height: 0 !important;
    height: 100dvh;
    overflow: hidden;
  }
  body.route-studio:not(.mobile-sim) #leftSidebar {
    display: flex !important;
    width: 72px !important;
    padding: 14px 6px 16px !important;
    align-items: center !important;
  }
  body.route-studio:not(.mobile-sim) .nav-rail-lbl,
  body.route-studio:not(.mobile-sim) .nav-rail-brand,
  body.route-studio:not(.mobile-sim) .nav-rail-profile-meta,
  body.route-studio:not(.mobile-sim) .nav-rail-compose-lbl,
  body.route-studio:not(.mobile-sim) .nav-rail-badge-inline {
    display: none !important;
  }
  body.route-studio:not(.mobile-sim) .sh-rail-logo {
    padding: 7px !important;
    margin: 0 auto 10px !important;
    justify-content: center !important;
  }
  body.route-studio:not(.mobile-sim) .sh-rail-item {
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    margin: 0 auto !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  body.route-studio:not(.mobile-sim) .sh-rail-dot { display: flex !important; }
  body.route-studio:not(.mobile-sim) .sh-compose-btn {
    width: 48px !important;
    height: 48px !important;
    padding: 0 !important;
    margin: 14px auto 0 !important;
    border-radius: 9999px !important;
  }
  body.route-studio:not(.mobile-sim) .nav-rail-compose-ico { display: inline-flex !important; }
  body.route-studio:not(.mobile-sim) .sh-rail-account {
    width: 48px !important;
    height: 48px !important;
    padding: 4px !important;
    margin: 0 auto !important;
    justify-content: center !important;
  }
  body.route-studio:not(.mobile-sim) #centerColumn {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }
}

body.in-mobile-studio #mobileTopBar,
body.in-mobile-studio #mobileBottomNav,
body.in-mobile-studio #installBanner,
body.in-mobile-studio #backToTopBtn {
  display: none !important;
}
body.in-mobile-studio #desktopGrid,
body.in-mobile-studio #centerColumn {
  height: 100% !important;
  max-height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex;
  flex-direction: column;
}

/* ---------- Studio Shell Layout ---------- */
.ps-studio {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100%;
  min-height: 0;
  background: var(--background);
  color: var(--foreground);
  overflow: hidden;
}
body.mobile-sim .ps-studio {
  height: 100%;
}

.ps-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 52px;
  padding: 6px 12px;
  background: var(--ds-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 12;
}
.ps-top-l {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.ps-top-title {
  font-family: var(--ds-font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.ps-studio .ds-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
@media (max-width: 520px) {
  .ps-top { padding: 6px 10px; gap: 4px; }
  .ps-top-title { font-size: 15px; }
  .ps-pass-pill { padding: 0 7px; font-size: 10.5px; height: 22px; }
  .ps-top-actions { gap: 3px; }
  .ps-tbtn.ps-tbtn-ico, .ps-tbtn { width: 29px; height: 29px; padding: 0; justify-content: center; }
  .ps-tbtn svg { width: 14px; height: 14px; }
}
.ps-pass-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}
.ps-pass-pill.is-ok {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
}
.ps-pass-pill.is-warn {
  background: color-mix(in srgb, var(--warning) 16%, transparent);
  color: var(--warning);
}
.ps-pass-pill.is-lock {
  background: color-mix(in srgb, var(--primary) 13%, transparent);
  color: var(--primary);
}
.ps-top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ps-tbtn {
  height: 32px;
  padding: 0 10px;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background: var(--background);
  color: var(--foreground);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background-color 140ms ease, transform 120ms ease;
}
.ps-tbtn:hover { background: var(--ds-hover); }
.ps-tbtn:active { transform: scale(.96); }
.ps-tbtn:disabled { opacity: .4; pointer-events: none; }
.ps-tbtn svg { width: 15px; height: 15px; }
.ps-tbtn-ico { width: 32px; padding: 0; justify-content: center; }

.ps-target-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--background);
  flex-shrink: 0;
}
.ps-target-bar .ds-segment { width: 100%; }
.ps-target-bar .ds-segment button { flex: 1; }

/* Workspace: stacked on mobile, 420px left controls + preview right on desktop */
.ps-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ps-preview-col {
  order: 1;
  display: flex;
  flex-direction: column;
  height: 34vh;
  max-height: 320px;
  min-height: 180px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
  transition: height 200ms var(--ds-ease), max-height 200ms var(--ds-ease);
}
.ps-preview-col.is-expanded {
  height: 56vh;
  max-height: 520px;
}
.ps-preview-col.is-collapsed {
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  overflow: hidden;
}
.ps-stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: var(--background);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-foreground);
}
.ps-stage-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: var(--success);
}
.ps-stage-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  background: var(--card);
}
.ps-preview-frame {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--background);
  overflow: hidden;
}
.ps-controls-col {
  order: 2;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--background);
}

@media (min-width: 900px) {
  body:not(.mobile-sim) .ps-workspace {
    flex-direction: row;
  }
  body:not(.mobile-sim) .ps-controls-col {
    order: 1;
    width: 420px;
    flex: 0 0 420px;
    border-right: 1px solid var(--border);
    height: 100%;
  }
  body:not(.mobile-sim) .ps-preview-col {
    order: 2;
    flex: 1;
    height: 100% !important;
    max-height: 100% !important;
    border-bottom: 0;
  }
  body:not(.mobile-sim) .ps-stage-scroll {
    padding: 20px 24px 32px;
  }
  body:not(.mobile-sim) .ps-preview-frame {
    border: 1px solid var(--card-border);
    border-radius: var(--ds-radius-xl);
    box-shadow: var(--ds-shadow-pop);
  }
  body:not(.mobile-sim) .ps-stage-size-btn {
    display: none !important;
  }
}

.ps-mode-row {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ps-mode-row .ds-segment { width: 100%; }
.ps-mode-row .ds-segment button { flex: 1; }

.ps-custom-tabs {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ps-custom-tabs .ds-tab {
  padding: 11px 10px;
  font-size: 13px;
}

.ps-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ps-card {
  border: 1px solid var(--card-border);
  border-radius: var(--ds-radius-l);
  background: var(--background);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.ps-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ps-card-title {
  font-family: var(--ds-font-display);
  font-size: 14.5px;
  font-weight: 800;
  color: var(--foreground);
}
.ps-card-sub {
  font-size: 12px;
  color: var(--muted-foreground);
  line-height: 1.35;
}
.ps-reset-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--error);
  padding: 4px 9px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--error) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--error) 18%, transparent);
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 140ms ease, transform 120ms ease;
}
.ps-reset-link:hover {
  background: color-mix(in srgb, var(--error) 16%, transparent);
}
.ps-reset-link:active {
  transform: scale(.96);
}

/* Profile Cover Image Settings Card */
.ps-cover-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 5.4;
  border-radius: var(--ds-radius-m);
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: var(--card);
}
.ps-cover-preview.is-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted-foreground);
  border-style: dashed;
}
.ps-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ps-cover-presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.ps-cover-preset {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--card-border);
  padding: 0;
  background: var(--card);
  cursor: pointer;
  transition: border-color 140ms ease, transform 120ms ease;
}
.ps-cover-preset:hover {
  border-color: var(--primary);
}
.ps-cover-preset:active {
  transform: scale(.96);
}
.ps-cover-preset.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 24%, transparent);
}
.ps-cover-preset img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ps-cover-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--ds-radius-m);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--card-border));
  background: color-mix(in srgb, var(--primary) 8%, var(--background));
  font-size: 12px;
  line-height: 1.35;
  color: var(--foreground);
}
.ps-sub-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.ps-save-badge {
  width: 52px;
  height: 52px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
  margin: 0 auto 10px;
}
.ps-save-badge svg {
  width: 26px;
  height: 26px;
}

/* Themes & Palettes */
.ps-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ps-theme-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-radius: var(--ds-radius-m);
  border: 1.5px solid var(--card-border);
  background: var(--card);
  text-align: left;
  transition: border-color 140ms ease, transform 120ms ease;
}
.ps-theme-card:hover { border-color: var(--primary); }
.ps-theme-card:active { transform: scale(.98); }
.ps-theme-card.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--background));
}
.ps-theme-dots {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ps-dots-pair {
  display: inline-flex;
  align-items: center;
}
.ps-dots-pair span {
  width: 15px;
  height: 15px;
  border-radius: 9999px;
  border: 1.5px solid var(--background);
}
.ps-dots-pair span + span { margin-left: -5px; }
.ps-theme-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--foreground);
  line-height: 1.25;
}

.ps-palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.ps-pal-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px 0 6px;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
}
.ps-pal-btn:hover { border-color: var(--primary); }
.ps-pal-swatch {
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, .25);
  flex-shrink: 0;
}

/* Color Pickers */
.ps-color-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ps-color-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: var(--ds-radius-m);
  border: 1px solid var(--card-border);
  background: var(--card);
  min-width: 0;
}
.ps-color-item input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}
.ps-color-item input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.ps-color-item input[type="color"]::-webkit-color-swatch {
  border-radius: 7px;
  border: 1px solid var(--card-border);
}
.ps-color-meta {
  min-width: 0;
  flex: 1;
}
.ps-color-lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-color-hex {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--muted-foreground);
  text-transform: uppercase;
}

/* Range Sliders */
.ps-slider-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-radius: var(--ds-radius-m);
  background: var(--card);
  border: 1px solid var(--border);
}
.ps-slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--foreground);
}
.ps-slider-val {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--primary) 13%, transparent);
  color: var(--primary);
}
.ps-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 9999px;
  background: var(--card-border);
  outline: none;
  cursor: pointer;
}
.ps-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 9999px;
  background: var(--primary);
  border: 2px solid var(--background);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

/* Chips & Icon Grid */
.ps-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ps-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.ps-icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: var(--ds-radius-m);
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 140ms ease;
}
.ps-icon-tile svg { width: 18px; height: 18px; }
.ps-icon-tile.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--background));
  color: var(--primary);
  font-weight: 700;
}

/* Reorder list */
.ps-order-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ps-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--ds-radius-m);
  border: 1px solid var(--card-border);
  background: var(--card);
}
.ps-order-lbl {
  font-size: 13px;
  font-weight: 700;
  color: var(--foreground);
  min-width: 0;
  flex: 1;
}
.ps-order-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.ps-mini-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--background);
  color: var(--foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ps-mini-btn:hover { background: var(--ds-hover); }
.ps-mini-btn:disabled { opacity: .35; pointer-events: none; }
.ps-mini-btn.is-off { color: var(--muted-foreground); opacity: .65; }
.ps-mini-btn svg { width: 14px; height: 14px; }

/* Custom link button card */
.ps-cbtn-card {
  padding: 10px;
  border-radius: var(--ds-radius-m);
  border: 1px solid var(--card-border);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Pass tab */
.ps-pass-hero {
  border-radius: var(--ds-radius-l);
  padding: 16px;
  color: #fff;
  background: var(--ds-grad);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ps-pass-bar {
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, .25);
  overflow: hidden;
}
.ps-pass-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #fff;
}
.ps-pass-plans {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ps-pass-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--ds-radius-m);
  border: 1.5px solid var(--card-border);
  background: var(--background);
  text-align: left;
  cursor: pointer;
}
.ps-pass-plan.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--background));
}

/* Footer */
.ps-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--ds-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex-shrink: 0;
}

/* Swatches for avatar / eyedropper */
.ps-swatch-dot {
  width: 28px;
  height: 28px;
  border-radius: 9999px;
  border: 2px solid var(--background);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
  cursor: pointer;
  transition: transform 120ms ease;
}
.ps-swatch-dot:hover { transform: scale(1.1); }

/* =====================================================================
   PHASE 2: POST DESIGN STUDIO & GLOBAL POST CANOPY STYLES
   ===================================================================== */
@keyframes psPtPatDrift {
  0%, 100% { background-position: 0px 0px; }
  50% { background-position: 18px 10px; }
}
@keyframes psPtRimShimmer {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.14); }
}
@keyframes psAvPulse {
  0%, 100% { filter: drop-shadow(0 0 0px transparent); }
  50% { filter: drop-shadow(0 0 6px rgba(255, 255, 255, .28)); }
}
@media (prefers-reduced-motion: reduce) {
  .pf-post[data-author]::before,
  .pf-post[data-author]::after,
  .pf-post[data-author] .pf-av,
  .pf-post[data-author] .pf-av::before {
    animation: none !important;
  }
}

/* Post Design Studio: Archetype cards & Live Post Preview wrapper */
.ps-arch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
@media (max-width: 480px) {
  .ps-arch-grid { grid-template-columns: 1fr; }
}
.ps-arch-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 11px;
  border-radius: var(--ds-radius-m);
  border: 1.5px solid var(--card-border);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, transform 120ms ease;
}
.ps-arch-card:hover { border-color: var(--primary); }
.ps-arch-card:active { transform: scale(.98); }
.ps-arch-card.is-active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 9%, var(--background));
}
.ps-arch-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--foreground);
}
.ps-arch-desc {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted-foreground);
}

.ps-post-preview-wrap {
  background: var(--background);
}
.ps-post-preview-wrap article.pf-post {
  border-bottom: 1px solid var(--border);
}
.ps-post-preview-note {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
  background: var(--card);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* Composer "Post design" shortcut chip */
.cmp-tools {
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  flex: 1;
}
.cmp-tools::-webkit-scrollbar { display: none; }
.cmp-design-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  margin-left: 4px;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--foreground);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 120ms ease;
}
.cmp-design-chip:hover {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--background));
  color: var(--primary);
}
.cmp-design-chip:active { transform: scale(.95); }
.cmp-design-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
