/* =========================================================
   Crowsong Tools: Shader Cauldron (the editor at /shader-cauldron)
   ========================================================= */
.page-cauldron {
  --bg: #16151b; --bg-raised: #1e1d25; --panel: #1b1a21; --panel-2: #24232c;
  --ink: #ece8df; --ink-soft: #c9c6cf; --muted: #8f8b99;
  --line: rgba(232, 226, 240, .13); --line-strong: rgba(232, 226, 240, .4);
  --accent: #f2b25c; --accent-2: #9dbbe6; --err: #ff9b8f;
}
.page-cauldron .site-header.is-scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.sc-intro { padding-top: calc(var(--header-h) + clamp(28px, 5vw, 64px)); padding-bottom: 28px; }
/* breadcrumb back to the tools page: quiet, normal case */
.sc-kicker { font-size: 13px; color: var(--muted); }
.sc-kicker a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.sc-kicker a:hover { color: var(--ink); text-decoration-color: currentColor; }
.sc-intro h1 { margin-top: 14px; font-family: var(--serif); font-weight: 600; font-size: clamp(36px, 5vw, 60px); line-height: 1.05; }
.sc-intro .lede { margin-top: 14px; max-width: 70ch; color: var(--ink-soft); font-size: clamp(15px, 1.4vw, 17px); }
.sc-note { margin-top: 10px; font-size: 12px; color: var(--muted); max-width: 90ch; }
.sc-dim { color: var(--muted); }

