.b3d:has([data-studio]),
.b3e-aside:has([data-studio]) {
  --studio-ink: #29251f;
  --studio-muted: #665d51;
  --studio-line: #e4dacb;
  --studio-paper: #fffcf7;
  --studio-gold: #886033;
}

.b3d:has([data-studio]) .b3d-wrap,
.b3e-aside:has([data-studio]) .b3e-card {
  background: var(--studio-paper);
  border: 1px solid var(--studio-line);
  border-radius: 20px;
  box-shadow: 0 9px 34px #39291b12;
  color: var(--studio-ink);
}

.b3d:has([data-studio]) .b3d-head h1 { color: var(--studio-ink); }
.b3d:has([data-studio]) .b3d-head p,
.b3d:has([data-studio]) :is(.b3d-spec,.b3d-fine),
.b3e-aside:has([data-studio]) :is(.b3e-ttl,.b3e-spec,.b3e-fine) { color: var(--studio-muted); }
.b3d:has([data-studio]) :is(.b3d-bar,.b3d-fine) {
  background: var(--studio-paper);
  border-color: var(--studio-line);
}
.b3d:has([data-studio]) .b3d-quote {
  background: #2f2922;
  color: #fffaf0 !important;
  border-radius: 12px;
  box-shadow: none;
}
.b3e-aside:has([data-studio]) .b3e-bar { border-color: var(--studio-line); }
.b3e-aside:has([data-studio]) .b3e-ttl {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .03em;
  text-transform: none;
}
.b3e-aside:has([data-studio]) .b3e-toggle {
  min-height: 44px;
  background: #fff;
  border-color: var(--studio-line);
  color: var(--studio-ink);
}

.b3x-stage[data-studio] {
  touch-action: auto;
  overscroll-behavior: auto;
}
.b3x-stage[data-studio][data-bg="studio"] {
  background: radial-gradient(ellipse at 51% 34%, #fffdf7 0, #f4efe7 68%, #ece4d9 100%);
}
.b3d-stage.b3x-stage[data-studio] { height: clamp(410px, 64vh, 650px); min-height: 0; }
.b3e-stage.b3x-stage[data-studio] { height: clamp(370px, calc(100vh - 345px), 540px); min-height: 0; }
.b3x-stage[data-studio] .b3x-poster {
  inset: 5% 4% 11%;
  width: 92%;
  height: 84%;
  object-fit: contain;
  mask-image: radial-gradient(ellipse at center, #000 48%, #0000 76%);
}
.b3x-stage[data-studio] .b3x-status {
  font-size: 13px;
  color: #51473d;
  letter-spacing: normal;
  text-transform: none;
}
.b3e-stage[data-studio] .b3e-na { background: #f4efe7; color: #51473d; }

.b3x-stage[data-studio]:not([data-bg="black"]) .b3x-ui {
  --fg: #29251f;
  --mut: #665d51;
  --glass: #fffcf5f5;
  --glass2: #fffcf7;
  --line: #ded4c7;
  --hov: #eee6d9;
  --trk: #cfc3b3;
  --gold: #886033;
  --act: #ead8b9;
  --sh: 0 5px 20px #3e2a1617;
}
[data-studio] .b3x-studio-nav {
  position: absolute;
  inset: 12px 12px auto;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  z-index: 3;
}
[data-studio] .b3x-studio-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--glass);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
[data-studio] .b3x-studio-btn[aria-expanded="true"] { background: var(--act); }
[data-studio] .b3x-studio-btn svg { width: 17px; height: 17px; }
[data-studio] .b3x-studio-play {
  justify-content: center;
  min-width: 44px;
  background: var(--act);
}
[data-studio] .b3x-studio-play:not(.is-playing) svg:nth-child(2),
[data-studio] .b3x-studio-play.is-playing svg:first-child { display: none; }
[data-studio] .b3x-studio-play[hidden] { display: none; }
@container b3x (max-width: 315px) {
  [data-studio] .b3x-studio-nav { gap: 5px; }
  [data-studio] .b3x-studio-btn { padding-inline: 8px; }
  [data-studio] .b3x-studio-play span { display: none; }
}
[data-studio] .b3x-dock {
  bottom: 12px;
  display: flex;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 5px 12px 5px 5px;
  border-radius: 15px;
  z-index: 2;
}
[data-studio] .b3x-open { min-height: 44px; }
[data-studio] #b3xOpenBtn {
  background: #29251f;
  color: #fffaf2;
  border-color: #29251f;
  border-radius: 10px;
  min-height: 44px;
  white-space: nowrap;
}
[data-studio] .b3x-slider { width: clamp(76px, 26cqw, 174px); min-width: 0; }
[data-studio] .b3x-slider input { height: 24px; }
[data-studio] :is(.b3x-zoom,.b3x-bg) { display: none; }
[data-studio] .b3x-tools-open .b3x-dock :is(.b3x-zoom,.b3x-bg) {
  display: flex;
  position: absolute;
  bottom: calc(100% + 8px);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
}
[data-studio] .b3x-zoom { left: 0; }
[data-studio] .b3x-bg { right: 0; }
[data-studio] .b3x-bg button { min-width: 32px; min-height: 40px; }

[data-studio] .b3x-rail {
  display: none;
  top: 66px;
  right: auto;
  left: 12px;
  transform: none;
  padding: 3px;
  border-radius: 12px;
  z-index: 4;
}
[data-studio] .b3x-right { right: 12px; left: auto; }
[data-studio] .b3x-tools-open .b3x-rail { display: flex; }
[data-studio] .b3x-rail .b3x-ib { width: 44px; height: 44px; }
[data-studio] .b3x-fly:is(.l,.r),
[data-studio] .b3x-fly:is(#b3xP-art,#b3xP-paper) {
  top: 64px;
  bottom: 70px;
  right: 12px !important;
  left: auto !important;
  width: min(350px, calc(100% - 24px));
  height: fit-content;
  max-height: calc(100% - 142px);
  transform: none;
  border-radius: 12px;
  z-index: 5;
  touch-action: pan-y;
  overscroll-behavior: contain;
}
[data-studio] .b3x-fly .b3x-x { min-width: 36px; min-height: 36px; }
[data-studio] .b3x-fly button { touch-action: manipulation; }
[data-studio] .b3x-crrow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 8px 2px;
  cursor: pointer;
}
[data-studio] .b3x-crrow input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--gold); }
[data-studio] .b3x-crrow small { display: block; }
[data-studio] #b3xCrLam { width: 100%; min-height: 44px; margin: 3px 0 8px; color: #29251f; background: #fff; }
[data-studio] #b3xCrOk { min-height: 44px; }
[data-studio] .b3x-demo {
  top: auto;
  bottom: 74px;
  max-width: calc(100% - 36px);
  padding: 4px 10px;
  color: var(--fg);
  background: var(--glass);
  border: 1px solid var(--line);
}
[data-studio] :is(.b3x-tools-open,.b3x-has-fly) .b3x-demo { display: none; }

