/* Dressing room (avatar.php). Tokens follow DESIGN.md. */
body { background: #d4d4d4; }

.avn {
  --primary: #5abeb4;
  --primary-deep: #46a59b;
  --primary-soft: rgb(90 190 180 / 0.12);
  --primary-text: #2b7d75; /* darker teal for text links, readable on white */
  --accent: oklch(0.80 0.14 75);
  --ink: oklch(0.18 0.01 270);
  --muted: oklch(0.52 0.015 270);
  --ink-body: oklch(0.40 0.015 270);
  --bg: oklch(1 0 0);
  --surface: oklch(0.96 0.006 270);
  --surface-2: oklch(0.93 0.008 270);
  --border: oklch(0.88 0.008 270);
  --border-strong: oklch(0.78 0.01 270);
  --danger: oklch(0.55 0.21 25);
  --success: oklch(0.58 0.16 145);
  --danger-text: oklch(0.4 0.2 25);
  --shadow-float: 0 4px 16px rgba(20, 16, 40, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nav-h: 0px;
  --nav-full: 0px;
  --stage-h: 0px;
  --z-sticky: 20;
  --z-savebar: 30;

  box-sizing: border-box;
  max-width: 1280px;
  margin: 20px auto 40px;
  padding: 24px;
  background: var(--bg);
  border-radius: 14px;
  color: var(--ink);
  font: 400 0.9375rem/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: grid;
  /* Avatar column narrows on smaller desktops so the closet gets the room */
  grid-template-columns: clamp(220px, 20vw + 40px, 300px) minmax(0, 1fr);
  gap: clamp(20px, 2.5vw, 32px);
  align-items: start;
}
.avn *, .avn *::before, .avn *::after { box-sizing: border-box; }
.avn [hidden] { display: none !important; }
.avn button, .avn input, .avn select { font: inherit; color: inherit; }
.avn button { cursor: pointer; }
.avn a { color: var(--primary-text); text-decoration: none; font-weight: 600; }
.avn a:hover { text-decoration: underline; }
.avn :focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.avn-visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.avn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── Stage ─────────────────────────────────────────────── */
.avn-stage {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - var(--nav-h) - 32px);
}
.avn-figure {
  flex: none;
  /* Fills the column width, but never so tall that the save bar leaves the screen */
  /* Sized from the nav's full height, so the avatar doesn't grow as the nav scrolls away;
     the wearing list takes that room instead */
  width: min(100%, calc((100vh - var(--nav-full) - 300px) * 330 / 630));
  min-width: 140px;
  aspect-ratio: 330 / 630;
  margin-inline: auto;
}
.avn-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  transition: opacity 150ms var(--ease);
}
.avn-canvas.is-busy { opacity: 0.8; }
.avn-canvas > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}
.avn-canvas > .avn-backdrop { inset: 0; object-fit: cover; object-position: top; }

.avn-stage-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; min-height: 0; flex: 1; }
.avn-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.avn-stage-title { margin: 0; font-size: 0.875rem; font-weight: 600; }
.avn-count { color: var(--muted); font-weight: 500; }
.avn-history { display: flex; gap: 4px; }

.avn-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.avn-icon-btn svg { width: 16px; height: 16px; }
.avn-icon-btn:hover:not(:disabled) { background: var(--surface); border-color: var(--border-strong); }
.avn-icon-btn:disabled { opacity: 0.4; cursor: default; }

