/* Bayou Studio: the app's own chrome (the preview is styled by Steam).
   Graphite surfaces, warm off-white text and one lantern-amber accent. Text holds 4.5:1 or more on the surfaces it
   sits on, control outlines 3:1 (design-system/bayou-studio/MASTER.md). Inter for the interface, Playfair Display
   for the wordmark and the welcome. Laid out like an editor: layers left, preview middle, settings right. */

@font-face { font-family: 'Inter'; src: url('/fonts/ui/Inter.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('/fonts/ui/PlayfairDisplay.ttf') format('truetype'); font-weight: 400 900; font-display: swap; }

:root {
  /* surfaces, darkest to lightest */
  --stage: #09090b;       /* behind the preview */
  --bg: #0e0f11;          /* the app's ground, the top bar */
  --panel: #15161a;       /* rail, inspector */
  --raised: #1c1d22;      /* rows, cards */
  --field: #101114;       /* inputs */
  --hover: #26282e;
  /* lines */
  --divider: #26282d;     /* decoration between areas */
  --outline: #6b6f78;     /* control outlines: 3:1 on every surface */
  --outline-soft: #3a3d44;
  /* text */
  --text: #ecebe7;        /* 14:1 and up */
  --muted: #a6a5a9;       /* labels, hints: 6.8:1 and up */
  --dim: #8d8c92;         /* tertiary notes, never on --hover: 5:1 and up */
  /* lantern */
  --accent: #f0a63a;
  --accent-hover: #f7b955;
  --accent-ink: #1a1206;  /* text on the accent: 9:1 */
  --accent-soft: rgba(240, 166, 58, .12);
  --accent-line: rgba(240, 166, 58, .5);
  /* states */
  --danger: #f07167;
  --warn: #e8b464;
  /* shape */
  --radius: 6px;
  --radius-lg: 10px;
  --rail-w: 264px;
  --insp-w: 344px;
  --pose-w: 52vw;
  --top-h: 52px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --t: 150ms;
  font-synthesis: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 'Inter', 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { display: grid; grid-template-rows: var(--top-h) minmax(0, 1fr); overflow: hidden; }

h2, h3 { margin: 0; font-weight: 600; color: var(--text); }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
kbd {
  font: 600 10px/1 'Inter', system-ui, sans-serif; padding: 2px 4px; border-radius: 3px;
  border: 1px solid var(--outline-soft); background: var(--raised); color: var(--muted);
}
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.hidden { display: none !important; }

/* keyboard focus is always visible: the lantern ring */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c2e34; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #3a3d44; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------ top bar ------------------------------ */

.topbar {
  display: flex; align-items: center; gap: 16px; padding: 0 12px 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--divider);
}
.brand { display: flex; align-items: center; gap: 9px; flex: none; width: calc(var(--rail-w) - 28px); }
.brand-mark { width: 24px; height: 24px; flex: none; color: var(--accent); filter: drop-shadow(0 0 6px rgba(240, 166, 58, .4)); }
.brand-name { font: 600 19px/1 'Playfair Display', Georgia, serif; letter-spacing: .01em; white-space: nowrap; }
.brand-name em { font-style: italic; font-weight: 500; color: var(--accent); }

.profile-form {
  flex: 0 1 440px; min-width: 220px; height: 34px; display: flex; align-items: center; gap: 8px;
  padding: 0 3px 0 11px; background: var(--field); border: 1px solid var(--outline-soft); border-radius: 999px;
  color: var(--dim); transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.profile-form:hover { border-color: var(--outline); }
.profile-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.profile-form input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--text); font: inherit; }
.profile-form input::placeholder { color: var(--dim); }
.profile-form .btn { height: 26px; border-radius: 999px; padding: 0 13px; }
.topbar-status { flex: 1; min-width: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: none; }
.topbar-sep { width: 1px; height: 22px; background: var(--divider); margin: 0 8px; }
#btn-open-bake { height: 34px; padding: 0 16px; }
#btn-open-bake.is-active { box-shadow: 0 0 0 3px var(--accent-soft); }
#btn-open-bake.is-busy svg { animation: flicker 1.1s ease-in-out infinite; }
@keyframes flicker { 50% { opacity: .35; } }

.pill {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; margin-right: 6px;
  background: var(--raised); color: var(--muted); border: 1px solid var(--outline);
}
.pill-bad { color: var(--danger); border-color: rgba(240, 113, 103, .5); background: rgba(240, 113, 103, .08); }

/* ------------------------------ layout ------------------------------ */

.layout {
  display: grid; min-height: 0; position: relative;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--insp-w);
}
/* posing: the pose editor takes the right; the layers make room for the preview */
.layout.is-posing { grid-template-columns: 0 minmax(0, 1fr) var(--pose-w); }
.layout.is-posing .rail, .layout.is-posing .inspector { display: none; }
.rail { grid-column: 1; }
.stage { grid-column: 2; }
.inspector { grid-column: 3; }

