/* ──────────────────────────────────────────────
   Lucy's Closet — Global Styles
   ────────────────────────────────────────────── */

:root {
  --bg:          #faf9f7;
  --surface:     #ffffff;
  --border:      #e8e4df;
  --text:        #2c2825;
  --text-muted:  #8a7f75;
  --accent:      #c07b54;
  --accent-dark: #a0623f;
  --accent-soft: #f5ede7;
  --danger:      #c0392b;
  --success:     #27ae60;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --radius:      12px;
  --radius-sm:   8px;
  --transition:  .2s ease;
  --nav-h:       60px;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

/* ── Typography ── */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.1rem;  font-weight: 600; }
p  { line-height: 1.6; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.page { display: none; }
.page.active { display: block; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }

/* ── Auth screens ── */
#auth-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(135deg, #faf9f7 0%, #f0e8e0 100%);
}
#auth-screen.hidden { display: none; }

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.auth-logo .logo-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: .5rem;
}
.auth-logo h1 {
  font-size: 1.5rem;
  color: var(--accent);
}
.auth-logo p {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: .25rem;
}

.auth-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1;
  padding: .5rem;
  text-align: center;
  border-radius: 6px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form { display: none; }
.auth-form.active { display: block; }

/* ── Form elements ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: .375rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .65rem .875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--accent-soft);
  color: var(--accent);
}
.btn-secondary:hover { background: #edd9cc; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger {
  background: #fde8e7;
  color: var(--danger);
}
.btn-danger:hover { background: #f9ccc9; }
.btn-sm { padding: .4rem .8rem; font-size: .8125rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-google {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
  margin-bottom: .75rem;
}
.btn-google:hover { border-color: #aaa; }
.btn-google svg { width: 18px; height: 18px; }

.divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--text-muted);
  font-size: .8125rem;
  margin: 1rem 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.forgot-link {
  text-align: right;
  margin-top: -.5rem;
  margin-bottom: 1rem;
  font-size: .8125rem;
}

/* ── App shell ── */
#app-shell { display: none; min-height: 100dvh; }
#app-shell.active { display: flex; flex-direction: column; }

/* ── Top nav ── */
.top-nav {
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1;
}
.nav-link {
  padding: .4rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: var(--transition);
  font-family: inherit;
}
.nav-link:hover { color: var(--text); background: var(--bg); }
.nav-link.active { color: var(--accent); background: var(--accent-soft); }
.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  overflow: hidden;
  display: none;
  z-index: 200;
}
.user-menu.open { display: block; }
.user-menu-item {
  padding: .625rem 1rem;
  font-size: .875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--text);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-item.danger { color: var(--danger); }
.user-menu hr { border: none; border-top: 1px solid var(--border); margin: .25rem 0; }

/* ── Page content ── */
.app-content { flex: 1; padding: 1.5rem 1rem 4rem; }

/* ── Section header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-header h2 { margin: 0; }

/* ── Filter bar ── */
.filter-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filter-chip {
  padding: .3rem .8rem;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: var(--transition);
  font-family: inherit;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.search-bar {
  position: relative;
  margin-bottom: 1rem;
}
.search-bar input {
  width: 100%;
  padding: .625rem 1rem .625rem 2.5rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: .9375rem;
  font-family: inherit;
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition);
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar .search-icon {
  position: absolute;
  left: .875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 1rem;
}

/* ── Item grid ── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.item-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
}
.item-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.item-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.item-photo {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
  background: var(--bg);
}
.item-photo-placeholder {
  width: 100%;
  aspect-ratio: 3/4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 2.5rem;
}
.item-info {
  padding: .6rem .75rem;
}
.item-name {
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-meta {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .125rem;
}
.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-top: .4rem;
}
.tag {
  display: inline-block;
  padding: .1rem .4rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 500;
}
.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
  vertical-align: middle;
  margin-right: .25rem;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; }
.empty-state h3 { color: var(--text); margin-bottom: .4rem; }
.empty-state p { font-size: .9rem; margin-bottom: 1.25rem; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}
@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 1rem;
  }
}
.modal {
  background: var(--surface);
  width: 100%;
  max-width: 520px;
  max-height: 90dvh;
  overflow-y: auto;
  border-radius: var(--radius) var(--radius) 0 0;
  transform: translateY(30px);
  transition: transform .25s ease;
  padding: 1.5rem;
}
.modal-backdrop.open .modal {
  transform: translateY(0);
}
@media (min-width: 640px) {
  .modal { border-radius: var(--radius); }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-footer {
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── Photo upload ── */
.photo-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
  overflow: hidden;
}
.photo-upload:hover { border-color: var(--accent); background: var(--accent-soft); }
.photo-upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-upload .upload-icon { font-size: 2rem; color: var(--accent); }
.photo-upload p { font-size: .875rem; color: var(--text-muted); margin-top: .5rem; }
.photo-preview {
  position: relative;
  display: inline-block;
  margin-top: .75rem;
}
.photo-preview img {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.photo-preview-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: .75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Color swatches ── */
.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .375rem;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .15s, border-color .15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text); }

