/* makeup.land stand builder.
   The stand is the content; everything else defers to it. Chrome is hairlines and soft fills, the controls that
   float over the stage are glass, and magenta is kept for the one main action and for what is selected.
   The stud (a round, raised dot) is the brand's one motif: colour swatches and the counters. */
@font-face { font-family: Assistant; src: url(assets/Assistant.ttf); font-weight: 200 800; font-display: swap; }

:root {
  color-scheme: light dark;
  --accent: #C01C6E; --accent-press: #A3155C; --accent-wash: #FBEAF2; --on-accent: #fff;
  --bg: #fff; --bg-2: #F6F3F4; --fill: rgba(112, 100, 110, .12); --fill-2: rgba(112, 100, 110, .2);
  --label: #000; --label-2: rgba(0, 0, 0, .62); --sep: rgba(0, 0, 0, .1);
  --stage-a: #FCF8F6; --stage-b: #EEE4E1;
  --glass: rgba(255, 255, 255, .72); --glass-edge: rgba(255, 255, 255, .7); --raised: #fff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 28px rgba(50, 10, 35, .12);
  --danger: #C4211F; --danger-wash: #FDECEC; --ok: #1F7A3A;
  --r-s: 10px; --r-m: 16px; --r-l: 26px; --tap: 36px;
  --text: 1rem; --note: .8125rem; --sub: .9375rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #D9307F; --accent-press: #EA4A95; --accent-wash: rgba(217, 48, 127, .2);
    --bg: #161417; --bg-2: #232025; --fill: rgba(255, 255, 255, .1); --fill-2: rgba(255, 255, 255, .18);
    --label: #fff; --label-2: rgba(255, 255, 255, .66); --sep: rgba(255, 255, 255, .14);
    --stage-a: #322D33; --stage-b: #1E1B1F;
    --glass: rgba(44, 40, 46, .7); --glass-edge: rgba(255, 255, 255, .12); --raised: #5A545C;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .4);
    --danger: #FF7A75; --danger-wash: rgba(255, 100, 95, .16); --ok: #62D58C;
  }
  .brand img { filter: invert(1) hue-rotate(180deg); }
}
@media (pointer: coarse) { :root { --tap: 44px; } .studs button { width: 44px; } }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: Assistant, system-ui, sans-serif; color: var(--label); background: var(--bg);
       font-size: var(--text); line-height: 1.4; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* the material for controls that float over the stand */
.glass { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
         box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow); }

/* ---- top bar ---- */
.bar { display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--sep); }
.brand img { height: 22px; display: block; }
.bar h1 { font-size: 1.375rem; font-weight: 800; letter-spacing: -.01em; margin-inline-end: auto; }
.shelf { display: flex; align-items: center; gap: 8px; color: var(--label-2); font-size: var(--sub); }
.shelf label { position: relative; display: block; }
.shelf label span { position: absolute; inset-inline: 0; top: 3px; text-align: center; font-size: .6875rem; line-height: 1; pointer-events: none; }
.shelf input { width: 68px; height: 42px; padding: 13px 4px 0; text-align: center; font-weight: 700; font-size: 1.0625rem; color: var(--label);
               border: 0; border-radius: var(--r-s); background: var(--fill); -moz-appearance: textfield; }
.shelf input::-webkit-inner-spin-button, .cost input::-webkit-inner-spin-button { -webkit-appearance: none; }
.shelf i { font-style: normal; }

/* plain button: toolbar, language, dialog */
.ghost { min-height: var(--tap); padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: var(--sub); background: var(--fill);
         transition: background .15s; }
.ghost:hover { background: var(--fill-2); }
.ghost:active { scale: .97; }
.ghost:disabled { opacity: .35; pointer-events: none; }

/* ---- layout: the stage fills the window; the parts tray sits under it; the summary is an inspector ---- */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: minmax(0, 1fr) auto; }
.stage { position: relative; min-height: 320px; overflow: hidden;
         background: radial-gradient(120% 90% at 50% 0%, var(--stage-a), var(--stage-b)); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage.is-placing canvas { cursor: copy; }
.stage.is-erase canvas, .stage.is-paint canvas { cursor: pointer; }

.tools { position: absolute; inset-inline: 14px; top: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: none; }
.tools > * { pointer-events: auto; }
.tools .spacer { flex: 1; }
.tools .ghost { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
                box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow); }
.tools .ghost:hover { background: var(--raised); }

/* segmented control */
.seg { display: flex; padding: 3px; border-radius: 999px; background: var(--fill); }
.seg button { min-height: calc(var(--tap) - 6px); padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: var(--sub); color: var(--label-2);
              transition: background .15s, color .15s; }
.seg button:hover { color: var(--label); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--raised); color: var(--label);
              box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .05); }
.tools .seg, .studs { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.7); backdrop-filter: blur(22px) saturate(1.7);
              box-shadow: inset 0 0 0 1px var(--glass-edge), var(--shadow); }