/* Wearing list */
.avn-tray {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 48px;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.avn-wear {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  border-radius: 6px;
}
.avn-wear:hover { background: var(--surface); }
.avn-wear-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: var(--surface);
  object-fit: contain;
  flex: none;
}
.avn-wear-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  color: inherit;
}
a.avn-wear-main:hover { text-decoration: none; }
.avn-wear-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.avn-wear-cat { font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.avn-wear-remove {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  flex: none;
}
.avn-wear-remove:hover { background: var(--surface-2); color: var(--ink); }

/* ▲▼ for stacked accessories / necklaces */
.avn-wear-move { display: flex; flex-direction: column; flex: none; }
.avn-wear-move button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 18px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
}
.avn-wear-move button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.avn-wear-move button:disabled { opacity: 0.3; cursor: default; }
.avn-wear-move svg { width: 16px; height: 16px; }
.avn-wear-remove svg { width: 16px; height: 16px; }
.avn-tray-empty { color: var(--ink-body); font-size: 0.875rem; padding: 4px; }

/* Save bar: sits right under the avatar on desktop so it never scrolls away */
.avn-savebar {
  order: -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.avn-figure { order: -2; }
.avn-savebar-text { font-size: 0.75rem; color: var(--muted); }
.avn.is-dirty .avn-savebar-text { color: var(--ink); font-weight: 600; }
.avn-savebar-actions { display: flex; gap: 6px; margin-left: auto; }
.avn-savebar .avn-btn { min-height: 32px; padding: 5px 12px; font-size: 0.75rem; }

.avn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), opacity 150ms var(--ease);
}
.avn-btn:hover:not(:disabled) { border-color: var(--border-strong); }
.avn-btn--primary { background: var(--primary); border-color: var(--primary); color: #fff !important; }
.avn-btn--primary:hover:not(:disabled) { background: var(--primary-deep); border-color: var(--primary-deep); }
.avn-btn--danger { background: var(--danger); border-color: var(--danger); color: #fff !important; }
.avn-btn:disabled { opacity: 0.45; cursor: default; }
.avn-btn.is-loading { pointer-events: none; }
.avn-btn.is-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: avn-spin 700ms linear infinite;
}
@keyframes avn-spin { to { transform: rotate(360deg); } }

/* ── Closet ────────────────────────────────────────────── */
.avn-closet { min-width: 0; }
.avn-head h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.avn-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }

.avn-tabs-wrap {
  position: sticky;
  top: var(--nav-h);
  z-index: var(--z-sticky);
  background: var(--bg);
  margin-top: 16px;
  padding: 10px 0;
}
.avn-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.avn-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease), color 150ms var(--ease);
}
.avn-tab:hover { border-color: var(--border-strong); }
.avn-tab-count { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.avn-tab[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.avn-tab[aria-selected="true"] .avn-tab-count { color: oklch(1 0 0 / 0.75); }

/* Search and sort always share one row */
.avn-toolbar { display: flex; gap: 8px; margin: 4px 0 16px; }
.avn-search {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color 150ms var(--ease);
}
.avn-search:focus-within { border-color: var(--primary); }
.avn-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
  font-size: 1rem; /* 16px stops iOS zooming on focus */
}
.avn-search input::placeholder { color: var(--muted); }
.avn-select select {
  min-height: 40px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.875rem;
}
.avn-select select:focus-visible { border-color: var(--primary); outline: none; }

/* Category panels: skin sliders, hair toss, looks */
.avn-panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.avn-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.avn-panel-title { margin: 0; font-size: 1rem; font-weight: 600; }
.avn-panel-note { margin: 0; color: var(--ink-body); font-size: 0.875rem; }
.avn-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; }
.avn-slider { display: flex; flex-direction: column; gap: 4px; }
.avn-slider-label { display: flex; justify-content: space-between; font-size: 0.8125rem; font-weight: 600; }
.avn-slider output { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.avn-slider input { width: 100%; accent-color: var(--primary); height: 28px; margin: 0; }

.avn-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.avn-switch {
  position: relative;
  width: 44px;
  height: 26px;
  border: 0;
  border-radius: 999px;
  background: var(--border-strong);
  flex: none;
  transition: background-color 180ms var(--ease);
}
.avn-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 180ms var(--ease);
}
.avn-switch[aria-checked="true"] { background: var(--primary); }
.avn-switch[aria-checked="true"]::after { transform: translateX(18px); }

