/* StreamCozy studio: the editor page /studio/ (src/studio.html, assets/js/studio/editor.js).
   Built only from the site's tokens (styles.css, :root) and its parts (.button, .icon-button, .count-pill, .app-dialog,
   .gp-card). The widgets themselves look the way widgets.css says, in the editor exactly as on the stream. */

.page-studio .studio { padding: clamp(1rem, 2.4vw, 1.75rem) 0 var(--band); }

/* ---------- Signed out ---------- */
.studio-public { padding-top: 1rem; }
.studio-public-card { grid-template-columns: minmax(0, 1fr); max-width: 44rem; margin: 0 auto; }

/* ---------- Title row ---------- */
.studio-room { width: min(100% - 2 * var(--gutter), var(--wide)); margin: 0 auto; }
.studio-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 1rem; }
.studio-title h1 { margin: 0; font-size: var(--t-title); font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; }
.studio-title p { margin: 0.15rem 0 0; color: var(--text-dim); font-size: var(--t-small); }
.studio-count {
  display: inline-flex; align-items: center; gap: 0.6rem; margin: 0; padding: 0.45rem 0.9rem; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--t-small); font-weight: 700; color: var(--text-dim);
}
.studio-count b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.studio-meter { position: relative; width: 4rem; height: 0.35rem; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.studio-meter i { position: absolute; top: 0; inset-inline-start: 0; height: 100%; width: 100%; border-radius: inherit; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); transition: transform 240ms var(--ease); }
[dir="rtl"] .studio-meter i { transform-origin: 100% 50%; }
.studio-save { margin: 0; min-height: 1.2em; color: var(--text-dim); font-size: var(--t-small); font-weight: 700; transition: opacity 400ms ease; }
.studio-save.is-quiet { opacity: 0; }
.studio-save[data-state="error"] { color: var(--coral); }
/* The account's e-mail address is not confirmed: nothing is saved and the overlay does not connect until it is. */
.studio-verify { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0; padding: 0.75rem 1rem; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--coral); }
.studio-verify[hidden] { display: none; }
/* A locked scene (Cozy has ended, editor.js setLocked): seen, not touched; only "Delete scene" in the bar. */
.studio-lock-bar { box-shadow: inset 0 0 0 1px var(--coral); }
.studio-emotes-lapsed { box-shadow: inset 0 0 0 1px var(--line-2); }
.studio-emotes-lapsed[hidden] { display: none; }
.studio-emotes-lapsed p { flex: 1 1 18rem; margin: 0; color: var(--text-dim); }
.studio-lock-bar.is-nudged { animation: studio-nudge 520ms var(--ease); }
@media (prefers-reduced-motion: reduce) { .studio-lock-bar.is-nudged { animation: none; } }
.studio-room.is-locked .studio-stage, .studio-room.is-locked .studio-element-list { pointer-events: none; opacity: 0.6; filter: saturate(0.6); }
.studio-verify p { margin: 0; flex: 1 1 18rem; min-width: 0; }
.studio-verify b { color: var(--text); }
.studio-verify .studio-verify-note { flex: 1 1 100%; color: var(--text-dim); font-size: var(--t-small); }
.studio-verify .studio-verify-note:empty { display: none; }
.studio-save[data-state="saved"]::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; margin-inline-end: 0.45rem; border-radius: 50%; background: var(--mint); vertical-align: 0.08em; }
.studio-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-inline-start: auto; max-width: 100%; }
.studio-tools .icon-button[disabled] { opacity: 0.4; cursor: default; }
.studio-tools .icon-button[aria-expanded="true"] { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--accent); }
.studio-history { display: inline-flex; gap: 0.35rem; }

/* ---------- Guide ---------- */
.studio-guide { margin-bottom: 1.25rem; padding: 1.1rem 1.35rem 1.25rem; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-guide[hidden] { display: none; }
.studio-guide-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.85rem; }
.studio-guide-head h2 { margin: 0; font-size: var(--t-card); font-weight: 800; }
.studio-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.5rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.studio-steps li { position: relative; display: grid; gap: 0.25rem; padding-inline-start: 2.4rem; counter-increment: step; font-size: var(--t-small); color: var(--text-dim); line-height: 1.5; }
.studio-steps li::before {
  content: counter(step); position: absolute; inset-inline-start: 0; top: 0; display: grid; place-items: center; width: 1.7rem; height: 1.7rem;
  border-radius: 50%; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--accent-hi); font-weight: 700; font-size: var(--t-small);
}
.studio-steps b { color: var(--text); font-weight: 800; font-size: var(--t-item); }

.studio-small { display: none; }

/* The studio's panels (library, cards, blocks): the same lavender surface as every box, on a dark ground that lets only
   a little of the sky through, so a bright painted cloud behind a panel no longer washes out its edge (B-52, Chat A
   2026-11-22: "Wolken dürfen Paneele nicht verdecken"). */
:root { --studio-panel: linear-gradient(var(--surface), var(--surface)) rgba(20, 15, 50, 0.8); }

/* ---------- Layout ---------- */
/* Studio with areas (founder, 2026-11-22): a rail on the left switches the view (editor.js setView, [data-view] on the room).
   "studio": library left, scene in the middle, testing and elements right (work runs left to right: choose, place, try).
   "reactions", "figures", "sounds": the area's card wide, the same scene small on the right as its live preview. */
.studio-grid { display: grid; grid-template-columns: 5.5rem clamp(16.5rem, 21vw, 27rem) minmax(0, 1fr) clamp(16.5rem, 19vw, 23rem); gap: clamp(1rem, 1.6vw, 1.5rem); align-items: start; }
.studio-grid > .studio-rail { grid-column: 1; grid-row: 1; }
.studio-grid > .studio-lib-col { grid-column: 2; grid-row: 1; }
.studio-grid > .studio-main { grid-column: 3; grid-row: 1; }
.studio-grid > .studio-side { grid-column: 4; grid-row: 1; }
.studio-lib-col { display: flex; flex-direction: column; min-width: 0; position: sticky; top: calc(var(--header-h) + 1rem); max-height: calc(100vh - var(--header-h) - 2rem); }
.studio-lib-col > .studio-library { flex: 1 1 auto; min-height: 0; }
.studio-lib-col { container-type: inline-size; }
/* A narrow library (laptops, 1280 to 1366 px): a smaller picture, so a long name like "Weihnachtsedition" keeps its line. */
@container (max-width: 19rem) {
  .studio-lib-groups:not([data-view="grid"]) .studio-lib-item { grid-template-columns: 3.75rem minmax(0, 1fr); gap: 0.6rem; }
  .studio-lib-groups:not([data-view="grid"]) .studio-lib-preview { width: 3.75rem; }
  .studio-lib-name { font-size: var(--t-item); }
}
/* The rail: the shared .side-rail of styles.css (B-52, the same as on the games page); only the line between the areas
   and the phone's bar at the bottom (below) are the studio's own. */
.studio-rail-sep { height: 1px; margin: 0.4rem 0.75rem; background: var(--line-2); }
.studio-preview-h { display: none; margin: 0; font-size: var(--t-card); font-weight: 800; }
/* The studio view: testing (and a timer) are always open, the cards of the areas live in their own views. */
.studio-room[data-view="studio"] .studio-block:is([data-block="rules"], [data-block="figures"], [data-block="sounds"], [data-block="tts"], [data-block="avatar"]) { display: none; }
/* The area "AI avatar" (founder 2026-11-30, avatar-card.js): a tile per avatar, then its reactions in groups, one row each
   (switch, its values, "Test"). The fields are the settings dialog's own (settings.js). */
