/* Code Studio (code-studio.js): colourful liquid glass, scoped to .cs so the rest of Studio keeps its calm look.
 * Layers, back to front: a slow colourful aura → glass panels (blur + saturation, a bright rim that catches
 * light at the top-left, a soft inner glow and a specular sheen) → content. Works in dark and light themes,
 * respects reduced motion and reduced transparency. */
.cs-host, .st-body-code { display: block; min-width: 0; max-width: 100%; }
.cs > *, .cs-glass > *, .cs-field { min-width: 0; }
.cs {
  --cs-a: #2ee6b6;   /* teal (Genexts) */
  --cs-b: #7c5cff;   /* violet */
  --cs-c: #ff4fa3;   /* pink */
  --cs-d: #3aa8ff;   /* sky */
  --cs-e: #c6f05a;   /* lime */
  --cs-ink: #f5f7ff;
  --cs-sub: rgba(235, 240, 255, .72);
  --cs-glass: rgba(255, 255, 255, .075);
  --cs-glass-2: rgba(255, 255, 255, .03);
  --cs-rim: rgba(255, 255, 255, .5);
  --cs-rim-soft: rgba(255, 255, 255, .08);
  --cs-well: rgba(8, 10, 24, .42);
  --cs-shadow: 0 30px 60px -28px rgba(4, 6, 20, .75), 0 10px 24px -14px rgba(4, 6, 20, .5);
  --cs-grad: linear-gradient(120deg, var(--cs-a), var(--cs-d) 30%, var(--cs-b) 60%, var(--cs-c));
  --cs-r: 26px;
  position: relative; isolation: isolate; display: flex; flex-direction: column; gap: 18px; container: cs / inline-size;
  padding: 28px; border-radius: 32px; color: var(--cs-ink); overflow: hidden; overflow: clip; /* clip: can't be scrolled by scrollIntoView */
  background: radial-gradient(120% 90% at 0% 0%, #17123a 0%, #0b0f22 55%, #070a17 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 40px 80px -40px rgba(0, 0, 0, .7);
}
html[data-theme="light"] .cs {
  --cs-ink: #12142a; --cs-sub: rgba(24, 28, 58, .68);
  --cs-glass: rgba(255, 255, 255, .5); --cs-glass-2: rgba(255, 255, 255, .22);
  --cs-rim: rgba(255, 255, 255, .95); --cs-rim-soft: rgba(255, 255, 255, .35);
  --cs-well: rgba(255, 255, 255, .55);
  --cs-shadow: 0 30px 60px -30px rgba(60, 50, 140, .35), 0 8px 22px -14px rgba(60, 50, 140, .25);
  background: radial-gradient(120% 90% at 0% 0%, #f1edff 0%, #eef6ff 50%, #f6f0ff 100%);
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, .12), 0 40px 80px -50px rgba(60, 50, 140, .35);
}
.cs * { box-sizing: border-box; }
.cs h2, .cs h3, .cs p, .cs ol, .cs dl, .cs dd { margin: 0; }
.cs-i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.cs-muted { color: var(--cs-sub); font-size: .82rem; }
.cs-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the colourful aura behind the glass ---- */
.cs-aura { position: absolute; inset: -10%; z-index: -1; filter: blur(80px) saturate(130%); opacity: .5; pointer-events: none; }
.cs-aura i { position: absolute; border-radius: 50%; mix-blend-mode: screen; animation: cs-drift 22s ease-in-out infinite alternate; }
.cs-aura i:nth-child(1) { width: 38%; height: 34%; left: -2%; top: -4%; background: var(--cs-b); }
.cs-aura i:nth-child(2) { width: 30%; height: 30%; right: -2%; top: 6%; background: var(--cs-c); animation-duration: 26s; animation-delay: -6s; }
.cs-aura i:nth-child(3) { width: 36%; height: 30%; left: 18%; bottom: -4%; background: var(--cs-a); animation-duration: 30s; animation-delay: -12s; }
.cs-aura i:nth-child(4) { width: 28%; height: 28%; right: 10%; bottom: 20%; background: var(--cs-d); animation-duration: 24s; animation-delay: -3s; }
html[data-theme="light"] .cs-aura { opacity: .4; }
html[data-theme="light"] .cs-aura i { mix-blend-mode: multiply; }
@keyframes cs-drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6%, 8%, 0) scale(1.12); }
  100% { transform: translate3d(-6%, -4%, 0) scale(.94); }
}

