/* Trait Studio — its own page, so nothing here touches the terminal's own layout. */
.st-body { padding-bottom: 80px; }
.st-head { display: flex; align-items: center; gap: 14px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.st-mark { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  background: radial-gradient(120% 120% at 30% 20%, rgba(255,122,42,.25), rgba(255,122,42,.06)); border: 1px solid var(--line); }
.st-titles { display: flex; flex-direction: column; line-height: 1.1; }
.st-titles small { font-size: 10.5px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.st-titles small b { color: var(--text); }
.st-titles h1 { margin: 2px 0 0; font-size: 20px; }
.st-note { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.st-back { flex: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.st-back:hover { color: var(--text); border-color: var(--accent); }

.st-wrap { max-width: 1040px; margin: 0 auto; padding: 22px 18px; display: grid; gap: 18px; }
.st-card { padding: 18px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.st-step { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.st-step b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; }

/* the drop zone */
.st-drop { padding: 26px 18px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; background: var(--panel2); }
.st-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel2)); }
.st-drop-big { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.st-drop-sub { margin: 0; font-size: 13px; color: var(--muted); }
.st-link { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; }
.st-hint { margin: 12px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.st-hint code { font-family: var(--mono); font-size: 11.5px; color: var(--text); background: rgba(255,255,255,.05); padding: 1px 5px; border-radius: 4px; }
/* What a layers folder looks like, since "one folder per layer" is not a picture of anything. */
.st-eg { margin-top: 16px; text-align: left; }
.st-eg-t { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.st-eg-t b { color: var(--text); }
.st-tree { margin: 0; padding: 12px 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font-family: var(--mono); font-size: 11.5px; line-height: 1.75; color: var(--muted); white-space: pre; }
.st-err { margin: 10px 0 0; font-size: 13px; color: var(--bad); min-height: 0; }
.st-err:empty { display: none; }
.st-warn { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.6;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 9%, transparent); color: var(--text); }

/* the layer list */
.st-layers { display: grid; gap: 10px; margin-top: 14px; }
.st-layer { border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); overflow: hidden; }
.st-layer-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.st-layer-top b { font-size: 14px; }
.st-layer-n { font-size: 12px; color: var(--muted); }
.st-move { margin-left: auto; display: flex; gap: 4px; }
.st-move button { all: unset; cursor: pointer; width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 13px; }
.st-move button:hover:not(:disabled) { color: var(--text); border-color: var(--accent); }
.st-move button:disabled { opacity: .3; cursor: default; }
.st-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 0 12px 12px; }
.st-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.02); }
.st-opt canvas.st-thumb { width: 30px; height: 30px; border-radius: 6px; background: var(--bg); flex: none; }
.st-opt .st-none { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; flex: none;
  border: 1px dashed var(--line); color: var(--muted); font-size: 10px; }
.st-opt span { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-opt input { width: 56px; flex: none; padding: 4px 6px; font-family: var(--mono); font-size: 12px; text-align: right;
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }

/* the collection's own details */
.st-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.st-fields label { display: grid; gap: 5px; min-width: 0; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.st-fields label.st-wide { grid-column: span 3; }
.st-fields input { width: 100%; padding: 8px 10px; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.st-actions { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.st-actions button { padding: 9px 18px; border: 0; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.st-actions button:disabled { opacity: .5; cursor: default; }
.st-busy { font-size: 13px; color: var(--muted); }

/* the result */
.st-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.st-tile { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); }
.st-tile small { display: block; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.st-tile b { display: block; margin-top: 4px; font-family: var(--mono); font-size: 19px; }

.st-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 16px; }
.st-prev { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel2); }
.st-prev canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; background: var(--bg); }
.st-prev-cap { padding: 7px 9px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.st-prev-cap b { color: var(--text); font-family: var(--mono); font-weight: 500; }

.st-spread { margin-top: 18px; display: grid; gap: 14px; }
.st-sp-layer > h3 { margin: 0 0 8px; font-size: 13px; }
.st-sp-rows { display: grid; gap: 4px; }
.st-sp-row { display: grid; grid-template-columns: minmax(90px, 1.3fr) 1fr 58px 58px; align-items: center; gap: 10px; font-size: 12.5px; }
.st-sp-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.st-bar { height: 7px; border-radius: 4px; background: rgba(255,255,255,.06); overflow: hidden; }
.st-bar i { display: block; height: 100%; background: var(--accent); }
.st-sp-row b, .st-sp-row em { font-family: var(--mono); font-size: 12px; font-style: normal; text-align: right; }
.st-sp-row em { color: var(--muted); }
.st-sp-row.off b { color: var(--warn); }

@media (max-width: 720px) {
  .st-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-fields label.st-wide { grid-column: span 2; }
  .st-note { display: none; }
  .st-back { margin-left: auto; }
}
@media (max-width: 460px) {
  .st-wrap { padding: 16px 12px; }
  .st-card { padding: 14px 13px; }
  .st-fields { grid-template-columns: 1fr; }
  .st-fields label.st-wide { grid-column: span 1; }
  .st-opts { grid-template-columns: 1fr; }
  .st-sp-row { grid-template-columns: minmax(70px, 1fr) 52px 52px; }
  .st-sp-row .st-bar { display: none; }
}

/* Making the whole collection */
.st-fields select { width: 100%; padding: 8px 10px; font-size: 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.st-stop { background: transparent !important; color: var(--bad) !important; border: 1px solid var(--line) !important; }
.st-prog { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.st-prog-bar { flex: 1; height: 8px; border-radius: 5px; background: rgba(255,255,255,.07); overflow: hidden; }
.st-prog-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
/* The count may shrink and wrap; what it must never do is squeeze the bar out of existence. */
.st-prog span { min-width: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.st-prog-bar { min-width: 90px; }
.st-done { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line)); border-radius: 10px;
  background: color-mix(in srgb, var(--ok) 7%, transparent); font-size: 12.5px; color: var(--muted); }
.st-done code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; color: var(--text); }
/* The folded R2 panel: where the artwork is going, and a way back in. */
.st-have { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); font-size: 13px; color: var(--muted); }
.st-have b { color: var(--text); }
.st-have-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.st-have code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.st-have button { flex: none; padding: 4px 12px; font-size: 11.5px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--muted); }
.st-have button:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 460px) { .st-have code { flex-basis: 100%; } .st-have button { margin-left: auto; } }