.studio-av-list { display: grid; gap: var(--gap); margin: 1rem 0 0; padding: 0; list-style: none; }
.studio-av-tile { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 1rem; align-items: center; padding: 0.75rem; border-radius: var(--r-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.studio-av-pic { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-3); }
.studio-av-pic.is-whole { object-fit: contain; }
.studio-av-pic.is-missing { color: transparent; font-size: 0; }
.studio-av-tile.is-chosen { box-shadow: inset 0 0 0 2px var(--accent); }
.studio-av-info { display: grid; gap: 0.35rem; min-width: 0; }
.studio-av-name { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: var(--t-item); font-weight: 800; }
.studio-av-desc { margin: 0; font-size: var(--t-small); font-weight: 500; color: var(--text-dim); }
.studio-av-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.35rem; }
.studio-av-actions .studio-in-scene { margin-inline-start: 0; }
.studio-av-actions [hidden] { display: none; }
#studio-av-empty { margin: 1rem 0 0; }
.studio-av-groups { display: grid; gap: var(--gap-l); margin-top: var(--gap-l); }
.studio-av-groups[hidden] { display: none; }
.studio-av-group-h { margin: 0 0 0.5rem; font-size: var(--t-small); font-weight: 700; color: var(--text-dim); }
/* One sentence under a group heading that explains the rows below it (TTS "Single viewers"). */
.studio-av-group-hint { margin: -0.2rem 0 0.6rem; max-width: 60rem; }
/* One list per group, every row the same columns (switch · name · setting · Test), so all rows line up. */
.studio-av-table { margin: 0; padding: 0; list-style: none; border-radius: var(--r-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.studio-av-row { display: grid; grid-template-columns: 2.75rem 11rem minmax(0, 1fr) 6.5rem; gap: 0.5rem 1rem; align-items: center; min-height: calc(var(--ctl) + 0.9rem); padding: 0.45rem 0.9rem; }
/* A switch row without a value of its own (TTS filters): the name takes the empty value column too. */
.studio-av-row[data-flag] .studio-av-name-cell { grid-column: 2 / 4; }
.studio-av-row[data-flag] .studio-av-set { display: none; }
.studio-av-row + .studio-av-row { box-shadow: inset 0 1px 0 var(--line); }
.studio-av-switch { justify-content: flex-start; }
.studio-av-name-cell { font-size: var(--t-text); font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.studio-av-set { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-width: 0; font-size: var(--t-small); font-weight: 500; color: var(--text-dim); }
.studio-av-phrase { display: inline; line-height: 2.4; }
.studio-av-num { width: 5.5rem; height: calc(var(--ctl) * 0.82); margin: 0; padding: 0 0.5rem; border: 0; border-radius: var(--r-sm); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: inherit; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.studio-av-num:focus-visible, .studio-av-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-av-select { width: auto; min-width: 10rem; max-width: 100%; }
.studio-av-range { flex: 1 1 8rem; max-width: 16rem; accent-color: var(--accent); }
.studio-av-out { min-width: 3.5rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.studio-av-text { flex: 1 1 14rem; max-width: 28rem; height: calc(var(--ctl) * 0.82); padding: 0 0.7rem; border: 0; border-radius: var(--r-sm); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: inherit; font-weight: 500; }
.studio-av-text:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* TTS (tts-card.js): the switch on top stays bright; while it is off the settings below are quieter, still settable. */
.studio-tts-groups.is-off .studio-av-group:not(:first-child) { opacity: 0.6; }
.studio-tts-cozy { margin-top: 0.75rem; }
.studio-tts-left { margin: 0.75rem 0 0; }
/* TTS amounts of the month: a longer bar of the title row's meter, the rest in words beside it. */
.studio-tts-quota[hidden] { display: none; }
.studio-tts-meter { width: 8rem; flex: 0 0 auto; }
.studio-tts-quota .studio-av-set { align-items: center; }
.studio-tts-quota-text { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.studio-tts-quota-reset { margin: 0.5rem 0 0; }
.studio-tts-own-name { flex: 0 1 10rem; }
.studio-tts-own-list { display: flex; flex-wrap: wrap; gap: 0.4rem; flex-basis: 100%; margin: 0; padding: 0; list-style: none; }
.studio-tts-own-list:empty { display: none; }
.studio-tts-own-list li { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.2rem 0.15rem 0.7rem; border-radius: var(--r-pill); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font-size: var(--t-small); font-weight: 700; }
.studio-tts-own-x { width: 1.6rem; height: 1.6rem; min-height: 0; }
#studio-tts-events .studio-av-set .studio-av-text { flex: 0 1 24rem; }       /* every line the same width */
.studio-av-test { justify-self: end; }
.studio-av-row.is-off .studio-av-name-cell { color: var(--text-dim); }
.studio-av-row.is-off .studio-av-set { opacity: 0.45; }
.studio-av-row[hidden] { display: none; }
.studio-tts-browser .field-hint { margin: 0; flex: 1 1 16rem; }
@media (max-width: 36rem) {
  .studio-av-tile { grid-template-columns: minmax(0, 1fr); }
  .studio-av-row { grid-template-columns: 2.75rem minmax(0, 1fr) auto; padding-block: 0.6rem; }
  .studio-av-row[data-flag] .studio-av-name-cell { grid-column: 2; }
  .studio-av-set { grid-column: 2 / -1; grid-row: 2; }
  .studio-av-test, .studio-av-test-gap { grid-column: 3; grid-row: 1; }
}
.studio-room[data-view="studio"] .studio-block:is([data-block="sim"], [data-block="timer"]) .studio-block-chev { display: none; }
.studio-room[data-view="studio"] .studio-block:is([data-block="sim"], [data-block="timer"]) .studio-block-head button { cursor: default; }
.studio-room[data-view="studio"] .studio-block:is([data-block="sim"], [data-block="timer"]) .studio-block-head button:hover { background: none; }
/* What a test set off */
.studio-sim-log { margin-top: 0.9rem; padding: 0.7rem 0.9rem; border-radius: var(--r-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.studio-sim-log[hidden] { display: none; }
.studio-sim-log p { margin: 0; font-size: var(--t-small); line-height: 1.45; overflow-wrap: anywhere; }
.studio-sim-log.is-empty p { color: var(--pink); }
.studio-sim-log .link-button { margin-top: 0.35rem; }
/* The sounds of the reactions (rules-card.js drawSounds) */
.studio-sounds-head { justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.4rem; }
.studio-sounds-head h3 { margin: 0; font-size: var(--t-item); font-weight: 800; }
.studio-sounds-missing { margin: 0.75rem 0 0; padding: 0.6rem 0.9rem; border-radius: var(--r-sm); background: rgba(254, 195, 236, 0.08); box-shadow: inset 0 0 0 1px rgba(254, 195, 236, 0.3); }
.studio-sounds-missing[hidden], #studio-sound-rules-none[hidden], .studio-sound-rules[hidden] { display: none; }
.studio-sound-rules { display: grid; gap: 0.45rem; margin: 0.9rem 0 0; padding: 0; list-style: none; }
.studio-sound-rule { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(8rem, 12rem) auto; align-items: center; gap: 0.6rem 0.9rem; padding: 0.6rem 0.8rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-sound-rule.is-off .studio-sound-rule-text { color: var(--text-mute); }
.studio-sound-rule-text { display: grid; gap: 0.15rem; min-width: 0; }
.studio-sound-rule-text b { font-weight: 800; overflow-wrap: anywhere; }
.studio-sound-rule-text span { color: var(--text-dim); font-size: var(--t-small); overflow-wrap: anywhere; }
.studio-sound-rule-volume { display: flex; align-items: center; gap: 0.5rem; }
.studio-sound-rule-volume input { flex: 1 1 auto; min-width: 0; accent-color: var(--accent); }
.studio-sound-rule-volume output { min-width: 3ch; font-weight: 800; font-size: var(--t-small); text-align: end; font-variant-numeric: tabular-nums; }
@container (max-width: 34rem) {
  .studio-sound-rule { grid-template-columns: auto minmax(0, 1fr) auto; }
  .studio-sound-rule-volume { grid-column: 1 / -1; }
}
/* Medium screens (62 to 75rem: tablets across, laptops at 150 %): scene and testing side by side, so the scene stays in
   view while testing (Chat A's screen test 2026-11-22, the founder's first complaint); the library under the scene. */
@media (max-width: 75rem) and (min-width: 62.01rem) {
  .studio-room[data-view="studio"] .studio-grid { grid-template-columns: 5.5rem minmax(0, 1fr) clamp(16.5rem, 28vw, 21rem); }
  .studio-room[data-view="studio"] .studio-grid > .studio-main { grid-column: 2; grid-row: 1; }
  .studio-room[data-view="studio"] .studio-grid > .studio-side { grid-column: 3; grid-row: 1 / span 2; }
  .studio-room[data-view="studio"] .studio-grid > .studio-lib-col { grid-column: 2; grid-row: 2; position: static; max-height: 34rem; }
}
/* An area: its card wide, the scene as live preview on the right (sticky, so it stays in view while the card scrolls). */
.studio-room:not([data-view="studio"]) .studio-grid { grid-template-columns: 5.5rem minmax(0, 1fr) clamp(22rem, 30vw, 36rem); }
.studio-room:not([data-view="studio"]) .studio-grid > .studio-lib-col { display: none; }
.studio-room:not([data-view="studio"]) .studio-grid > .studio-side { grid-column: 2; grid-row: 1; position: static; max-height: none; display: block; }
.studio-room:not([data-view="studio"]) .studio-grid > .studio-main { grid-column: 3; grid-row: 1; position: sticky; top: calc(var(--header-h) + 1rem); gap: 0.75rem; max-height: calc(100vh - var(--header-h) - 2rem); overflow: auto; overscroll-behavior: contain; }
/* Testing under the live preview: the same block as in the studio, framed like a card. */
.studio-main > .studio-block[data-block="sim"] { padding: 1rem 1.1rem 1.1rem; border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-main > .studio-block[data-block="sim"] .studio-block-body { padding: 0; overflow: visible; }
.studio-main > .studio-block[data-block="sim"] .studio-card-head h2 { font-size: var(--t-card); }
.studio-main > .studio-block[data-block="sim"] .studio-sim-label { flex-basis: 100%; }
.studio-room:not([data-view="studio"]) :is(.studio-viewbar, .studio-phone-hint, #studio-link-card, .studio-keys, .studio-elements, .studio-block-head) { display: none !important; }
.studio-room:not([data-view="studio"]) .studio-preview-h { display: block; }
.studio-room:not([data-view="studio"]) .studio-blocks { display: block; }
.studio-room:not([data-view="studio"]) .studio-block { background: none; box-shadow: none; }
.studio-room:not([data-view="studio"]) .studio-block-body { overflow: visible; padding: 0; }
.studio-room:not([data-view="studio"]) .studio-block-body > .studio-card { padding: 1.4rem 1.6rem 1.6rem; border-radius: var(--r-lg); background: var(--studio-panel); box-shadow: inset 0 0 0 1px var(--line); }
.studio-room:not([data-view="studio"]) .studio-side .studio-block-body > .studio-card > .studio-card-head h2 { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; font-size: var(--t-card); font-weight: 800; }
@media (max-width: 68rem) and (min-width: 62.01rem) {
  .studio-room:not([data-view="studio"]) .studio-grid { grid-template-columns: 5.5rem minmax(0, 1fr); }
  .studio-room:not([data-view="studio"]) .studio-grid > .studio-main { grid-column: 2; grid-row: 1; position: static; max-width: 40rem; }
  .studio-room:not([data-view="studio"]) .studio-grid > .studio-side { grid-column: 2; grid-row: 2; }
}
.studio-main { display: grid; gap: 1.25rem; min-width: 0; }
.studio-side { display: grid; gap: 1.25rem; min-width: 0; position: sticky; top: calc(var(--header-h) + 1rem); max-height: calc(100vh - var(--header-h) - 2rem); grid-template-rows: auto minmax(0, 1fr); }

/* ---------- The scene ---------- */
.studio-frame {
  /* The whole scene fits into the window: never taller than the space below the header. */
  width: min(100%, calc((100vh - var(--header-h) - 2.5rem) * 4 / 3)); justify-self: center;
  position: relative; aspect-ratio: var(--scene-ratio, 1.7778); width: min(100%, calc((100vh - var(--header-h) - 7.5rem) * var(--scene-ratio, 1.7778))); margin-inline: auto; border-radius: var(--r-lg); overflow: hidden; touch-action: none;
  background-color: rgba(12, 9, 34, 0.72);
  background-image: radial-gradient(rgba(201, 193, 253, 0.16) 1px, transparent 1.2px);
  background-size: calc(var(--scene-scale, 1) * 20px) calc(var(--scene-scale, 1) * 20px);
  box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow);
}
.studio-camera {
  position: absolute; top: 50%; left: 50%; display: grid; justify-items: center; gap: 0.6rem; transform: translate(-50%, -50%);
  color: rgba(201, 193, 253, 0.28); font-weight: 800; font-size: var(--t-item); text-align: center; pointer-events: none;
}
.studio-camera .ico { width: clamp(2.5rem, 2rem + 2vw, 4rem); height: auto; aspect-ratio: 1; stroke-width: 1.3; }
.studio-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.studio-stage:focus { outline: none; }
.studio-loading { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(100deg, transparent 30%, rgba(201, 193, 253, 0.06) 50%, transparent 70%) 0 0 / 200% 100%; animation: studio-shine 1.4s linear infinite; pointer-events: none; }
.studio-loading[hidden] { display: none; }
@keyframes studio-shine { to { background-position: -200% 0; } }

/* Items in the editor: grab, select, move. The selection frame and its handles keep their size on screen. */
.studio-stage .sc-item { cursor: grab; outline: none; }
.studio-stage .sc-item:active { cursor: grabbing; }
.studio-stage .sc-item.sc-hidden { opacity: 0.4; }
.studio-stage .sc-item:hover::after {
  content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  box-shadow: 0 0 0 calc(1px / var(--scene-scale, 1)) rgba(201, 193, 253, 0.55); pointer-events: none;
}
.studio-sel { position: absolute; top: 0; left: 0; z-index: 900; pointer-events: none; box-shadow: 0 0 0 calc(2px / var(--scene-scale, 1)) var(--accent); border-radius: calc(3px / var(--scene-scale, 1)); }
.studio-sel[hidden] { display: none; }
/* A locked element (founder, 2026-11-22): no handles, a dashed frame and a small lock. */
.studio-sel.is-locked { box-shadow: 0 0 0 calc(2px / var(--scene-scale, 1)) rgba(196, 181, 253, 0.55); }
.studio-sel.is-locked .studio-handle { display: none; }
.studio-sel.is-locked::after {
  content: ""; position: absolute; top: calc(-14px / var(--scene-scale, 1)); right: calc(-14px / var(--scene-scale, 1)); width: calc(28px / var(--scene-scale, 1)); height: calc(28px / var(--scene-scale, 1));
  border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f1838' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2.5'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E") center / 62% no-repeat;
}
.studio-el.is-locked .studio-el-quick [data-act="lock"] { color: var(--accent); }
.studio-handle {
  position: absolute; width: calc(14px / var(--scene-scale, 1)); height: calc(14px / var(--scene-scale, 1));
  margin: calc(-7px / var(--scene-scale, 1)) 0 0 calc(-7px / var(--scene-scale, 1));
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 calc(2px / var(--scene-scale, 1)) var(--bg); pointer-events: auto; touch-action: none;
}
.studio-handle[data-corner="nw"] { top: 0; left: 0; cursor: nwse-resize; }
.studio-handle[data-corner="ne"] { top: 0; left: 100%; cursor: nesw-resize; }
.studio-handle[data-corner="sw"] { top: 100%; left: 0; cursor: nesw-resize; }
.studio-handle[data-corner="se"] { top: 100%; left: 100%; cursor: nwse-resize; }
/* The middle of each side (founder, 2026-11-20): smaller pills along the side. */
.studio-handle[data-corner="n"], .studio-handle[data-corner="s"] { left: 50%; width: calc(22px / var(--scene-scale, 1)); height: calc(10px / var(--scene-scale, 1)); margin: calc(-5px / var(--scene-scale, 1)) 0 0 calc(-11px / var(--scene-scale, 1)); border-radius: calc(5px / var(--scene-scale, 1)); cursor: ns-resize; }
.studio-handle[data-corner="n"] { top: 0; }
.studio-handle[data-corner="s"] { top: 100%; }
.studio-handle[data-corner="e"], .studio-handle[data-corner="w"] { top: 50%; width: calc(10px / var(--scene-scale, 1)); height: calc(22px / var(--scene-scale, 1)); margin: calc(-11px / var(--scene-scale, 1)) 0 0 calc(-5px / var(--scene-scale, 1)); border-radius: calc(5px / var(--scene-scale, 1)); cursor: ew-resize; }
.studio-handle[data-corner="e"] { left: 100%; }
.studio-handle[data-corner="w"] { left: 0; }
.studio-sel.no-sides-w .studio-handle[data-corner="n"], .studio-sel.no-sides-w .studio-handle[data-corner="s"],
.studio-sel.no-sides-h .studio-handle[data-corner="e"], .studio-sel.no-sides-h .studio-handle[data-corner="w"] { display: none; }
.studio-frame.is-drop { box-shadow: inset 0 0 0 2px var(--accent), var(--shadow); }

/* ---------- Edit or phone (phone-view.js): the scene as viewers see it on a phone ---------- */
.studio-viewbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem 1rem; }
.studio-viewbar .studio-segments[hidden] { display: none; }
.studio-viewbar .studio-segments button { display: inline-flex; align-items: center; gap: 0.4rem; }
.studio-viewbar .studio-segments .ico { width: 1.05em; height: 1.05em; }
/* "Resolution" under "Monitor", "Model" under "Phone": a small caption and the site's pill choice (hub-select). */
.studio-res { display: inline-flex; align-items: center; gap: 0.5rem; }
.studio-res[hidden] { display: none; }
/* The switch "Snap" in the bar above the scene, and the guides it draws while an element moves (editor.js). */
.studio-snap { justify-content: flex-start; gap: 0.55rem; }
.studio-snap > span:first-child { color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
.studio-guides { position: absolute; top: 0; left: 0; z-index: 950; pointer-events: none; }
.studio-guide-line { position: absolute; top: 0; left: 0; background: var(--pink); box-shadow: 0 0 calc(3px / var(--scene-scale, 1)) rgba(254, 195, 236, 0.6); }
.studio-guide-line.is-x { width: calc(1px / var(--scene-scale, 1)); margin-left: calc(-0.5px / var(--scene-scale, 1)); }
.studio-guide-line.is-y { height: calc(1px / var(--scene-scale, 1)); margin-top: calc(-0.5px / var(--scene-scale, 1)); }
.studio-res > span { color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
.studio-res .hub-select { height: 2.35rem; color: var(--text); }
.studio-frame.is-phone {
  /* A phone in portrait: the whole phone fits below the header. Its picture is the stream; the scene lies across it. */
  /* Its height: the room measured below the view bar (phone-view.js --phone-room), at most 50rem so it zooms with the rest
     of the studio (founder, 2026-11-27: at 100 % the phone was cut off at the bottom, at 50 % it grew huge next to the rest). */
  width: min(100%, calc(min(var(--phone-room, calc(100vh - var(--header-h) - 7.5rem)), 50rem) * var(--phone-ratio, 0.4615) * var(--phone-scale, 1))); aspect-ratio: var(--phone-ratio, 0.4615); margin-top: 0.5rem; border-radius: 2.4rem;
  background: radial-gradient(120% 60% at 50% 35%, #3a2f7a 0%, #1d1650 45%, #0e0a28 100%);
  box-shadow: 0 0 0 0.5rem #09061c, 0 0 0 calc(0.5rem + 1px) var(--line-2), var(--shadow);
}
.studio-frame.is-phone .studio-camera { top: 30%; }
.studio-frame.is-phone .studio-camera span { display: none; }
.studio-phone-ui {
  /* TikTok's LIVE interface over an upright stream, in % of the phone (measured on 150 screenshots, 2026-11-27,
     Overlays/docs/handy/RECHERCHE.md); sizes in cqh, so it scales with the phone like the real app. */
  position: absolute; top: 0; left: 0; z-index: 950; width: 100%; height: 100%; container-type: size;
  color: #fff; line-height: 1.2; pointer-events: none;
}
/* The size of the drawn interface follows the phone: cqh resolves against the nearest container above an element, so it is
   set on the children, not on the container itself (there it meant the window's height: at 50 % zoom the text was twice
   as big, found 2026-11-27 on the founder's screen). */
.studio-phone-ui > * { font-size: 1.45cqh; }
.studio-phone-ui[hidden], .studio-phone-hint[hidden] { display: none; }
.studio-phone-ui > * { position: absolute; inset-inline: 3.5%; }
.studio-phone-ui .ico { width: 1.35em; height: 1.35em; flex: none; stroke-width: 2; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); }
.studio-phone-top { top: 6.6%; height: 4.6%; display: flex; align-items: center; gap: 0.45em; min-width: 0; }
.studio-phone-host { display: flex; align-items: center; gap: 0.4em; min-width: 0; max-width: 62%; padding: 0.2em 0.25em 0.2em 0.2em; border-radius: 999px; background: rgba(0, 0, 0, 0.36); }
.studio-phone-avatar { flex: none; width: 1.9em; height: 1.9em; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #fec3ec); }
.studio-phone-name { min-width: 0; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-phone-follow { flex: none; padding: 0.3em 0.7em; border-radius: 999px; background: #ff3b5c; font-weight: 800; }
.studio-phone-viewers { display: flex; align-items: center; gap: 0.25em; margin-inline-start: auto; font-weight: 800; white-space: nowrap; }
.studio-phone-viewers .ico { width: 1.1em; height: 1.1em; }
.studio-phone-dot { width: 1.6em; height: 1.6em; margin-inline-end: -0.55em; border-radius: 50%; background: linear-gradient(135deg, #90c5fb, #7be8b0); box-shadow: 0 0 0 1.5px #1d1650; }
.studio-phone-dot + .studio-phone-dot { margin-inline-end: 0.15em; background: linear-gradient(135deg, #ffc98b, #ff8b7b); }
.studio-phone-close { opacity: 0.9; }
/* the second row: ranking, gallery and event pills */
.studio-phone-pills { top: 12%; height: 3%; display: flex; gap: 2%; }
.studio-phone-pills span { height: 100%; border-radius: 999px; background: rgba(0, 0, 0, 0.32); }
.studio-phone-pills span:nth-child(1) { width: 34%; }
.studio-phone-pills span:nth-child(2) { width: 22%; margin-inline-start: auto; }
.studio-phone-pills span:nth-child(3) { width: 26%; }
/* the comments: from 64 % to 90 % of the height, the left four fifths */
.studio-phone-bottom { top: 64%; bottom: 10%; inset-inline-end: 20%; display: flex; flex-direction: column; justify-content: flex-end; gap: 0.9em; }
.studio-phone-line { display: flex; align-items: center; gap: 0.6em; }
.studio-phone-line i { flex: none; width: 2em; height: 2em; border-radius: 50%; background: rgba(255, 255, 255, 0.32); }
.studio-phone-line b { display: block; height: 0.8em; width: 70%; border-radius: 999px; background: rgba(255, 255, 255, 0.4); box-shadow: 0 1.25em 0 rgba(255, 255, 255, 0.22); transform: translateY(-0.55em); }
.studio-phone-line:nth-child(2) b { width: 52%; }
.studio-phone-line:nth-child(3) b { width: 84%; }
.studio-phone-line:nth-child(4) b { width: 60%; }
.studio-phone-joined { align-self: flex-start; padding: 0.3em 0.7em; border-radius: 999px; background: rgba(0, 0, 0, 0.3); font-weight: 700; }
/* floating hearts and gift bubbles at the right, above the input row */
.studio-phone-hearts { inset-inline: auto 3%; top: 74%; bottom: 11%; width: 9%; display: flex; flex-direction: column; justify-content: flex-end; gap: 1.2em; }
.studio-phone-hearts span { aspect-ratio: 1; border-radius: 50%; background: rgba(255, 95, 126, 0.75); }
.studio-phone-hearts span + span { background: rgba(144, 197, 251, 0.75); }
.studio-phone-bar { top: 90.6%; height: 4.4%; display: flex; align-items: center; gap: 0.7em; }
.studio-phone-comment { flex: 1 1 auto; min-width: 0; padding: 0.6em 0.9em; border-radius: 999px; background: rgba(255, 255, 255, 0.14); color: rgba(255, 255, 255, 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-phone-bar .ico { width: 1.7em; height: 1.7em; }
/* What the chosen platforms' apps cover on the phone (phone-view.js, formats.js COVERED): shaded, under TikTok's drawn
   interface; elements lying there are marked (editor.js, "covered"). */
.studio-zones { position: absolute; inset: 0; z-index: 960; pointer-events: none; }   /* over the scene, so the labels stay readable */
.studio-zones[hidden] { display: none; }
/* Not a forbidden zone (founder, 2026-11-27): a calm veil with a dashed edge and a label saying what the app shows there. */
/* Only a fine dashed line: the picture under it stays exactly as it is (founder, 2026-11-27: "bei Veränderungen darf
   niemals der Hintergrund mitverändert werden"). */
.studio-zone { position: absolute; border-radius: 0.6rem; border: 1px dashed rgba(255, 255, 255, 0.5); background: none; }
.studio-zone-label { position: absolute; inset-inline-start: 0.5rem; top: 0.4rem; max-width: calc(100% - 1rem); padding: 0.1rem 0.5rem; border-radius: 999px; background: rgba(14, 10, 40, 0.82); color: #fff; font: 800 var(--t-badge) / 1.4 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the narrow column at the side and the input row: the label sits above the zone, so it does not cover the buttons */
.studio-zone[data-kind="side"] .studio-zone-label { top: auto; bottom: calc(100% + 0.3rem); inset-inline: auto 0; max-width: none; }
.studio-zone[data-kind="input"] .studio-zone-label { top: auto; bottom: 0.4rem; }
.studio-platforms .studio-segments { flex-wrap: nowrap; }
.studio-platforms[hidden], .studio-clear[hidden], .studio-arrange[hidden] { display: none; }
.studio-stage .sc-item.is-covered { outline: calc(2px / var(--scene-scale, 1)) dashed rgba(255, 209, 102, 0.9); outline-offset: calc(2px / var(--scene-scale, 1)); }
.studio-phone-hint { max-width: 36rem; margin: 0 auto; color: var(--text-dim); font-size: var(--t-small); text-align: center; line-height: 1.5; }

/* ---------- Cards ---------- */
.studio-card { padding: 1.1rem 1.25rem 1.2rem; border-radius: var(--r-lg); background: var(--studio-panel); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.studio-card-head { display: flex; align-items: center; gap: 0.6rem; }
.studio-card-head h2 { margin: 0; font-size: var(--t-card); font-weight: 800; }
.studio-card-sub { margin: 0.35rem 0 0.9rem; color: var(--text-dim); font-size: var(--t-small); line-height: 1.5; }
.studio-empty { margin: 0.75rem 0 0; color: var(--text-dim); font-size: var(--t-small); }
.studio-empty[hidden] { display: none; }

.studio-link-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.studio-link-field {
  flex: 1 1 16rem; min-width: 0; height: var(--ctl); padding: 0 1rem; border: 0; border-radius: var(--r-pill);
  background: var(--solid); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-dim); font: 500 var(--t-small) / 1 var(--body);
}
.studio-link-field:focus { outline: 2px solid var(--accent); outline-offset: 2px; color: var(--text); }
/* The covered link (D F3): the field keeps the real address (copying), a layer on top shows it without the key. */
.studio-link-wrap { position: relative; display: flex; flex: 1 1 16rem; min-width: 0; }
.studio-link-wrap .studio-link-field { flex: 1 1 auto; width: 100%; }
.studio-link-mask { display: none; position: absolute; inset: 0; padding: 0 1rem; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text-dim); font: 500 var(--t-small) / 1 var(--body); pointer-events: none; }
.studio-link-wrap.is-masked .studio-link-mask { display: flex; }
.studio-link-wrap.is-masked .studio-link-field { color: transparent; caret-color: transparent; }
.studio-link-wrap.is-masked .studio-link-field::selection { color: transparent; background: transparent; }
/* "Test", right below the stage: one row per group (gifts, viewers, chat, scene), a label in front */
.studio-sim .studio-card-head { flex-wrap: wrap; justify-content: space-between; row-gap: 0.5rem; }
.studio-sim-groups { display: grid; gap: 0.6rem; }
.studio-sim-group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0; }
.studio-sim-label { flex: 0 0 7.5rem; color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
.studio-sim-chat input {
  flex: 1 1 12rem; min-width: 0; height: 2.25rem; padding: 0 0.9rem; border: 0; border-radius: var(--r-pill); background: var(--solid-2);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: 600 var(--t-small) / 1 var(--body);
}
.studio-sim-chat input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 40rem) { .studio-sim-label { flex-basis: 100%; } }
/* Tabs below the stage: the parts of the studio, one card each */
.studio-rule-nomsg { margin: 0 0 0.75rem; padding: 0.6rem 0.9rem; border-radius: var(--r-sm); background: rgba(254, 195, 236, 0.08); box-shadow: inset 0 0 0 1px rgba(254, 195, 236, 0.3); }
.studio-rule-nomsg[hidden] { display: none; }
/* Templates (templates.js): stream size, ready overlays, "Recommended" in the settings */
.studio-templates { width: min(100% - 1.5rem, 40rem); }
.studio-templates h3 { margin: 0 0 0.5rem; font-size: var(--t-item); font-weight: 800; }
.studio-tpl-size, .studio-tpl-packs { display: grid; gap: 0.4rem; margin-top: 1rem; }
.studio-size-choice { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.studio-size-choice button {
  display: grid; gap: 0.15rem; padding: 0.7rem 0.6rem; border: 0; border-radius: var(--r-sm); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: inherit; text-align: center; cursor: pointer;
}
.studio-size-choice button span { color: var(--text-dim); font-size: var(--t-small); }
.studio-size-choice button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.studio-size-choice button[aria-pressed="true"] span { color: inherit; }
.studio-size-choice button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-pack-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.studio-pack { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 1rem; align-items: center; padding: 0.8rem 0.9rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-pack span { grid-column: 1; color: var(--text-dim); font-size: var(--t-small); }
.studio-pack button { grid-column: 2; grid-row: 1 / 3; }
/* Templates: tabs, shared and own templates (templates.js, sets.js) */
.studio-tpl-tabs { margin: 1rem 0 0; flex-wrap: wrap; justify-self: start; }
.studio-tpl-tabs[hidden], .studio-tpl-tabs button[hidden], .studio-tpl-packs h3[hidden], .studio-tpl-popular[hidden], .studio-tpl-mine[hidden], .studio-tpl-packs[hidden] { display: none; }
.studio-tpl-packs, .studio-tpl-popular, .studio-tpl-mine { display: grid; gap: 0.6rem; margin-top: 0.75rem; }
.studio-tpl-popular .field-hint, .studio-tpl-mine .field-hint { margin: 0; }
.studio-tpl-popular .field-hint:empty, .studio-tpl-mine .field-hint:empty { display: none; }
.studio-tpl-save { display: grid; gap: 0.6rem; padding: 0.9rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-tpl-save h3 { margin: 0; font-size: var(--t-item); font-weight: 800; }
.studio-tpl-save .button { justify-self: start; }
.studio-tpl-save input[type="text"] {
  height: var(--ctl); padding: 0 0.9rem; border: 0; border-radius: var(--r-sm); background: var(--solid-2); box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--text); font: 500 var(--t-ui) / 1 var(--body);
}
.studio-pack-tools { grid-column: 2; grid-row: 1 / 3; display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.studio-pack-tools .button { grid-column: auto; grid-row: auto; }
/* A template with Cozy elements, seen without Cozy: "Use" is shut and this line says why. */
.studio-pack .studio-pack-cozy { color: var(--text); }
.studio-pack b .studio-lock { margin-inline-start: 0.45rem; vertical-align: 0.1em; }
.studio-pack-badge { justify-self: start; padding: 0.1rem 0.55rem; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-dim); font-size: var(--t-badge); font-weight: 800; }
/* Heart of a shared template: outline, filled in lavender once given */
.studio-heart { gap: 0.35rem; }
.studio-heart .ico { width: 1.05rem; height: 1.05rem; }
.studio-heart[aria-pressed="true"] { color: var(--accent-hi); }
.studio-heart[aria-pressed="true"] .ico { fill: currentColor; }
.studio-pack-likes { display: inline-flex; align-items: center; gap: 0.2rem; margin-inline-start: 0.5rem; }
.studio-pack-likes .ico { width: 0.8rem; height: 0.8rem; fill: currentColor; }
.studio-tpl-public-note[hidden] { display: none; }
.studio-tpl-public-note { margin: 0; padding: 0.6rem 0.75rem; border-radius: var(--r-sm); background: var(--surface-3); color: var(--text-dim); }
.studio-pack-badge.is-public { background: rgba(123, 232, 176, 0.16); color: var(--mint); }
@media (max-width: 30rem) {
  .studio-pack { grid-template-columns: minmax(0, 1fr); }
  .studio-pack button, .studio-pack-tools { grid-column: 1; grid-row: auto; justify-content: flex-start; }
}
@media (max-width: 30rem) { .studio-pack { grid-template-columns: 1fr; } .studio-pack button { grid-column: 1; grid-row: auto; justify-self: start; } }
.studio-recommend { display: grid; gap: 0.45rem; margin-bottom: 1rem; padding: 0.8rem 0.9rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-recommend[hidden] { display: none; }
/* "My templates" of one widget in the settings dialog (my-items.js): one pill per saved template with its own delete
   button, "Save as template", a short form for the name. Same box as "Recommended" above it. */
.studio-mine { display: grid; gap: 0.55rem; margin-bottom: 1rem; padding: 0.8rem 0.9rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-mine[hidden], .studio-mine-list[hidden], .studio-mine-empty[hidden], .studio-mine-form[hidden], .studio-mine-save[hidden] { display: none; }
.studio-mine-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.studio-mine-head h3 { margin: 0; }
.studio-mine-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.studio-mine-item { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; border-radius: var(--r-pill); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.studio-mine-use { min-width: 0; min-height: 2.25rem; padding: 0 0.4rem 0 0.9rem; border: 0; background: none; color: var(--text); font: 700 var(--t-small) / 1 var(--body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border-radius: var(--r-pill); }
.studio-mine-use:hover { color: var(--accent-hi); }
.studio-mine-use:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-mine-item .studio-mine-drop { width: 2rem; height: 2rem; margin-inline-end: 0.15rem; background: none; box-shadow: none; color: var(--text-mute); }
.studio-mine-item .studio-mine-drop:hover { background: var(--surface-3); color: var(--coral); }
.studio-mine-item .studio-mine-drop .ico { width: 1rem; height: 1rem; }
.studio-mine-empty { margin: 0; }
.studio-mine-form { display: grid; gap: 0.55rem; }
.studio-mine-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* The sound page for TikTok LIVE Studio (card "Overlay link") */
.studio-audio-page { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin-top: 0.9rem; }
.studio-audio-page p { flex: 1 1 22rem; margin: 0; }
.studio-audio-page a[aria-disabled="true"] { pointer-events: none; opacity: 0.5; }

/* Sounds of a reaction, the loudness of all sounds, an own picture (task 3e) */
.studio-rule-sounds { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.studio-rule-sound { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.4rem 0.3rem 0.8rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-rule-sound-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.studio-rule-sound [aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.studio-volume { margin-top: 1rem; display: grid; gap: 0.3rem; max-width: 28rem; }
.studio-volume[hidden] { display: none; }
.studio-number output { font-weight: 800; font-variant-numeric: tabular-nums; }
.studio-own-thumb { width: 1.4rem; height: 1.4rem; border-radius: 0.3rem; object-fit: cover; margin-inline-end: 0.35rem; vertical-align: middle; }
.studio-own-thumb[hidden] { display: none; }
#studio-rule-own { display: inline-flex; align-items: center; }

/* Dialog "Sound library" (sound-library.js) */
.studio-sound-dialog { width: min(100% - 1.5rem, 42rem); max-height: calc(100dvh - 2rem); display: none; flex-direction: column; gap: 0.8rem; background: var(--solid); }
.studio-sound-dialog[open] { display: flex; }
.studio-sound-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.studio-sound-head h2 { margin: 0; }
.studio-sound-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.studio-sound-or { color: var(--text-dim); font-size: var(--t-small); }
.studio-sound-progress { width: 100%; height: 0.5rem; accent-color: var(--accent); }
.studio-sound-progress[hidden], .studio-sound-note[hidden], .studio-sound-search[hidden], .count-pill[hidden] { display: none; }
.studio-sound-note a { color: var(--accent); font-weight: 700; }
/* Volume of the library: what "Play" uses and what "Apply" hands to the reaction */
.studio-sound-volume { display: grid; grid-template-columns: auto minmax(0, 1fr) 3.5rem; align-items: center; gap: 0.75rem; }
.studio-sound-volume[hidden] { display: none; }
.studio-sound-volume input[type="range"] { width: 100%; accent-color: var(--accent); }
.studio-sound-volume output { font-weight: 800; font-variant-numeric: tabular-nums; text-align: end; }
.studio-sound-search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.studio-sound-search input {
  flex: 1 1 14rem; min-width: 0; height: var(--ctl); padding: 0 0.9rem; border: 0; border-radius: var(--r-sm); background: var(--solid-2);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: 500 var(--t-ui) / 1 var(--body);
}
.studio-sound-search input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-sound-search .studio-sound-rights { flex: 1 1 100%; margin: 0; }   /* the line about rights under the search field */
#studio-music-rights { margin: 0 0 var(--gap); }   /* music mode: the rights line, then the list (music player) */
.studio-sound-list { flex: 1 1 auto; min-height: 12rem; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1rem; padding-inline-end: 0.2rem; }
.studio-sound-group, .studio-sound-rows, .studio-sound-row { min-width: 0; }
@media (max-width: 30rem) { .studio-sound-rows:not(.is-grid) .studio-sound-name { flex-basis: 100%; } }
.studio-sound-group h3 { margin: 0 0 0.4rem; font-size: var(--t-item); font-weight: 800; }
.studio-sound-rows { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.studio-sound-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; padding: 0.4rem 0.5rem 0.4rem 0.8rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-sound-name { flex: 1 1 9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.studio-sound-play[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.studio-sound-rows.is-grid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); }
.studio-sound-rows.is-grid .studio-sound-row { flex-direction: column; align-items: stretch; padding: 0.5rem; }
.studio-sound-rows.is-grid .studio-sound-name { flex: none; font-size: var(--t-small); }
.studio-sound-thumb { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 0.5rem; background: var(--solid-2); }

/* Card "Timer" (timer-card.js): name and state, the time, start/pause, reset */
.studio-timer[hidden] { display: none; }
.studio-timer-list { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.studio-timer-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; padding: 0.7rem 0.9rem; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.studio-timer-info { display: grid; gap: 0.1rem; flex: 1 1 10rem; min-width: 0; }
.studio-timer-name { font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-timer-state { color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
.studio-timer-time { font-weight: 800; font-size: var(--t-card); font-variant-numeric: tabular-nums; min-width: 5.5ch; text-align: end; }
.studio-sim-as { display: flex; align-items: center; gap: 0.6rem; }
.studio-sim-as .studio-field-label { white-space: nowrap; }
.studio-sim-as select { height: 2.25rem; }
.studio-keys { margin: 0; }

/* ---------- Elements ---------- */
.studio-elements.is-empty .studio-element-list { display: none; }
.studio-elements.is-empty .studio-empty { margin-top: 0.35rem; }
/* "Layers" (founder, 2026-11-27: "rechts sollen es Layers sein"; editor.js, layers.js), like the layers of an image program
   or the sources of OBS: one line per row; a layer's row a little stronger, its elements indented under it; the chosen
   layer (where new widgets go) tinted in the accent; the selected element outlined. The buttons beyond eye and lock show
   on the selected row only, on a line of their own. */
.studio-element-list { display: grid; gap: 0.2rem; margin: 0.6rem 0 0; padding: 0; list-style: none; max-height: min(20rem, 28vh); overflow: auto; }
.studio-el, .studio-group {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 0.45rem;
  min-height: calc(var(--ctl) * 0.95); padding: 0.15rem 0.25rem 0.15rem 0.35rem; border-radius: 0.7rem; cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.studio-el:hover, .studio-group:hover { background: var(--surface); }
.studio-group { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); padding-inline-start: 0.15rem; }
.studio-group + .studio-group, .studio-el + .studio-group { margin-top: 0.3rem; }
.studio-group.is-target { background: color-mix(in srgb, var(--accent) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
.studio-group.is-selected { box-shadow: inset 0 0 0 1.5px var(--accent); }
.studio-el.is-selected { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--accent); }
.studio-el.is-in-group { margin-inline-start: 1.35rem; }
.studio-el[hidden] { display: none; }
.studio-el.is-hidden .studio-el-main, .studio-group.is-hidden .studio-el-main { opacity: 0.5; }
.studio-el-thumb { display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 0.55rem; background: var(--surface-2); color: var(--text-dim); }
.studio-el-thumb .ico { width: 1.1rem; height: 1.1rem; }
.studio-el-main { display: flex; align-items: baseline; gap: 0.45rem; min-width: 0; padding: 0.35rem 0; border: 0; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.studio-el-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: var(--t-item); }
.studio-group .studio-el-name { font-weight: 800; }
.studio-el-size { flex: none; color: var(--text-dim); font-size: var(--t-small); font-variant-numeric: tabular-nums; }
.studio-el-count { flex: none; min-width: 1.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--surface-3); color: var(--text-dim); font: 700 var(--t-small) / 1.5 var(--body); text-align: center; font-variant-numeric: tabular-nums; }
.studio-group.is-target .studio-el-count { background: var(--accent); color: var(--accent-ink); }
.studio-el-covered { flex: none; padding: 0.05rem 0.45rem; border-radius: 999px; background: rgba(255, 209, 102, 0.14); color: #ffd166; font: 800 var(--t-badge) / 1.4 var(--body); white-space: nowrap; }
.studio-el-quick, .studio-el-actions { display: flex; align-items: center; gap: 0; }
.studio-el-quick button, .studio-el-actions button {
  display: grid; place-items: center; width: 1.8rem; height: 1.8rem; padding: 0; border: 0; border-radius: 50%; background: none;
  color: var(--text-dim); cursor: pointer; transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.studio-el-quick button:hover, .studio-el-actions button:hover { background: var(--surface-3); color: var(--text); }
.studio-el-quick button:disabled, .studio-el-actions button:disabled { opacity: 0.3; cursor: default; background: none; }
.studio-el-quick .ico, .studio-el-actions .ico { width: 1.05rem; height: 1.05rem; }
.studio-el-quick [aria-pressed="true"] { color: var(--accent); }
.studio-el-actions [data-act="remove"]:hover, .studio-el-actions [data-act="delete"]:hover { color: var(--coral); }
/* The other buttons: on the selected row, on their own line under the name. */
.studio-el-actions { display: none; grid-column: 1 / -1; justify-content: flex-end; padding-bottom: 0.15rem; }
.studio-el.is-selected .studio-el-actions, .studio-group.is-selected .studio-el-actions { display: flex; }
.studio-el-actions:has(.studio-el-fix) { flex-wrap: wrap; row-gap: 0.25rem; }
.studio-el-actions .studio-el-fix { order: -1; flex: 1 0 100%; width: auto; height: auto; min-height: 1.9rem; padding: 0.15rem 0.7rem; border-radius: 999px; background: rgba(255, 209, 102, 0.18); color: #ffd166; font: 800 var(--t-small) / 1.2 var(--body); }
.studio-el-actions .studio-el-fix:hover { background: rgba(255, 209, 102, 0.3); color: #ffd166; }
.studio-el-fix:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The fold arrow of a layer. */
.studio-group-fold { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-dim); cursor: pointer; }
.studio-group-fold:disabled { visibility: hidden; }
.studio-group-fold .ico { width: 0.95rem; height: 0.95rem; transform: rotate(-90deg); transition: transform 160ms var(--ease); }
.studio-group.is-open .studio-group-fold .ico { transform: none; }
:dir(rtl) .studio-group-fold .ico { transform: rotate(90deg); }
:dir(rtl) .studio-group.is-open .studio-group-fold .ico { transform: none; }
.studio-group-fold:hover { background: var(--surface-3); color: var(--text); }
.studio-group-name { min-width: 0; width: 100%; height: calc(var(--ctl) * 0.8); padding: 0 0.55rem; border: 0; border-radius: 0.55rem; background: var(--solid); color: var(--text); font: 700 var(--t-item) / 1 var(--body); box-shadow: inset 0 0 0 1.5px var(--accent); }
/* An empty layer (just made): a calm line under it says where new widgets go. */
.studio-layer-hint { margin-inline-start: 1.35rem; padding: 0.3rem 0.5rem; color: var(--text-dim); font: 500 var(--t-small) / 1.35 var(--body); }
/* "New layer": a quiet line under the list, as in an image program. */
.studio-layer-new {
  display: flex; align-items: center; gap: 0.4rem; width: 100%; margin-top: 0.35rem; padding: 0.35rem 0.5rem; border: 1px dashed var(--line); border-radius: 0.7rem;
  background: none; color: var(--text-dim); font: 700 var(--t-ui) / 1.2 var(--body); cursor: pointer; transition: color 160ms var(--ease), border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.studio-layer-new .ico { width: 1rem; height: 1rem; }
.studio-layer-new:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--surface); }
.studio-layer-new:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-layer-new:disabled { opacity: 0.5; cursor: default; }
/* An empty scene: only "Still empty" (the first widget makes "Layer 1"; keeps the column short on small laptops). */
.studio-elements.is-empty .studio-layer-new { display: none; }
/* Dragging rows. */
.studio-element-list li.is-dragging { opacity: 0.45; }
.studio-element-list li.is-drop-above { box-shadow: inset 0 2px 0 var(--accent); }
.studio-element-list li.is-drop-into { box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface-2); }
.studio-element-list.is-drop-end { box-shadow: inset 0 -2px 0 var(--accent); }
/* A chosen layer on the stage: one box that moves all its elements (no handles; editor.js). */
.studio-sel.is-group { pointer-events: auto; cursor: move; box-shadow: 0 0 0 calc(2px / var(--scene-scale, 1)) var(--accent); outline: calc(1px / var(--scene-scale, 1)) dashed rgba(196, 181, 253, 0.7); outline-offset: calc(4px / var(--scene-scale, 1)); }
.studio-sel.is-group .studio-handle { display: none; }

/* ---------- Library ---------- */
.studio-library { display: flex; flex-direction: column; min-height: 0; }
.studio-library > :not(.studio-lib-groups) { flex: none; }
.studio-lib-tools { display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem 0 0.75rem; }
.studio-library > .studio-lib-search { margin-top: 0.75rem; flex: none; height: var(--ctl); }
/* The two shelves: overlays, and the GTA VI packs (library.js). A segmented switch, the active one lavender. */
.studio-lib-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0.25rem; margin-top: 0.75rem; padding: 0.25rem; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-lib-tabs button { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.3rem; min-width: 0; min-height: 2.1rem; padding: 0.3rem 0.5rem; border: 0; border-radius: 999px; background: none; color: var(--text-dim); font: 800 var(--t-small) / 1.1 var(--body); cursor: pointer; transition: background-color 160ms ease, color 160ms ease; }
.studio-lib-tabs button[hidden] { display: none; }
/* The second row inside "Overlay packs": Standard and GTA VI (library.js, founder 2026-11-27). */
.studio-lib-packtabs { margin-top: 0.5rem; }
.studio-lib-packtabs[hidden] { display: none; }
.studio-lib-tabs button:hover { color: var(--text); }
.studio-lib-tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.studio-lib-tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-cozy-mark { padding: 0.12rem 0.45rem; border-radius: 999px; background: var(--surface-3); color: var(--text); font-size: var(--t-badge); font-weight: 800; letter-spacing: 0.02em; }
.studio-lib-tabs button[aria-selected="true"] .studio-cozy-mark,
#studio-sound-upload .studio-cozy-mark { background: rgba(255, 255, 255, 0.35); color: var(--accent-ink); }
#studio-sound-upload .studio-cozy-mark { margin-inline-start: 0.45rem; }   /* own files only with Cozy (eigene-toene/PLAN.md) */
/* The note above the packs for an account without Cozy: everyone may look, Cozy puts them into the scene. */
.studio-lib-cozy { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 0.75rem; padding: 0.7rem 0.85rem; border-radius: 1rem; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-lib-cozy p { flex: 1 1 12rem; margin: 0; color: var(--text-dim); font-size: var(--t-small); line-height: 1.45; }
.studio-lib-cozy.is-nudged { animation: studio-nudge 520ms var(--ease); }
@keyframes studio-nudge { 0%, 100% { transform: none; } 30% { transform: translateX(-4px); } 60% { transform: translateX(4px); } }
/* A pack: its picture across the top of its group. */
.studio-lib-pack summary { position: relative; min-height: 4.2rem; overflow: hidden; border-radius: 0.9rem; color: #fff; text-shadow: 0 1px 6px rgba(10, 6, 30, 0.85); }
.studio-lib-pack .studio-pack-cover { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; object-fit: cover; }
.studio-lib-pack summary::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(23, 17, 44, 0.85), rgba(23, 17, 44, 0.15)); }
/* The shelf "Emotes" (emote-packs.js): the pack's first emote beside its name, every emote in a grid, the ZIP with Cozy */
.studio-lib-emotes .studio-pack-cover { width: 2.2rem; height: 2.2rem; flex: none; object-fit: contain; }
.studio-emotes-about { margin: 0.2rem 0 0.6rem; color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
.studio-emotes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr)); gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.studio-emotes-grid li { display: grid; place-items: center; aspect-ratio: 1; padding: 0.25rem; border-radius: var(--r-sm); background: var(--solid-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.studio-emotes-grid li[hidden] { display: none; }
/* A moving emote: a small "GIF" mark (the format name, the same in every language); it plays on hover or focus (library.js). */
.studio-emotes-grid li.is-animated { position: relative; cursor: default; }
.studio-emotes-grid li.is-animated::after { content: "GIF"; position: absolute; inset-block-end: 0.15rem; inset-inline-end: 0.15rem; padding: 0.1rem 0.25rem; border-radius: 0.3rem; background: var(--accent); color: var(--accent-ink); font: 800 var(--t-badge) / 1 var(--body); letter-spacing: 0.02em; }
.studio-emotes-grid li.is-animated:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-emotes-grid img { display: block; width: 100%; height: auto; }
.studio-emotes-get { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; margin-top: 0.8rem; }
.studio-emotes-get .studio-lock[hidden] { display: none; }
.studio-emotes-zip[aria-disabled="true"] { opacity: 0.7; }
.studio-emotes-sizes { color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
.studio-lib-pack summary { isolation: isolate; }
.studio-lib-pack summary .count { padding: 0.1rem 0.55rem; border-radius: 999px; background: rgba(23, 17, 44, 0.72); color: #fff; text-shadow: none; }
.studio-lib-item .studio-lock, .studio-pack b .studio-lock, .studio-emotes-get .studio-lock { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--surface-3); color: var(--text); font-size: var(--t-badge); font-weight: 800; }
.studio-lib-item .studio-lock .ico { width: 0.8rem; height: 0.8rem; }
.studio-lib-search {
  display: flex; align-items: center; gap: 0.5rem; flex: 1 1 auto; min-width: 0; height: var(--ctl); padding: 0 0.9rem;
  border-radius: var(--r-pill); background: var(--solid); box-shadow: inset 0 0 0 1px var(--line-2);
}
.studio-lib-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.studio-lib-search input { flex: 1 1 auto; min-width: 0; border: 0; background: none; color: var(--text); font: 600 var(--t-small) / 1 var(--body); outline: none; }
.studio-lib-search .ico { width: 1.1rem; height: 1.1rem; }
.studio-lib-views { display: flex; gap: 0.35rem; }
.studio-lib-views .icon-button[aria-pressed="true"] { background: var(--surface-3); box-shadow: inset 0 0 0 1.5px var(--accent); }
/* The category choice: one pill as wide as the row allows, beside list/grid. */
.studio-lib-filters { flex: 1 1 auto; min-width: 0; }
.studio-lib-filters[hidden] { display: none; }
.studio-lib-filters .hub-select { width: 100%; height: var(--ctl); color: var(--text); font-weight: 700; }
.studio-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem; padding: 0 0.8rem; border: 0; border-radius: var(--r-pill);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-dim); font: 700 var(--t-small) / 1 var(--body); cursor: pointer;
}
.studio-chip b { color: var(--text-mute); font-weight: 700; }
.studio-chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.studio-chip[aria-pressed="true"] b { color: var(--accent-ink); opacity: 0.7; }
.studio-lib-groups { overflow: auto; min-height: 0; margin-inline-end: -0.5rem; padding-inline-end: 0.5rem; }
.studio-lib-group summary {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 0.15rem 0.45rem; list-style: none; cursor: pointer;
  color: var(--text-dim); font-size: var(--t-small); font-weight: 700;
}
.studio-lib-group summary::-webkit-details-marker { display: none; }
.studio-lib-group summary .ico { width: 1rem; height: 1rem; transition: transform 200ms var(--ease); }
.studio-lib-group:not([open]) summary .chev { transform: rotate(-90deg); }
.studio-lib-group summary .count { margin-inline-start: auto; color: var(--text-mute); font-weight: 700; }
.studio-lib-list { display: grid; gap: 0.45rem; margin: 0; padding: 0 0 0.35rem; list-style: none; }
/* "Game interactions for <game>" above the gift widgets (library.js gameButtons): one button per game. */
.studio-lib-games { display: flex; flex-wrap: wrap; gap: var(--gap, 0.5rem); margin: 0 0 0.5rem; }
.studio-lib-game { display: inline-flex; align-items: center; gap: 0.45rem; max-width: 100%; min-height: var(--ctl, 2.25rem); text-align: start; }
.studio-lib-game span { min-width: 0; overflow-wrap: anywhere; }
.studio-lib-game .ico { flex: none; width: 1.1em; height: 1.1em; }
/* Inside a pack: "Layouts" above the layouts, "Single pieces" above the rest. */
.studio-lib-sub { margin: 0.55rem 0.25rem 0.35rem; font-size: var(--t-badge); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-mute); }
.studio-lib-sub[hidden] { display: none; }
/* The heading of the Christmas packs on the tab "Standard" (founder 2026-11-30: below the general packs, a section of its own). */
.studio-lib-packhead { margin: 0.9rem 0.25rem 0.45rem; font-size: var(--t-ui); font-weight: 800; color: var(--text); }
.studio-lib-packhead[hidden] { display: none; }
.studio-lib-item {
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); align-items: center; gap: 0.75rem; width: 100%; padding: 0.45rem;
  border: 0; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  color: inherit; font: inherit; text-align: start; cursor: pointer; transition: background-color 160ms ease, transform 160ms var(--ease);
}
.studio-lib-item:hover { background: var(--surface-2); }
.studio-lib-item:active { transform: scale(0.985); }
.studio-lib-item[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.studio-lib-preview { position: relative; width: 5.5rem; aspect-ratio: 16 / 10; border-radius: 0.75rem; overflow: hidden; background: rgba(12, 9, 34, 0.7); box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.studio-lib-preview .sc-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.studio-lib-text { display: grid; gap: 0.15rem; min-width: 0; }
/* Plain text that wraps (a long name like "Weihnachtsschlitten" is hyphenated in a narrow library), the "in the scene" mark after it. */
.studio-lib-name { display: block; min-width: 0; font-weight: 800; font-size: var(--t-item); line-height: 1.3; hyphens: auto; overflow-wrap: break-word; }
.studio-lib-desc { color: var(--text-dim); font-size: var(--t-small); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.studio-in-scene { display: inline-flex; align-items: center; gap: 0.2rem; margin-inline-start: 0.45rem; color: var(--mint); font-size: var(--t-badge); font-weight: 800; white-space: nowrap; vertical-align: 0.05em; }
.studio-in-scene .ico { width: 0.85rem; height: 0.85rem; stroke-width: 2.4; }
.studio-in-scene[hidden] { display: none; }
/* Grid view: bigger previews with name and size */
.studio-lib-groups[data-view="grid"] .studio-lib-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.studio-lib-groups[data-view="grid"] .studio-lib-item { grid-template-columns: minmax(0, 1fr); align-items: start; }
.studio-lib-groups[data-view="grid"] .studio-lib-preview { width: 100%; }
.studio-lib-groups[data-view="grid"] .studio-lib-desc { display: none; }
.studio-lib-groups[data-view="grid"] .studio-lib-name { hyphens: manual; overflow-wrap: normal; word-break: normal; font-size: var(--t-item); }

/* ---------- Settings dialog ---------- */
/* Changes show in the scene while the dialog is open, so the scene must stay in view: hardly any dimming, and on wide
   screens the dialog sits over the right-hand column instead of the middle. */
/* Founder 2026-11-21: the dialog looked too dark next to the cards. The lighter solid of the design with a soft light from
   above: it matches the violet of the cards over the sky and still hides what lies behind. */
.studio-dialog {
  width: min(100% - 2rem, 30rem); background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 40%), #261f5a; /* = --solid-2 of :root */
  --solid-2: var(--solid);   /* its fields (gifts, numbers, choices) one step darker, so they stand out on the lighter dialog */
}
/* The templates dialog is wider (four tabs, lists with several buttons); .studio-dialog would cut it to 30rem. */
.studio-dialog.studio-templates { width: min(100% - 2rem, 40rem); }
/* Narrow: the four tabs as an even 2 × 2 grid instead of a pill that breaks into two uneven lines */
@media (max-width: 40rem) {
  .studio-tpl-tabs:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-self: stretch; border-radius: var(--r-sm); }
  .studio-tpl-tabs button { justify-content: center; padding-inline: 0.5rem; text-align: center; }
}
.studio-dialog::backdrop { background: rgba(6, 5, 10, 0.18); backdrop-filter: none; -webkit-backdrop-filter: none; }
@media (min-width: 62rem) {
  .studio-dialog { margin: calc(var(--header-h) + 1rem) var(--gutter) auto auto; max-height: calc(100vh - var(--header-h) - 2rem); }
}
.studio-dialog-form { display: grid; gap: 1rem; }
/* Position and size (editor.js fillPlace) */
.studio-place { display: grid; gap: 0.75rem; padding: 0.9rem 1rem 1rem; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-place-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem 0.75rem; }
.studio-place-grid input { width: 100%; box-sizing: border-box; font-variant-numeric: tabular-nums; }
.studio-place-align { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.studio-place-align .icon-button[disabled] { opacity: 0.35; cursor: default; }
.studio-place-toggle { justify-content: space-between; }
.studio-place-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; }
.studio-place-row .button { margin-inline-start: auto; }
.studio-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.studio-dialog-head h2 { margin: 0; font-size: var(--t-card); font-weight: 800; }
.studio-fields { display: grid; gap: 0.95rem; max-height: min(60vh, 34rem); overflow: auto; padding: 0.15rem; }
.studio-field { display: grid; gap: 0.4rem; }
.studio-field-label { font-size: var(--t-small); font-weight: 700; color: var(--text-dim); }
/* A setting that is a gift (settings.js): picture, name, "choose" */
.studio-gift-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.studio-gift-choose {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: var(--ctl); max-width: 100%; padding: 0.35rem 0.9rem 0.35rem 0.5rem;
  border: 0; border-radius: var(--r-sm); background: var(--solid-2); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text);
  font: 700 var(--t-ui) / 1.2 var(--body); cursor: pointer; text-align: start;
}
.studio-gift-choose:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.studio-gift-choose:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-gift-choose img { width: 2rem; height: 2rem; object-fit: contain; flex: none; }
.studio-gift-choose img[hidden] { display: none; }
.studio-gift-choose > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-gift-change { color: var(--accent); font-size: var(--t-small); font-weight: 700; white-space: nowrap; }
.studio-gift-setting [hidden] { display: none; }
/* A setting that is a list of gifts (the bingo card, settings.js): one square button per gift */
.studio-gifts-grid { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 3.5rem)); gap: 0.4rem; }
.studio-gifts-slot {
  display: grid; place-items: center; aspect-ratio: 1; min-width: 0; padding: 0.3rem; border: 0; border-radius: var(--r-sm); background: var(--solid-2);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-dim); font: 800 var(--t-card) / 1 var(--body); cursor: pointer;
}
.studio-gifts-slot:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.studio-gifts-slot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-gifts-slot img { width: 100%; height: 100%; object-fit: contain; }
.studio-gifts-slot span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-small); }
.studio-gifts-hint { margin: 0; color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
/* With a goal per gift (gift gallery): the place, the number wanted below it, a small "×" to take it out */
.studio-gifts-grid.has-goals { grid-template-columns: repeat(var(--n, 4), minmax(0, 4rem)); row-gap: 0.6rem; }
.studio-gifts-cell { position: relative; display: grid; gap: 0.3rem; min-width: 0; }
.studio-gifts-goal {
  width: 100%; min-width: 0; height: 2rem; padding: 0 0.3rem; border: 0; border-radius: var(--r-sm); background: var(--solid-2);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: 800 var(--t-small) / 1 var(--body); text-align: center;
  font-variant-numeric: tabular-nums;
}
.studio-gifts-goal:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-gifts-remove {
  position: absolute; top: -0.45rem; inset-inline-end: -0.45rem; display: grid; place-items: center; width: 1.4rem; height: 1.4rem; padding: 0; border: 0;
  border-radius: 50%; background: var(--solid); box-shadow: inset 0 0 0 1px var(--line-2), var(--shadow); color: var(--text-dim);
  font: 800 var(--t-item) / 1 var(--body); cursor: pointer;
}
.studio-gifts-remove:hover { color: var(--text); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.studio-gifts-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A setting that is a board (board-setting.js): source, game, state, rows by hand */
.studio-board { display: grid; gap: 0.6rem; min-width: 0; }
.studio-board-part { display: grid; gap: 0.55rem; min-width: 0; }
/* The game of a gift list or interactions element, its own row under the title (board-setting.js, founder 2026-11-27). */
.studio-board-pick { display: grid; gap: 0.4rem; min-width: 0; margin-block-end: var(--gap, 0.6rem); }
.studio-board-pick[hidden] { display: none; }
.studio-board-part[hidden], .studio-board [hidden] { display: none; }
.studio-board-state, .studio-board-hint { margin: 0; color: var(--text-dim); font-size: var(--t-small); font-weight: 700; line-height: 1.45; }
.studio-board-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.studio-board-rows { display: grid; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.studio-board-row { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center; gap: 0.5rem; }
.studio-board-row .studio-gift-choose { max-width: 11rem; }
.studio-board-row input[type="text"] { min-width: 0; width: 100%; }
.studio-board-add { justify-self: start; }
@media (max-width: 30rem) {
  .studio-board-row { grid-template-columns: minmax(0, 1fr) auto; }
  .studio-board-row input[type="text"] { grid-column: 1 / -1; grid-row: 2; }
}
/* A setting with songs (music player, music-setting.js): name, up, down, remove; "Add song" below */
.studio-songs { display: grid; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.studio-song { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 0.35rem; padding: 0.3rem 0.3rem 0.3rem 0.7rem; border-radius: 0.6rem; box-shadow: inset 0 0 0 1px var(--line); }
.studio-song-name { min-width: 0; overflow-wrap: anywhere; font-size: var(--t-text); font-weight: 500; }
.studio-songs-add { justify-self: start; margin-top: 0.15rem; }
.studio-songs-empty, .studio-songs-note { margin: 0; }
/* A setting with results (luck widgets, results-setting.js): text, weight, chance with its rarity, remove */
.studio-results { display: grid; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.studio-results-row { display: grid; grid-template-columns: minmax(0, 1fr) 4.6rem 3.4rem auto; align-items: center; gap: 0.5rem; }
.studio-field .studio-results-row input[type="text"] { min-width: 0; width: 100%; }
.studio-field .studio-results-row input[type="number"] { width: 100%; padding: 0 0.5rem; text-align: center; }
.studio-results-chance {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.35rem; color: var(--text-dim); font-size: var(--t-small);
  font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.studio-results-chance::before { content: ""; flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #7be8b0; }
.studio-results-chance[data-rarity="rare"]::before { background: #90c5fb; }
.studio-results-chance[data-rarity="epic"]::before { background: #c3adff; }
.studio-results-chance[data-rarity="legendary"]::before { background: #ffd36b; box-shadow: 0 0 0.45rem #ffd36b; }
.studio-results-add { justify-self: start; margin-top: 0.15rem; }
@media (max-width: 30rem) {
  .studio-results-row { grid-template-columns: 4.6rem 3.4rem 1fr auto; }
  .studio-field .studio-results-row input[type="text"] { grid-column: 1 / -1; }
}
.studio-field input[type="text"], .studio-field input[type="number"] {
  height: var(--ctl); padding: 0 0.9rem; border: 0; border-radius: var(--r-sm); background: var(--solid-2); box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--text); font: 500 var(--t-ui) / 1 var(--body);
}
.studio-field input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-number { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem; align-items: center; gap: 0.75rem; }
.studio-number input[type="range"] { width: 100%; accent-color: var(--accent); }
.studio-segments { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.studio-segments button {
  min-height: 2.25rem; padding: 0 0.9rem; border: 0; border-radius: var(--r-pill); background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line); color: var(--text-dim); font: 700 var(--t-small) / 1 var(--body); cursor: pointer;
}
.studio-segments button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.studio-toggle { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.studio-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.studio-switch { position: relative; flex: none; width: 2.75rem; height: 1.5rem; border-radius: var(--r-pill); background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-2); transition: background-color 160ms ease; }
.studio-switch::after { content: ""; position: absolute; top: 0.2rem; inset-inline-start: 0.2rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--text); transition: transform 200ms var(--ease); }
.studio-toggle input:checked + .studio-switch { background: var(--accent); }
.studio-toggle input:checked + .studio-switch::after { transform: translateX(1.25rem); background: var(--accent-ink); }
[dir="rtl"] .studio-toggle input:checked + .studio-switch::after { transform: translateX(-1.25rem); }
.studio-toggle input:focus-visible + .studio-switch { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.studio-swatches button {
  width: 2.1rem; height: 2.1rem; padding: 0; border: 0; border-radius: 50%; background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); cursor: pointer;
}
.studio-swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--solid), 0 0 0 4px var(--accent); }
.studio-dialog-foot { display: flex; justify-content: space-between; gap: 0.75rem; }
/* "Are you sure?" before the scene is emptied: narrow, the question, one sentence, Cancel and the red Yes. */
/* It changes nothing while open, so unlike the settings it sits in the middle and dims the page. */
.studio-dialog.studio-reset-dialog { width: min(100% - 2rem, 28rem); margin: auto; }
.studio-dialog.studio-reset-dialog::backdrop { background: rgba(6, 5, 10, 0.55); }
.studio-reset-text { margin: 0; color: var(--text-dim); }

/* ---------- Narrow screens ---------- */
@media (max-width: 62rem) {
  /* One column: the library comes right under the scene (where things are added), the cards after it. */
  .studio-grid { display: flex; flex-direction: column; align-items: stretch; gap: 1.25rem; }
  .studio-main { display: contents; }
  .studio-main > * { order: 6; }
  .studio-viewbar { order: 1; }
  .studio-frame { order: 2; }
  .studio-phone-hint { order: 3; }
  .studio-lib-col { order: 4; position: static; max-height: none; }
  .studio-side { order: 5; }
  .studio-side { position: static; max-height: none; grid-template-rows: none; }
  .studio-lib-groups { max-height: 32rem; }
  .studio-block-body { overflow: visible; }
  .studio-rail {
    position: fixed; inset-inline: 0; bottom: 0; top: auto; z-index: 40; width: auto; flex-direction: row; justify-content: space-around; gap: 0;
    padding: 0.35rem 0.5rem calc(0.35rem + env(safe-area-inset-bottom, 0px)); background: var(--solid); box-shadow: 0 -1px 0 var(--line-2);
  }
  .studio-rail button { flex: 1 1 0; padding: 0.45rem 0.1rem; font-size: var(--t-rail); }
  .studio-rail button .ico { width: 1.3rem; height: 1.3rem; }
  .studio-rail button.is-soon, .studio-rail-sep { display: none; }
  .studio-room { padding-bottom: 4.5rem; }
  .studio-room:not([data-view="studio"]) .studio-lib-col { display: none; }
  .studio-room:not([data-view="studio"]) .studio-preview-h { order: 1; }
  .studio-room:not([data-view="studio"]) .studio-frame { order: 2; }
  .studio-room:not([data-view="studio"]) .studio-side { order: 3; }
}
@media (max-width: 47.9rem) {
  .studio-small {
    display: block; margin: 0 0 1rem; padding: 0.75rem 1rem; border-radius: var(--r); background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line); color: var(--text-dim); font-size: var(--t-small);
  }
}
@media (max-width: 48rem) {
  .studio-steps { grid-template-columns: minmax(0, 1fr); }
  .studio-tools { margin-inline-start: 0; }
  .studio-keys { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .studio-loading { animation: none; }
  .studio-meter i, .studio-switch::after, .studio-lib-item { transition: none; }
}

/* ---------- Card "Rules" and its dialog (rules-card.js) ---------- */
.studio-starter { display: grid; gap: 0.5rem; justify-items: start; padding: 1rem 1.1rem; margin-bottom: 0.9rem; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.studio-starter[hidden] { display: none; }
.studio-starter h3 { margin: 0; font-size: var(--t-item); font-weight: 800; }
.studio-starter p { margin: 0; color: var(--text-dim); font-size: var(--t-small); line-height: 1.5; max-width: 52rem; }
.studio-rule-list { display: grid; gap: 0.4rem; margin: 0 0 0.9rem; padding: 0; list-style: none; }
.studio-rule-list[hidden] { display: none; }
.studio-rule { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; padding: 0.55rem 0.6rem 0.55rem 0.8rem; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-rule.is-off .studio-rule-text { color: var(--text-mute); }
.studio-rule-switch { gap: 0; }
.studio-rule-body { min-width: 0; display: grid; gap: 0.2rem; }
.studio-rule-text { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0; font-size: var(--t-text); line-height: 1.4; overflow-wrap: anywhere; }
.studio-rule-text b { font-weight: 800; }
.studio-rule-pic { width: 1.6rem; height: 1.6rem; object-fit: contain; }
.studio-rule-hint { margin: 0; color: var(--pink); font-size: var(--t-small); font-weight: 700; }
.studio-rule-tools { display: flex; gap: 0.15rem; }
.studio-rule-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.studio-rule-dialog { width: min(100% - 1.5rem, 44rem); max-height: calc(100dvh - 2rem); background: var(--solid); overflow: auto; }
.studio-rule-form { display: grid; gap: 1.1rem; }
.studio-rule-top { display: grid; gap: 0.5rem; }
.studio-rule-top h2 { margin: 0; }
.studio-rule-steps { display: flex; gap: 0.4rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.studio-rule-steps li { flex: 1 1 0; padding-top: 0.45rem; border-top: 3px solid var(--surface-3); color: var(--text-mute); font-size: var(--t-small); font-weight: 800; }
.studio-rule-steps li.is-on { border-top-color: var(--accent); color: var(--text); }
.studio-rule-page { display: grid; gap: 1rem; }
.studio-rule-page[hidden] { display: none; }
.studio-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.5rem; }
.studio-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; min-height: 5.2rem; padding: 0.8rem 0.9rem; border: 0; border-radius: var(--r);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: 800 var(--t-item) / 1.25 var(--body); text-align: start; cursor: pointer;
}
.studio-tile .ico { width: 1.4rem; height: 1.4rem; color: var(--accent); }
.studio-tile:hover { background: var(--surface-3); }
.studio-tile[aria-checked="true"], .studio-tile[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.studio-tile[aria-checked="true"] .ico, .studio-tile[aria-pressed="true"] .ico { color: var(--accent-ink); }
.studio-tile[hidden] { display: none; }
.studio-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-rule-param[hidden], .studio-rule-then[hidden] { display: none; }
.studio-rule-param { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; }
label.studio-rule-param { display: grid; max-width: 20rem; }
.studio-rule-who { max-width: 20rem; }
.studio-rule-who[hidden] { display: none; }
.studio-rule-gift { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 800; }
.studio-rule-gift img { width: 2rem; height: 2rem; object-fit: contain; }
.studio-rule-then { display: grid; gap: 0.9rem; margin: 0; padding: 0.9rem 1rem; border: 0; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-ph {
  display: inline-flex; align-items: center; min-height: 2rem; padding: 0 0.8rem; border: 0; border-radius: var(--r-pill);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: 700 var(--t-small) / 1 var(--body); cursor: pointer;
}
.studio-ph:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-rule-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; color: var(--text-mute); font-size: var(--t-small); font-weight: 700; }
.studio-rule-dialog select, .studio-rule-dialog input[type="text"], .studio-rule-dialog input[type="number"], .studio-sim-as select {
  width: 100%; height: var(--ctl); padding: 0 0.85rem; border: 0; border-radius: var(--r-sm); background: var(--solid-2);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: 500 var(--t-ui) / 1 var(--body);
}
.studio-rule-dialog select:focus-visible, .studio-rule-dialog input:focus-visible, .studio-sim-as select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-sim-as select { cursor: pointer; }
.studio-rule-none { color: var(--coral); font-weight: 700; }
.studio-rule-summary { margin: 0; padding: 0.9rem 1rem; border-radius: var(--r); background: var(--surface-2); font-size: var(--t-item); font-weight: 800; line-height: 1.4; overflow-wrap: anywhere; }
.studio-rule-hints { margin: 0; padding-inline-start: 1.1rem; color: var(--pink); font-size: var(--t-small); font-weight: 700; }
.studio-rule-hints:empty { display: none; }
.studio-rule-more { display: grid; gap: 0.9rem; }
.studio-rule-more summary { cursor: pointer; font-weight: 800; color: var(--accent); }
.studio-rule-more[open] { gap: 0.9rem; }
.studio-rule-more > * + * { margin-top: 0.8rem; }
.studio-rule-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
/* The buttons stay at the bottom edge of the dialog while its content scrolls (small screens, long step 1). */
.studio-rule-dialog { --pad: clamp(1.25rem, 4vw, 2rem); }
.studio-rule-buttons {
  position: sticky; bottom: calc(-1 * var(--pad)); z-index: 1;
  margin: 0 calc(-1 * var(--pad)) calc(-1 * var(--pad)); padding: 0.85rem var(--pad) var(--pad);
  background: var(--solid); box-shadow: 0 -1px 0 var(--line-2);
}
.studio-rule-gap { flex: 1 1 auto; }
.studio-rule-buttons [hidden] { display: none; }
@media (max-width: 30rem) {
  .studio-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio-rule { grid-template-columns: auto minmax(0, 1fr); }
  .studio-rule-tools { grid-column: 1 / -1; justify-content: flex-end; }
}

/* ---------- Card "Assign events" (reactions-card.js): one row per event, a table on wide screens ---------- */
/* Lower part of the card "Reactions": what the characters do by themselves */

.studio-rules .studio-react .studio-card-sub { margin: 0.35rem 0 0.9rem; }
.studio-react-for { max-width: 22rem; margin-bottom: 0.9rem; }
.studio-react select, .studio-react-cool input {
  width: 100%; height: var(--ctl); padding: 0 0.75rem; border: 0; border-radius: var(--r-sm); background: var(--solid-2);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text); font: 500 var(--t-ui) / 1 var(--body);
}
.studio-react select { cursor: pointer; }
.studio-react select:focus-visible, .studio-react-cool input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.studio-react-table { display: grid; gap: 0.35rem; }
.studio-react-row {
  display: grid; grid-template-columns: minmax(8rem, 1.1fr) minmax(10rem, 1.5fr) 6.5rem auto; align-items: center; gap: 0.6rem;
  padding: 0.35rem 0.5rem; border-radius: var(--r-sm);
}
.studio-react-row:not(.studio-react-heads):hover { background: var(--surface); }
.studio-react-heads { padding-block: 0; color: var(--text-mute); font-size: var(--t-small); font-weight: 700; }
.studio-react-name { font-weight: 700; min-width: 0; }
.studio-react-off { display: none; color: var(--text-mute); font-size: var(--t-small); font-weight: 700; }
.studio-react-row.is-off .studio-react-name { color: var(--text-mute); }
.studio-react-row.is-off .studio-react-off { display: block; }
.studio-react-row.is-off select, .studio-react-row.is-off input { opacity: 0.5; }
.studio-react-cool { display: flex; align-items: center; gap: 0.35rem; color: var(--text-dim); font-weight: 700; }
.studio-react-big { margin-top: 0.9rem; }
/* Simple view: the four main events, no pause column (the button "More options" shows everything) */
.studio-react.is-simple [data-extra], .studio-react.is-simple .studio-react-cool, .studio-react.is-simple #studio-react-h-cool { display: none; }
.studio-react.is-simple .studio-react-row { grid-template-columns: minmax(8rem, 1.1fr) minmax(10rem, 1.5fr) auto; }
.studio-react-more { margin-top: 0.75rem; }
#studio-react-reset { margin-top: 0.4rem; }
@media (max-width: 40rem) {
  .studio-react-row { grid-template-columns: minmax(0, 1fr) 5.5rem auto; row-gap: 0.4rem; padding-inline: 0; }
  .studio-react-name { grid-column: 1 / -1; }
  .studio-react-heads span:first-child { display: none; }
  .studio-react.is-simple .studio-react-row { grid-template-columns: minmax(0, 1fr) auto; }
}

/* ---------- Blocks next to the scene (editor.js showTab): one open at a time, it fills the column ---------- */
.studio-blocks { display: flex; flex-direction: column; gap: 0.5rem; min-height: 0; }
/* "Elements": its own fold; open it keeps its natural height (the list scrolls from 24 % of the screen), never fills. */
.studio-elements.studio-block, .studio-elements.studio-block.is-open { flex: none; }
.studio-elements .studio-block-head .count-pill { margin-inline-start: 0.1rem; }
.studio-block.studio-elements.is-open .studio-block-head button:hover { background: var(--surface-2); cursor: pointer; }
.studio-elements .studio-element-list { margin-top: 0; }
.studio-block {
  display: flex; flex-direction: column; flex: none; min-height: 0; border-radius: var(--r-lg); background: var(--studio-panel);
  box-shadow: inset 0 0 0 1px var(--line);
}
.studio-block[hidden] { display: none; }
.studio-block.is-open { flex: 1 1 auto; box-shadow: inset 0 0 0 1px var(--line-2); }
.studio-block-head { margin: 0; font-size: var(--t-card); }
.studio-block-head button {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; min-height: 2.9rem; padding: 0.55rem 1.1rem; border: 0;
  border-radius: var(--r-lg); background: none; color: var(--text-dim); font: 800 var(--t-card) / 1.2 var(--body); text-align: start; cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}
.studio-block-head button:hover { color: var(--text); background: var(--surface-2); }
.studio-block-head button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.studio-block.is-open .studio-block-head button { color: var(--text); }
.studio-block.is-open .studio-block-head button:hover { background: var(--surface-2); }
.studio-block-head .ico { width: 1.15rem; height: 1.15rem; flex: none; }
.studio-block.is-open .studio-block-head .ico:first-child { color: var(--accent); }
.studio-block-chev { margin-inline-start: auto; transform: rotate(-90deg); transition: transform 200ms var(--ease); }
[dir="rtl"] .studio-block-chev { transform: rotate(90deg); }
.studio-block.is-open .studio-block-chev { transform: none; }
.studio-block-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 1.1rem 1.1rem; container-type: inline-size; }
.studio-block-body[hidden] { display: none; }
/* The cards inside lose their own frame; a heading that only repeats the block's name is kept for screen readers. */
.studio-block-body > .studio-card { padding: 0; border-radius: 0; background: none; box-shadow: none; }
.studio-room[data-view="studio"] .studio-block:is([data-block="sim"], [data-block="timer"]) .studio-block-body > .studio-card > .studio-card-head h2 {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.studio-block[data-block="sim"] .studio-card-head { justify-content: flex-start; }
.studio-block[data-block="library"] .studio-block-body { display: flex; flex-direction: column; overflow: hidden; }
.studio-block[data-block="library"] .studio-library { flex: 1 1 auto; }
.studio-block .studio-lib-tabs { margin-top: 0; }
/* Narrow block (the column is 21 to 26rem): labels above their buttons, the reaction table in two lines. */
@container (max-width: 36rem) {
  .studio-sim-label { flex-basis: 100%; }
  .studio-react-row { grid-template-columns: minmax(0, 1fr) 5.5rem auto; row-gap: 0.4rem; padding-inline: 0; }
  .studio-react-name { grid-column: 1 / -1; }
  .studio-react-heads span:first-child { display: none; }
  .studio-react.is-simple .studio-react-row { grid-template-columns: minmax(0, 1fr) auto; }
  .studio-sound-rows:not(.is-grid) .studio-sound-name { flex-basis: 100%; }
}

/* ---------- Internal check page of the characters: /studio/?debug=figures (figures-debug.js) ---------- */
.studio-debug > [data-auth] { display: none !important; }
.studio-figcheck { padding-block: 1.5rem 3rem; }
.studio-figcheck-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-bottom: 1.25rem; }
.studio-figcheck-sizes { display: flex; gap: 0.5rem; }
.studio-figcheck-sizes .button[aria-pressed="true"] { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--accent); }
.studio-figcheck-name { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--text-dim); font-weight: 700; }
.studio-figcheck-figure + .studio-figcheck-figure { margin-top: 2rem; }
.studio-figcheck-figure h2 { margin: 0 0 0.75rem; font-size: var(--t-card); }
.studio-figcheck-grid { display: flex; flex-wrap: wrap; gap: 1rem; }
.studio-figcheck-tile { margin: 0; padding: 0.6rem; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.studio-figcheck-tile figcaption { margin-top: 0.45rem; color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
/* the frame of the element (what the editor selects); nothing may leave it */
.studio-figcheck-frame { position: relative; background: var(--bg-deep); box-shadow: 0 0 0 1px var(--accent); }
.studio-figcheck-box { position: absolute; top: 0; left: 0; width: 300px; height: 300px; transform-origin: 0 0; }
.studio-figcheck-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--pink); pointer-events: none; z-index: 2; }
.studio-figcheck-line.is-middle { border-top-color: var(--sky-blue); }
.studio-figcheck-line.is-upright { top: 0; bottom: 0; left: 50%; right: auto; width: 0; height: auto; border-top: 0; border-left: 1px dashed var(--sky-blue); }

/* ---------- Gift picker of the studio (studio/gifts.js): price ranges, sort, the whole list ---------- */
.studio-gift-dialog { width: min(100% - 2rem, 38rem); }
.studio-gift-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.75rem; }
.studio-gift-ranges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.studio-gift-ranges button {
  min-height: 2rem; padding: 0.2rem 0.75rem; border: 0; border-radius: var(--r-pill); background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text-dim); font: inherit; font-size: var(--t-small); font-weight: 700; cursor: pointer;
}
.studio-gift-ranges button:hover { color: var(--text); }
.studio-gift-ranges button[aria-pressed="true"] { background: var(--accent); box-shadow: none; color: var(--accent-ink); }
.studio-gift-sort { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text-dim); font-size: var(--t-small); font-weight: 700; }
.studio-gift-sort select {
  min-height: 2rem; padding: 0.2rem 0.6rem; border: 0; border-radius: var(--r-sm); background: var(--surface-3);
  color: var(--text); font: inherit; font-size: var(--t-small);
}
.studio-gift-count { margin: 0.6rem 0 0; }
.studio-gift-dialog .gift-list { margin-top: 0.4rem; }
.studio-gift-price { display: inline-flex; align-items: center; gap: 0.35rem; font-variant-numeric: tabular-nums; }
.studio-coin {
  display: inline-block; width: 1rem; height: 1rem; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a3, #f5b83d 55%, #c9821a); box-shadow: inset 0 0 0 1px rgba(120, 70, 0, 0.45);
}
.studio-gift-more { height: 1px; }
/* Catalogue marks (studio/gifts.js giftMarks): a small "new" tag after the name, gifts TikTok dropped greyed out. */
.studio-gift-new {
  flex: none; padding: 0.1rem 0.45rem; border-radius: var(--r-pill);
  background: var(--accent); color: var(--accent-ink); font-size: var(--t-badge); font-weight: 800;
}
.gift-option.is-gone { opacity: 0.45; }
.gift-option.is-gone:hover, .gift-option.is-gone:focus-visible { opacity: 0.8; }

/* A setting that depends on another (camera frame: the next channel once the one before is chosen). */
.studio-field[hidden] { display: none; }

/* ---------- Compact (B-52, 2026-11-26): the columns beside the scene tighter, from the shared --d ----------
   On the most common laptop (1366 × 638 of browser) "Simulate viewers" was cut off at the bottom of the right column and
   the library showed four entries. Only the space between and inside the panels shrinks; buttons keep their shared sizes. */
.studio-block-head button { min-height: var(--ctl); padding: calc(0.5rem * var(--d)) 1rem; }
.studio-block-body { padding: 0 1rem calc(1.1rem * var(--d)); }
.studio-block .studio-card-sub { margin: 0.2rem 0 calc(0.75rem * var(--d)); }
.studio-sim-groups { gap: calc(0.55rem * var(--d)); }
.studio-sim-group { gap: calc(0.45rem * var(--d)); }
.studio-lib-list { gap: calc(0.45rem * var(--d)); }
.studio-lib-item { gap: calc(0.75rem * var(--d)); padding: calc(0.45rem * var(--d)); }
/* the chat line and the viewer count keep their button beside the field in the narrow column (1280 wide) */
.studio-sim-chat input { flex-basis: 7rem; }
/* A very short window (laptops at 1280 × 590 of browser): the sentence under "Simulate events" goes, so every test
   button fits without scrolling the column; it only repeats what the heading says. */
@media (min-width: 62.01rem) and (max-height: 620px) { .studio-room[data-view="studio"] .studio-block[data-block="sim"] .studio-card-sub { display: none; } }