/* ── Outfit cards ── */
.outfit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.outfit-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.outfit-card:hover { box-shadow: var(--shadow-md); }
.outfit-items-strip {
  display: flex;
  height: 110px;
  overflow: hidden;
  background: var(--bg);
}
.outfit-items-strip .strip-img {
  flex: 1;
  object-fit: cover;
  min-width: 0;
}
.outfit-items-strip .strip-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.5rem;
  min-width: 0;
}
.outfit-info {
  padding: .75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.outfit-name { font-weight: 600; font-size: .9375rem; }
.outfit-count { font-size: .8125rem; color: var(--text-muted); }
.outfit-actions {
  display: flex;
  gap: .375rem;
}

/* ── List styles ── */
.lists-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
}
@media (max-width: 700px) {
  .lists-layout { grid-template-columns: 1fr; }
}
.lists-sidebar { display: flex; flex-direction: column; gap: .5rem; }
.list-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .6rem .875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--transition);
}
.list-item-row:hover { background: var(--bg); }
.list-item-row.active { background: var(--accent-soft); border-color: var(--accent); }
.list-item-row .list-name { font-weight: 500; font-size: .9rem; }
.list-item-row .list-badge {
  font-size: .75rem;
  color: var(--text-muted);
}

.checklist { display: flex; flex-direction: column; gap: .5rem; }
.checklist-entry {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .875rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: opacity var(--transition);
}
.checklist-entry.checked { opacity: .55; }
.checklist-entry input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.checklist-entry .entry-label {
  flex: 1;
  font-size: .9375rem;
}
.checklist-entry.checked .entry-label {
  text-decoration: line-through;
  color: var(--text-muted);
}
.checklist-entry .entry-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .875rem;
  opacity: 0;
  transition: opacity .15s;
  padding: .2rem;
}
.checklist-entry:hover .entry-delete { opacity: 1; }

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: .625rem 1.25rem;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideUp .25s ease;
  white-space: nowrap;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }
@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Loading ── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner.dark {
  border-color: rgba(0,0,0,.15);
  border-top-color: var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

/* ── Hamburger button (hidden on desktop) ── */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: .4rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-hamburger:hover { background: var(--bg); }

/* ── Responsive nav ── */
@media (max-width: 600px) {
  .nav-hamburger { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: .375rem .5rem .5rem;
    gap: .125rem;
    z-index: 99;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links .nav-link {
    width: 100%;
    text-align: left;
    padding: .7rem 1rem;
    font-size: .975rem;
    border-radius: var(--radius-sm);
  }
  .nav-links .nav-link span { display: inline; }
}

/* ── Item detail view ── */
.item-detail {
  max-width: 640px;
  margin: 0 auto;
}
.item-detail-photo {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  margin-bottom: 1.25rem;
  background: var(--accent-soft);
}
.item-detail-placeholder {
  width: 100%;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: var(--radius);
  font-size: 4rem;
  margin-bottom: 1.25rem;
}
.detail-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.detail-field { min-width: 120px; }
.detail-field label {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  display: block;
  margin-bottom: .25rem;
}
.detail-field span { font-size: .9375rem; }

/* ── Outfit builder ── */
.outfit-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .outfit-builder { grid-template-columns: 1fr; }
}
.builder-panel {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: .875rem;
  min-height: 200px;
}
.builder-panel h4 {
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.builder-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: .5rem;
}
.builder-thumb {
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 3/4;
  border: 2px solid transparent;
  transition: var(--transition);
}
.builder-thumb img, .builder-thumb .thumb-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.builder-thumb .thumb-placeholder {
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.builder-thumb.in-outfit { border-color: var(--accent); }
.builder-thumb .remove-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: .65rem;
}
.builder-thumb.in-outfit .remove-badge { display: flex; }

/* ── Utility ── */
.hidden { display: none !important; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); font-size: .875rem; }
.w-full { width: 100%; }

/* ── Avatar page ── */
.avatar-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  align-items: start;
}
@media (max-width: 700px) {
  .avatar-layout { grid-template-columns: 1fr; }
}

.avatar-figure-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar-container {
  position: relative;
  width: 220px;
  /* height maintains SVG aspect ratio 200:520 */
  aspect-ratio: 200 / 520;
  background: linear-gradient(180deg, #f9f6f2 0%, #ede8e2 100%);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

#avatar-svg-wrapper {
  position: absolute;
  inset: 0;
}

#avatar-overlays {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.avatar-overlay-img {
  position: absolute;
  object-fit: contain;
  pointer-events: none;
}

/* ── Avatar controls ── */
.avatar-controls-panel {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.avatar-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .375rem;
}

.avatar-swatch {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2.5px solid transparent;
  transition: transform .15s, border-color .15s;
  position: relative;
}
.avatar-swatch:hover { transform: scale(1.15); }
.avatar-swatch.selected {
  border-color: var(--text);
  transform: scale(1.1);
}
.avatar-swatch .swatch-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  font-size: .65rem;
  white-space: nowrap;
  padding: .2rem .4rem;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.avatar-swatch:hover .swatch-tooltip { opacity: 1; }

.body-type-options,
.hair-style-options {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .375rem;
}

.avatar-option-btn {
  padding: .35rem .875rem;
  border-radius: 999px;
  font-size: .8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  transition: var(--transition);
  font-family: inherit;
}
.avatar-option-btn:hover { border-color: var(--accent); color: var(--accent); }
.avatar-option-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Background removal status badge ── */
.bg-removal-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .5rem;
  font-size: .78rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 999px;
  padding: .25rem .6rem;
  border: 1px solid var(--border);
}
.bg-removal-badge.processing { color: var(--accent); border-color: var(--accent); }
.bg-removal-badge.done       { color: var(--success); border-color: var(--success); }
.bg-removal-badge.failed     { color: var(--danger);  border-color: var(--danger);  }