/* ------------------------------ layers ------------------------------ */

.rail {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border-right: 1px solid var(--divider);
}
.rail-head {
  display: flex; align-items: center; gap: 9px; margin: 10px 10px 0; padding: 0 10px; height: 40px;
  background: none; border: 1px solid transparent; border-radius: var(--radius); color: var(--text);
  font: inherit; cursor: pointer; text-align: left; transition: background var(--t) var(--ease);
}
.rail-head:hover { background: var(--raised); }
.rail-head.is-selected { background: var(--accent-soft); border-color: var(--accent-line); }
.rail-head svg { color: var(--accent); }
.rail-title { font-weight: 600; font-size: 14px; }
.rail-meta { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }

.rail-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 10px; border-bottom: 1px solid var(--divider); }
.tool:disabled { opacity: .45; cursor: not-allowed; }
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 50px;
  background: var(--raised); border: 1px solid var(--outline-soft); border-radius: var(--radius);
  color: var(--text); font: 500 12px/1 'Inter', system-ui, sans-serif; cursor: pointer;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
}
.tool svg { width: 18px; height: 18px; color: var(--muted); transition: color var(--t) var(--ease); }
.tool:hover { background: var(--hover); border-color: var(--outline); }
.tool:hover svg { color: var(--accent); }
.tool:active { transform: translateY(1px); }
.rail > .status { margin: 6px 12px 0; }
.rail > .status:empty { display: none; }

.rail-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px 10px; }
.rail-caption { margin: 6px 4px 6px; font-size: 11px; color: var(--dim); cursor: help; }
.rail-keys { margin: 0; padding: 10px 14px 12px; border-top: 1px solid var(--divider); font-size: 11px; line-height: 1.8; color: var(--dim); }