/* ---- liquid glass ---- */
.cs-glass {
  position: relative; border-radius: var(--cs-r); padding: 20px;
  background: linear-gradient(155deg, var(--cs-glass), var(--cs-glass-2));
  -webkit-backdrop-filter: blur(26px) saturate(185%); backdrop-filter: blur(26px) saturate(185%);
  box-shadow: var(--cs-shadow),
    inset 0 1px 0 0 var(--cs-rim-soft),            /* lit top edge */
    inset 0 -1px 0 0 rgba(255, 255, 255, .04),     /* faint bottom edge */
    inset 0 0 24px 0 rgba(255, 255, 255, .035);    /* thickness: a soft inner glow */
}
/* The rim: a 1px border that's brightest top-left, like light hitting the edge of real glass. */
.cs-glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, var(--cs-rim) 0%, rgba(255, 255, 255, .14) 22%, rgba(255, 255, 255, .03) 50%,
                                       rgba(255, 255, 255, .1) 78%, rgba(255, 255, 255, .32) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* The sheen: a soft curved highlight across the top, the part that makes it read as "liquid". */
.cs-glass::after {
  content: ''; position: absolute; inset: 1px 1px auto 1px; height: 55%; border-radius: calc(var(--cs-r) - 1px) calc(var(--cs-r) - 1px) 50% 50% / calc(var(--cs-r) - 1px) calc(var(--cs-r) - 1px) 22% 22%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .11), rgba(255, 255, 255, 0) 85%); pointer-events: none;
}
html[data-theme="light"] .cs-glass::after { background: linear-gradient(180deg, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 85%); }
.cs-glass > * { position: relative; z-index: 1; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cs-glass { background: rgba(22, 24, 48, .92); }
  html[data-theme="light"] .cs-glass { background: rgba(255, 255, 255, .92); }
}

/* ---- hero ---- */
.cs-hero { display: flex; flex-direction: column; gap: 10px; padding: 6px 4px 4px; }
.cs-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--cs-ink);
  background: linear-gradient(var(--cs-glass), var(--cs-glass)) padding-box, var(--cs-grad) border-box; border: 1px solid transparent;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); }
.cs-badge .cs-i { width: 15px; height: 15px; color: var(--cs-a); }
.cs-title { font-size: clamp(2rem, 4.4vw, 2.9rem); line-height: 1.05; font-weight: 800; letter-spacing: -.03em;
  background: var(--cs-grad); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent !important; -webkit-text-fill-color: transparent;
  animation: cs-shift 9s ease-in-out infinite alternate; }
@keyframes cs-shift { to { background-position: 100% 0; } }
.cs-hero p { color: var(--cs-sub); max-width: 640px; line-height: 1.55; font-size: .98rem; }

/* ---- composer ---- */
.cs-compose { display: flex; flex-direction: column; gap: 14px; }
.cs textarea, .cs input:not([type="range"]), .cs select { font: inherit; color: var(--cs-ink); }
#cs-prompt { width: 100%; resize: vertical; min-height: 86px; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--cs-rim-soft);
  background: var(--cs-well); line-height: 1.5; font-size: 1rem; outline: none; transition: border-color .2s, box-shadow .2s;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .18); }