.st-done-tag { flex: none; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; font-size: 11px; color: var(--ok); }
.st-done-note { flex-basis: 100%; margin: 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.st-done-note code { font-family: var(--mono); font-size: 11.5px; color: var(--text); overflow-wrap: anywhere; }
/* Nothing to copy until there is an address: only the direct children go, not the note's own code spans. */
.st-done-wait > code, .st-done-wait > button { display: none; }
.st-done button { flex: none; padding: 3px 10px; font-size: 11px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); }
.st-done button:hover { color: var(--text); border-color: var(--accent); }

/* Where a finished collection goes */
.st-where { display: grid; gap: 8px; margin-bottom: 14px; }
.st-where label { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); font-size: 13.5px; }
.st-where label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel2)); }
.st-where input { width: auto; flex: none; margin: 0; accent-color: var(--accent); }
.st-where span { color: var(--muted); font-size: 12.5px; }
.st-r2 { margin: 0 0 16px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; background: rgba(255,255,255,.02); }
/* The walk-through for setting a bucket up, shut until it is wanted */
.st-how { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.st-how summary { cursor: pointer; padding: 10px 12px; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); list-style: none; }
.st-how summary::-webkit-details-marker { display: none; }
.st-how summary::before { content: "\25B8"; display: inline-block; margin-right: 8px; transition: transform .15s; }
.st-how[open] summary::before { transform: rotate(90deg); }
/* A host name has nowhere to break, so it is told it may break anywhere rather than widen the card. */
.st-steps { margin: 0; padding: 0 16px 14px 32px; display: grid; gap: 10px; font-size: 13px; line-height: 1.65;
  color: var(--muted); overflow-wrap: anywhere; }
.st-steps li { min-width: 0; }
.st-steps b { color: var(--text); }
.st-steps i { font-style: normal; color: var(--text); background: rgba(255,255,255,.05); padding: 1px 5px; border-radius: 4px; }
.st-steps code { font-family: var(--mono); font-size: 11.5px; color: var(--text); }
.st-note-s { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.st-copy { position: relative; margin: 8px 0 0; }
.st-copy pre { margin: 0; padding: 10px 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); font-family: var(--mono); font-size: 11.5px; line-height: 1.6; color: var(--text); }
.st-copy button { position: absolute; top: 7px; right: 7px; padding: 3px 9px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--muted); cursor: pointer; }
.st-copy button:hover { color: var(--text); border-color: var(--accent); }
.st-ghost { background: transparent !important; color: var(--text) !important; border: 1px solid var(--line) !important; }
.st-keep { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.st-keep input { width: auto; margin: 0; accent-color: var(--accent); }
.st-ok { margin: 10px 0 0; font-size: 13px; color: var(--ok); }
.st-ok:empty { display: none; }

/* On a phone the count sits under the bar rather than being squeezed beside it. Last in the file on purpose:
   the base rules above it are what it has to override. */
@media (max-width: 460px) {
  .st-prog { flex-wrap: wrap; }
  .st-prog-bar { flex: 1 0 100%; }
  .st-prog span { white-space: normal; }
  /* the button and the keep-these tick stack rather than being squeezed side by side */
  .st-actions { flex-wrap: wrap; }
  .st-r2 { padding: 12px 10px; }
}

/* Narrow: an r2.dev address is too long to share a row with anything, so it gets one of its own. */
@media (max-width: 460px) {
  /* Tag and Copy on the first row, then the address, then the note — the thing to copy stays above
     the paragraph explaining it, not under it. Direct children only, so the note's own code spans
     are left as inline text. */
  .st-done > code { order: 1; flex-basis: 100%; }
  .st-done-note { order: 2; }
  .st-done > button { margin-left: auto; }
}
