/* Crowdvio-Avatar – Seite /avatar/ (mit Kopf-/Fußzeile der Webseite) und Stream-Fenster /avatar/stream/ */
.av-app {
  --av-line: #ffffff1c; --av-card: #111518; --av-muted: #a9ada8; --av-lime: #d1ff69; --av-top: 74px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); gap: 24px;
  max-width: 1480px; margin: 0 auto; padding: 20px clamp(12px, 3vw, 32px) 56px; box-sizing: border-box;
}
.av-app *, .av-app *::before, .av-app *::after { box-sizing: border-box; }

/* ---------- Bühne ---------- */
[data-bg="transparent"] .av-stage-wrap, [data-backdrop="transparent"] {
  --checker: conic-gradient(#22292e 25%, #171d21 0 50%, #22292e 0 75%, #171d21 0);
}
.av-stage-wrap {
  position: sticky; top: calc(var(--av-top) + 16px);
  height: calc(100vh - var(--av-top) - 40px); height: calc(100svh - var(--av-top) - 40px); min-height: 420px;
  display: grid; place-items: center; padding: 24px; overflow: hidden;
  border: 1px solid var(--av-line); border-radius: 28px;
  box-shadow: 0 30px 80px #0007, inset 0 1px 0 #ffffff12;
}
.av-stage-wrap, .av-backdrop-sample {
  background-color: var(--avatar-bg, transparent);
  background-image: var(--scene, var(--checker, none));
  background-position: center; background-size: cover;
}
body[data-bg="transparent"] .av-stage-wrap, [data-backdrop="transparent"] .av-backdrop-sample { background-size: 24px 24px; }
.av-stage { width: min(72vh, 100%); width: min(72svh, 100%); aspect-ratio: 1; transform: scale(var(--size, 1)); transform-origin: 50% 65%; transition: transform .2s; }
.av-stage-wrap[data-bust] .av-stage { align-self: end; translate: 0 14%; transform-origin: 50% 90%; }
.av-stage svg { width: 100%; height: 100%; overflow: visible; stroke: none; filter: var(--figure-shadow, drop-shadow(0 14px 16px #0006)); }
.av-stage-bar {
  position: absolute; left: 50%; bottom: 18px; translate: -50% 0; z-index: 2;
  display: flex; align-items: center; gap: 14px; padding: 8px 10px 8px 8px; border-radius: 999px;
  background: #090b0cc4; border: 1px solid #ffffff22; backdrop-filter: blur(14px);
}
.av-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #ffffff14; color: #f4f5f0; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.av-pill input { position: absolute; opacity: 0; pointer-events: none; }
.av-pill:has(input:checked) { background: var(--av-lime); color: #0b0e10; }
.av-pill:has(input:focus-visible) { outline: 2px solid var(--av-lime); outline-offset: 2px; }
.av-meter { width: 120px; height: 8px; border-radius: 6px; background: #ffffff1a; overflow: hidden; }
.av-meter span { display: block; height: 100%; width: calc(var(--level, 0) * 100%); background: linear-gradient(90deg, var(--av-lime), #ffd23f); transition: width .05s; }
.av-stream-start { display: none; }

/* ---------- Einstellungen ---------- */
.av-panel { display: grid; gap: 14px; align-content: start; min-width: 0; }
.av-intro { padding: 6px 4px 4px; }
.av-intro h1 { margin: 6px 0 8px; font-size: clamp(28px, 3vw, 40px); line-height: 1.05; letter-spacing: -.02em; }
.av-lead { margin: 0; color: var(--av-muted); }
.av-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.av-facts li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--av-line); background: #ffffff08; font-size: 13px; }
.av-step { padding: 18px; border: 1px solid var(--av-line); border-radius: 22px; background: var(--av-card); }
.av-step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 17px; letter-spacing: 0; text-transform: none; color: inherit; }
.av-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--av-lime); color: #0b0e10; font-size: 14px; font-weight: 700; flex: none; }
.av-scene-label { margin: 0 0 8px; color: var(--av-muted); font-size: .875rem; }
.av-scene-details { margin-top: 8px; border: 1px solid var(--av-line); border-radius: 12px; }
.av-scene-details summary { padding: 9px 12px; cursor: pointer; font-size: .875rem; }
.av-scene-details .av-backdrops { padding: 0 8px 8px; }
.av-backdrops { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.av-backdrop {
  display: grid; align-content: start; gap: 5px; padding: 4px 4px 7px;
  border: 1px solid var(--av-line); border-radius: 12px; color: inherit; background: #ffffff08;
  cursor: pointer; font: inherit; font-size: .8rem; line-height: 1.2; text-align: center;
}
.av-backdrop-sample { display: block; aspect-ratio: 2.15; border-radius: 8px; border: 1px solid #ffffff26; }
.av-backdrop span:last-child { overflow-wrap: anywhere; }
.av-backdrop:hover { border-color: #ffffff66; }
.av-backdrop[aria-pressed="true"] { border-color: var(--av-lime); background: #d1ff691b; color: var(--av-lime); }
.av-backdrop:focus-visible, .fig:focus-visible, .chip:focus-visible, .swatch:focus-visible { outline: 2px solid var(--av-lime); outline-offset: 2px; }
.av-figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-height: 470px; overflow: auto; padding: 2px; scrollbar-width: thin; }
.fig { display: grid; gap: 2px; padding: 6px 4px 7px; border-radius: 16px; border: 1px solid var(--av-line); background: #ffffff08; color: inherit; font: inherit; font-size: 12px; cursor: pointer; transition: transform .15s, border-color .15s; }
.fig:hover { border-color: #ffffff55; transform: translateY(-2px); }
.fig .figure { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.fig[aria-pressed="true"] { border-color: var(--av-lime); background: #d1ff6914; color: var(--av-lime); }
.fig[hidden] { display: none; }
.av-categories { margin-bottom: 10px; }
.av-style-filter { margin: 0 0 10px; }
.av-style-filter[hidden] { display: none; }
.figure[data-pixel-art], .figure[data-pixel-art] image, .figure[data-pixel-art] use { image-rendering: pixelated; }
.av-colors, .av-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.av-accessories { margin-top: 12px; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #ffffff30; background: var(--c); cursor: pointer; padding: 0; position: relative; overflow: hidden; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--av-lime); outline-offset: 2px; }
.swatch.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.chip { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--av-line); background: #ffffff08; color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--av-lime); color: var(--av-lime); background: #d1ff6912; }
.av-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; }
.av-field { display: grid; gap: 6px; margin-top: 12px; font-size: 14px; }
.av-field small { color: var(--av-muted); font-size: 12px; }
.av-app select, .av-app input[type=range] { width: 100%; accent-color: var(--av-lime); }
.av-app select { background: #0b0e10; color: inherit; border: 1px solid var(--av-line); border-radius: 12px; padding: 10px 12px; font: inherit; }
.av-app input[type=color] { width: 44px; height: 30px; border: 0; background: none; padding: 0; }
.av-mic, .av-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.av-actions { margin-top: 16px; }
.av-status { min-height: 22px; margin: 10px 0 0; color: var(--av-muted); font-size: 14px; }
.av-status.is-error { color: #ff8a7a; }
.av-help { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--av-line); border-radius: 14px; color: var(--av-muted); font-size: 14px; }
.av-help summary { color: #f4f5f0; cursor: pointer; font-weight: 600; }
.av-help b { color: #f4f5f0; }

/* ---------- Stream-Fenster: nur die Figur, ohne Seitenrahmen ---------- */
html[data-stream], html[data-stream] body { margin: 0; background: transparent; color: #f4f5f0; font-family: system-ui, sans-serif; }
html[data-stream] body[data-bg="transparent"] .av-stage-wrap { --checker: none; }
html[data-stream] .av-app { display: block; padding: 0; max-width: none; }
html[data-stream] .av-panel, html[data-stream] .av-stage-bar { display: none; }
html[data-stream] .av-stage-wrap { position: fixed; inset: 0; height: auto; min-height: 0; padding: 4vmin; border: 0; border-radius: 0; box-shadow: none; }
html[data-stream] .av-stage { width: min(92vmin, 100%); }
html[data-stream] .av-stream-start { display: block; position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; border: 0; background: #d1ff69; color: #0b0e10; font: 600 15px system-ui, sans-serif; cursor: pointer; }
html[data-stream] .av-stream-start[hidden] { display: none; }

@media (max-width: 960px) {
  .av-app { grid-template-columns: 1fr; gap: 14px; padding-top: 12px; }
  .av-stage-wrap { position: relative; top: 0; height: 52vh; height: 52svh; min-height: 300px; border-radius: 22px; }
  .av-stage { width: min(44vh, 100%); width: min(44svh, 100%); }
  .av-stage-bar { bottom: 12px; }
  .av-meter { width: 80px; }
  .av-figures { max-height: none; }
}
@media (max-width: 420px) {
  .av-step { padding: 14px; }
  .av-figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .av-stage, .fig { transition: none; } }

/* Gegen die allgemeinen Seitenregeln (clean.css: „main section {position:relative}“, „h2 span {background:none!important}“) */
main:not(.workspace) .av-app > .av-stage-wrap { position: sticky; }
main:not(.workspace) .av-app .av-step h2 .av-num { background: var(--av-lime) !important; color: #0b0e10 !important; -webkit-text-fill-color: #0b0e10 !important; }
@media (max-width: 960px) { main:not(.workspace) .av-app > .av-stage-wrap { position: relative; } }