/* a row never grows past the rail, so a long name is cut short and its buttons stay in reach */
.layer-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.layer-row {
  position: relative; display: flex; align-items: center; gap: 9px; width: 100%; min-width: 0; min-height: 46px;
  padding: 6px 6px 6px 7px; background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; user-select: none;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.layer-row:hover { background: var(--raised); }
.layer-row.is-selected { background: var(--accent-soft); border-color: var(--accent-line); }
.layer-row.is-dragging { opacity: .4; }
.layer-row.drop-above::before, .layer-row.drop-below::after {
  content: ''; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 2px; background: var(--accent);
}
.layer-row.drop-above::before { top: -3px; }
.layer-row.drop-below::after { bottom: -3px; }
.layer-row.is-hidden .layer-name, .layer-row.is-hidden .layer-thumb { opacity: .45; }
.layer-thumb {
  width: 32px; height: 32px; flex: none; object-fit: contain; border-radius: 5px; color: var(--accent);
  background: repeating-conic-gradient(#24262b 0% 25%, #1b1c20 0% 50%) 0 0 / 8px 8px;
  background-size: cover; background-position: center;
  display: grid; place-items: center; overflow: hidden; border: 1px solid var(--outline-soft);
}
.layer-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.layer-name, .layer-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-name small { font-size: 11px; color: var(--dim); }
.layer-row:hover .layer-name small { color: var(--muted); }
.layer-row.is-empty .layer-name { color: var(--muted); }
.layer-row.is-empty .layer-thumb { color: var(--muted); border-style: dashed; border-color: var(--outline); }
.layer-row { flex-wrap: wrap; row-gap: 4px; }
/* the chosen layer's actions, on a line of their own under it, so they never cover what you click to choose one */
.layer-acts { display: none; order: 9; flex-basis: 100%; gap: 2px; padding-left: 41px; }
.layer-row.is-selected .layer-acts { display: flex; }
.layer-eye { margin-left: auto; }
.layer-row button {
  flex: none; width: 26px; height: 26px; display: grid; place-items: center; padding: 0;
  background: none; border: 0; border-radius: 4px; color: var(--muted); cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.layer-row button svg { width: 15px; height: 15px; }
.layer-row button:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.layer-row button.is-danger:hover { color: var(--danger); }
.layer-row.is-hidden .layer-eye { color: var(--accent); }
.bg-row { margin-top: 3px; border-top: 1px dashed var(--outline-soft); border-radius: 0 0 var(--radius) var(--radius); padding-top: 9px; }
.bg-row.is-selected { border-top-style: solid; border-radius: var(--radius); }
.bg-row.is-empty .layer-thumb { border-style: dashed; border-color: var(--outline); color: var(--muted); }

/* --------------------------- the preview --------------------------- */

.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--stage); }
.stage-bar {
  height: 36px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 14px; border-bottom: 1px solid var(--divider); background: var(--bg);
}
.stage-label { font-size: 12px; font-weight: 500; color: var(--text); display: flex; align-items: center; gap: 8px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-label::before { content: ''; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.stage-note { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-scroll { flex: 1; min-height: 0; position: relative; overflow: hidden; display: flex; justify-content: center; }

/* The preview is the real profile page in an iframe, so its own stylesheets cannot leak into this UI. */
.stage-frame { flex: 1; width: 100%; height: 100%; border: 0; background: #1b2838; display: block; }
.stage-empty { margin: auto; max-width: 460px; padding: 32px; color: var(--muted); }
.stage-empty .brand-mark { width: 44px; height: 44px; margin: 0 0 16px; display: block; }
.stage-empty h3 { color: var(--text); font: 600 26px/1.2 'Playfair Display', Georgia, serif; margin: 0 0 18px; }
.empty-steps { margin: 0 0 22px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.empty-steps li { counter-increment: step; display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 14px; line-height: 1.55; }
.empty-steps li::before {
  content: counter(step); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 700 12px/1 'Inter', system-ui, sans-serif; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent-line);
}
.empty-steps b { color: var(--text); font-weight: 600; }

/* ------------------------------ inspector ------------------------------ */

.inspector {
  position: relative; min-height: 0; overflow-y: auto;
  background: var(--panel); border-left: 1px solid var(--divider);
}
.insp-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 9px; height: 50px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--divider);
}
.insp-head svg { color: var(--accent); }
.insp-head h2 { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-head .btn-icon { margin-right: -6px; }
.insp-body { padding: 4px 16px 20px; }
/* the hunter's transparency continues the hunter's own section */
.insp.is-continued .insp-head { display: none; }
.insp.is-continued .insp-body { padding-top: 0; }

.group { padding: 14px 0; display: grid; gap: 10px; }
.group + .group, details.sub + .group, .group + details.sub, details.sub + details.sub { border-top: 1px solid var(--divider); }
.group-title {
  display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.group-note { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--dim); }
.group-actions { margin-left: auto; display: flex; gap: 2px; text-transform: none; letter-spacing: 0; }
.subgroup { display: grid; gap: 10px; }

/* folding groups (text style, effect, position; how baking works) */
details.sub { padding: 4px 0 12px; }
details.sub > summary {
  cursor: pointer; list-style: none; padding: 10px 0 6px; font-size: 13px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; justify-content: space-between; user-select: none;
}
details.sub > summary::-webkit-details-marker { display: none; }
details.sub > summary::after {
  content: ''; width: 7px; height: 7px; margin-right: 4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform var(--t) var(--ease);
}
details.sub:not([open]) > summary::after { transform: rotate(-45deg); }
details.sub > summary:hover { color: var(--accent); }
details.sub > summary:hover::after { border-color: var(--accent); }
details.sub > .subgroup { margin-top: 6px; }
details.sub > .hint { margin-top: 6px; }
#font-status:empty { display: none; }

.hint { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); }
.hint b { color: var(--text); font-weight: 600; }
.hint.center { text-align: center; }
.note {
  margin: 0; padding: 9px 11px; font-size: 12px; line-height: 1.5; color: var(--text);
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: var(--radius);
}
.note:empty, .note[hidden] { display: none; }
/* a warning that applies to this profile now (its background is full screen) */
.note.is-alert { background: rgba(240, 113, 103, .1); border-color: rgba(240, 113, 103, .6); }
.note.is-alert b:first-child { color: var(--danger); }

/* ------------------------------ controls ------------------------------ */

.row { display: flex; gap: 8px; align-items: center; }
.row-between { justify-content: space-between; }
.inline-label { flex: none; min-width: 52px; font-size: 12px; font-weight: 500; color: var(--muted); }
.field-inline { display: contents; }

.input {
  flex: 1; min-width: 0; height: 34px; width: 100%;
  background: var(--field); border: 1px solid var(--outline); color: var(--text);
  padding: 0 10px; border-radius: var(--radius); font: inherit;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.input::placeholder { color: var(--dim); }
.input:hover { border-color: #8a8e97; }
.input:focus, .input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-sm { height: 32px; font-size: 13px; padding: 0 9px; }
select.input { padding-right: 6px; cursor: pointer; }
textarea.input { height: auto; padding: 8px 10px; }
.text-content { resize: vertical; min-height: 60px; font-size: 14px; line-height: 1.45; }
.input-color { flex: 0 0 44px; width: 44px; padding: 3px; cursor: pointer; }
.field-grow { flex: 1; min-width: 0; }

/* a slider: its name, its value (click to type one) and a Reset */
.ctl { display: block; font-size: 12px; color: var(--muted); }
.ctl > span { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; font-weight: 500; min-height: 22px; }
.ctl small { font-weight: 400; color: var(--dim); }
.ctl b {
  margin-left: auto; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; cursor: text;
  padding: 1px 6px; border-radius: 4px; transition: background var(--t) var(--ease);
}
.ctl b:hover { background: var(--hover); }
.num-edit { width: 70px; height: 24px; font: inherit; font-size: 12px; padding: 0 6px; background: var(--field); color: var(--text);
  border: 1px solid var(--accent); border-radius: 4px; }

input[type=range] { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; height: 18px; }
.range-ends { display: flex; justify-content: space-between; margin-top: -6px; font-size: 11px; color: var(--dim); }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }

/* an on/off setting: a switch */
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); cursor: pointer; min-height: 26px; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; margin: 0; cursor: pointer;
  width: 32px; height: 18px; border-radius: 999px; background: #33363d; border: 1px solid var(--outline);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--text); transition: transform var(--t) var(--ease);
}
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(14px); background: var(--accent-ink); }

.status { font-size: 12px; color: var(--muted); }
.status:empty { display: none; }
.status.is-error { color: var(--danger); }
.status.is-ok { color: var(--text); }
.status.is-busy { color: var(--warn); }

.link-btn {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--accent); cursor: pointer;
}
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }
.link-btn svg { width: 14px; height: 14px; }

