/* Modelage — a sculptor's studio in four pigments:
   terracotta, ochre, verdigris and lapis, on warm paper. */

:root {
  --paper: light-dark(#f7f1e8, #1b1719);
  --paper-2: light-dark(#efe6d8, #231e21);
  --card: light-dark(#fffdf9, #262023);
  --sunken: light-dark(#f0e8dc, #1f1a1d);
  --text: light-dark(#2a2320, #f1e9df);
  --muted: light-dark(#7a6c62, #ab9e93);
  --border: light-dark(#e4d8c8, #3a3236);
  --p1: light-dark(#c4623f, #e07f5b); /* terracotta */
  --p2: light-dark(#c99528, #e4b54d); /* ochre */
  --p3: light-dark(#4f927b, #73b99f); /* verdigris */
  --p4: light-dark(#4662aa, #7f98dc); /* lapis */
  --accent: light-dark(#a8482a, #ee9473);
  --ink: light-dark(#2a2320, #f6efe6);
  --shade: light-dark(rgb(80 50 30 / 0.07), rgb(0 0 0 / 0.35));
  --shade-lg: light-dark(rgb(80 50 30 / 0.28), rgb(0 0 0 / 0.7));
  --shadow: 0 1px 2px var(--shade);
  --shadow-lg: 0 18px 40px -18px var(--shade-lg);
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Manrope', system-ui, -apple-system, sans-serif;
  --radius: 22px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-block-size: 100dvh;
  background: var(--paper);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
/* paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain, 0.5);
  mix-blend-mode: var(--blend, multiply);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .38 0 0 0 0 .3 0 0 0 .12 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
/* dark-mode values that light-dark() can't express */
:root:has(meta[name="color-scheme"][content="dark"]) { --grain: 0.16; --blend: screen; --wash: 0.12; }
@media (prefers-color-scheme: dark) {
  :root:has(meta[name="color-scheme"][content="light dark"]) { --grain: 0.16; --blend: screen; --wash: 0.12; }
}

/* watercolour washes */
.washes { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.washes i {
  position: absolute;
  inline-size: 46vmax;
  block-size: 46vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: var(--wash, 0.2);
  animation: drift 38s ease-in-out infinite alternate;
}
.washes i:nth-child(1) { background: var(--p1); inset-block-start: -20vmax; inset-inline-start: -14vmax; }
.washes i:nth-child(2) { background: var(--p2); inset-block-start: -18vmax; inset-inline-end: -16vmax; animation-delay: -9s; }
.washes i:nth-child(3) { background: var(--p3); inset-block-end: -24vmax; inset-inline-start: 8vmax; animation-delay: -18s; }
.washes i:nth-child(4) { background: var(--p4); inset-block-end: -22vmax; inset-inline-end: -12vmax; animation-delay: -27s; }
@keyframes drift {
  to { translate: 6vmax 5vmax; scale: 1.12; }
}

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { inline-size: 20px; block-size: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; letter-spacing: -0.01em; }
.visually-hidden { position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ---------- header ---------- */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  max-inline-size: 1240px;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 16px 0;
}
@media (min-width: 700px) { .topbar { padding-inline: 32px; padding-block-start: 1.4rem; } }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--serif); font-size: 1.5rem; font-style: italic; font-weight: 450; }
.logo { inline-size: 1.85rem; block-size: 1.85rem; stroke: none; }
.credit { white-space: nowrap; margin: 0.1rem 0 0; padding-inline-start: 2.45rem; font-size: 0.75rem; font-weight: 500; line-height: 1.3; color: var(--muted); }
.credit a { color: var(--accent); font-weight: 600; text-decoration: none; }
.credit a:hover { text-decoration: underline; }
.apps-link { display: block; inline-size: fit-content; margin-block-start: 0.15rem; white-space: nowrap; }
.apps-link svg { display: inline; inline-size: 1.05em; block-size: 1.05em; margin-inline-end: 0.25em; vertical-align: -0.18em; stroke-width: 2.2; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  transition: background-color 0.15s, scale 0.15s;
}
.icon-btn:hover { background: var(--sunken); }
.icon-btn:active { scale: 0.94; }

.lang-switch { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); }
.lang-switch button {
  min-inline-size: 38px;
  block-size: 36px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.lang-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- hero ---------- */

main { max-inline-size: 1240px; margin: 0 auto; padding: 0 16px max(2rem, env(safe-area-inset-bottom)); }
@media (min-width: 700px) { main { padding-inline: 32px; } }

.hero { text-align: center; padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(1.8rem, 4vw, 2.6rem); }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before, .eyebrow::after { content: ''; inline-size: 2.2rem; block-size: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--p1), var(--p2), var(--p3), var(--p4)); }
.hero h1 {
  font-size: clamp(2.5rem, 7.5vw, 5rem);
  line-height: 1.02;
  font-weight: 350;
  font-variation-settings: 'opsz' 144;
  text-wrap: balance;
}
.hero h1 em {
  font-style: italic;
  font-weight: 300;
  background: linear-gradient(100deg, var(--p1) 10%, var(--p2) 38%, var(--p3) 64%, var(--p4) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-inline-end: 0.06em;
}
.tagline { max-inline-size: 36rem; margin: 1.1rem auto 0; font-size: 1.06rem; color: var(--muted); text-wrap: pretty; }

/* ---------- composer ---------- */

.composer {
  position: relative;
  max-inline-size: 760px;
  margin: 0 auto;
  padding: 0.6rem 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow: var(--shadow-lg);
}
.tabs { display: flex; gap: 0.25rem; padding: 0.2rem 0.2rem 0.6rem; }
.tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  transition: background-color 0.15s, color 0.15s;
}
.tabs button svg { inline-size: 18px; block-size: 18px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { background: var(--sunken); color: var(--text); }

.pane { padding: 0 0.2rem; }
textarea {
  display: block;
  inline-size: 100%;
  min-block-size: 5.5rem;
  max-block-size: 14rem;
  field-sizing: content;
  resize: none;
  padding: 0.9rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--sunken);
  font-family: var(--serif);
  font-size: 1.3rem;
  line-height: 1.4;
  transition: border-color 0.15s, background-color 0.15s;
}
textarea::placeholder, .ref-note::placeholder { color: var(--muted); opacity: 0.75; font-style: italic; }
textarea:focus { outline: none; border-color: var(--border); background: var(--paper); }
.ideas { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-block-start: 0.7rem; }
.idea {
  padding: 0.35rem 0.8rem;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: none;
  font-size: 0.82rem;
  color: var(--muted);
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.idea:hover { color: var(--text); border-style: solid; background: var(--sunken); }

.drop {
  position: relative;
  display: grid;
  min-block-size: 13rem;
  place-items: center;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--sunken);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.drop:hover, .drop.over { border-color: var(--p3); }
.drop.over { background: color-mix(in oklab, var(--p3) 10%, var(--sunken)); }
.drop-empty { display: grid; justify-items: center; gap: 0.2rem; padding: 1.6rem 1rem; text-align: center; }
.drop-empty > svg { inline-size: 34px; block-size: 34px; color: var(--p3); margin-block-end: 0.4rem; }
.drop-title { margin: 0; font-family: var(--serif); font-size: 1.25rem; }
.drop-help { margin: 0 0 0.8rem; font-size: 0.85rem; color: var(--muted); }
.drop-preview { position: relative; margin: 0; padding: 0.7rem; cursor: default; }
.drop-preview img { display: block; max-inline-size: 100%; max-block-size: 18rem; border-radius: 14px; box-shadow: var(--shadow-lg); }
.chip-btn {
  position: absolute;
  inset-block-start: 1.1rem;
  inset-inline-end: 1.1rem;
  display: grid;
  place-items: center;
  inline-size: 34px;
  block-size: 34px;
  border: 0;
  border-radius: 50%;
  background: rgb(20 15 12 / 0.6);
  color: #fff;
  backdrop-filter: blur(4px);
}
.ref-note {
  inline-size: 100%;
  margin-block-start: 0.6rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--sunken);
}
.ref-note:focus { outline: none; border-color: var(--border); background: var(--paper); }

.composer-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.9rem 0.2rem 0; }
.material { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; border: 0; }
.material label { position: relative; }
.material input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.material span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem 0.4rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--muted);
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.material b { font-weight: 600; }
.material input:checked + span { border-color: var(--text); color: var(--text); background: var(--sunken); }
.material input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.swatch { inline-size: 20px; block-size: 20px; border-radius: 50%; box-shadow: inset 0 -3px 5px rgb(0 0 0 / 0.18), inset 0 2px 3px rgb(255 255 255 / 0.35); }
.swatch.grey { background: #8f8a84; }
.swatch.terracotta { background: #b7643f; }
.swatch.stoneware { background: #e6ddcf; }

.sculpt-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-block-size: 50px;
  padding: 0 1.5rem 0 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 22px -12px var(--p1);
  transition: translate 0.15s, box-shadow 0.2s, opacity 0.2s;
  isolation: isolate;
  overflow: hidden;
}
.sculpt-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, var(--p1), var(--p2), var(--p3), var(--p4), var(--p1));
  background-size: 300% 100%;
  opacity: 0;
  transition: opacity 0.3s;
}
.sculpt-btn:hover:not(:disabled) { translate: 0 -1px; box-shadow: 0 14px 26px -12px var(--p4); }
.sculpt-btn:hover:not(:disabled)::before { opacity: 0.22; }
.sculpt-btn:disabled { cursor: progress; }
.sculpt-btn svg { fill: currentColor; stroke: none; }
.spinner { display: none; inline-size: 18px; block-size: 18px; border: 2px solid color-mix(in oklab, var(--paper) 35%, transparent); border-block-start-color: var(--paper); border-radius: 50%; animation: spin 0.8s linear infinite; }
.busy .sculpt-btn .spinner { display: block; }
.busy .sculpt-btn svg { display: none; }
.busy .sculpt-btn::before { opacity: 0.35; animation: flow 3s linear infinite; }
@keyframes spin { to { rotate: 1turn; } }
@keyframes flow { to { background-position: 300% 0; } }

.status { min-block-size: 1.3em; margin: 0.6rem 0.4rem 0; font-size: 0.86rem; color: var(--muted); text-align: center; }
.status:empty { display: none; }
.status[data-tone="error"] { color: light-dark(#b3261e, #ff8f86); }
.status[data-tone="warn"] { color: light-dark(#8d5a00, #f0bf63); }
.status[data-tone="ok"] { color: var(--p3); }

/* ---------- studio: the four plates ---------- */

.studio { margin-block-start: clamp(2.5rem, 6vw, 4rem); scroll-margin-block-start: 1rem; }
.studio-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.8rem; margin-block-end: 1.3rem; }
.studio-head h2 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); font-style: italic; font-weight: 350; }
.studio-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.soft-btn, .primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-block-size: 40px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  font-size: 0.86rem;
  font-weight: 600;
  transition: background-color 0.15s;
}
.soft-btn svg { inline-size: 17px; block-size: 17px; }
#play svg { fill: currentColor; stroke: none; }
.soft-btn:hover { background: var(--sunken); }
.soft-btn[hidden] { display: none; }
.primary-btn { border-color: transparent; background: var(--ink); color: var(--paper); padding-inline: 1.4rem; }

.plates {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.9rem, 2vw, 1.6rem);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: plate;
}
@media (max-width: 1000px) { .plates { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .plates { grid-template-columns: 1fr; } }

.plate { position: relative; display: grid; align-content: start; gap: 0.8rem; }
.plate-frame {
  position: relative;
  display: block;
  aspect-ratio: 1;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.25s, translate 0.25s;
}
.plate-frame:disabled { cursor: default; }
.plate[data-status="done"] .plate-frame { cursor: zoom-in; }
.plate[data-status="done"] .plate-frame:hover { translate: 0 -3px; box-shadow: var(--shadow-lg); }
.plate-frame::before {
  /* the empty mat: a soft pigment wash */
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 11px;
  background:
    radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--pig) 22%, transparent), transparent 60%),
    radial-gradient(circle at 70% 75%, color-mix(in oklab, var(--pig) 14%, transparent), transparent 55%),
    var(--sunken);
}
.plate-frame img {
  position: relative;
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  border-radius: 11px;
  opacity: 0;
  transition: opacity 0.7s ease, scale 0.9s ease;
  scale: 1.03;
}
.plate-frame img[src] { opacity: 1; scale: 1; }
.plate-num {
  position: absolute;
  z-index: 2;
  inset-block-start: 18px;
  inset-inline-start: 18px;
  display: grid;
  place-items: center;
  min-inline-size: 2.3rem;
  block-size: 2.3rem;
  padding-inline: 0.5rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(6px);
  color: var(--pig);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  font-weight: 500;
  box-shadow: var(--shadow);
}
.plate-state {
  position: absolute;
  z-index: 1;
  inset: 9px;
  display: grid;
  place-items: center;
  padding: 1rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.plate[data-status="done"] .plate-state, .plate[data-status="idle"] .plate-state { display: none; }
.plate[data-status="working"] .plate-frame::before { animation: breathe 2.4s ease-in-out infinite; }
.plate[data-status="working"] .plate-state { color: var(--pig); }
.plate[data-status="working"] .plate-state::before {
  content: '';
  position: absolute;
  inline-size: 46%;
  aspect-ratio: 1;
  border-radius: 46% 54% 42% 58% / 52% 44% 56% 48%;
  background: color-mix(in oklab, var(--pig) 30%, transparent);
  filter: blur(2px);
  animation: knead 3.2s ease-in-out infinite;
}
.plate[data-status="failed"] .plate-state { color: light-dark(#b3261e, #ff8f86); }
@keyframes breathe { 50% { opacity: 0.55; } }
@keyframes knead {
  0%, 100% { border-radius: 46% 54% 42% 58% / 52% 44% 56% 48%; rotate: 0deg; scale: 1; }
  50% { border-radius: 58% 42% 55% 45% / 42% 58% 44% 56%; rotate: 25deg; scale: 0.9; }
}

.plate-text { padding-inline: 0.3rem; }
.plate-title { display: flex; align-items: center; gap: 0.6rem; font-size: 1.2rem; font-weight: 450; }
.plate-title::before { content: ''; inline-size: 1.4rem; block-size: 2px; border-radius: 2px; background: var(--pig); flex: none; }
.plate-desc { margin: 0.25rem 0 0; font-size: 0.87rem; color: var(--muted); text-wrap: pretty; }
.retry { justify-self: start; margin-inline-start: 0.3rem; padding: 0.35rem 0.9rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 0.8rem; font-weight: 600; }
.retry:hover { background: var(--sunken); }

.note { max-inline-size: 40rem; margin: 1.8rem auto 0; text-align: center; font-family: var(--serif); font-style: italic; font-size: 0.98rem; color: var(--muted); }

/* ---------- recent works ---------- */

.works { margin-block-start: clamp(2.5rem, 6vw, 4rem); }
.works h2 { margin-block-end: 1rem; font-size: 1.4rem; font-style: italic; font-weight: 350; }
.works-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.9rem; margin: 0; padding: 0; list-style: none; }
.work { position: relative; }
.work-open { display: grid; gap: 0.4rem; inline-size: 100%; padding: 0; border: 0; background: none; text-align: start; }
.work-open img { inline-size: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; border: 1px solid var(--border); transition: translate 0.2s, box-shadow 0.2s; }
.work-open:hover img { translate: 0 -2px; box-shadow: var(--shadow-lg); }
.work[aria-current="true"] img { outline: 2px solid var(--p2); outline-offset: 2px; }
.work-open span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 0.8rem; color: var(--muted); }
.work-del {
  position: absolute;
  inset-block-start: 6px;
  inset-inline-end: 6px;
  display: grid;
  place-items: center;
  inline-size: 28px;
  block-size: 28px;
  border: 0;
  border-radius: 50%;
  background: rgb(20 15 12 / 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
}
.work-del svg { inline-size: 15px; block-size: 15px; }
.work:hover .work-del, .work-del:focus-visible { opacity: 1; }
@media (hover: none) { .work-del { opacity: 1; } }

.copyright { display: grid; gap: 0.3rem; padding: 3.5rem 1rem 0; text-align: center; font-size: 0.8rem; color: var(--muted); }
.copyright p { margin: 0; }

/* ---------- dialogs ---------- */

dialog {
  inline-size: min(30rem, calc(100vw - 32px));
  max-block-size: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.4);
}
dialog[open] { display: flex; flex-direction: column; animation: dialog-in 0.22s ease-out; }
dialog::backdrop { background: rgb(30 20 15 / 0.45); backdrop-filter: blur(4px); }
@keyframes dialog-in { from { opacity: 0; translate: 0 14px; scale: 0.98; } }
.dialog-head { padding: 1.3rem 1.4rem 0.3rem; }
.dialog-head h2 { font-size: 1.5rem; font-style: italic; font-weight: 400; }
.dialog-body { display: grid; gap: 1.25rem; padding: 0.8rem 1.4rem 1.3rem; overflow-y: auto; }
.dialog-foot { display: flex; justify-content: flex-end; padding: 0.9rem 1.4rem max(0.9rem, env(safe-area-inset-bottom, 0px)); border-block-start: 1px solid var(--border); }
.field { display: grid; gap: 0.5rem; margin: 0; padding: 0; border: 0; }
.field legend, .label { padding: 0; margin-block-end: 0.5rem; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.label { margin: 0; }
.help { margin: 0; font-size: 0.84rem; color: var(--muted); }
.help a { color: var(--accent); font-weight: 600; }
.key-row { display: flex; gap: 0.5rem; }
.key-row input { flex: 1; min-inline-size: 0; padding: 0.6rem 0.9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--sunken); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }
.key-alert { margin: 0; padding: 0.8rem 1rem; border-radius: 14px; background: color-mix(in oklab, var(--p2) 18%, var(--card)); font-size: 0.88rem; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--sunken); }
.segmented label { position: relative; display: grid; }
.segmented input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-block-size: 40px; padding: 0 0.4rem; border-radius: 10px; font-size: 0.85rem; font-weight: 600; color: var(--muted); text-align: center; }
.segmented input:checked + span { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); }
.segmented input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.prose p, .prose ol { margin: 0; }
.prose ol { padding-inline-start: 1.3rem; display: grid; gap: 0.3rem; }
.prose li::marker { font-family: var(--serif); font-style: italic; color: var(--accent); }

/* ---------- lightbox ---------- */

.lightbox {
  inline-size: 100vw;
  max-inline-size: 100vw;
  block-size: 100dvh;
  max-block-size: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: color-mix(in oklab, #15110f 94%, var(--pig));
  color: #f4ede4;
  display: none;
  transition: background-color 0.6s;
}
.lightbox[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; animation: fade 0.25s ease-out; }
.lightbox::backdrop { background: #000; }
@keyframes fade { from { opacity: 0; } }
.lb-stage { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.5rem; min-block-size: 0; padding: 4rem 0.8rem 0.5rem; }
.lb-figure { display: grid; place-items: center; min-block-size: 0; margin: 0; touch-action: pan-y; }
.lb-figure img { max-inline-size: 100%; max-block-size: calc(100dvh - 15rem); object-fit: contain; border-radius: 12px; box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.9); user-select: none; -webkit-user-drag: none; }
.lb-figure img.in { animation: lb-in 0.55s ease-out; }
@keyframes lb-in { from { opacity: 0; scale: 0.985; } }
.lb-nav, .lb-tool {
  display: grid;
  place-items: center;
  inline-size: 48px;
  block-size: 48px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.08);
  color: #f4ede4;
  text-decoration: none;
  transition: background-color 0.15s, opacity 0.15s;
}
.lb-nav:hover:not(:disabled), .lb-tool:hover { background: rgb(255 255 255 / 0.18); }
.lb-nav:disabled { opacity: 0.2; cursor: default; }
.lb-nav svg { inline-size: 26px; block-size: 26px; }
.lb-tool svg { inline-size: 20px; block-size: 20px; }
#lb-play svg { fill: currentColor; stroke: none; }
.playing #lb-play { background: var(--pig); }
.lb-tools { position: absolute; inset-block-start: max(0.9rem, env(safe-area-inset-top)); inset-inline-end: 0.9rem; display: flex; gap: 0.5rem; }
.lb-tools form { display: contents; }
.lb-caption { padding: 0.6rem 1rem max(1.4rem, env(safe-area-inset-bottom)); text-align: center; }
.lb-step { margin: 0 0 0.2rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--pig); filter: brightness(1.35); }
.lb-caption h2 { font-size: clamp(1.4rem, 3vw, 2rem); font-style: italic; font-weight: 350; }
.lb-caption p:not(.lb-step) { max-inline-size: 34rem; margin: 0.3rem auto 0; font-size: 0.9rem; color: rgb(244 237 228 / 0.65); }
.lb-dots { display: flex; justify-content: center; gap: 0.55rem; margin-block-start: 0.9rem; }
.lb-dots button { inline-size: 30px; block-size: 6px; padding: 0; border: 0; border-radius: 3px; background: var(--pig); opacity: 0.3; transition: opacity 0.2s, inline-size 0.3s; }
.lb-dots button[aria-current="true"] { opacity: 1; inline-size: 46px; }
.lb-dots button:disabled { opacity: 0.1; cursor: default; }
@media (max-width: 600px) {
  .lb-stage { grid-template-columns: 1fr; padding-inline: 0.5rem; }
  .lb-nav { display: none; }
}

@media (max-width: 560px) {
  .header-actions { gap: 0.35rem; }
  .icon-btn { inline-size: 40px; block-size: 40px; }
  .composer-foot { flex-direction: column; align-items: stretch; }
  .material { justify-content: center; }
  .ideas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -0.8rem; padding-inline: 0.8rem; mask-image: linear-gradient(90deg, transparent, #000 0.8rem, #000 calc(100% - 1.6rem), transparent); }
  .idea { flex: none; }
  .sculpt-btn { justify-content: center; }
}

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