#cs-prompt::placeholder, #cs-change-text::placeholder, #cs-code::placeholder { color: var(--cs-sub); opacity: .75; }
#cs-prompt:focus, #cs-change-text:focus { border-color: color-mix(in srgb, var(--cs-b) 70%, white); box-shadow: inset 0 2px 10px rgba(0, 0, 0, .18), 0 0 0 4px color-mix(in srgb, var(--cs-b) 26%, transparent); }
.cs-ideas { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.cs-ideas::-webkit-scrollbar { display: none; }
.cs-chip { flex: none; border: 1px solid var(--cs-rim-soft); background: rgba(255, 255, 255, .06); color: var(--cs-sub); padding: 7px 12px;
  border-radius: 999px; font: inherit; font-size: .8rem; cursor: pointer; transition: color .15s, background .15s, border-color .15s, transform .15s; }
.cs-chip:hover { color: var(--cs-ink); background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .28); transform: translateY(-1px); }

.cs-controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 14px; }
.cs-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; transition: opacity .2s; }
.cs-field.off { opacity: .45; }
.cs-label { font-size: .74rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--cs-sub); display: flex; justify-content: space-between; }
.cs-label b { color: var(--cs-ink); letter-spacing: 0; text-transform: none; font-weight: 650; }

/* segmented control: a glass track with a gradient-lit pill for the chosen one */
.cs-seg { display: flex; gap: 4px; padding: 4px; border-radius: 16px; background: var(--cs-well); border: 1px solid var(--cs-rim-soft); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .2); }
.cs-seg button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 8px; border: 0; border-radius: 12px;
  background: transparent; color: var(--cs-sub); font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; transition: color .2s, background .25s, box-shadow .25s; white-space: nowrap; }
.cs-seg button .cs-i { width: 16px; height: 16px; }
.cs-seg button:hover { color: var(--cs-ink); }
.cs-seg button.on { color: #fff;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%), linear-gradient(120deg, var(--cs-b), var(--cs-c));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 6px 16px -6px color-mix(in srgb, var(--cs-c) 70%, transparent); }
#cs-engine button.on { background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 60%), linear-gradient(120deg, var(--cs-a), var(--cs-d));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 6px 16px -6px color-mix(in srgb, var(--cs-d) 70%, transparent); color: #05121a; }

/* range: gradient fill up to the thumb, a glass bead for the thumb */
#cs-len { --fill: 30%; -webkit-appearance: none; appearance: none; width: 100%; height: 38px; background: transparent; cursor: pointer; margin: 0; }
#cs-len::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--cs-a), var(--cs-b) var(--fill), rgba(255, 255, 255, .12) var(--fill)); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .3); }
#cs-len::-moz-range-track { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
#cs-len::-moz-range-progress { height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--cs-a), var(--cs-b)); }
#cs-len::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; border: 0;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(255, 255, 255, .7) 45%, rgba(220, 225, 255, .55)); box-shadow: 0 4px 12px rgba(0, 0, 0, .35), inset 0 -2px 4px rgba(124, 92, 255, .35); }
#cs-len::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; border: 0; background: radial-gradient(circle at 35% 30%, #fff, rgba(220, 225, 255, .7)); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
#cs-len:disabled { cursor: not-allowed; }

.cs-select { position: relative; }
.cs-select::after { content: ''; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border: solid var(--cs-sub); border-width: 0 1.8px 1.8px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.cs-select select { width: 100%; min-height: 46px; padding: 0 36px 0 14px; border-radius: 16px; border: 1px solid var(--cs-rim-soft); background: var(--cs-well); -webkit-appearance: none; appearance: none; cursor: pointer; box-shadow: inset 0 2px 8px rgba(0, 0, 0, .2); }
.cs-select select option { color: #111; }

.cs-go { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* ---- buttons ---- */
.cs-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 14px; cursor: pointer;
  font: inherit; font-size: .88rem; font-weight: 650; color: var(--cs-ink); text-decoration: none; white-space: nowrap;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05)); border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 18px -10px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%); transition: transform .15s, background .2s, box-shadow .2s, opacity .2s; }
