:root {
  color-scheme: dark;
  --bg: #090909;
  --line: #66636a;
  --mint: #baffca;
  --violet: #bc9cf4;
  --rail: 246px;
  font: 15px/1.35 "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: #f5f3f6;
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, a { color: inherit; }
button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}
a { text-decoration: none; }
button:hover, a:hover { background: #26222c; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: -3px; }
[hidden] { display: none !important; }

.lab {
  display: grid;
  grid-template: 44px minmax(0,1fr) / var(--rail) minmax(0,1fr);
  height: 100vh;
  height: 100dvh;
  border: 1px solid var(--line);
}
.lab.collapsed { --rail: 42px; }
.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
}
.brand {
  display: grid;
  grid-auto-flow: column;
  place-content: center;
  gap: .65ch;
  padding: 0 16px;
  width: 245px;
  flex: none;
  border-right: 1px solid var(--line);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -.06em;
  white-space: nowrap;
}
.brand strong, h1 span:first-child, .medium, nav small { color: var(--mint); }
h1 {
  align-self: center;
  min-width: 0;
  margin: 0 16px;
  font-size: clamp(.88rem, 1.7vw, 1.35rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
h1 span:first-child { margin-right: .6em; }
.controls { display: flex; align-items: stretch; margin-left: auto; }
.medium { align-self: center; padding: 0 14px; font-size: .88rem; }
.controls button, #toggle {
  border-left: 1px solid var(--line);
  width: 42px;
  font-size: 1.45rem;
  padding: 0;
}
.sidebar { min-height: 0; overflow: auto; border-right: 1px solid var(--line); }
.sidebar-heading {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  height: 34px;
  border-bottom: 1px solid var(--line);
}
#index-title {
  align-self: center;
  padding-left: 13px;
  font-size: .875rem;
  text-transform: uppercase;
}
.collapsed #index-title { display: none; }
.collapsed #toggle { border-left: 0; }
nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
  text-transform: uppercase;
  font-weight: 600;
  font-size: .93rem;
}
nav a[aria-current] { background: #211b2a; border-left-color: var(--violet); }
nav small { display: block; font-size: .875rem; }
nav img {
  display: block;
  flex: none;
  object-fit: cover;
  background: #24261c;
  border: 1px solid var(--line);
}
#stage { position: relative; min-width: 0; min-height: 0; background: #181a13; }
iframe { display: block; border: 0; width: 100%; height: 100%; }
.immersive #stage { position: fixed; inset: 0; z-index: 1; }
.immersive .topbar > :not(.controls), .immersive .controls > :not(#fullscreen), .immersive .sidebar {
  visibility: hidden;
}
.immersive #fullscreen {
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 2;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--bg);
}

@media (max-width: 650px) {
  .lab, .lab.collapsed { grid-template: 44px auto minmax(0,1fr) / minmax(0,1fr); }
  .brand { width: auto; padding: 0 9px; font-size: 1rem; }
  h1 { margin: 0 8px; }
  h1 span:first-child, .medium { display: none; }
  .controls button { width: 36px; }
  .sidebar { border-right: 0; max-height: 25dvh; border-bottom: 1px solid var(--line); }
  .collapsed #index-title { display: block; }
  nav { display: flex; overflow-x: auto; }
  nav a { min-height: 54px; flex: 0 0 auto; border-bottom: 0; }
  nav img { width: 60px; height: 36px; }
}