/* colour studs */
.studs { display: flex; align-items: center; border-radius: 999px; padding: 0 6px; min-height: var(--tap); }
.studs button { width: 34px; height: var(--tap); display: grid; place-items: center; }
.studs button::before { content: ""; width: 24px; height: 24px; border-radius: 50%; background: var(--c);
              box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .16), inset 0 -3px 0 rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .2); transition: scale .15s; }
.studs button:hover::before { scale: 1.1; }
.studs button[aria-checked="true"]::before { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.studs button.auto::before { background: conic-gradient(#C01C6E 0 25%, #F6C9D4 0 50%, #E9E2D8 0 75%, #1a1a1a 0); }

/* the dock: message, the part in hand or selected with its actions, and what to do next */
.dock { position: absolute; inset-inline: 14px; bottom: 14px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.dock > * { pointer-events: auto; max-width: 100%; }
.hint { color: var(--label-2); font-size: var(--note); padding: 5px 14px; border-radius: 999px; pointer-events: none; text-align: center; }
.toast { background: var(--label); color: var(--bg); padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: var(--sub);
         opacity: 0; translate: 0 8px; pointer-events: none; transition: opacity .18s, translate .18s; text-align: center; }
.toast.on { opacity: 1; translate: 0 0; }
.placing { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; border-radius: 24px; padding: 8px; }
.placing img { width: 52px; height: 40px; object-fit: contain; margin-inline-start: 4px; }
.placing > span { display: flex; flex-direction: column; line-height: 1.15; margin-inline-end: 8px; min-width: 0; }
.placing small { color: var(--label-2); font-size: .75rem; }
.placing b { font-size: var(--sub); font-weight: 700; }
.placing button { min-height: var(--tap); padding: 0 16px; border-radius: 999px; font-weight: 700; font-size: var(--sub);
                  background: var(--accent); color: var(--on-accent); transition: background .15s; }
.placing button:hover { background: var(--accent-press); }
.placing button:active { scale: .97; }
.placing button.alt { background: var(--fill); color: var(--label); font-weight: 600; }
.placing button.alt:hover { background: var(--fill-2); }
.placing #selRemove { color: var(--danger); }

/* ---- parts tray ---- */
.box { border-top: 1px solid var(--sep); background: var(--bg); min-width: 0; padding-top: 10px; }
.tabs { display: inline-flex; margin-inline: 16px; padding: 3px; border-radius: 999px; background: var(--fill); max-width: calc(100% - 32px); overflow-x: auto; }
.tabs button { flex: none; min-height: calc(var(--tap) - 6px); padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: var(--sub);
               color: var(--label-2); transition: background .15s, color .15s; }
.tabs button:hover { color: var(--label); }
.tabs button[aria-selected="true"] { background: var(--raised); color: var(--label); box-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .05); }
.cards { display: flex; gap: 10px; overflow-x: auto; padding: 10px 16px 14px; scroll-snap-type: x proximity; scroll-padding-inline: 16px; }
.card { position: relative; flex: 0 0 128px; scroll-snap-align: start; border-radius: var(--r-m); background: var(--bg-2);
        padding: 8px 8px 10px; text-align: center; transition: background .15s, translate .15s; }
.card img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; display: block; }
.card b { display: block; font-size: var(--sub); font-weight: 700; line-height: 1.2; }
.card span { color: var(--label-2); font-size: var(--note); }
.card:hover { background: var(--fill-2); translate: 0 -2px; }
.card[aria-pressed="true"] { background: var(--accent-wash); box-shadow: inset 0 0 0 2.5px var(--accent); }
.card[aria-pressed="true"]::after { content: "✕"; position: absolute; top: 8px; inset-inline-end: 8px; width: 22px; height: 22px;
        border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: .75rem; font-weight: 700; line-height: 22px; }
.card.new { background: none; box-shadow: inset 0 0 0 1.5px var(--fill-2); display: grid; place-content: center; gap: 2px; }
.card.new i { font-style: normal; font-size: 2.5rem; font-weight: 300; line-height: 1; color: var(--accent); }

/* ---- inspector ---- */
.side { grid-row: 1 / span 2; grid-column: 2; border-inline-start: 1px solid var(--sep); padding: 18px 20px 0;
        overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.side h2 { font-size: 1.375rem; font-weight: 800; letter-spacing: -.01em; }
.side h3 { font-size: var(--note); font-weight: 600; color: var(--label-2); margin-top: 10px; }
.locks { border-radius: var(--r-m); padding: 10px 14px; background: var(--bg-2); font-size: var(--sub); color: var(--label-2); }
.locks b { display: block; color: var(--label); }
.locks.ok { background: none; padding: 0; }
.locks.ok b { color: var(--ok); font-weight: 700; }
.locks.bad { background: var(--danger-wash); color: var(--label); }
.locks.bad b { color: var(--danger); font-size: var(--text); margin-bottom: 2px; }
.facts { display: grid; grid-template-columns: auto 1fr; background: var(--bg-2); border-radius: var(--r-m); padding: 2px 14px; font-size: var(--sub); }
.facts dt, .facts dd { padding: 8px 0; border-bottom: 1px solid var(--sep); }
.facts dt:nth-last-of-type(1), .facts dd:nth-last-of-type(1) { border-bottom: 0; }
.facts dt { color: var(--label-2); }
.facts dd { font-weight: 700; text-align: end; }
.holds { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.holds li { background: var(--bg-2); border-radius: 999px; padding: 4px; padding-inline-end: 14px; display: flex; gap: 8px; align-items: center; font-size: var(--sub); }
.holds li b { min-width: 28px; height: 28px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
              display: grid; place-items: center; padding: 0 7px; font-size: var(--note);
              box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .16); }
.holds li.empty { background: none; padding: 0; color: var(--label-2); }
.parts { list-style: none; font-size: var(--sub); }
.parts li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--sep); }
.parts li:last-child { border-bottom: 0; }
.parts li span:last-child { color: var(--label-2); white-space: nowrap; }

/* the one main action stays in reach */
.checkout { position: sticky; bottom: 0; margin: auto -20px 0; padding: 12px 20px 16px; background: var(--bg); border-top: 1px solid var(--sep);
            display: flex; flex-direction: column; gap: 8px; }
.cost { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 2px 12px; }
.cost p { font-size: 2rem; font-weight: 800; line-height: 1; grid-row: 1 / span 2; align-self: center; }
.cost label { display: flex; align-items: center; gap: 8px; font-size: var(--note); color: var(--label-2); justify-content: flex-end; }
.cost input { width: 58px; height: 30px; text-align: center; border: 0; border-radius: 8px; background: var(--fill); font-weight: 700;
              color: var(--label); -moz-appearance: textfield; }
.cost small, .dl-note { color: var(--label-2); font-size: .75rem; display: block; line-height: 1.3; }
.cost small { grid-column: 2; text-align: end; max-width: 190px; }
.primary { min-height: 48px; padding: 0 22px; border-radius: 999px; background: var(--accent); color: var(--on-accent);
           font-weight: 800; font-size: 1.0625rem; transition: background .15s; }
.primary:hover { background: var(--accent-press); }
.primary:active { scale: .98; }
.primary:disabled { opacity: .45; pointer-events: none; }

/* ---- part editor: a sheet for one self-contained job ---- */
.editor { border: 0; border-radius: var(--r-l); padding: 0; margin: auto; width: min(840px, calc(100vw - 24px));
          max-height: calc(100dvh - 24px); color: var(--label); background: var(--bg); box-shadow: 0 24px 80px rgba(0, 0, 0, .3); }
.editor::backdrop { background: rgba(20, 10, 16, .4); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.editor form { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.editor h2 { font-size: 1.375rem; font-weight: 800; letter-spacing: -.01em; }
.ed-note { background: var(--bg-2); border-radius: var(--r-s); padding: 8px 14px; font-size: var(--note); color: var(--label-2); }
.ed-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ed-view { border-radius: var(--r-m); overflow: hidden; background: radial-gradient(120% 90% at 50% 0%, var(--stage-a), var(--stage-b)); }
.ed-view canvas { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; touch-action: none; cursor: grab; }
.ed-view p { font-size: var(--note); color: var(--label-2); padding: 4px 14px 10px; min-height: 2.2em; }
.ed-fields { display: grid; gap: 10px; }
.ed-fields label { display: grid; gap: 4px; font-size: var(--note); color: var(--label-2); font-weight: 600; }
.ed-fields .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-fields input, .ed-fields select { font-size: 1.0625rem; font-weight: 700; color: var(--label); background: var(--fill);
          border: 0; border-radius: var(--r-s); padding: 0 12px; height: 42px; width: 100%; }
.ed-fields input:disabled { opacity: .4; }
.ed-fields label.check { display: flex; align-items: center; gap: 10px; font-size: var(--sub); color: var(--label); min-height: 42px; }
.ed-fields label.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.ed-error { color: var(--danger); font-weight: 700; font-size: var(--sub); min-height: 1.4em; }
.ed-actions { display: flex; gap: 10px; align-items: center; }
.ed-actions .spacer { flex: 1; }
.ed-actions .ghost, .ed-actions .primary { min-height: 44px; }
#edDelete { color: var(--danger); }

@media (max-width: 900px) {
  body { height: auto; }
  .bar { flex-wrap: wrap; gap: 8px 12px; padding: 10px 14px; }
  .bar h1 { font-size: 1.1875rem; }
  .layout { display: block; }
  .stage { height: 60vh; }
  .side { border-inline-start: 0; border-top: 1px solid var(--sep); overflow: visible; }
  .tools #example, .tools #clear { display: none; }
  .checkout { position: static; margin-top: 10px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .ed-body { grid-template-columns: 1fr; }
  .editor form { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (prefers-reduced-transparency: reduce) {
  .glass, .tools .ghost, .tools .seg, .studs { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .editor::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --label-2: var(--label); --sep: var(--label); }
  .glass, .tools .ghost, .tools .seg, .studs, .card, .ghost, .seg, .tabs { background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--label);
    -webkit-backdrop-filter: none; backdrop-filter: none; }
}
