/* ══════════════════════════════════════════════════════════════════════
   FCC Kid Identity Platform styles
   — Avatar Studio (.avst-*), My Avatar moods, Family Portrait (.fp-*),
     achievement celebration (.ach-celebrate-*), kid dashboard avatar frame.
   Mobile-first, iOS-premium feel: soft lavender surfaces, 16–24px radii,
   layered shadows, springy transitions.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Hero ─────────────────────────────────────────────────────────── */

.avst-hero {
  position: relative;
  border-radius: 24px;
  padding: 26px 24px;
  margin-bottom: 18px;
  background: linear-gradient(120deg, #6C4DFF 0%, #8F5CFF 55%, #C86CFF 100%);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(108, 77, 255, 0.28);
}
.avst-hero::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}
.avst-hero--moods { background: linear-gradient(120deg, #FF7AC8 0%, #B15CFF 60%, #6C4DFF 100%); }
.avst-hero--portrait { background: linear-gradient(120deg, #12B8C9 0%, #6C4DFF 70%, #8F5CFF 100%); }
.avst-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
}
.avst-hero-title {
  margin: 10px 0 4px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 900;
  color: #fff;
}
.avst-hero-sub { margin: 0; opacity: 0.92; font-size: 0.98rem; }

/* ── Layout ───────────────────────────────────────────────────────── */

.avst-shell,
.avst-shell * {
  box-sizing: border-box;
}

.avst-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.avst-shell img,
.avst-shell svg,
.avst-shell canvas {
  max-width: 100%;
}

.avst-shell button,
.avst-shell input,
.avst-shell select {
  min-width: 0;
  max-width: 100%;
}

.avst-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 18px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
@media (max-width: 860px) {
  .avst-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 768px) and (max-width: 860px) {
  body.fcc-app-shell-v1.logged-in:has(#avatarStudio.page.active) #mainContent {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  body.fcc-app-shell-v1.logged-in #avatarStudio.page.active {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
    overflow-x: clip !important;
  }
}

/* ── Preview card ─────────────────────────────────────────────────── */

.avst-preview-card {
  position: sticky;
  top: 12px;
  min-width: 0;
  max-width: 100%;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 18px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(76, 54, 150, 0.14), 0 2px 6px rgba(76, 54, 150, 0.08);
  overflow: hidden;
}
@media (max-width: 860px) {
  .avst-preview-card { position: static; }
}
.avst-preview {
  display: flex;
  justify-content: center;
  width: min(100%, 360px);
  max-width: 100%;
  aspect-ratio: 240 / 260;
  margin-inline: auto;
  border-radius: 20px;
  overflow: hidden;
}
.avst-preview svg {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
}
.avst-preview-name {
  margin: 10px 0 12px;
  font-weight: 800;
  font-size: 1.15rem;
  color: #43318F;
}
.avst-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
  min-width: 0;
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.avst-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  min-height: 44px;
  max-width: 100%;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.16s ease, opacity 0.16s ease;
}
.avst-btn:active { transform: scale(0.95); }
.avst-btn:disabled { opacity: 0.55; cursor: default; }
.avst-btn--primary {
  background: linear-gradient(120deg, #6C4DFF, #8F5CFF);
  color: #fff;
  box-shadow: 0 8px 18px rgba(108, 77, 255, 0.35);
}
.avst-btn--primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(108, 77, 255, 0.42); }
.avst-btn--fun {
  background: linear-gradient(120deg, #FF7AC8, #FF9F1C);
  color: #fff;
  box-shadow: 0 8px 18px rgba(255, 122, 200, 0.35);
}
.avst-btn--ghost {
  background: #F1EDFF;
  color: #5438D6;
}
.avst-btn--ghost:not(:disabled):hover { background: #E7E0FF; }

/* ── Tabs + option grid ───────────────────────────────────────────── */

.avst-controls {
  min-width: 0;
  max-width: 100%;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(76, 54, 150, 0.12), 0 2px 6px rgba(76, 54, 150, 0.07);
}
.avst-tabs {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 2px solid #F1EDFF;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.avst-tabs::-webkit-scrollbar { display: none; }
.avst-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 9px 13px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #6E6494;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.avst-tab:hover { background: #F6F3FF; }
.avst-tab.is-active {
  background: linear-gradient(120deg, #6C4DFF, #8F5CFF);
  color: #fff;
  box-shadow: 0 6px 14px rgba(108, 77, 255, 0.3);
}
.avst-tab-emoji { font-size: 1.05rem; }

.avst-group-title {
  margin: 14px 4px 8px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8A7FB8;
}
.avst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}
.avst-grid.is-disabled, .avst-toggle-list.is-disabled { opacity: 0.45; pointer-events: none; }
.avst-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 2.5px solid transparent;
  background: #F8F6FF;
  border-radius: 18px;
  padding: 10px 6px;
  min-width: 0;
  max-width: 100%;
  min-height: 96px;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.avst-tile:hover { transform: translateY(-2px); background: #F3EFFF; }
.avst-tile.is-selected {
  border-color: #6C4DFF;
  background: #EFE9FF;
  box-shadow: 0 6px 16px rgba(108, 77, 255, 0.22);
}
.avst-tile.is-locked { opacity: 0.72; }
.avst-tile-art { width: min(64px, 100%); height: 70px; pointer-events: none; }
.avst-tile-art svg { width: 100%; height: 100%; }
.avst-tile-name {
  max-width: 100%;
  font-size: 0.72rem;
  font-weight: 700;
  color: #55497E;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
}
.avst-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.75), 0 3px 8px rgba(60, 40, 120, 0.18);
}
.avst-swatch--wide { width: 62px; height: 42px; border-radius: 14px; }
.avst-lock {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.85rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}
.avst-shake { animation: avst-shake 0.4s ease; }
@keyframes avst-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-2deg); }
  75% { transform: translateX(4px) rotate(2deg); }
}

.avst-locked-note {
  background: #FFF4D6;
  color: #8A6A12;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.avst-hint { font-size: 0.82rem; color: #8A7FB8; margin: 10px 4px 2px; }

/* ── Toggles ──────────────────────────────────────────────────────── */

.avst-toggle-list { display: flex; flex-direction: column; gap: 8px; }
.avst-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #F8F6FF;
  border-radius: 16px;
  padding: 12px 14px;
  min-width: 0;
  font-weight: 700;
  color: #43318F;
  cursor: pointer;
}
.avst-switch { position: relative; display: inline-block; flex: 0 0 auto; width: 48px; height: 28px; }
.avst-switch input { opacity: 0; width: 0; height: 0; }
.avst-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #D9D2F0;
  transition: background 0.2s ease;
}
.avst-switch-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(40, 25, 90, 0.25);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.avst-switch input:checked + .avst-switch-slider { background: #6C4DFF; }
.avst-switch input:checked + .avst-switch-slider::before { transform: translateX(20px); }
.avst-switch input:focus-visible + .avst-switch-slider { outline: 3px solid #B7A6FF; outline-offset: 2px; }

/* ── Member picker (parent mode) ──────────────────────────────────── */

.avst-member-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}
.avst-member {
  position: relative;
  flex: 0 0 clamp(82px, 26vw, 112px);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 2.5px solid transparent;
  background: #fff;
  border-radius: 18px;
  padding: 8px 14px;
  min-width: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(76, 54, 150, 0.1);
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.15s ease;
}
.avst-member:hover { transform: translateY(-2px); }
.avst-member.is-active { border-color: #6C4DFF; background: #F3EFFF; }
.avst-member-art { width: 46px; height: 50px; }
.avst-member-name {
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 800;
  color: #43318F;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avst-member-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #FF9F1C;
  box-shadow: 0 0 0 3px #FFF;
}

/* ── Chips ────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
  body.fcc-app-shell-v1.logged-in #avatarStudio.page.active {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
    overflow-y: visible;
    padding-inline: 0;
  }

  body.fcc-app-shell-v1.logged-in #avatarStudioPageContent.avst-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
    overflow-y: visible;
    padding: 0 16px calc(var(--fcc-bottomnav-height, 64px) + env(safe-area-inset-bottom, 0px) + 28px);
    -webkit-overflow-scrolling: touch;
  }

  .avst-hero {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-bottom: 14px;
    padding: 20px 18px;
    border-radius: 20px;
  }

  .avst-hero::after {
    right: -82px;
    top: -82px;
    width: 168px;
    height: 168px;
  }

  .avst-hero-chip {
    max-width: 100%;
    white-space: normal;
  }

  .avst-hero-title {
    font-size: clamp(1.45rem, 8vw, 1.9rem);
    line-height: 1.08;
  }

  .avst-hero-sub {
    font-size: 0.94rem;
    line-height: 1.4;
  }

  .avst-member-row {
    margin-inline: 0;
    padding: 4px 2px 14px;
    scrollbar-width: none;
  }

  .avst-member-row::-webkit-scrollbar {
    display: none;
  }

  .avst-member {
    flex-basis: clamp(86px, 30vw, 112px);
    padding-inline: 10px;
  }

  .avst-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .avst-preview-card,
  .avst-controls,
  .avst-admin {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-radius: 20px;
    padding: 14px;
  }

  .avst-preview-card {
    position: static;
  }

  .avst-preview {
    width: min(100%, 320px);
  }

  .avst-preview-name {
    margin: 9px 0 10px;
    font-size: 1.05rem;
    overflow-wrap: anywhere;
  }

  .avst-preview-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }

  .avst-preview-actions .avst-btn {
    width: 100%;
    justify-content: center;
    padding-inline: 12px;
    white-space: normal;
  }

  .avst-preview-actions #avstResetBtn,
  .avst-preview-actions #avstRandomBtn,
  .avst-preview-actions #avstSaveBtn {
    grid-column: 1 / -1;
  }

  .avst-tabs {
    margin-inline: 0;
    padding-bottom: 10px;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
  }

  .avst-tab {
    scroll-snap-align: start;
    max-width: min(58vw, 180px);
    min-height: 44px;
    white-space: normal;
  }

  .avst-options,
  .avst-toggle-list,
  .avst-chiprow,
  .avst-admin-rows,
  .avst-admin-actions {
    max-width: 100%;
    min-width: 0;
  }

  .avst-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .avst-tile {
    min-height: 92px;
    padding: 9px 5px;
    border-radius: 16px;
  }

  .avst-tile-art {
    width: min(58px, 100%);
    height: 64px;
  }

  .avst-swatch {
    width: min(42px, 100%);
    height: 42px;
  }

  .avst-swatch--wide {
    width: min(58px, 100%);
  }

  .avst-toggle-row {
    gap: 10px;
    padding: 12px;
  }

  .avst-toggle-row > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .avst-pending-previews,
  .avst-pending-actions {
    flex-wrap: wrap;
  }

  .avst-chip {
    min-height: 44px;
    white-space: normal;
  }

  .avst-admin-actions .avst-btn,
  .avst-pending-actions .avst-btn {
    flex: 1 1 min(100%, 140px);
  }
}

@media (max-width: 359px) {
  body.fcc-app-shell-v1.logged-in #avatarStudioPageContent.avst-shell {
    padding-inline: 14px;
  }

  .avst-preview-card,
  .avst-controls,
  .avst-admin {
    padding: 12px;
  }

  .avst-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .avst-preview-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

.avst-chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.avst-chip {
  border: 2px solid #E4DCFF;
  background: #fff;
  color: #5438D6;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.avst-chip:hover { border-color: #B7A6FF; }
.avst-chip.is-on {
  background: linear-gradient(120deg, #6C4DFF, #8F5CFF);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 5px 12px rgba(108, 77, 255, 0.3);
}

/* ── Parent admin panel ───────────────────────────────────────────── */

.avst-admin {
  margin-top: 20px;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(76, 54, 150, 0.12);
}
.avst-admin-title { margin: 0 0 12px; font-size: 1.05rem; font-weight: 900; color: #43318F; }
.avst-admin-sub { margin: 12px 4px 8px; font-size: 0.85rem; font-weight: 700; color: #8A7FB8; }
.avst-admin-rows { display: flex; flex-direction: column; gap: 8px; }
.avst-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.avst-pending-card {
  background: linear-gradient(120deg, #FFF4D6, #FFE9F4);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
}
.avst-pending-label { margin: 0 0 8px; font-weight: 800; color: #7A5A12; }
.avst-pending-previews { display: flex; align-items: center; gap: 10px; }
.avst-pending-slot { display: flex; flex-direction: column; align-items: center; gap: 2px; background: #fff; border-radius: 14px; padding: 6px; }
.avst-pending-cap { font-size: 0.7rem; font-weight: 800; color: #8A7FB8; text-transform: uppercase; }
.avst-pending-arrow { font-size: 1.4rem; font-weight: 900; color: #6C4DFF; }
.avst-pending-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── Empty / loading states ───────────────────────────────────────── */

.avst-empty {
  text-align: center;
  padding: 48px 20px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(76, 54, 150, 0.1);
}
.avst-empty-emoji { font-size: 3rem; display: block; margin-bottom: 8px; }
.avst-empty h2 { margin: 0 0 6px; color: #43318F; }
.avst-empty p { margin: 0; color: #6E6494; }
.avst-empty-art { display: flex; justify-content: center; margin-top: 16px; }
.avst-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 34px;
  color: #6E6494;
  font-weight: 700;
}
.avst-spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 3px solid #E4DCFF;
  border-top-color: #6C4DFF;
  animation: avst-spin 0.8s linear infinite;
}
@keyframes avst-spin { to { transform: rotate(360deg); } }

/* ── Confetti ─────────────────────────────────────────────────────── */

.avst-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
  z-index: 30;
}
.ach-celebrate-overlay .avst-confetti { position: fixed; border-radius: 0; }
.avst-confetti-bit {
  position: absolute;
  top: -12px;
  width: 9px;
  height: 14px;
  border-radius: 3px;
  animation: avst-confetti-fall 1.4s ease-in forwards;
}
@keyframes avst-confetti-fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(112%) translateY(240px) rotate(300deg); opacity: 0; }
}

/* ── My Avatar (moods) page ───────────────────────────────────────── */

.avst-moods-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 860px) {
  .avst-moods-layout { grid-template-columns: 1fr; }
}
.avst-moods-panels { display: flex; flex-direction: column; gap: 14px; }
.avst-mood-card {
  background: #fff;
  border-radius: 22px;
  padding: 16px;
  box-shadow: 0 10px 26px rgba(76, 54, 150, 0.12);
}
.avst-mood-card h3 { margin: 0 0 12px; font-size: 1rem; font-weight: 900; color: #43318F; }
.avst-mood-card--cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.avst-mood-card--cta p { margin: 0; font-weight: 700; color: #55497E; }
.avst-mood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.avst-mood {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 2.5px solid transparent;
  background: #F8F6FF;
  border-radius: 18px;
  padding: 12px 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #55497E;
  cursor: pointer;
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.16s ease, background 0.16s ease;
}
.avst-mood:hover { transform: translateY(-2px) scale(1.02); background: #F3EFFF; }
.avst-mood.is-active {
  border-color: #FF7AC8;
  background: #FFF0F8;
  box-shadow: 0 6px 16px rgba(255, 122, 200, 0.25);
}
.avst-mood--anim.is-active { border-color: #6C4DFF; background: #EFE9FF; box-shadow: 0 6px 16px rgba(108, 77, 255, 0.25); }
.avst-mood-emoji { font-size: 1.6rem; }

/* ── Family Portrait page ─────────────────────────────────────────── */

.fp-style-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.fp-style-row::-webkit-scrollbar { display: none; }
.fp-style { flex: 0 0 auto; }
.fp-canvas-card {
  position: relative;
  background: #fff;
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 12px 32px rgba(76, 54, 150, 0.14);
}
.fp-canvas { border-radius: 18px; overflow: hidden; line-height: 0; }
.fp-canvas svg { width: 100%; height: auto; display: block; }
.fp-caption-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.fp-caption-input {
  flex: 1 1 220px;
  border: 2px solid #E4DCFF;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 800;
  color: #43318F;
  background: #F8F6FF;
}
.fp-caption-input:focus { outline: none; border-color: #6C4DFF; background: #fff; }
.fp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.fp-saved { margin-top: 22px; }
.fp-saved-title { margin: 0 0 12px; font-size: 1.05rem; font-weight: 900; color: #43318F; }
.fp-saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.fp-thumb {
  margin: 0;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(76, 54, 150, 0.12);
  transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.fp-thumb:hover { transform: translateY(-3px); }
.fp-thumb-art { line-height: 0; }
.fp-thumb-art svg { width: 100%; height: auto; display: block; }
.fp-thumb figcaption {
  position: relative;
  padding: 10px 40px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.fp-thumb figcaption span { font-weight: 800; color: #43318F; font-size: 0.9rem; }
.fp-thumb figcaption small { color: #8A7FB8; font-size: 0.76rem; }
.fp-thumb-del {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: #F8F6FF;
  border-radius: 10px;
  padding: 6px 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.fp-thumb-del:hover { background: #FFE3E5; }

/* ── Achievement celebration overlay ──────────────────────────────── */

.ach-celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(35, 22, 80, 0.55);
  backdrop-filter: blur(4px);
  animation: ach-cel-fade 0.25s ease;
}
@keyframes ach-cel-fade { from { opacity: 0; } to { opacity: 1; } }
.ach-celebrate-card {
  position: relative;
  width: min(88vw, 360px);
  background: #fff;
  border-radius: 28px;
  padding: 34px 26px 26px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(20, 10, 60, 0.4);
  animation: ach-cel-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
@keyframes ach-cel-pop {
  0% { transform: scale(0.6) translateY(30px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.ach-celebrate-rays {
  position: absolute;
  left: 50%;
  top: 74px;
  width: 220px;
  height: 220px;
  transform: translate(-50%, -50%);
  background: conic-gradient(from 0deg, rgba(255, 209, 102, 0.28) 0 14deg, transparent 14deg 28deg,
    rgba(255, 209, 102, 0.28) 28deg 42deg, transparent 42deg 56deg, rgba(255, 209, 102, 0.28) 56deg 70deg,
    transparent 70deg 84deg, rgba(255, 209, 102, 0.28) 84deg 98deg, transparent 98deg 112deg,
    rgba(255, 209, 102, 0.28) 112deg 126deg, transparent 126deg 140deg, rgba(255, 209, 102, 0.28) 140deg 154deg,
    transparent 154deg 168deg, rgba(255, 209, 102, 0.28) 168deg 182deg, transparent 182deg 196deg,
    rgba(255, 209, 102, 0.28) 196deg 210deg, transparent 210deg 224deg, rgba(255, 209, 102, 0.28) 224deg 238deg,
    transparent 238deg 252deg, rgba(255, 209, 102, 0.28) 252deg 266deg, transparent 266deg 280deg,
    rgba(255, 209, 102, 0.28) 280deg 294deg, transparent 294deg 308deg, rgba(255, 209, 102, 0.28) 308deg 322deg,
    transparent 322deg 336deg, rgba(255, 209, 102, 0.28) 336deg 350deg, transparent 350deg 360deg);
  border-radius: 50%;
  animation: ach-cel-spin 9s linear infinite;
}
@keyframes ach-cel-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.ach-celebrate-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  font-size: 2.6rem;
  background: linear-gradient(135deg, #FFF4D6, #FFE29A);
  box-shadow: 0 10px 24px rgba(255, 159, 28, 0.35), inset 0 0 0 4px #fff;
  animation: ach-cel-badge 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s backwards;
}
@keyframes ach-cel-badge {
  0% { transform: scale(0) rotate(-40deg); }
  100% { transform: scale(1) rotate(0); }
}
.ach-celebrate-kicker {
  position: relative;
  margin: 14px 0 2px;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #FF9F1C;
}
.ach-celebrate-name { position: relative; margin: 0 0 4px; font-size: 1.35rem; font-weight: 900; color: #43318F; }
.ach-celebrate-child { position: relative; margin: 0 0 16px; color: #6E6494; font-weight: 700; }
.ach-celebrate-btn {
  position: relative;
  border: 0;
  border-radius: 999px;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(120deg, #6C4DFF, #8F5CFF);
  box-shadow: 0 8px 18px rgba(108, 77, 255, 0.4);
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ach-celebrate-btn:hover { transform: translateY(-1px) scale(1.03); }
.ach-celebrate-btn:active { transform: scale(0.96); }

/* ── Achievements page: view tabs + category chips ────────────────── */

.ach-view-tabs {
  display: inline-flex;
  gap: 4px;
  background: #F1EDFF;
  border-radius: 999px;
  padding: 4px;
}
.ach-view-tab {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #6E6494;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ach-view-tab.is-active {
  background: #fff;
  color: #5438D6;
  box-shadow: 0 3px 8px rgba(76, 54, 150, 0.18);
}
.ach-cat-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ach-cat-row::-webkit-scrollbar { display: none; }
.ach-cat-chip {
  flex: 0 0 auto;
  border: 2px solid #E4DCFF;
  background: #fff;
  color: #5438D6;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ach-cat-chip:hover { border-color: #B7A6FF; }
.ach-cat-chip.is-on {
  background: linear-gradient(120deg, #6C4DFF, #8F5CFF);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 5px 12px rgba(108, 77, 255, 0.3);
}
.ach-filter-empty { grid-column: 1 / -1; }

/* ── Kid dashboard: engine avatar frame ───────────────────────────── */
/* Base .kid-avatar-frame (kid-dashboard.css) is a circular grid cell —
   these rules only make sure the engine SVG scales inside it. */

.kid-avatar-frame--fcc { overflow: hidden; }
.kid-avatar-frame--fcc svg,
body.fcc-app-shell-v1 #dashboard .kid-avatar-frame--fcc svg {
  width: 92%;
  height: 92%;
}

/* ── Fallback toast ───────────────────────────────────────────────── */

.avst-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(16px);
  z-index: 10001;
  background: #43318F;
  color: #fff;
  font-weight: 800;
  font-size: 0.92rem;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(30, 18, 70, 0.35);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 86vw;
  text-align: center;
}
.avst-toast.is-in { opacity: 1; transform: translateX(-50%) translateY(0); }
.avst-toast--error { background: #C2364B; }
.avst-toast--info { background: #5438D6; }

/* ── Reduced motion ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .avst-btn, .avst-tile, .avst-mood, .avst-member, .fp-thumb,
  .ach-celebrate-card, .ach-celebrate-badge, .ach-celebrate-rays,
  .avst-confetti-bit, .avst-shake {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Premium Avatar Pilot (development-gated) ─────────────────────────── */
.avpilot { border: 1px dashed #B9A6F0; }
.avpilot-badge { display:inline-block; font-size:11px; font-weight:800; letter-spacing:.06em;
  background:#6C4DFF; color:#fff; border-radius:999px; padding:2px 8px; margin-left:8px; vertical-align:middle; }
.avpilot-body { display:flex; gap:16px; flex-wrap:wrap; align-items:flex-start; }
.avpilot-preview { flex:0 0 auto; width:160px; min-height:174px; display:flex; align-items:center; justify-content:center;
  background:conic-gradient(#ece8f8 25%,#fff 0 50%,#ece8f8 0 75%,#fff 0); background-size:18px 18px;
  border-radius:14px; padding:6px; }
.avpilot-preview svg { max-width:100%; height:auto; }
.avpilot-ph { font-size:12px; color:#8177A6; text-align:center; padding:10px; }
.avpilot-controls { flex:1 1 240px; min-width:220px; }
.avpilot-note { font-size:12px; color:#B4506B; background:#FFF0F3; border:1px solid #F3C9D3;
  border-radius:8px; padding:8px 10px; margin-top:10px; min-height:0; }
.avpilot-note:empty { display:none; }
.avpilot-locked { background:#F2EEFB; border:1px solid #DCD2F5; color:#5B4E86; }
@media (max-width: 520px){ .avpilot-body { flex-direction:column; } .avpilot-preview { width:100%; } }

/* ── Choose Your Starting Look (representation presets, dev-gated) ─────── */
.avstart-filters { display:flex; flex-wrap:wrap; gap:6px; margin:6px 0 12px; }
.avst-chip { border:1px solid #E4DEF7; background:#F7F4FF; color:#5B4E86; border-radius:999px;
  padding:5px 12px; font-size:12px; cursor:pointer; }
.avst-chip.is-on { background:#6C4DFF; color:#fff; border-color:#6C4DFF; }
.avstart-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(120px,1fr)); gap:10px; }
.avstart-card { display:flex; flex-direction:column; align-items:center; gap:2px; padding:8px 6px 10px;
  border:2px solid transparent; border-radius:14px; background:#fff; cursor:pointer; box-shadow:0 3px 10px rgba(90,60,180,.08); }
.avstart-card.is-selected { border-color:#6C4DFF; }
.avstart-thumb { width:96px; height:104px; object-fit:contain;
  background:conic-gradient(#ece8f8 25%,#fff 0 50%,#ece8f8 0 75%,#fff 0); background-size:16px 16px; border-radius:10px; }
.avstart-name { font-size:13px; font-weight:700; color:#2A2440; text-align:center; }
.avstart-desc { font-size:11px; color:#7A4DD8; text-align:center; text-transform:capitalize; }
@media (max-width:520px){ .avstart-grid{ grid-template-columns:repeat(auto-fill,minmax(104px,1fr)); } }

/* ── Skin & Face editor (head-foundation, dev-gated) ──────────────────── */
.avsf-body { display:flex; gap:16px; flex-wrap:wrap; align-items:flex-start; }
.avsf-preview { flex:0 0 auto; width:160px; min-height:174px; display:flex; align-items:center; justify-content:center;
  background:conic-gradient(#ece8f8 25%,#fff 0 50%,#ece8f8 0 75%,#fff 0); background-size:18px 18px; border-radius:14px; padding:6px; }
.avsf-preview svg { max-width:100%; height:auto; }
.avsf-controls { flex:1 1 260px; min-width:230px; }
.avsf-swatches { display:flex; flex-wrap:wrap; gap:8px; }
.avsf-swatch { display:flex; flex-direction:column; align-items:center; gap:3px; width:64px; border:2px solid transparent;
  background:transparent; border-radius:12px; padding:4px 2px; cursor:pointer; }
.avsf-swatch.is-selected { border-color:#6C4DFF; }
.avsf-sw { width:34px; height:34px; border-radius:50%; box-shadow:inset 0 0 0 1px rgba(0,0,0,.08); }
.avsf-swname { font-size:9px; line-height:1.1; color:#5B4E86; text-align:center; }
.avsf-faces { grid-template-columns:repeat(auto-fill,minmax(96px,1fr)); }
.avsf-facethumb { width:76px; height:82px; object-fit:contain; }
@media (max-width:520px){ .avsf-body{ flex-direction:column; } .avsf-preview{ width:100%; } .avsf-swatch{ width:56px; } }

/* facial-feature option rows */
.avsf-optrow { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:4px; }

.avsf-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }

.avpilot .avst-admin-sub { max-width: 760px; }
.avpilot .avst-btn,
.avsf-actions .avst-btn {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 359px) {
  .avstart-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .avsf-controls { min-width: 0; width: 100%; }
  .avsf-optrow,
  .avsf-swatches,
  .avsf-actions { max-width: 100%; }
}

/* Unified Premium Avatar Studio V2 */
.avst-v2-header,
.avst-v2-header *,
.avst-v2-workspace,
.avst-v2-workspace *,
.avst-v2-actionbar,
.avst-v2-actionbar *,
.avst-settings-backdrop,
.avst-settings-backdrop * { box-sizing: border-box; }

.avst-v2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin-bottom: 14px;
  padding: 4px 2px 12px;
  border-bottom: 1px solid #E4E0F1;
}
.avst-v2-heading { min-width: 0; }
.avst-v2-heading h2,
.avst-v2-title-row h2 { margin: 0; color: #30245F; font-size: 1.55rem; line-height: 1.15; letter-spacing: 0; }
.avst-v2-heading p { margin: 4px 0 0; color: #655C81; font-size: .9rem; }
.avst-v2-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.avst-v2-preview-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid #D7CDF8;
  border-radius: 999px;
  background: #F4F0FF;
  color: #5941B7;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: 0;
}
.avst-v2-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.avst-v2-member {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(110px, 190px) 18px;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid #DED7F0;
  border-radius: 8px;
  background: #FFF;
  color: #382B69;
  font-weight: 750;
}
.avst-v2-member--static { grid-template-columns: 38px minmax(0, auto); padding-right: 12px; }
.avst-v2-member-art { display: grid; place-items: center; width: 38px; height: 38px; overflow: hidden; border-radius: 50%; background: #EEE9FC; }
.avst-v2-member-art svg { width: 38px; height: 42px; }
.avst-v2-member select {
  appearance: none;
  width: 100%;
  min-height: 40px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #382B69;
  font: inherit;
  cursor: pointer;
}
.avst-v2-select-arrow { pointer-events: none; color: #74689B; }
.avst-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 1px solid #DCD4F1;
  border-radius: 8px;
  background: #FFF;
  color: #5438D6;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
}
.avst-icon-btn:hover { background: #F3F0FC; }
.avst-icon-btn:disabled { opacity: .42; cursor: default; }

.avst-v2-workspace {
  display: grid;
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
  padding-bottom: 92px;
}
.avst-v2-preview-card {
  position: sticky;
  top: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #DDD6EE;
  border-radius: 8px;
  background: #FFF;
  box-shadow: 0 12px 30px rgba(57, 38, 113, .11);
}
.avst-v2-stage {
  display: grid;
  place-items: center;
  min-height: 430px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, #F4F0FF 0%, #EDE9FB 72%, #E4E7F6 100%);
}
.avst-v2-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 360px);
  min-height: 390px;
  transform: scale(var(--avst-preview-zoom, 1));
  transform-origin: 50% 60%;
  transition: transform .18s ease;
}
.avst-v2-preview > svg { display: block; width: 100%; height: auto; max-height: 410px; }
.avst-v2-preview-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 2px 0; }
.avst-v2-preview-meta h3 { margin: 0; color: #332664; font-size: 1.05rem; }
.avst-v2-preview-meta p { margin: 3px 0 0; color: #71688E; font-size: .78rem; }
.avst-v2-zoom { display: flex; gap: 4px; }
.avst-v2-zoom button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #DAD3EC;
  border-radius: 8px;
  background: #F7F5FC;
  color: #49358F;
  font-size: 1.2rem;
  cursor: pointer;
}

.avst-v2-editor {
  min-width: 0;
  border: 1px solid #DDD6EE;
  border-radius: 8px;
  background: #FFF;
  box-shadow: 0 12px 30px rgba(57, 38, 113, .09);
}
.avst-v2-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(88px, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 8px;
  border-bottom: 1px solid #E8E3F3;
  background: #F8F7FC;
  border-radius: 8px 8px 0 0;
}
.avst-v2-tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #69607F;
  font-size: .79rem;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}
.avst-v2-tab:hover { background: #ECE8F8; color: #49358F; }
.avst-v2-tab.is-active { background: #5E43D1; color: #FFF; box-shadow: 0 4px 10px rgba(94, 67, 209, .24); }
.avst-v2-panel {
  min-width: 0;
  min-height: 470px;
  max-height: calc(100vh - 230px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  scrollbar-color: #C8BEEA transparent;
}
.avst-v2-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.avst-v2-panel-head h3 { margin: 0; color: #30245F; font-size: 1.12rem; letter-spacing: 0; }
.avst-v2-panel-head p { margin: 4px 0 0; color: #6D6486; font-size: .84rem; }
.avst-v2-section-label { margin: 18px 0 9px; color: #544A72; font-size: .8rem; letter-spacing: 0; }
.avst-v2-filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 14px; }
.avst-v2-filter-row .avst-chip { min-height: 44px; padding-inline: 14px; font-size: .78rem; }
.avst-v2-subnav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 8px;
  background: #EEEBF6;
}
.avst-v2-subnav button {
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #675E7D;
  font-size: .8rem;
  font-weight: 750;
  cursor: pointer;
}
.avst-v2-subnav button.is-active { background: #FFF; color: #5135C2; box-shadow: 0 2px 7px rgba(52, 36, 104, .13); }
.avst-v2-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 10px;
  min-width: 0;
}
.avst-v2-option-grid--presets { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
.avst-v2-option {
  position: relative;
  display: grid;
  grid-template-rows: minmax(94px, 1fr) auto;
  align-items: stretch;
  min-width: 0;
  min-height: 138px;
  overflow: hidden;
  padding: 5px 5px 9px;
  border: 2px solid #E5E0F0;
  border-radius: 8px;
  background: #FBFAFE;
  color: #41365F;
  cursor: pointer;
}
.avst-v2-option:hover { border-color: #B9A8F1; background: #F6F3FE; }
.avst-v2-option.is-selected { border-color: #6649DE; background: #F2EEFF; box-shadow: 0 0 0 2px rgba(102, 73, 222, .11); }
.avst-v2-option.is-disabled { opacity: .42; cursor: not-allowed; }
.avst-v2-option-art { display: grid; place-items: center; min-width: 0; min-height: 94px; overflow: hidden; border-radius: 5px; background: #F0EDF8; }
.avst-v2-option-art img { display: block; width: 100%; height: 100%; max-height: 112px; object-fit: contain; }
.avst-v2-none-art { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: #FFF; color: #776E8E; font-size: 1.4rem; }
.avst-v2-option-name {
  display: block;
  min-height: 34px;
  padding: 7px 3px 0;
  color: #433660;
  font-size: .75rem;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: break-word;
}
.avst-v2-check {
  position: absolute;
  top: 7px;
  right: 7px;
  display: none;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #5E43D1;
  color: #FFF;
  font-size: .76rem;
  box-shadow: 0 2px 6px rgba(42, 26, 92, .25);
}
.avst-v2-option.is-selected .avst-v2-check { display: grid; }
.avst-v2-swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.avst-v2-swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 96px;
  padding: 8px 4px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #F8F6FC;
  color: #4F4568;
  cursor: pointer;
}
.avst-v2-swatch > span { width: 42px; height: 42px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.75), 0 2px 7px rgba(42,32,70,.18); }
.avst-v2-swatch small { width: 100%; font-size: .68rem; line-height: 1.15; font-weight: 700; text-align: center; overflow-wrap: break-word; }
.avst-v2-swatch i { position: absolute; top: 6px; right: 7px; display: none; width: 22px; height: 22px; place-items: center; border-radius: 50%; background: #5E43D1; color: #FFF; font-size: .72rem; font-style: normal; }
.avst-v2-swatch.is-selected { border-color: #6649DE; background: #F1EDFF; }
.avst-v2-swatch.is-selected i { display: grid; }
.avst-v2-inline-note,
.avst-v2-note { margin: 10px 0; color: #675E7D; font-size: .82rem; }
.avst-v2-note:empty { display: none; }
.avst-v2-coming { display: grid; place-items: center; min-height: 260px; padding: 30px 18px; border: 1px dashed #CFC5E8; border-radius: 8px; background: #F8F6FC; text-align: center; }
.avst-v2-coming > span { font-size: 1.9rem; color: #6447D4; }
.avst-v2-coming h4 { margin: 10px 0 4px; color: #3D315E; }
.avst-v2-coming p { margin: 0; max-width: 360px; color: #6C6381; font-size: .84rem; }
.avst-v2-loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 420px; color: #655A83; font-weight: 750; }

.avst-v2-actionbar {
  position: sticky;
  z-index: 40;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-top: -74px;
  padding: 10px;
  border: 1px solid rgba(210, 201, 234, .9);
  border-radius: 8px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 32px rgba(42, 26, 92, .18);
  backdrop-filter: blur(14px);
}
.avst-v2-history-actions,
.avst-v2-primary-actions { display: flex; align-items: center; gap: 7px; min-width: 0; }
.avst-v2-primary-actions .avst-btn { white-space: nowrap; }
.avst-btn--danger { background: #FFF0F2; color: #A62643; border: 1px solid #F1CAD3; }

.avst-settings-backdrop {
  position: fixed;
  z-index: 10020;
  inset: 0;
  display: flex;
  justify-content: flex-end;
  background: rgba(31, 22, 56, .44);
  backdrop-filter: blur(3px);
}
.avst-settings-backdrop[hidden] { display: none; }
.avst-settings-drawer {
  width: min(100%, 460px);
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  background: #F8F7FC;
  box-shadow: -16px 0 40px rgba(28, 18, 57, .22);
}
.avst-settings-drawer > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.avst-settings-drawer > header h2 { margin: 0; color: #31245E; font-size: 1.3rem; letter-spacing: 0; }
.avst-settings-drawer > header p { margin: 4px 0 0; color: #706787; font-size: .82rem; }
.avst-settings-panel { margin: 0; padding: 14px; border-radius: 8px; box-shadow: none; }
.avst-settings-panel .avst-admin-title { display: none; }
.avst-settings-panel .avst-toggle-row { border-radius: 7px; }
.avst-settings-panel .avst-admin-actions { display: grid; grid-template-columns: 1fr; }
.avst-settings-panel > .avst-btn--danger { width: 100%; margin-top: 10px; }
body.avst-settings-open { overflow: hidden; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.avst-v2-header button:focus-visible,
.avst-v2-header select:focus-visible,
.avst-v2-tabs button:focus-visible,
.avst-v2-panel button:focus-visible,
.avst-v2-actionbar button:focus-visible,
.avst-settings-backdrop button:focus-visible,
.avst-settings-backdrop input:focus-visible {
  outline: 3px solid #2D8C86;
  outline-offset: 2px;
}

/* Consumer previews use a studio surface; checkerboards remain QA-only. */
.avpilot-preview,
.avsf-preview,
.avstart-thumb { background: #F1EDFA !important; }

@media (max-width: 1099px) {
  .avst-v2-workspace { grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); }
  .avst-v2-stage { min-height: 350px; }
  .avst-v2-preview { min-height: 320px; }
  .avst-v2-tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
  .avst-v2-tabs::-webkit-scrollbar { display: none; }
  .avst-v2-tab { flex: 0 0 auto; min-width: 96px; }
}

@media (max-width: 899px) {
  .avst-v2-workspace { grid-template-columns: minmax(0, 1fr); padding-bottom: 106px; }
  .avst-v2-preview-card { position: static; display: grid; grid-template-columns: minmax(220px, 320px) 1fr; align-items: center; gap: 14px; }
  .avst-v2-stage { min-height: 300px; }
  .avst-v2-preview { min-height: 280px; }
  .avst-v2-preview-meta { align-self: stretch; flex-direction: column; align-items: flex-start; justify-content: center; padding: 0; }
  .avst-v2-panel { max-height: none; overflow: visible; min-height: 420px; }
  .avst-v2-actionbar { margin-top: -88px; }
}

@media (max-width: 767px) {
  .avst-v2-header { align-items: flex-start; padding-bottom: 10px; }
  .avst-v2-heading p { display: none; }
  .avst-v2-heading h2,
  .avst-v2-title-row h2 { font-size: 1.25rem; }
  .avst-v2-title-row { gap: 6px; }
  .avst-v2-preview-badge { min-height: 24px; font-size: .66rem; }
  .avst-v2-header-actions { flex: 1 1 auto; }
  .avst-v2-member { grid-template-columns: 32px minmax(70px, 1fr) 15px; flex: 1 1 auto; min-height: 44px; padding: 3px 6px; }
  .avst-v2-member--static { grid-template-columns: 32px minmax(0, 1fr); font-size: .78rem; }
  .avst-v2-member-art,
  .avst-v2-member-art svg { width: 32px; height: 34px; }
  .avst-v2-member select { min-height: 38px; font-size: .78rem; text-overflow: ellipsis; }
  .avst-v2-workspace { gap: 10px; padding-bottom: 158px; }
  .avst-v2-preview-card { display: block; padding: 8px; }
  .avst-v2-stage { min-height: 238px; }
  .avst-v2-preview { width: min(100%, 230px); min-height: 224px; }
  .avst-v2-preview > svg { max-height: 232px; }
  .avst-v2-preview-meta { flex-direction: row; align-items: center; justify-content: space-between; padding: 7px 2px 0; }
  .avst-v2-zoom { display: none; }
  .avst-v2-editor { border-radius: 8px; }
  .avst-v2-tabs { padding: 6px; }
  .avst-v2-tab { min-width: auto; min-height: 44px; padding-inline: 14px; }
  .avst-v2-panel { min-height: 380px; padding: 14px 10px; }
  .avst-v2-panel-head { margin-bottom: 11px; }
  .avst-v2-option-grid,
  .avst-v2-option-grid--presets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .avst-v2-option { grid-template-rows: minmax(78px, 1fr) auto; min-height: 124px; padding: 4px 4px 7px; }
  .avst-v2-option-art { min-height: 78px; }
  .avst-v2-option-art img { max-height: 92px; }
  .avst-v2-option-name { min-height: 32px; padding-top: 6px; font-size: .67rem; }
  .avst-v2-swatch-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .avst-v2-swatch { min-height: 88px; padding-inline: 2px; }
  .avst-v2-swatch > span { width: 38px; height: 38px; }
  .avst-v2-subnav { display: grid; grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); width: 100%; }
  .avst-v2-subnav button { min-width: 0; padding-inline: 6px; }
  .avst-v2-actionbar { bottom: 0; flex-wrap: wrap; margin: -142px -2px 0; padding: 8px; border-radius: 8px 8px 0 0; }
  .avst-v2-history-actions { flex: 0 0 100%; width: 100%; gap: 4px; }
  .avst-v2-primary-actions { display: grid; flex: 0 0 100%; grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr); width: 100%; }
  .avst-v2-primary-actions .avst-btn { width: 100%; min-height: 44px; padding: 9px 8px; font-size: .76rem; white-space: normal; line-height: 1.1; }
  .avst-settings-drawer { height: min(92vh, 760px); margin-top: auto; border-radius: 8px 8px 0 0; }
}

@media (max-width: 389px) {
  .avst-v2-header { flex-wrap: wrap; }
  .avst-v2-heading { width: 100%; }
  .avst-v2-header-actions { width: 100%; }
  .avst-v2-option-grid,
  .avst-v2-option-grid--presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .avst-v2-swatch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .avst-v2-primary-actions .avst-btn--ghost { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .avst-v2-preview,
  .avst-v2-option,
  .avst-v2-tab,
  .avst-v2-swatch { transition: none !important; animation: none !important; }
}