/* Design grid */
.avn-grid {
  display: grid;
  /* At least 5 per row: tiles shrink below 102px rather than drop a column */
  grid-template-columns: repeat(auto-fill, minmax(min(102px, calc((100% - 48px) / 5)), 1fr));
  gap: 12px;
}
.avn-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  text-align: left;
  color: inherit;
  content-visibility: auto;
  contain-intrinsic-size: auto 200px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease), transform 120ms var(--ease);
}
a.avn-tile:hover { text-decoration: none; }
.avn-tile:hover { border-color: var(--border-strong); }
.avn-tile:active { transform: scale(0.97); }
.avn-tile[aria-pressed="true"] { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-soft); }
.avn-tile[aria-disabled="true"] { cursor: default; opacity: 0.55; transform: none; }
.avn-tile-img {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
}
.avn-tile-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.avn-tile-img img, .avn-wear-thumb { opacity: 0; transition: opacity 150ms var(--ease); }
.avn-tile-img img[data-ready], .avn-wear-thumb[data-ready] { opacity: 1; }
.avn-tile-name {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}
.avn-tile-meta { font-size: 0.75rem; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -4px; }
.avn-badge {
  position: absolute;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1.5;
}
.avn-badge--new {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 2px var(--bg);
}
.avn-badge--copies { bottom: 6px; right: 6px; background: var(--bg); color: var(--ink-body); border: 1px solid var(--border); }
.avn-badge--note { bottom: 6px; left: 6px; background: var(--bg); color: var(--ink-body); border: 1px solid var(--border); }
.avn-check {
  position: absolute;
  top: 6px;
  right: 6px;
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  transform: scale(0.6);
  opacity: 0;
  transition: transform 180ms var(--ease), opacity 150ms var(--ease);
}
.avn-check svg { width: 14px; height: 14px; stroke-width: 3; }
.avn-tile[aria-pressed="true"] .avn-check { transform: scale(1); opacity: 1; }

.avn-tile--none .avn-tile-img { display: grid; place-items: center; color: var(--muted); }
.avn-tile--none .avn-tile-img img { width: 70%; height: 70%; opacity: 0.6; }

.avn-tile--skeleton { pointer-events: none; }
.avn-tile--skeleton .avn-tile-img,
.avn-tile--skeleton .avn-sk-line { background: var(--surface); animation: avn-pulse 1.2s ease-in-out infinite; }
.avn-sk-line { height: 10px; border-radius: 4px; width: 80%; }
.avn-sk-line + .avn-sk-line { width: 50%; }
@keyframes avn-pulse { 50% { opacity: 0.5; } }

.avn-empty {
  grid-column: 1 / -1;
  padding: 40px 16px;
  text-align: center;
  color: var(--ink-body);
}
.avn-empty strong { display: block; color: var(--ink); font-size: 1rem; margin-bottom: 4px; }
.avn-empty .avn-btn { margin-top: 12px; }
.avn-sentinel { height: 1px; }
.avn-end { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 0.8125rem; padding: 16px 0 8px; }