/* ------------------------------ buttons ------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  background: var(--hover); border: 1px solid var(--outline-soft); color: var(--text);
  border-radius: var(--radius); cursor: pointer; font: 500 13px/1 'Inter', system-ui, sans-serif;
  white-space: nowrap; text-decoration: none;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:hover { background: #30333a; border-color: var(--outline); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--raised); border-color: transparent; color: var(--text); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn-xs { height: 22px; padding: 0 7px; font-size: 11px; border-radius: 4px; }
.ctl .btn-xs { margin-left: 0; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn-lg { height: 42px; font-size: 14px; }
.btn-primary svg { stroke-width: 2.2; }

/* ------------------------------ tabs ------------------------------ */

.tabs { display: flex; gap: 2px; padding: 3px; background: var(--field); border: 1px solid var(--outline-soft); border-radius: var(--radius); }
.tab {
  flex: 1; height: 28px; background: none; border: none; border-radius: 4px;
  color: var(--muted); cursor: pointer; font: 500 12px/1 'Inter', system-ui, sans-serif;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); background: var(--hover); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.tabpane { display: none; }
.tabpane.is-active { display: grid; gap: 10px; }

/* ----------------------------- thumbnails ----------------------------- */

.thumbgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.thumbgrid-sm { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.placeholder { grid-column: 1 / -1; color: var(--dim); font-size: 12px; padding: 12px; text-align: center;
  border: 1px dashed var(--outline-soft); border-radius: var(--radius); }

.thumb {
  position: relative; border: 1px solid var(--outline-soft); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; background: var(--field); aspect-ratio: 16 / 9;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.thumb:hover { border-color: var(--outline); }
.thumb.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px;
  font-size: 11px; line-height: 1.3; color: var(--text);
  background: linear-gradient(0deg, rgba(9, 9, 11, .92), rgba(9, 9, 11, 0));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.thumbgrid-sm .thumb-name { display: none; }
.thumb-tag {
  position: absolute; top: 4px; right: 4px; font-size: 10px; font-weight: 600; padding: 1px 6px;
  border-radius: 999px; background: rgba(9, 9, 11, .85); color: var(--accent);
}
.thumb-del {
  position: absolute; top: 4px; left: 4px; width: 22px; height: 22px;
  display: grid; place-items: center; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(9, 9, 11, .85); color: var(--text); padding: 0; opacity: 0;
  transition: opacity var(--t) var(--ease), background var(--t) var(--ease);
}
.thumb-del svg { width: 13px; height: 13px; }
.thumb:hover .thumb-del, .thumb-del:focus-visible { opacity: 1; }
.thumb-del:hover { background: var(--danger); color: #140504; }
a.thumb { display: block; color: inherit; text-decoration: none; }

/* ------------------------------ dropzone ------------------------------ */

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 14px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--outline); border-radius: var(--radius-lg); background: var(--field);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.dropzone svg { width: 22px; height: 22px; color: var(--accent); }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--text); font-size: 13px; font-weight: 600; }
.dropzone span { font-size: 12px; color: var(--muted); }