html[data-theme="light"] .cs-btn { background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .5)); border-color: rgba(124, 92, 255, .2); }
.cs-btn:hover { transform: translateY(-1px); background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .08)); }
.cs-btn:active { transform: translateY(0) scale(.98); }
.cs-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.cs-btn:focus-visible, .cs-seg button:focus-visible, .cs-chip:focus-visible, .cs-thumb:focus-visible, .cs-x:focus-visible { outline: 2px solid var(--cs-a); outline-offset: 2px; }
.cs-ghost { background: transparent; border-color: var(--cs-rim-soft); box-shadow: none; }
.cs-primary { min-height: 50px; padding: 0 24px; border-radius: 18px; font-size: .98rem; color: #fff; border: 0; overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 55%), var(--cs-grad); background-size: 100% 100%, 180% 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 6px rgba(0, 0, 0, .18), 0 14px 30px -12px color-mix(in srgb, var(--cs-b) 80%, transparent);
  transition: transform .15s, box-shadow .25s, background-position .6s; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
html[data-theme="light"] .cs-primary { background: linear-gradient(180deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 55%), var(--cs-grad); background-size: 100% 100%, 180% 100%; }
.cs-primary:hover { background-position: 0 0, 100% 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 6px rgba(0, 0, 0, .18), 0 18px 36px -12px color-mix(in srgb, var(--cs-c) 80%, transparent); }
.cs-primary::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .45) 50%, transparent 70%); transform: translateX(-120%); }
.cs-primary.busy::after { animation: cs-sweep 1.4s ease-in-out infinite; }
@keyframes cs-sweep { to { transform: translateX(120%); } }

/* ---- result + code ---- */
.cs-work { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cs-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; min-height: 40px; }
.cs-sec-head h3 { display: inline-flex; align-items: center; gap: 8px; font-size: 1.02rem; font-weight: 700; }
.cs-sec-head h3 .cs-i { color: var(--cs-b); }
.cs-tools { display: flex; gap: 8px; }
.cs-screen { position: relative; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: var(--cs-well);
  box-shadow: inset 0 0 0 1px var(--cs-rim-soft), inset 0 6px 24px rgba(0, 0, 0, .3); display: grid; place-items: center; }
.cs-screen img, .cs-screen video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.cs-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 24px; color: var(--cs-sub); font-size: .88rem; }
.cs-empty b { color: var(--cs-ink); font-size: 1rem; }
.cs-empty .cs-i { width: 30px; height: 30px; color: var(--cs-c); margin-bottom: 4px; }
.cs-bad .cs-i { color: #ff8a8a; }
.cs-bad span { max-width: 460px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; word-break: break-word; }

.cs-working { display: flex; align-items: center; gap: 22px; padding: 24px; width: 100%; }
.cs-orb { flex: none; width: 74px; height: 74px; border-radius: 50%; background: conic-gradient(from 0deg, var(--cs-a), var(--cs-d), var(--cs-b), var(--cs-c), var(--cs-a));
  -webkit-mask: radial-gradient(circle, transparent 52%, #000 54%); mask: radial-gradient(circle, transparent 52%, #000 54%);
  animation: cs-spin 1.6s linear infinite; filter: drop-shadow(0 0 14px color-mix(in srgb, var(--cs-b) 70%, transparent)); }
@keyframes cs-spin { to { transform: rotate(1turn); } }
.cs-steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cs-steps li { display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--cs-sub); }
.cs-steps li.now { color: var(--cs-ink); font-weight: 600; }
.cs-steps li .cs-i { width: 16px; height: 16px; color: var(--cs-a); }
.cs-dot { width: 10px; height: 10px; margin: 0 3px; border-radius: 50%; background: var(--cs-c); box-shadow: 0 0 0 0 var(--cs-c); animation: cs-pulse 1.2s ease-out infinite; flex: none; }
@keyframes cs-pulse { to { box-shadow: 0 0 0 10px transparent; } }

.cs-receipt { margin-top: 14px; border-radius: 16px; background: var(--cs-well); border: 1px solid var(--cs-rim-soft); }
.cs-receipt summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; list-style: none; font-size: .9rem; }
.cs-receipt summary::-webkit-details-marker { display: none; }
.cs-receipt summary .cs-i { color: var(--cs-a); }
.cs-tag { margin-left: auto; font-size: .74rem; padding: 4px 10px; border-radius: 999px; color: #06261d; background: linear-gradient(120deg, var(--cs-a), var(--cs-e)); font-weight: 650; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-tag.warn { color: #3a1a00; background: linear-gradient(120deg, #ffd166, #ffb86b); }
.cs-receipt dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 10px 16px; padding: 4px 14px 12px; }
.cs-receipt dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cs-sub); }
.cs-receipt dd { font-size: .86rem; word-break: break-word; }
.cs-receipt code, .cs-cmd code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; }
.cs-cmd { display: flex; flex-direction: column; gap: 4px; padding: 0 14px 10px; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--cs-sub); }
.cs-cmd code { text-transform: none; letter-spacing: 0; color: var(--cs-ink); padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, .25); overflow-x: auto; white-space: nowrap; }
html[data-theme="light"] .cs-cmd code { background: rgba(124, 92, 255, .08); }
.cs-receipt > .cs-muted { padding: 0 14px 12px; font-size: .76rem; }

