:root {
  --demo-language-height: 42px;
  --demo-content-height: calc(100dvh - var(--demo-language-height));
}

.demo-language-bar {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--demo-language-height);
  padding-inline: 14px;
  border-bottom: 1px solid #283749;
  background: #101a29;
  color: #c7d4e5;
  font: 500 13px/1.2 "Avenir Next", "PingFang SC", sans-serif;
}

.demo-language-bar a { color: inherit; text-decoration: none; }
.demo-language-back:hover { text-decoration: underline; text-underline-offset: 3px; }
.demo-language-options { display: flex; gap: 2px; padding: 2px; border: 1px solid #344259; border-radius: 999px; }
.demo-language-options a { padding: 5px 10px; border-radius: 999px; font-size: 12px; }
.demo-language-options a:hover { background: #203049; }
.demo-language-options a[aria-current] { background: #d6e5fb; color: #102139; }
.demo-language-bar a:focus-visible { outline: 2px solid #95d9ef; outline-offset: 2px; }
.demo-language-error { margin: 24px; color: #f2f5ff; }

/* Account for the shared strip without covering the demos' native controls. */
[data-demo="aigc-eeg"] .research-shell,
[data-demo="aigc-eeg"] .research-sidebar,
[data-demo="aigc-eeg"] .research-workspace {
  height: var(--demo-content-height);
  min-height: 0;
}
[data-demo="aigc-eeg"] .research-workspace { grid-template-rows: auto minmax(0, 1fr); }
[data-demo="aigc-eeg"] .research-main { height: auto; }
[data-demo="aigc-eeg"] .research-topbar { min-height: 68px; flex-wrap: wrap; }
[data-demo="aigc-eeg"] .topbar-status,
[data-demo="aigc-eeg"] .topbar-controls { flex-wrap: wrap; }
[data-demo="diffscanauth"] #root > .min-h-screen { min-height: var(--demo-content-height); }
[data-demo="diffscanauth"] #root > div > .h-screen { height: var(--demo-content-height); }

/* The camera and gesture targets share viewport coordinates. Don't resize the stage. */
[data-demo="gesture-guitar-drum"] .demo-language-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 100;
  background: #101a29eb;
}
[data-demo="gesture-guitar-drum"] .top-gesture-bar { top: calc(16px + var(--demo-language-height)); }

@media (max-width: 980px) {
  [data-demo="aigc-eeg"] .research-sidebar { height: auto; max-height: min(37dvh, 18rem); }
  [data-demo="aigc-eeg"] .research-shell { grid-template-rows: auto minmax(0, 1fr); }
  [data-demo="aigc-eeg"] .research-workspace { height: auto; }

  [data-demo="diffscanauth"] #root > div > .h-screen { height: auto; min-height: var(--demo-content-height); }
  [data-demo="diffscanauth"] #root > div > .h-screen > header,
  [data-demo="diffscanauth"] #root > div > .h-screen > main { grid-template-columns: minmax(0, 1fr); }
  [data-demo="diffscanauth"] #root > div > .h-screen > header { height: auto; padding-block: 12px; }
  [data-demo="diffscanauth"] #root header > :last-child { flex-wrap: wrap; justify-content: flex-start; }
  [data-demo="diffscanauth"] #root main > section { min-width: 0; }
  [data-demo="diffscanauth"] #root main > section:first-child { height: clamp(25rem, 70dvh, 37rem); }
  [data-demo="diffscanauth"] #root main > section:first-child > div > :first-child { flex-wrap: wrap; }
}