/* ----------------------------- the bake ----------------------------- */

/* the bake panel lies over the settings, so the preview stays in view */
.sheet {
  position: absolute; inset: 0; z-index: 5; overflow-y: auto; background: var(--panel);
  animation: sheet-in 180ms var(--ease);
}
@keyframes sheet-in { from { opacity: 0; transform: translateX(14px); } }

.progress { height: 6px; border-radius: 999px; background: var(--field); border: 1px solid var(--outline-soft); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .3s var(--ease); }

.bake-result {
  display: grid; gap: 8px; padding: 10px; border: 1px solid var(--accent-line);
  border-radius: var(--radius-lg); background: var(--field);
}
.bake-result img { width: 100%; border-radius: 4px; display: block; }
.bake-meta { font-size: 12px; color: var(--muted); }
.bake-meta b { color: var(--text); font-weight: 600; }
.bake-warn { font-size: 12px; color: var(--warn); }
.bake-result .btn { width: 100%; }

.profile-summary { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.profile-summary > div { display: contents; }
.profile-summary b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

/* --------------------------- the pose editor --------------------------- */

.pose {
  grid-column: 3; position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
  background: var(--panel); border-left: 1px solid var(--divider);
  animation: sheet-in 180ms var(--ease);
}
.pose-resize {
  position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; z-index: 3; cursor: col-resize;
}
.pose-resize::after {
  content: ''; position: absolute; left: 3px; top: 50%; width: 2px; height: 40px; margin-top: -20px;
  border-radius: 2px; background: var(--outline); opacity: 0; transition: opacity var(--t) var(--ease);
}
.pose-resize:hover::after, body.is-dragging .pose-resize::after { opacity: 1; background: var(--accent); }
.pose-bar {
  height: 50px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--divider);
}
.pose-bar > svg { color: var(--accent); }
.pose-title { font-size: 15px; font-weight: 600; white-space: nowrap; }
.pose-foot { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pose-frame { flex: 1; width: 100%; border: 0; display: block; background: var(--stage); }
body.is-dragging iframe { pointer-events: none; }
body.is-dragging { cursor: col-resize; user-select: none; }

/* The viewer that renders a hunter for a bake: it draws at the bake's own size
   whatever its box, so it only needs to be in the document. */
.hunt-render {
  position: fixed; left: 0; top: 0; width: 2px; height: 2px;
  border: 0; opacity: 0; pointer-events: none;
}

/* ------------------------------ the gate ------------------------------ */

/* Until a profile is loaded, the gate is all there is. */
.gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 35%, rgba(240, 166, 58, .08), transparent 55%), var(--stage);
}
body.has-profile .gate { display: none; }
.gate-card { width: min(480px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; }
.gate-card .brand-mark { width: 52px; height: 52px; }
.gate-title { margin: 0; font: 600 40px/1.1 'Playfair Display', Georgia, serif; letter-spacing: .01em; }
.gate-title em { font-style: italic; font-weight: 500; color: var(--accent); }
.gate-lede { margin: 0 0 6px; font-size: 14px; line-height: 1.6; color: var(--muted); }
.gate-form { display: flex; gap: 8px; width: 100%; }
.gate-form .input { height: 44px; font-size: 14px; padding: 0 14px; }
.gate-form .btn { height: 44px; padding: 0 18px; font-size: 14px; }
.gate .status { min-height: 18px; }
.gate .status:empty { display: block; }
.gate-alt { margin: 0; font-size: 13px; color: var(--muted); }
.gate-alt .link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; }
.gate .hint { color: var(--dim); }