/* Looks */
.avn-looks { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
.avn-look { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.avn-look-apply {
  aspect-ratio: 330 / 630;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg) center / cover no-repeat;
  padding: 0;
  transition: border-color 150ms var(--ease), transform 120ms var(--ease);
}
.avn-look-apply:hover { border-color: var(--primary); }
.avn-look-apply:active { transform: scale(0.97); }
.avn-look-foot { display: flex; align-items: center; gap: 4px; min-width: 0; }
.avn-look-name { flex: 1; min-width: 0; font-size: 0.8125rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avn-look-more { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; display: grid; place-items: center; color: var(--muted); }
.avn-look-more:hover { background: var(--surface-2); color: var(--ink); }
.avn-look-new {
  aspect-ratio: 330 / 630;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-body);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}
.avn-look-new:hover { border-color: var(--primary); color: var(--primary-text); }
.avn-look-new svg { width: 24px; height: 24px; }
.avn-look-form { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.avn-look-form input, .avn-rename input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 1rem;
}
.avn-look-form input:focus, .avn-rename input:focus { border-color: var(--primary); outline: none; }
.avn-look-form .avn-btn { min-height: 36px; padding: 6px 10px; }
.avn-rename { display: flex; gap: 4px; }

/* ── Floating: menu + toasts ───────────────────────────── */
.avn-menu {
  position: fixed;
  z-index: 1100;
  min-width: 200px;
  padding: 6px;
  border-radius: 10px;
  background: oklch(1 0 0);
  box-shadow: var(--shadow-float);
  font: 400 0.875rem/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: oklch(0.18 0.01 270);
}
.avn-menu button {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.avn-menu button:hover, .avn-menu button:focus-visible { background: oklch(0.96 0.006 270); outline: none; }
.avn-menu .is-danger { color: oklch(0.4 0.2 25); }
.avn-menu p { margin: 6px 12px 8px; color: oklch(0.40 0.015 270); }

.avn-toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.avn-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 10px;
  background: oklch(0.18 0.01 270);
  color: #fff;
  box-shadow: var(--shadow-float, 0 4px 16px rgba(20, 16, 40, 0.12));
  font: 500 0.875rem/1.4 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: auto;
  animation: avn-toast-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.avn-toast--error { background: oklch(0.4 0.2 25); }
.avn-toast--success { background: oklch(0.5 0.15 145); }
.avn-toast button {
  border: 0;
  background: none;
  color: oklch(0.80 0.14 75);
  font: 700 0.8125rem/1 inherit;
  font-family: inherit;
  padding: 4px;
  cursor: pointer;
}
.avn-toast.is-leaving { opacity: 0; transition: opacity 180ms ease; }
@keyframes avn-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Phones and small tablets ──────────────────────────── */
@media (max-width: 899px) {
  .avn {
    display: block;
    margin: 0;
    padding: 0 16px calc(96px + env(safe-area-inset-bottom));
    border-radius: 0;
  }
  .avn:not(.avn--owner) { padding-bottom: 32px; }

  /* Avatar + wearing list stay pinned while the closet scrolls underneath */
  .avn-stage {
    max-height: none;
    top: var(--nav-h);
    z-index: var(--z-sticky);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    margin: 0 -16px;
    padding: 10px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .avn-figure { width: auto; min-width: 0; height: clamp(170px, 30vh, 250px); margin: 0; }
  .avn-canvas { border-radius: 10px; }
  .avn-stage-side { max-height: clamp(170px, 30vh, 250px); }
  .avn-tray { max-height: none; flex: 1; gap: 0; }
  .avn-wear { padding: 2px; gap: 8px; }
  .avn-wear-thumb { width: 30px; height: 30px; }
  .avn-wear-remove { width: 36px; height: 36px; }
  .avn-wear-move button { width: 30px; height: 20px; }
  .avn-icon-btn { width: 32px; height: 32px; }

  /* Save bar becomes a thumb-reach bar that slides up once there is something to save */
  .avn-savebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-savebar);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-float);
    transform: translateY(110%);
    transition: transform 240ms var(--ease);
  }
  .avn.is-dirty .avn-savebar, .avn.is-saving .avn-savebar { transform: none; }
  .avn-savebar .avn-btn { min-height: 36px; padding: 6px 14px; }

  .avn-head { padding-top: 16px; }
  .avn-head h1 { font-size: 1.375rem; }

  .avn-tabs-wrap { top: calc(var(--nav-h) + var(--stage-h)); margin: 8px -16px 0; padding: 6px 16px; }
  .avn-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    gap: 4px;
    margin: 0 -16px;
    padding: 0 16px;
  }
  .avn-tabs::-webkit-scrollbar { display: none; }
  /* Mouse users can't swipe, so give them a visible scrollbar */
  @media (hover: hover) and (pointer: fine) {
    .avn-tabs { scrollbar-width: thin; padding-bottom: 6px; }
    .avn-tabs::-webkit-scrollbar { display: block; height: 6px; }
    .avn-tabs::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
  }
  .avn-tab { scroll-snap-align: start; min-height: 28px; padding: 3px 10px; gap: 4px; }

  .avn-toolbar { margin-bottom: 12px; }
  .avn-select select { max-width: 132px; }

  /* At least 4 per row */
  .avn-grid { grid-template-columns: repeat(auto-fill, minmax(min(80px, calc((100% - 24px) / 4)), 1fr)); gap: 8px; }
  .avn-tile { padding: 4px 4px 6px; gap: 4px; }
  .avn-tile-meta { display: none; }

  .avn-toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .avn.is-dirty ~ .avn-toasts { bottom: calc(72px + env(safe-area-inset-bottom)); }
}