/* ---------- frame ---------- */
.sc {
  margin: 0 auto clamp(40px, 6vw, 80px);
  width: min(1760px, calc(100% - 2 * clamp(12px, 2vw, 32px)));
  border: 1px solid var(--line); background: var(--panel); font-size: 13px;
  position: relative;
}
.sc.is-drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
.sc-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.sc-name input {
  width: min(300px, 70vw); padding: 7px 10px; font: 600 16px/1.2 var(--serif); color: var(--ink);
  background: transparent; border: 1px solid transparent;
}
.sc-name input:hover, .sc-name input:focus { border-color: var(--line-strong); outline: none; background: var(--bg); }
.sc-bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sc-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.sc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 12px; font: 500 12px/1 var(--mono); letter-spacing: .05em;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.sc-btn:hover { background: #2b2a34; border-color: var(--ink-soft); }
.sc-btn:disabled { opacity: .45; cursor: default; }
.sc-btn--primary { background: var(--accent); border-color: var(--accent); color: #1a1408; }
.sc-btn--primary:hover { background: #ffc574; border-color: #ffc574; }
/* "Publish to community": the accent as an outline, next to the filled Save button */
.sc-btn--publish { color: var(--accent); border-color: var(--accent); background: transparent; }
.sc-btn--publish:hover { color: #1a1408; background: var(--accent); border-color: var(--accent); }
.sc-btn:focus-visible, .sc-mini:focus-visible, .sc-chip:focus-visible, .sc-model:focus-visible, .sc-tab:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.sc-select { padding-right: 8px; max-width: 200px; }
.sc-mini {
  min-height: 28px; padding: 4px 9px; font: 500 11px/1 var(--mono); letter-spacing: .04em;
  color: var(--ink-soft); background: transparent; border: 1px solid var(--line); cursor: pointer; white-space: nowrap;
}
.sc-mini:hover { color: var(--ink); border-color: var(--line-strong); }

.sc-body {
  display: grid; grid-template-columns: 340px minmax(0, 1fr) minmax(340px, 30%);
  height: min(84vh, 920px); min-height: 600px;
}

/* ---------- controls ---------- */
.sc-controls { border-right: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; padding: 0 0 24px; min-width: 0; }
.sc-controls-head { position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; padding: 10px; background: var(--panel); border-bottom: 1px solid var(--line); }
.sc-controls-head input {
  flex: 1; min-width: 0; padding: 7px 10px; font: 12px var(--mono); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong);
}
.sc-controls-head input:focus { outline: none; border-color: var(--accent-2); }
.sc-search-empty { padding: 16px; }
.sc.is-code .sc-controls-head { display: none; }

.sc-group { border-bottom: 1px solid var(--line); }
.sc-group > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 12px; cursor: pointer; list-style: none;
  font: 600 15px/1.2 var(--serif); color: var(--ink);
}
.sc-group > summary::-webkit-details-marker { display: none; }
.sc-group > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .2s; margin-right: 4px; }
.sc-group[open] > summary::before { transform: rotate(45deg); }
.sc-group > summary > span:first-child { flex: 1; }
.sc-group > summary:hover { background: rgba(255, 255, 255, .03); }
.sc-count { font: 500 10.5px/1 var(--mono); letter-spacing: .08em; color: var(--accent); }
.sc-group-body { padding: 0 0 6px; display: grid; }

/* one option per row, split by hairlines (no boxes inside boxes); a switched-on option gets a faint warm tint */
.sc-mod { border-top: 1px solid var(--line); transition: background .2s; }
.sc-mod:hover { background: rgba(255, 255, 255, .02); }
.sc-mod.is-on:not(.is-always) { background: rgba(242, 178, 92, .05); }
.sc-mod.is-on:not(.is-always) .sc-mod-name { color: #ffd9a3; }
.sc-mod-head { display: flex; align-items: center; gap: 6px; padding: 9px 8px 0 12px; }
.sc-mod-toggle { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.sc-mod-toggle input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; cursor: pointer; }
.sc-mod-name { flex: 1; font-weight: 500; font-size: 13px; color: var(--ink); }
.sc-mod-reset { width: 26px; height: 26px; flex: none; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; opacity: 0; transition: opacity .2s; }
.sc-mod:hover .sc-mod-reset, .sc-mod-reset:focus-visible { opacity: 1; }
.sc-mod:not(.is-on) .sc-mod-reset { display: none; }
.sc-mod-reset:hover { color: var(--ink); }
.sc-mod-desc { padding: 2px 12px 9px 36px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.sc-mod.is-always .sc-mod-desc { padding-left: 12px; }
.sc-mod-body { padding: 0 12px; }
.sc-mod.is-on .sc-mod-body { padding-bottom: 12px; }
.sc-mod-body:empty { display: none; }

.sc-p { display: grid; gap: 3px; padding: 4px 0; }
.sc-p > label { font-size: 11.5px; color: var(--ink-soft); cursor: default; user-select: none; }
.sc-range { display: grid; grid-template-columns: minmax(0, 1fr) 62px; gap: 8px; align-items: center; }
.sc-range[data-c] { grid-template-columns: 14px minmax(0, 1fr) 62px; }
.sc-comp { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.sc-range input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; height: 20px; cursor: pointer; }
.sc-range input[type="number"], .sc-color input[type="text"], .sc-color input[type="number"] {
  width: 100%; min-width: 0; padding: 3px 5px; font: 11px var(--mono); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); text-align: right;
}
.sc-range input[type="number"]:focus, .sc-color input:focus, .sc-p select:focus { outline: none; border-color: var(--accent-2); }
.sc-color { display: grid; grid-template-columns: 44px 84px; gap: 8px; align-items: center; }
.sc-color input[type="color"] { width: 44px; height: 24px; padding: 0; border: 1px solid var(--line-strong); background: none; cursor: pointer; }
.sc-color input[type="text"] { text-align: left; }
.sc-p select {
  width: 100%; padding: 5px 6px; font: 12px var(--mono); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); cursor: pointer;
}
.sc-hint { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.sc-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--ink-soft); }
.sc-check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.sc-subgroup { margin: 6px 0 2px; padding: 4px 8px; background: rgba(0, 0, 0, .14); border: 1px solid var(--line); }
.sc-subgroup.is-on { border-color: rgba(242, 178, 92, .35); }
.sc-p--sub .sc-check span { font-weight: 500; color: var(--ink); }
.sc-ugroup { margin: 12px 0 2px; font: 600 13px/1.2 var(--serif); color: var(--ink); }
.sc-tex { display: flex; gap: 6px; align-items: center; }
.sc-tex input { min-width: 0; flex: 1; font-size: 11px; color: var(--ink-soft); }

