/* AFSA Create Studio — reuses client.css tokens (--surface, --accent, …). */
.cs { display: grid; gap: 18px; }
.cs-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cs-modes { display: inline-flex; padding: 4px; gap: 4px; border: 1px solid var(--border); border-radius: 999px; background: rgba(5, 8, 16, 0.6); }
.cs-modes button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; letter-spacing: 0.01em; transition: background var(--transition-fast), color var(--transition-fast); }
.cs-modes button:hover { color: var(--text); }
.cs-modes button[aria-selected="true"] { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.cs-ai, #aiStatusPill { font-size: 0.82rem; color: var(--muted); }
.cs-ai { margin: 0; max-width: 520px; }
.cs-ai[data-state="on"], #aiStatusPill[data-state="on"] { color: var(--success); }
#aiStatusPill[data-state="on"]::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }

.cs-grid { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.cs-panel { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); max-height: calc(100vh - 150px); overflow: auto; }
.cs-label { margin: 4px 0 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.cs-panel textarea, .cs-panel input[type="text"], .cs-panel select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(5, 8, 16, 0.7); color: var(--text); }
.cs-panel textarea:focus-visible, .cs-panel input:focus-visible, .cs-panel select:focus-visible, .cs button:focus-visible { outline: 2px solid var(--accent-3); outline-offset: 2px; }
.cs-actions, .cs-row, .cs-export { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cs-actions .btn { flex: 1 1 140px; }
.cs .btn { min-height: 44px; }
.cs .btn:disabled { opacity: 0.55; cursor: progress; }
.cs-hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.cs-hint code { font-size: 0.78rem; color: var(--accent-3); }

.cs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 0.84rem; }
.cs-chip:hover { border-color: var(--accent); }

.cs-shots { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-shots:empty { display: none; }
.cs-shot { display: grid; min-width: 64px; min-height: 44px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: 0.8rem; font-weight: 600; text-align: left; }
.cs-shot small { color: var(--muted); font-weight: 500; }
.cs-shot[aria-pressed="true"] { border-color: var(--accent-3); box-shadow: inset 0 0 0 1px var(--accent-3); }
.cs-shot-add { place-items: center; color: var(--accent-3); }

.cs-box { border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(5, 8, 16, 0.35); }
.cs-box > summary { min-height: 44px; display: flex; align-items: center; padding: 0 12px; font-weight: 600; cursor: pointer; }
.cs-box > *:not(summary) { margin: 0 12px 12px; }
.cs-layer { border-top: 1px solid var(--border); }
.cs-layer > summary { display: flex; justify-content: space-between; align-items: center; min-height: 40px; cursor: pointer; font-size: 0.88rem; }
.cs-layer-actions { display: inline-flex; gap: 2px; }
.cs-layer-actions button { width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.cs-layer-actions button:hover { background: var(--surface-2); color: var(--text); }
.cs-layer-body { display: grid; gap: 6px; padding-bottom: 10px; }
.cs-ctl { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.cs-ctl.cs-wide { grid-template-columns: 70px 1fr; }
.cs-ctl.cs-check { grid-template-columns: auto 1fr; }
.cs-ctl output { min-width: 36px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.cs-ctl input[type="range"] { width: 100%; accent-color: var(--accent-3); }
.cs-ctl input[type="color"] { width: 44px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; }
.cs-row .cs-ctl { flex: 1 1 140px; grid-template-columns: 56px 1fr; }
.cs-link { justify-self: start; min-height: 36px; border: 0; background: none; color: var(--danger); font-size: 0.82rem; }
.cs-code { font-family: "Cascadia Code", Consolas, monospace; font-size: 0.78rem; }

.cs-stage-col { display: grid; gap: 12px; min-width: 0; position: sticky; top: 12px; }
.cs-stage { position: relative; margin: 0 auto; width: 100%; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: #000; border: 1px solid var(--border); box-shadow: var(--shadow); }
.cs-stage[data-format="portrait"] { aspect-ratio: 2 / 3; max-width: min(100%, calc((100vh - 270px) * 2 / 3)); }
.cs-stage-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cs-transport { display: flex; align-items: center; gap: 12px; }
.cs-transport .btn { min-width: 84px; }
.cs-transport input[type="range"] { flex: 1; accent-color: var(--accent); }
.cs-time { font-variant-numeric: tabular-nums; font-size: 0.86rem; color: var(--muted); min-width: 92px; text-align: right; }
.cs-status { margin: 0; min-height: 1.4em; font-size: 0.86rem; color: var(--muted); }
.cs-status[data-kind="error"] { color: var(--danger); }
.cs-status[data-kind="warn"] { color: var(--warning); }
.cs-status[data-kind="busy"] { color: var(--accent); }

.cs-gallery-wrap h4 { margin: 0 0 10px; display: flex; gap: 10px; align-items: baseline; }
.cs-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cs-card { position: relative; }
.cs-card-open { display: grid; gap: 4px; width: 100%; padding: 0 0 8px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface-2); color: var(--text); text-align: left; }
.cs-card-open img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: #000; }
.cs-card-open span, .cs-card-open small { padding: 0 10px; }
.cs-card-open small { color: var(--muted); font-size: 0.74rem; }
.cs-card-del { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.6); color: #fff; }

@media (max-width: 980px) {
  .cs-grid { grid-template-columns: 1fr; }
  .cs-stage-col { position: static; order: -1; }
  .cs-panel { max-height: none; }
}
@media (max-width: 480px) {
  .cs-modes { display: grid; grid-template-columns: 1fr 1fr; border-radius: 16px; width: 100%; }
  .cs-ctl { grid-template-columns: 78px 1fr auto; }
}
@media (prefers-reduced-motion: reduce) { .cs * { transition: none !important; } }
