.overlay-window {
  position: relative;
  container-type: inline-size;
  color-scheme: dark;
  --capture-width: 760;
  --capture-height: 800;
  --capture-tabs: 61;
  background: #101010;
  border: 1px solid #433b55;
  border-radius: 15px;
  box-shadow: 0 30px 65px -28px #000, 0 0 34px -21px #8b5cf6;
  overflow: clip;
}

.overlay-header, .overlay-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.overlay-header {
  background: linear-gradient(105deg, #251e36, #18192c);
  border-bottom: 1px solid #3e3750;
}

.overlay-header img { border-radius: 6px; }
.overlay-title { min-width: 0; }
.overlay-title h2 { font-size: 0.88rem; }
.overlay-title p { font-size: 0.68rem; color: #c4bad7; line-height: 1.35; margin-top: 3px; }

.overlay-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 6px;
  margin-inline-start: auto;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid #5e5174;
  border-radius: 6px;
  color: #f4edff;
  font-size: 0.73rem;
  font-weight: 600;
}

.overlay-expand:hover { background: #302641; border-color: #a994ce; }
.overlay-expand .ico, .overlay-footer .ico { flex: none; width: 14px; height: 14px; color: #c6a9ff; }

.overlay-scroll {
  position: relative;
  overflow: auto;
  max-height: clamp(290px, 38vw, 448px);
  scrollbar-gutter: stable;
  background: #101010;
}

.overlay-scroll:focus-visible { outline-offset: -3px; z-index: 1; }
.overlay-native-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  overflow: hidden;
  aspect-ratio: var(--capture-width) / var(--capture-tabs);
  background: #101010;
  border-bottom: 1px solid #334058;
}

.overlay-native-tabs img, .overlay-screen img { display: block; width: 100%; height: auto; }
.overlay-native-tabs img { position: absolute; inset: 0 auto auto 0; }
.overlay-hotspots { position: absolute; inset: 0; pointer-events: none; }
.overlay-hotspots button {
  position: absolute;
  pointer-events: auto;
  padding: 0;
  border-radius: 3px;
}

.overlay-hotspots button:hover { background: #a2c8ff28; box-shadow: inset 0 0 0 1px #a8caffbf; }
.overlay-hotspots button:focus-visible { outline-offset: -2px; }
.overlay-window.is-ready .overlay-screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--capture-width) / calc(var(--capture-height) - var(--capture-tabs));
}

.overlay-window.is-ready .overlay-screen img { position: absolute; inset: auto 0 0; }

.overlay-native-mode {
  position: absolute;
  border-radius: 3px;
}

.overlay-native-mode:hover, .overlay-native-mode:focus-within {
  background: #a2c8ff28;
  box-shadow: inset 0 0 0 1px #a8caffbf;
}

.overlay-native-mode select { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.overlay-mobile-nav { display: none; }
.overlay-menu {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 8px;
  background: #131922;
}

.overlay-menu--secondary { border-top: 1px solid #283347; }
.overlay-modes { display: none; padding-top: 7px; padding-bottom: 7px; }
.overlay-menu button {
  min-height: 30px;
  padding: 3px 8px;
  color: #c6d4e7;
  background: #18243a;
  border: 1px solid #2d405d;
  border-radius: 5px;
  font-size: 0.73rem;
  font-weight: 600;
}

.overlay-menu button:hover { border-color: #85b5ef; }
.overlay-menu button[aria-selected="true"] {
  background: #234672;
  border-color: #689adb;
  color: #fff;
}

.overlay-footer {
  padding-block: 8px;
  border-top: 1px solid #3e3750;
  background: #171420;
  color: #c4bad7;
  font-size: 0.71rem;
  line-height: 1.35;
}

.overlay-footer [data-overlay-pan] { display: none; }
.overlay-footer [data-overlay-error] { color: #ffc6cb; }

.overlay-dialog {
  width: min(960px, calc(100% - 28px));
  max-width: none;
  max-height: calc(100% - 24px);
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--text);
}

.overlay-dialog::backdrop { background: #090710d9; }
.overlay-dialog .overlay-scroll { max-height: min(68dvh, 730px); }
.overlay-dialog .overlay-stage { min-width: calc(var(--capture-width) * 1px); }

@container (max-width: 760px) {
  .overlay-dialog .overlay-footer [data-overlay-pan] { display: block; }
  .overlay-dialog .overlay-footer #overlay-help { display: none; }
}

@container (max-width: 570px) {
  .overlay-native-tabs, .overlay-native-mode { display: none; }
  .overlay-mobile-nav { display: block; }
  .overlay-mobile-nav > .overlay-menu:first-child { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overlay-modes { display: flex; }
  .overlay-menu button { min-height: 37px; padding-inline: 6px; overflow-wrap: anywhere; }
  .overlay-scroll { max-height: 365px; }
  .overlay-dialog .overlay-scroll { max-height: min(55dvh, 520px); }
}