/* Large phones and small tablets have room for a bigger avatar */
@media (min-width: 580px) and (max-width: 899px) {
  .avn-figure { height: clamp(240px, 42vh, 380px); }
  .avn-stage-side { max-height: clamp(240px, 42vh, 380px); }
}

@media (prefers-reduced-motion: reduce) {
  .avn *, .avn *::before, .avn *::after, .avn-toast {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* ── Kovaze Runway (fashionista_create.php): dark, with the runway pinks ───── */
body.avn-runway { background: #050814; }
.avn--runway {
  color-scheme: dark;
  --primary: #ff4fac;
  --primary-deep: #ef2f9a;
  --primary-soft: rgb(255 79 172 / 0.14);
  --primary-text: #ff8fcf;
  --on-primary: #1a0612;
  --ink: #fff8ff;
  --muted: #b8aecb;
  --ink-body: #ded4ea;
  --bg: #0a0e21;
  --surface: #131935;
  --surface-2: #1c2346;
  --border: #262d52;
  --border-strong: #3d4677;
  --success: #3ddc84;
  --shadow-float: 0 8px 24px rgb(0 0 0 / 0.5);
  border: 1px solid rgb(255 79 172 / 0.35);
  box-shadow: 0 0 40px rgb(255 79 172 / 0.12);
}
.avn--runway .avn-runway-word, .avn--runway .avn-theme { color: var(--primary); }
.avn--runway .avn-canvas { background: #fff; box-shadow: inset 0 0 0 1px rgb(255 79 172 / 0.3); }
/* Dark text on the pink fills reads far better than white */
.avn--runway .avn-btn--primary { color: var(--on-primary) !important; }
.avn--runway .avn-tab[aria-selected="true"], .avn--runway .avn-check { color: var(--on-primary); }
.avn--runway .avn-tab[aria-selected="true"] .avn-tab-count { color: rgb(26 6 18 / 0.7); }
.avn--runway .avn-tab:not([aria-selected="true"]) { background: var(--surface); }
/* Cover art is drawn for light backgrounds, so covers keep a pale backdrop */
.avn--runway .avn-tile-img, .avn--runway .avn-wear-thumb { background: #f4eef8; }
.avn--runway .avn-tile--none .avn-tile-img, .avn--runway .avn-tile--skeleton .avn-tile-img { background: var(--surface); }
.avn--runway .avn-tile { background: var(--surface); }
.avn--runway .avn-tile[aria-pressed="true"] { background: var(--primary-soft); }
.avn--runway .avn-badge--copies, .avn--runway .avn-badge--note { background: var(--surface-2); border-color: var(--border-strong); color: var(--ink-body); }
.avn--runway .avn-switch::after { background: var(--ink); }
body.avn-runway .avn-toast { background: #1c2346; border: 1px solid rgb(255 79 172 / 0.35); color: #fff8ff; }
body.avn-runway .avn-toast--success { background: #14532d; border-color: #3ddc84; }
body.avn-runway .avn-toast--error { background: #6b1d2a; border-color: #ff6b81; }
