/* Avatar Maker — Stage 1 tool styles. Inherits MAX tokens from /style.css
   (--bg, --surface, --ink, --accent, --line, --radius, --sans, --mono). */

.av-top { border-bottom: 1px solid var(--line); background: var(--surface); }
.av-top-in {
  max-width: 1080px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: baseline; gap: 16px;
}
.av-top h1 { font-size: 18px; font-weight: 600; margin: 0; color: var(--ink); }
.av-back { color: var(--ink-soft); text-decoration: none; font-size: 13px; }
.av-back:hover { color: var(--accent); }
.av-stage {
  margin-left: auto; font-size: 11px; color: var(--muted);
  font-family: var(--mono); border: 1px solid var(--line);
  padding: 2px 8px; border-radius: 999px;
}

.av-wrap {
  max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px;
  display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 28px;
  align-items: start;
}
@media (max-width: 780px) { .av-wrap { grid-template-columns: 1fr; } }

/* ---- preview column ---- */
.av-stagebox { position: sticky; top: 20px; }
.av-canvas {
  aspect-ratio: 1; width: 100%; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; background: #101112;
}
.av-canvas svg { display: block; width: 100%; height: 100%; }

.av-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.av-btn {
  flex: 1; min-width: 92px; padding: 9px 12px; font-size: 13px;
  font-family: var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.av-btn:hover { border-color: var(--accent); color: var(--accent); }
.av-btn-accent { background: var(--accent); color: #0c0d0d; border-color: var(--accent); font-weight: 600; }
.av-btn-accent:hover { background: var(--accent-soft); color: #0c0d0d; }
.av-btn-sm { flex: 0 0 auto; min-width: 0; padding: 8px 12px; }

.av-code { margin-top: 16px; }
.av-code label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.av-code-row { display: flex; gap: 8px; }
.av-code-row input {
  flex: 1; font-family: var(--mono); font-size: 12px; color: var(--ink-soft);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 8px 10px; min-width: 0;
}

/* ---- saved avatars ---- */
.av-saved { margin-top: 18px; }
.av-saved label {
  display: block; font-size: 11px; color: var(--muted); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .04em;
}
.av-saved input {
  flex: 1; min-width: 0; font-size: 13px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px;
}
.av-save-note { font-size: 11px; color: var(--accent); min-height: 14px; margin-top: 5px; }
.av-save-note.is-bad { color: #ff7a7a; }

.av-saved-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px; margin-top: 8px;
}
.av-saved-empty { grid-column: 1 / -1; font-size: 12px; color: var(--muted); padding: 6px 0; }
.av-saved-item { position: relative; }
.av-saved-load {
  display: block; width: 100%; aspect-ratio: 1; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); overflow: hidden;
}
.av-saved-load:hover { border-color: var(--accent); }
.av-saved-load svg { display: block; width: 100%; height: 100%; }
.av-saved-name {
  font-size: 10px; color: var(--ink-soft); margin-top: 3px; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.av-saved-del {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 4px; font-size: 12px; line-height: 1; cursor: pointer;
  color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
}
.av-saved-del:hover, .av-saved-del.is-confirm { color: #fff; background: #c0392b; border-color: #c0392b; }
.av-saved-del.is-confirm { font-size: 9px; height: 18px; }

/* ---- controls column ---- */
.av-group { margin-bottom: 22px; }
.av-group h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); margin: 0 0 10px; font-weight: 600;
}

/* theme switcher */
.av-themes { display: flex; flex-wrap: wrap; gap: 8px; }
.av-theme {
  padding: 8px 16px; font-size: 13px; font-family: var(--sans); cursor: pointer;
  color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
}
.av-theme:hover { color: var(--accent); border-color: var(--accent); }
.av-theme[aria-pressed="true"] {
  background: var(--accent); color: #0c0d0d; border-color: var(--accent); font-weight: 600;
}
/* "Mix All" pill — visually separated, since it changes the whole model */
.av-theme-mix { border-style: dashed; border-color: var(--ink-soft); color: var(--ink); }
.av-theme-mix[aria-pressed="true"] { border-style: solid; }

/* "none" option tile */
.av-tile-none {
  display: grid; place-items: center;
  font-size: 11px; color: var(--muted); font-family: var(--mono);
}
.av-tile-none[aria-pressed="true"] { color: var(--accent); }

.av-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.av-sw {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line);
}
.av-sw[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.av-sw-custom { position: relative; overflow: hidden; }
.av-sw-custom input[type="color"] {
  position: absolute; inset: -4px; width: 200%; height: 200%;
  border: 0; padding: 0; cursor: pointer; opacity: 0;
}
.av-sw-custom::after {
  content: "+"; position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--ink); font-size: 15px; pointer-events: none;
  background: repeating-conic-gradient(#888 0% 25%, #bbb 0% 50%) 50% / 10px 10px;
}

.av-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.av-tile {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius);
  background: #16171a; cursor: pointer; padding: 4px; overflow: hidden;
}
.av-tile svg { display: block; width: 100%; height: 100%; }
.av-tile[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* share-code hint */
.av-hint { text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 10px; }

/* Custom Mix — theme pool selector */
.av-poolbox { border: 1px dashed var(--line); border-radius: var(--radius); padding: 12px; }
.av-pool { display: flex; flex-wrap: wrap; gap: 6px; }
.av-pool-chip {
  padding: 5px 11px; font-size: 12px; font-family: var(--sans); cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px;
}
.av-pool-chip:hover { color: var(--ink); border-color: var(--ink-soft); }
.av-pool-chip[aria-pressed="true"] {
  color: #0c0d0d; background: var(--accent); border-color: var(--accent); font-weight: 600;
}
.av-pool-acts { display: flex; gap: 6px; margin-top: 10px; }