/* ---------- preview ---------- */
.sc-view { position: relative; min-width: 0; min-height: 0; background: #17161c; overflow: hidden; }
.sc-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.sc-view canvas:active { cursor: grabbing; }
.sc-view.is-nogl canvas { display: none; }
.sc-view-top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: center; pointer-events: none; }
.sc-models { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 2px; padding: 3px; background: rgba(14, 13, 18, .72); border: 1px solid var(--line); backdrop-filter: blur(8px); pointer-events: auto; }
.sc-model { padding: 6px 11px; font: 500 11.5px/1 var(--mono); color: var(--ink-soft); background: transparent; border: 0; cursor: pointer; }
.sc-model:hover { color: var(--ink); }
.sc-model[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.sc-view-bottom { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; pointer-events: none; }
.sc-chip {
  pointer-events: auto; padding: 6px 10px; font: 500 11px/1 var(--mono); letter-spacing: .03em; color: var(--ink-soft);
  background: rgba(14, 13, 18, .72); border: 1px solid var(--line); backdrop-filter: blur(8px); cursor: pointer;
}
.sc-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.sc-chip[aria-pressed="true"], .sc-chip[aria-expanded="true"] { color: var(--accent); border-color: rgba(242, 178, 92, .5); }
#sc-spin[aria-pressed="false"] { color: var(--muted); }
.sc-zoom { display: inline-flex; align-items: center; gap: 8px; cursor: default; }
.sc-zoom input { width: 110px; height: 14px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.sc-scene {
  position: absolute; right: 10px; bottom: 48px; z-index: 3; width: min(280px, calc(100% - 20px));
  display: grid; gap: 8px; padding: 12px; background: rgba(20, 19, 25, .96); border: 1px solid var(--line-strong);
  font-size: 11.5px; color: var(--ink-soft);
}
.sc-scene[hidden] { display: none; }
.sc-scene label { display: grid; gap: 3px; }
.sc-scene label.sc-check { display: inline-flex; }
.sc-scene select { padding: 4px 6px; font: 12px var(--mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line-strong); }
.sc-scene input[type="range"] { accent-color: var(--accent); width: 100%; }
.sc-scene .sc-dim { font-size: 10.5px; }
.sc-status { position: absolute; left: 50%; top: 52px; translate: -50% 0; max-width: calc(100% - 24px); padding: 0; font-size: 12px; color: var(--ink-soft); text-align: center; pointer-events: none; }
.sc-status.is-err { padding: 6px 10px; color: #2a0f0b; background: var(--err); }
.sc-view.is-nogl .sc-status { top: 45%; padding: 12px; color: var(--ink-soft); }
.sc-view-hint { position: absolute; left: 12px; top: 52px; font-size: 10.5px; color: rgba(236, 232, 223, .6); pointer-events: none; }

/* ---------- code ---------- */
.sc-code { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: #121116; }
.sc-code-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sc-tabs { display: flex; gap: 2px; }
.sc-tab { padding: 6px 10px; font: 500 11.5px/1 var(--mono); color: var(--ink-soft); background: transparent; border: 1px solid transparent; cursor: pointer; }
.sc-tab[aria-selected="true"] { color: var(--ink); border-color: var(--line-strong); background: var(--bg); }
.sc-tab:disabled { opacity: .35; cursor: default; }
.sc-code-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.sc-code-note { padding: 7px 12px; font-size: 11px; color: var(--muted); border-bottom: 1px solid var(--line); }
.sc-errors { padding: 8px 12px; font-size: 11.5px; border-bottom: 1px solid var(--line); background: rgba(255, 120, 100, .07); max-height: 34%; overflow: auto; }
.sc-errors ul { margin: 4px 0 0; padding-left: 16px; display: grid; gap: 3px; }
.sc-err-title { color: var(--err); }
.sc-errors li { color: var(--ink-soft); }
.sc-warn li { color: #e9d49a; }
.sc-err-line { padding: 0 4px; font: inherit; color: var(--err); background: none; border: 1px solid rgba(255, 155, 143, .4); cursor: pointer; }
.sc-codebox { position: relative; flex: 1; min-height: 0; --gutter: 46px; }
.sc-codebox pre, .sc-codebox textarea {
  position: absolute; inset: 0; margin: 0; padding: 12px 14px 12px calc(var(--gutter) + 12px); overflow: auto;
  font: 12px/1.6 var(--mono); tab-size: 4; white-space: pre; color: #d9d5cc;
}
/* line numbers; a line with a compile error is marked */
.sc-codebox .sc-gutter {
  right: auto; width: var(--gutter); padding: 12px 10px 12px 0; overflow: hidden; z-index: 1;
  text-align: right; color: #5f5b69; background: #121116; border-right: 1px solid var(--line);
  pointer-events: none; user-select: none; font-variant-numeric: tabular-nums;
}
.sc-gutter .is-err { color: var(--err); }
.sc-codebox pre::-webkit-scrollbar, .sc-codebox textarea::-webkit-scrollbar { width: 10px; height: 10px; }
.sc-codebox pre::-webkit-scrollbar-thumb, .sc-codebox textarea::-webkit-scrollbar-thumb { background: rgba(232, 226, 240, .16); border: 2px solid #121116; }
.sc-codebox pre::-webkit-scrollbar-corner, .sc-codebox textarea::-webkit-scrollbar-corner { background: transparent; }
#sc-pre::selection, #sc-pre *::selection { background: rgba(157, 187, 230, .3); }

/* the bar under the tabs while editing: state on the left, Run and Back on the right */
.sc-mini--edit { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); border-color: var(--line-strong); }
.sc-mini--edit:hover { border-color: var(--ink-soft); }
.sc-mini[hidden], .sc-editbar[hidden], .sc-code-note[hidden] { display: none; }
.sc-editbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 7px 10px 7px 12px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.sc-editstate { font-size: 11.5px; color: var(--muted); min-width: 0; }
.sc-editstate.is-dirty { color: var(--accent); }
.sc-editstate.is-err { color: var(--err); }
.sc-editbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.sc-autorun { margin-right: 4px; font-size: 11.5px; }
.sc-autorun input { width: 13px; height: 13px; }
.sc-run { display: inline-flex; align-items: center; gap: 6px; color: #1a1408; background: var(--accent); border-color: var(--accent); }
.sc-run:hover:not(:disabled) { color: #1a1408; background: #ffc574; border-color: #ffc574; }
.sc-run:disabled { color: var(--muted); background: transparent; border-color: var(--line); cursor: default; }
.sc-run kbd { font: inherit; font-size: 10px; opacity: .7; }
.sc-run:disabled kbd { display: none; }
.sc-mini:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* code mode: writing code is the main job, so the code gets more room */
@media (min-width: 1241px) {
  .sc.is-code .sc-body { grid-template-columns: 300px minmax(0, 1fr) minmax(440px, 44%); }
}
/* code mode: the uniforms take the place of the ingredient list */
.sc-codeui { padding: 14px 12px 0; }
.sc-codeui-title { font: 600 15px/1.2 var(--serif); color: var(--ink); }
.sc-codeui-desc { margin-top: 4px; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.sc-codeui > .sc-p:first-of-type, .sc-codeui-desc + .sc-ugroup { margin-top: 8px; }
.sc-editor-hl { display: none; pointer-events: none; }
.sc-codebox.is-editing #sc-pre { display: none; }
.sc-codebox.is-editing .sc-editor-hl { display: block; overflow: hidden; }
.sc-codebox textarea { background: transparent; color: transparent; caret-color: var(--accent); border: 0; resize: none; outline: none; }
.sc-codebox textarea::selection { background: rgba(157, 187, 230, .3); color: transparent; }
.sc-codebox textarea:focus-visible { box-shadow: inset 0 0 0 1px var(--accent-2); }

/* ---------- help ---------- */
.sc-help { padding-bottom: clamp(48px, 7vw, 96px); }
.sc-help-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 2.5vw, 32px); }
.sc-help-grid > div { padding-top: 16px; border-top: 1px solid var(--line); }
.sc-help h3 { font: 600 19px/1.25 var(--serif); }
.sc-help p { margin-top: 8px; font-size: 13.5px; color: var(--ink-soft); }

.sc-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 90; translate: -50% 20px;
  max-width: min(560px, calc(100vw - 32px)); padding: 12px 16px;
  background: #2b2a34; color: var(--ink); border: 1px solid var(--line-strong); font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .3s, translate .3s var(--ease);
}
.sc-toast.is-on { opacity: 1; translate: -50% 0; }

/* ---------- full screen ---------- */
.sc-bar { position: relative; padding-right: 58px; }
.sc-btn--icon { position: absolute; top: 10px; right: 12px; width: 34px; padding: 0; }
.sc-btn--icon .sc-fs-out { display: none; }
.sc.is-fullscreen .sc-btn--icon .sc-fs-in { display: none; }
.sc.is-fullscreen .sc-btn--icon .sc-fs-out { display: inline; }
.sc.is-fullscreen {
  width: 100%; height: 100%; margin: 0; border: 0;
  display: flex; flex-direction: column; overflow: auto;
}
.sc.is-fullscreen .sc-body { flex: 1; height: auto; min-height: 0; }
.sc:fullscreen::backdrop { background: var(--panel, #1b1a21); }

/* ---------- smaller screens ---------- */
@media (max-width: 1240px) {
  .sc-body { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: min(72vh, 760px) 460px; height: auto; }
  .sc-code { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .sc-help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sc.is-fullscreen .sc-body { flex: none; grid-template-rows: calc(100vh - 120px) 460px; }
}
@media (max-width: 760px) {
  .sc { width: 100%; border-left: 0; border-right: 0; }
  .sc-body { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .sc-view { order: -1; position: sticky; top: var(--header-h); z-index: 5; height: 44vh; min-height: 260px; border-bottom: 1px solid var(--line); }
  .sc-controls { border-right: 0; overflow: visible; }
  .sc-controls-head { position: static; }
  .sc-code { height: 70vh; }
  /* code mode: a smaller sticky preview, and the code (with its Run bar) fits right under it */
  .sc.is-code .sc-view { height: 32vh; min-height: 200px; }
  .sc.is-code .sc-code { order: -1; height: calc(100svh - var(--header-h) - max(32vh, 200px)); min-height: 340px; }
  .sc-bar { justify-content: center; }
  /* toolbar as a tidy six-column grid on phones */
  .sc-bar-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; }
  .sc-sep { display: none; }
  .sc-bar-actions > * { grid-column: span 2; min-width: 0; padding-inline: 6px; }
  #sc-presets, #sc-mine { grid-column: span 6; max-width: none; }
  #sc-random { grid-column: span 4; }
  #sc-undo, #sc-redo { grid-column: span 1; }
  #sc-save, #sc-publish { grid-column: span 3; }
  .sc-name input { width: 100%; text-align: center; }
  .sc-name { width: 100%; }
  .sc-view-hint { display: none; }
  .sc-help-grid { grid-template-columns: 1fr; }
  .sc-model { padding: 6px 8px; }
  .sc-scene { bottom: 46px; }
  .sc.is-fullscreen .sc-view { top: 0; }
}

/* =========================================================
   Gallery features: publish and "my creations" dialogs
   ========================================================= */
.sc-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 0; margin: auto;
  color: #ece8df; background: #1e1d25; border: 1px solid rgba(232, 226, 240, .4); font-size: 13px;
}
.sc-dialog::backdrop { background: rgba(8, 8, 12, .72); backdrop-filter: blur(3px); }
.sc-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid rgba(232, 226, 240, .13); }
.sc-dialog-head h2 { font: 600 19px/1.2 var(--serif); }
.sc-dialog-close { display: inline-grid; place-items: center; width: 32px; height: 32px; color: #c9c6cf; background: none; border: 0; cursor: pointer; }
.sc-dialog-close:hover { color: #fff; }
.sc-pub-body { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 16px; }
.sc-pub-thumb { width: 150px; height: 150px; object-fit: cover; background: #17161c; border: 1px solid rgba(232, 226, 240, .13); }
.sc-pub-fields { display: grid; gap: 10px; align-content: start; }
.sc-pub-fields label { display: grid; gap: 4px; font-size: 12px; color: #c9c6cf; }
.sc-pub-fields input, .sc-pub-fields textarea {
  width: 100%; padding: 7px 9px; font: 13px var(--mono); color: #ece8df; background: #16151b; border: 1px solid rgba(232, 226, 240, .4); resize: vertical;
}
.sc-pub-fields input:focus, .sc-pub-fields textarea:focus { outline: none; border-color: #9dbbe6; }
.sc-pub-license { display: flex; align-items: flex-start; margin: 0 16px; line-height: 1.5; }
.sc-pub-license input { margin-top: 2px; flex: none; }
.sc-pub-license a { color: #f2b25c; }
.sc-pub-bot { min-height: 72px; margin: 12px 16px 0; }
.sc-pub-note { margin: 8px 16px 0; font-size: 11.5px; color: #8f8b99; }
.sc-pub-error { margin: 10px 16px 0; padding: 8px 10px; font-size: 12px; color: #2a0f0b; background: #ff9b8f; }
.sc-dialog--small { width: min(540px, calc(100vw - 24px)); }
.sc-dialog-text { padding: 16px 16px 0; font-size: 13.5px; line-height: 1.55; color: #c9c6cf; max-width: 60ch; }
.sc-dialog-actions { flex-wrap: wrap; }
.sc-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 16px; margin-top: 12px; border-top: 1px solid rgba(232, 226, 240, .13); }
.sc-mine-note { padding: 12px 16px 0; font-size: 12px; }
.sc-mine-note a { color: #f2b25c; }
.sc-mine-list { list-style: none; margin: 0; padding: 10px 16px 16px; display: grid; gap: 8px; max-height: 60vh; overflow: auto; }
.sc-mine-list li { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px; border: 1px solid rgba(232, 226, 240, .13); }
.sc-mine-list li.sc-dim { display: block; border: 0; padding: 8px 0; }
.sc-mine-list img { width: 64px; height: 64px; object-fit: cover; background: #17161c; }
.sc-mine-text { display: grid; gap: 2px; min-width: 0; }
.sc-mine-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-mine-actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.sc-danger { color: #ff9b8f; }
@media (max-width: 560px) {
  .sc-pub-body { grid-template-columns: 1fr; }
  .sc-pub-thumb { width: 120px; height: 120px; }
  .sc-mine-list li { grid-template-columns: 48px minmax(0, 1fr); }
  .sc-mine-list img { width: 48px; height: 48px; }
  .sc-mine-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* =========================================================
   The gallery page (/creations) and its admin page
   ========================================================= */
.page-creations {
  --bg: #16151b; --bg-raised: #1e1d25; --ink: #ece8df; --ink-soft: #c9c6cf; --muted: #8f8b99;
  --line: rgba(232, 226, 240, .14); --line-strong: rgba(232, 226, 240, .42); --accent: #f2b25c;
}
.page-creations .site-header.is-scrolled { background: color-mix(in srgb, var(--bg) 82%, transparent); }
.cr-intro { padding-top: calc(var(--header-h) + clamp(28px, 5vw, 64px)); padding-bottom: 20px; }
.cr-intro h1 { margin-top: 10px; font-family: var(--serif); font-weight: 600; font-size: clamp(36px, 5vw, 60px); line-height: 1.05; }
.cr-intro .lede { margin-top: 14px; max-width: 68ch; color: var(--ink-soft); }
.cr-intro .lede a, .cr-licence a { color: var(--accent); }
.cr-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.cr-tools input[type="search"] { flex: 1; min-width: 220px; max-width: 420px; padding: 9px 12px; font: 14px var(--mono); color: var(--ink); background: var(--bg-raised); border: 1px solid var(--line-strong); }
.cr-tools input:focus { outline: none; border-color: #9dbbe6; }
.cr-count { font-size: 12px; color: var(--muted); }
.cr-grid { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: clamp(12px, 2vw, 20px); }
.cr-card { display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--bg-raised); transition: border-color .3s; }
.cr-card:hover { border-color: var(--line-strong); }
.cr-thumb { display: block; aspect-ratio: 1; background: #17161c; overflow: hidden; }
.cr-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.cr-card:hover .cr-thumb img { transform: scale(1.03); }
.cr-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 10px; flex: 1; }
.cr-body h2 { font: 600 17px/1.25 var(--serif); overflow-wrap: anywhere; }
.cr-meta { font-size: 11.5px; color: var(--muted); }
.cr-desc { margin-top: 4px; font-size: 12.5px; line-height: 1.5; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cr-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 12px; }
.cr-actions--minor { justify-content: flex-end; margin-top: -6px; padding-bottom: 8px; }
.cr-open { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 12px; font: 500 12px/1 var(--mono); letter-spacing: .04em; color: #1a1408; background: var(--accent); border: 1px solid var(--accent); }
.cr-open:hover { background: #ffc574; }
.cr-report { padding: 4px 6px; font: 11px var(--mono); color: var(--muted); background: none; border: 0; cursor: pointer; }
.cr-report:hover { color: #ff9b8f; }
.cr-empty { margin-top: 24px; color: var(--muted); }
.cr-more { margin-top: 22px; display: flex; justify-content: center; }
.cr-more .btn[hidden], .cr-tools[hidden], .cr-admin-login[hidden] { display: none; }
.cr-licence { margin-top: clamp(48px, 7vw, 88px); padding-bottom: clamp(48px, 7vw, 96px); max-width: 72ch; }
.cr-licence h2 { font: 600 24px/1.2 var(--serif); }
.cr-licence p { margin-top: 10px; color: var(--ink-soft); font-size: 14.5px; }
/* admin */
.cr-admin-login { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.cr-admin-login input { padding: 8px 10px; font: 14px var(--mono); color: var(--ink); background: var(--bg-raised); border: 1px solid var(--line-strong); }
.cr-admin-list { list-style: none; margin: 18px 0 60px; padding: 0; display: grid; gap: 8px; }
.cr-admin-list li { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px; border: 1px solid var(--line); background: var(--bg-raised); }
.cr-admin-list li.is-hidden { opacity: .6; border-style: dashed; }
.cr-admin-list img { width: 72px; height: 72px; object-fit: cover; background: #17161c; }
.cr-flag { color: #ff9b8f; font-size: 12px; }
.cr-admin-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
@media (max-width: 640px) {
  .cr-admin-list li { grid-template-columns: 56px minmax(0, 1fr); }
  .cr-admin-list img { width: 56px; height: 56px; }
  .cr-admin-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- tags ---------- */
.sc-pub-tags { margin: 2px 0 0; padding: 0; border: 0; min-width: 0; }
.sc-pub-tags legend { padding: 0; margin-bottom: 6px; font-size: 12px; color: #c9c6cf; }
.sc-pub-tags p { margin-top: 6px; font-size: 11px; }
.sc-tag-picker { display: flex; flex-wrap: wrap; gap: 5px; }
.sc-tag {
  padding: 5px 9px; font: 500 11.5px/1.2 var(--mono); color: #c9c6cf;
  background: #16151b; border: 1px solid rgba(232, 226, 240, .2); cursor: pointer;
}
.sc-tag:hover:not(:disabled) { border-color: rgba(232, 226, 240, .5); color: #ece8df; }
.sc-tag[aria-pressed="true"] { color: #1a1408; background: #f2b25c; border-color: #f2b25c; }
.sc-tag:disabled { opacity: .35; cursor: default; }
.cr-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.cr-tag { padding: 2px 7px; font-size: 10.5px; color: #c9c6cf; border: 1px solid rgba(232, 226, 240, .18); }
.cr-tag--auto { color: #9dbbe6; border-color: rgba(157, 187, 230, .3); }
.cr-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cr-sort { padding: 9px 10px; font: 13px var(--mono); color: var(--ink); background: var(--bg-raised); border: 1px solid var(--line-strong); }