.cs-code { display: flex; border-radius: 16px; overflow: hidden; background: rgba(5, 7, 18, .62); border: 1px solid var(--cs-rim-soft); height: 340px;
  box-shadow: inset 0 4px 18px rgba(0, 0, 0, .35); }
html[data-theme="light"] .cs-code { background: rgba(250, 250, 255, .78); box-shadow: inset 0 2px 10px rgba(80, 70, 160, .1); }
html[data-theme="light"] .cs-gutter { border-right-color: rgba(80, 70, 160, .1); color: rgba(80, 90, 140, .5); }
html[data-theme="light"] #cs-prompt, html[data-theme="light"] .cs-seg, html[data-theme="light"] .cs-select select { box-shadow: inset 0 2px 8px rgba(80, 70, 160, .08); }
.cs-gutter { margin: 0; padding: 14px 10px 14px 14px; min-width: 44px; text-align: right; color: rgba(160, 170, 220, .45); user-select: none; overflow: hidden;
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; border-right: 1px solid rgba(255, 255, 255, .06); }
#cs-code { flex: 1; resize: none; border: 0; outline: none; padding: 14px; background: transparent; white-space: pre; overflow: auto; tab-size: 2;
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; color: #dfe6ff; caret-color: var(--cs-c); }
html[data-theme="light"] #cs-code { color: #1b1f3b; }
.cs-change { display: flex; gap: 8px; margin-top: 12px; }
#cs-change-text { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--cs-rim-soft); background: var(--cs-well); outline: none; transition: border-color .2s, box-shadow .2s; }

