:root {
  --bg: #f4f1ec;
  --panel: #fffdf9;
  --ink: #1f1b17;
  --muted: #6e655b;
  --line: #e3ddd3;
  --accent: #6b3f23;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
.app { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: 100dvh; }

.stage { position: relative; min-height: 0; background: radial-gradient(circle at 50% 42%, #fbfaf7 0, #ece7df 55%, #ddd6cb 100%); }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#canvas:active { cursor: grabbing; }
.views { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); display: flex; gap: 4px; padding: 4px; background: rgb(255 253 249 / .88); border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.credit { position: absolute; left: 12px; right: 12px; bottom: 10px; text-align: center; font-size: 11px; color: var(--muted); }
.credit a { color: inherit; }
.loader { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.loader[hidden] { display: none; }
.bar { width: 220px; height: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s; }

.panel { display: flex; flex-direction: column; gap: 22px; padding: 28px 26px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h1 { font: 400 28px/1.2 Georgia, "Times New Roman", serif; }
h2 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px; }

button { font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
button:hover { border-color: var(--ink); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.views button { border: 0; padding: 6px 12px; font-size: 13px; }
.views button:hover { background: var(--line); }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 6px 12px; font-size: 13px; color: var(--muted); }
.tabs button[aria-selected="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--ink); }

.options { display: grid; gap: 20px; }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 6px; }
.swatch { display: grid; justify-items: center; align-content: start; gap: 6px; border: 0; border-radius: 8px; padding: 4px 0; font-size: 12px; line-height: 1.2; text-align: center; }
.swatch i { width: 44px; height: 44px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .18), inset 0 8px 14px rgb(255 255 255 / .14); }
.swatch[aria-pressed="true"] i { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.swatch[aria-pressed="true"] { font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.summary { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 14px; }
dt { color: var(--muted); }
dd { text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .primary { flex: 1 1 100%; background: var(--accent); border-color: var(--accent); color: #fff; padding: 12px; }
.actions .link { border: 0; text-decoration: underline; color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
.toast { min-height: 1.45em; font-size: 13px; color: var(--accent); overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 52dvh auto; height: auto; }
  .stage { position: sticky; top: 0; z-index: 1; height: 52dvh; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); }
  .views { bottom: 52px; }
  .views button { padding: 6px 9px; }
}