@media (max-width: 900px) {
  .b3d-stage.b3x-stage[data-studio] { height: clamp(340px, 96vw, 535px); }
  .b3e-stage.b3x-stage[data-studio] { height: clamp(320px, 85vw, 460px); }
  .b3d:has([data-studio]) .b3d-bar { gap: 9px; padding: 12px 14px; }
  .b3e-aside:has([data-studio]) .b3e-bar { padding: 5px 12px; }
}
@container b3x (max-width: 560px) {
  [data-studio] .b3x-rail { flex-direction: row; flex-wrap: wrap; max-width: calc(100% - 24px); }
  [data-studio] .b3x-right { top: 117px; left: 12px; right: auto; }
  [data-studio] .b3x-fly:is(.l,.r),
  [data-studio] .b3x-fly:is(#b3xP-art,#b3xP-paper) {
    top: auto;
    bottom: 66px;
    max-height: calc(100% - 128px);
    width: calc(100% - 24px);
  }
  [data-studio] .b3x-fly :is(.b3x-cta,.b3x-artbtns button) { min-height: 44px; }
  [data-studio] .b3x-demo { font-size: 11px; }
}
.b3e-aside:has([data-studio]) .b3e-finishes {
  background: #f7f0e4;
  border-top: 1px solid var(--studio-line);
  color: #56401f;
  font-size: 12px;
  padding: 9px 12px;
}
[data-studio] .b3x-studio-btn:hover { background: var(--hov); }
[data-studio] .b3x-crfilm { display: block; color: var(--mut); font-size: 12px; }
@media (max-width: 768px) {
  body:has([data-studio] .b3x-has-fly) .wa-float { visibility: hidden; }
}