/* how long bakes are kept */
.keep-note { font-size: 12px; text-align: center; }
.thumbgrid-sm .thumb-tag { font-size: 9px; padding: 1px 5px; }

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

.modal {
  width: min(500px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--outline-soft); border-radius: var(--radius-lg);
  background: var(--panel); color: var(--text); box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}
.modal::backdrop { background: rgba(5, 5, 7, .72); }
.modal-body { margin: 0; padding: 20px 22px; display: grid; gap: 14px; }
.modal-title { display: flex; align-items: center; gap: 9px; font-size: 17px; }
.modal-title svg { width: 18px; height: 18px; color: var(--accent); }
.modal-summary {
  margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; padding: 10px 12px; font-size: 12px;
  background: var(--field); border: 1px solid var(--outline-soft); border-radius: var(--radius);
}
.modal-summary dt { color: var(--muted); }
.modal-summary dd { margin: 0; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.modal-choice { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
.modal-choice legend {
  padding: 0; margin-bottom: 8px; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--outline-soft); border-radius: var(--radius);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.choice:hover { border-color: var(--outline); }
.choice:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.choice input { margin: 3px 0 0; accent-color: var(--accent); cursor: pointer; }
.choice span { display: grid; gap: 2px; font-size: 13px; }
.choice small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .btn-ghost { border-color: var(--outline-soft); color: var(--text); }

/* ------------------------------ while baking ------------------------------ */

/* The studio greyed out and locked behind a card that says how the bake is going. */
.bake-overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px;
  background: rgba(9, 9, 11, .55);
  -webkit-backdrop-filter: grayscale(1) brightness(.6);
  backdrop-filter: grayscale(1) brightness(.6);
  animation: fade-in 200ms var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
.bake-card {
  width: min(420px, 100%); display: grid; gap: 10px; justify-items: center; text-align: center; padding: 26px 26px 22px;
  background: var(--panel); border: 1px solid var(--outline-soft); border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}
.bake-card h2 { font-size: 17px; margin-top: 4px; }
.bake-card .progress { width: 100%; height: 8px; }
.bake-card-status { margin: 0; min-height: 20px; font-size: 13px; color: var(--muted); }
.bake-card-pct { margin: -2px 0 0; font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.bake-card .hint { margin-top: 4px; color: var(--dim); }
.spinner {
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid rgba(236, 235, 231, .15); border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s !important; } }
