/* Avatar builder. Style: framed-sheet builder (taste skill app sheet, seed 659219830).
   One tinted ground holds the top bar and three panels; panels are white, 1px edge, 16px corners, no shadow.
   Face: the stage is the avatar itself, at 320px, with the name field under it (same name, same face).
   Grid: 8px outer margin, 12px gap; parts 300 + stage minmax(0,1fr) + side 300. */
:root {
  --ground: #f3f6f7;
  --surface: #ffffff;
  --raised: #f4f6f8;
  --active: #e6ecee;
  --border: #e3e7ea;
  --rule: #eef0f2;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --accent: #1b6c80;
  --radius-card: 8px;
  --radius-control: 6px;
  --radius-sheet: 16px;
  --inset: 8px;
  --gap: 12px;
  --pad: 16px;
  --control-height: 32px;
  --fs-title: 16px;
  --fs-section: 14px;
  --fs-body: 14px;
  --fs-small: 12px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace; /* taste-skill-ignore: mono for the code snippet only */
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--text); font: 400 var(--fs-body)/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, p, pre, figure { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
[hidden] { display: none !important; }
.small { font-size: var(--fs-small); }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-icon] { display: inline-flex; }
[data-icon] svg { width: 16px; height: 16px; }

/* ── Shell ── */
.app { display: grid; grid-template-rows: 48px minmax(0, 1fr); height: 100dvh; }
.top { display: flex; align-items: center; gap: 12px; padding: 0 var(--inset) 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.brand img { border-radius: 50%; }
.brand h1 { font-size: var(--fs-title); font-weight: 600; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.divider { width: 1px; height: 20px; background: var(--border); margin: 0 8px; }

.btn { height: var(--control-height); display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); font-weight: 500; transition: background .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn.primary:hover { background: #2c2e31; }
.btn.wide { width: 100%; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover:not(:disabled) { background: var(--active); color: var(--text); }
.icon-btn.solid { width: 40px; height: 40px; border: 1px solid var(--control); background: var(--surface); color: var(--text); }
.icon-btn.solid [data-icon] svg, .icon-btn.solid svg { width: 20px; height: 20px; }

.work { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: var(--gap); padding: 0 var(--inset) var(--inset); min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sheet); padding: var(--pad); overflow-y: auto; min-height: 0; }
.panel h2 { font-size: var(--fs-section); font-weight: 600; margin: 20px 0 10px; }
.panel h2:first-child { margin-top: 0; }
.note { margin: -4px 0 10px; }

/* ── Parts ── */
.tabs { display: flex; flex-wrap: wrap; gap: 2px 14px; border-bottom: 1px solid var(--rule); margin-bottom: 12px; }
.tabs button { border: 0; background: none; padding: 6px 0; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; border-color: var(--text); }
.opts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.opt { display: grid; gap: 2px; padding: 4px 4px 2px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); font-size: 13px; color: var(--muted); text-align: center; transition: border-color .15s, transform .15s; }
.opt img { width: 100%; aspect-ratio: 1; display: block; border-radius: 4px; background: var(--raised); }
.opt:hover { border-color: var(--control); transform: translateY(-1px); }
.opt[aria-pressed="true"], .opt[aria-checked="true"] { border-color: var(--text); outline: 1px solid var(--text); outline-offset: -2px; color: var(--text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: var(--control-height); display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid var(--control); border-radius: 999px; background: var(--surface); }
.chip:hover { background: var(--raised); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }

.colours { display: grid; gap: 14px; }
.colour-row > span { display: block; margin-bottom: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgb(0 0 0 / .12); padding: 0; position: relative; }
.sw[aria-checked="true"] { outline: 2px solid var(--text); outline-offset: 2px; }
.sw.none { background: linear-gradient(135deg, transparent 46%, #c4242a 46% 54%, transparent 54%), #fff; } /* taste-skill-ignore: a strike-through mark for "no background", not a gradient fill */
.sw.custom { overflow: hidden; display: grid; place-items: center; background: var(--surface); }
.sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }
.sw.custom span { font-size: 16px; line-height: 1; color: var(--muted); pointer-events: none; }

/* ── Stage ── */
.stage { background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-sheet); overflow-y: auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 24px; padding: 40px 24px 32px; }
.preview { width: min(320px, 70vw); aspect-ratio: 1; }
.preview svg { width: 100%; height: 100%; display: block; }
.seed { width: min(360px, 100%); display: grid; gap: 6px; }
.seed-row { display: flex; gap: 8px; }
.seed input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); font-size: 16px; }
.seed input:focus { border-color: var(--text); outline: none; }
.variants, .sizes { width: min(520px, 100%); display: grid; gap: 8px; justify-items: center; }
.variants h2, .sizes h2 { font-weight: 400; }
.variant-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.variant { width: 56px; height: 56px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); overflow: hidden; transition: transform .15s, border-color .15s; }
.variant:hover { transform: translateY(-2px); border-color: var(--control); }
.variant img { width: 100%; height: 100%; display: block; }
.size-row { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; justify-content: center; }
.size-row figure { display: grid; justify-items: center; gap: 4px; }
.size-row figcaption { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Side ── */
.styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); padding: 2px; background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-control); }
.segmented button { height: 28px; border: 0; border-radius: 4px; background: none; color: var(--muted); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 500; outline: 1px solid var(--border); }
.export { display: grid; gap: 8px; }
.export select { height: var(--control-height); padding: 0 32px 0 10px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%235d5f60' stroke-width='1.5'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.code { font: 400 12px/1.6 var(--mono); background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px 12px; overflow-x: auto; white-space: pre; margin-bottom: 8px; max-height: 220px; }

.toast { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; background: var(--text); color: #fff; padding: 8px 14px; border-radius: var(--radius-control); font-size: var(--fs-small); opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: 0 4px 16px rgb(0 0 0 / .16); } /* taste-skill-ignore: the toast floats over the screen */
.toast.on { opacity: 1; }

/* ── Phone and tablet: the frame goes, panels stack under the preview ── */
@media (max-width: 1100px) {
  .app { height: auto; min-height: 100dvh; }
  .work { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stage { grid-column: 1 / -1; order: -1; }
  .panel, .stage { overflow: visible; }
}
@media (max-width: 680px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .by, #copy-link, .divider, #undo, #redo { display: none; }
  .btn, .icon-btn, .chip, .export select, .segmented button { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .sw { width: 36px; height: 36px; }
  .opts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tabs button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