/* ---- history ---- */
.cs-history { padding: 4px 2px 0; }
.cs-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 210px); gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x proximity; }
.cs-none { padding: 6px 2px; }
.cs-card { scroll-snap-align: start; border-radius: 18px; padding: 6px; background: linear-gradient(155deg, var(--cs-glass), var(--cs-glass-2));
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  box-shadow: inset 0 1px 0 var(--cs-rim-soft), inset 0 0 0 1px rgba(255, 255, 255, .07), 0 12px 24px -16px rgba(0, 0, 0, .6); transition: transform .2s, box-shadow .2s; }
.cs-card:hover { transform: translateY(-3px); }
.cs-card.on { box-shadow: inset 0 1px 0 var(--cs-rim-soft), inset 0 0 0 1.5px color-mix(in srgb, var(--cs-c) 80%, transparent), 0 14px 28px -14px color-mix(in srgb, var(--cs-c) 60%, transparent); }
.cs-thumb { position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer; background: none; border-radius: 13px; overflow: hidden; }
.cs-thumb-media { display: grid; place-items: center; aspect-ratio: 16 / 9; background: var(--cs-well); color: var(--cs-sub); }
.cs-thumb-media img, .cs-thumb-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-thumb-tag { position: absolute; left: 8px; bottom: 8px; font-size: .7rem; font-weight: 650; color: #fff; padding: 3px 8px; border-radius: 999px;
  background: rgba(10, 12, 30, .45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.cs-card-foot { display: flex; align-items: center; gap: 6px; padding: 8px 4px 2px 6px; font-size: .8rem; color: var(--cs-sub); }
.cs-card-foot span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-x { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; border: 0; background: transparent; color: var(--cs-sub); cursor: pointer; }
.cs-x:hover { background: rgba(255, 90, 120, .15); color: #ff7a93; }
.cs-x .cs-i { width: 16px; height: 16px; }

/* ---- the Code Studio card in Studio's service row (studio.js) ---- */
.st-svc.st-code-card { position: relative; overflow: hidden; }
.st-svc.st-code-card .st-logo { background: linear-gradient(135deg, #2ee6b6, #3aa8ff 35%, #7c5cff 65%, #ff4fa3); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.st-svc.st-code-card .st-logo svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.st-svc.st-code-card.on { border-color: transparent; background: linear-gradient(var(--bg-secondary, #111520), var(--bg-secondary, #111520)) padding-box,
  linear-gradient(120deg, #2ee6b6, #3aa8ff, #7c5cff, #ff4fa3) border-box; border: 1px solid transparent; }
.st-pill.st-new { color: #fff; background: linear-gradient(120deg, #7c5cff, #ff4fa3); }

/* ---- small screens ---- */
/* By the panel's own width (it sits beside the app's sidebar), not the window's. */
@container cs (max-width: 820px) {
  .cs-work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) { .cs { padding: 18px 14px; border-radius: 24px; gap: 14px; } }
@container cs (max-width: 520px) {
  .cs-glass { padding: 14px; --cs-r: 20px; }
  .cs-controls { grid-template-columns: 1fr; }
  .cs-go { flex-direction: column-reverse; align-items: stretch; }
  .cs-primary { width: 100%; }
  .cs-code { height: 260px; }
  .cs-working { flex-direction: column; text-align: center; }
  .cs-seg button span { font-size: .8rem; }
}

/* ---- comfort settings ---- */
@media (prefers-reduced-motion: reduce) {
  .cs-aura i, .cs-title, .cs-orb, .cs-dot, .cs-primary.busy::after { animation: none !important; }
  .cs-btn, .cs-card, .cs-chip { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .cs-glass, .cs-card, .cs-btn { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(22, 24, 48, .96); }
  html[data-theme="light"] .cs-glass, html[data-theme="light"] .cs-card { background: rgba(255, 255, 255, .97); }
  .cs-aura { display: none; }
}

/* slim glass scrollbars inside Code Studio */
.cs #cs-code, .cs .cs-strip, .cs .cs-cmd code { scrollbar-width: thin; scrollbar-color: rgba(160, 150, 255, .35) transparent; }
.cs #cs-code::-webkit-scrollbar, .cs .cs-strip::-webkit-scrollbar { width: 10px; height: 10px; }
.cs #cs-code::-webkit-scrollbar-track, .cs .cs-strip::-webkit-scrollbar-track { background: transparent; }
.cs #cs-code::-webkit-scrollbar-thumb, .cs .cs-strip::-webkit-scrollbar-thumb { border-radius: 99px; border: 3px solid transparent; background: linear-gradient(90deg, rgba(124, 92, 255, .55), rgba(255, 79, 163, .55)) padding-box; }
.cs #cs-code::-webkit-scrollbar-corner { background: transparent; }
