/* Existing applications adapted to the shared DeX window interior. */
/* The titlebar identifies the app. Its work area begins with useful content. */
body[data-dex-mode="only"] .dex-window :is(.sx-view, .sw-view) {
  width: 100%;
  max-width: none;
  min-height: 0;
  margin: 0;
  padding: 0;
}

/* Settings: persistent side rail and work surface. */
body[data-dex-mode="only"] .dex-window:is([data-app="settings"], [data-app="about"]) .sx-view {
  display: flex;
  flex-direction: column;
  height: 100%;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] #screen-settings {
  padding: 0 !important;
  overflow: hidden;
  scrollbar-gutter: auto;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-view.sx-settings {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-head {
  display: none;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-head {
  flex: none;
  align-items: center;
  min-height: 24px;
  margin: 0 0 10px;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-head :is(.sx-eyebrow, h1, p) {
  display: none;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-status {
  margin: 0 0 0 auto;
  color: #a8bbd2;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-layout {
  flex: 1;
  min-height: 0;
  border-radius: 8px;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-layout {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  margin: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  overflow: hidden;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-nav {
  display: block;
  min-height: 0;
  margin: 0;
  padding: 13px 8px 16px;
  border-right: 1px solid rgba(209, 224, 245, .13);
  overflow: auto;
  background: rgba(42, 47, 56, .72);
  scrollbar-width: thin;
  scrollbar-color: rgba(202, 220, 244, .2) transparent;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-nav button {
  position: relative;
  min-height: 35px;
  margin: 2px 0;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  color: #c7d1de;
  font-size: 12px;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-nav button:hover {
  background: rgba(201, 217, 239, .11);
  color: #f1f5fb;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-nav button.is-selected {
  border: 0;
  background: rgba(188, 206, 234, .16);
  color: #f4f7fc;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-content {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 19px 23px 16px;
  border: 0;
  border-radius: 0;
  overflow: auto;
  box-shadow: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(210, 227, 250, .25) transparent;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-rows {
  display: block;
  border-top: 1px solid rgba(211, 226, 246, .15);
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-section h2 {
  margin: 0 0 5px;
  font-size: 23px;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-section>p {
  margin-bottom: 18px;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-setting-row {
  align-items: center;
  flex-direction: row;
  gap: 16px;
  padding: 15px 0;
  border-top: 0;
  border-bottom: 1px solid rgba(211, 226, 246, .15);
  font-size: 13px;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-setting-row p {
  margin-top: 4px;
  color: #aab8c9;
  font-size: 11px;
}
body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-bottom {
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  padding-top: 13px;
  border-top: 1px solid rgba(211, 226, 246, .15);
}

/* Memory, Center, and About also inherit the window scale. */
body[data-dex-mode="only"] .dex-window:is([data-app="memory"], [data-app="center"]) .sw-view {
  min-height: 0;
  padding: 0;
}
body[data-dex-mode="only"] .dex-window .sw-heading { margin-bottom: 15px; }
body[data-dex-mode="only"] .dex-window .sw-heading h1 {
  font-size: 26px;
  margin-top: 3px;
}
body[data-dex-mode="only"] .dex-window .sw-memory-frame,
body[data-dex-mode="only"] .dex-window .sw-queue,
body[data-dex-mode="only"] .dex-window .sw-project-frame,
body[data-dex-mode="only"] .dex-window .sw-events-list {
  border-radius: 8px;
  background: rgba(22, 32, 47, .79);
  box-shadow: inset 0 1px rgba(219, 234, 253, .05);
}
body[data-dex-mode="only"] .dex-window .sw-memory-frame { min-height: 330px; }
body[data-dex-mode="only"] .dex-window .sw-center-grid { gap: 12px; }
body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-head {
  margin-bottom: 13px;
}
body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-head h1 {
  font-size: 26px;
  margin: 0 0 3px;
}
body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-eyebrow { display: none; }
body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-about-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-about .sx-panel {
  min-height: 0;
  padding: 16px;
  border-radius: 8px;
  background: rgba(43, 58, 77, .49);
}
body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-about h2 { font-size: 18px; }
body[data-dex-mode="only"] .dex-window[data-app="access"] .sx-access {
  min-height: 100%;
  padding: 43px 24px;
  background: transparent;
}
body[data-dex-mode="only"] .dex-window[data-app="access"] :is(.sx-access-top, .sx-access-foot) {
  left: 20px;
  right: 20px;
}
body[data-dex-mode="only"] .dex-window[data-app="access"] .sx-access-top { top: 16px; }
body[data-dex-mode="only"] .dex-window[data-app="access"] .sx-access-foot { bottom: 14px; }
body[data-dex-mode="only"] .dex-window[data-app="access"] .sx-access-card {
  width: min(420px, 100%);
  padding: 24px 27px;
  border-radius: 9px;
  background: rgba(22, 32, 47, .89);
}
body[data-dex-mode="only"] .dex-window[data-app="access"] .sx-access-symbol {
  margin-bottom: 13px;
}
body[data-dex-mode="only"] .dex-window[data-app="access"] .sx-access h1 {
  margin: 5px 0 7px;
  font-size: 26px;
}
body[data-dex-mode="only"] .dex-window[data-app="access"] .sx-access p { margin-bottom: 17px; }

/* Window width, not the browser viewport, determines the app's composition. */
@container (max-width: 800px) {
  body[data-dex-mode="only"] .dex-window[data-app="center"] .sw-center-grid {
    grid-template-columns: 1fr;
  }
  body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container (max-width: 620px) {
  body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-layout {
    display: flex;
    flex-direction: column;
  }
  body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-nav {
    display: flex;
    flex: none;
    gap: 3px;
    padding: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--sx-line);
    overflow-x: auto;
  }
  body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-nav button {
    flex: none;
    width: auto;
    min-width: 110px;
    margin: 0;
    padding: 8px;
  }
  body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-settings-content {
    flex: 1;
    padding: 17px;
  }
  body[data-dex-mode="only"] .dex-window[data-app="settings"] .sx-setting-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  body[data-dex-mode="only"] .dex-window[data-app="memory"] .sw-memory-frame,
  body[data-dex-mode="only"] .dex-window[data-app="center"] .sw-queue-content,
  body[data-dex-mode="only"] .dex-window[data-app="center"] .sw-project-frame {
    grid-template-columns: 1fr;
  }
  body[data-dex-mode="only"] .dex-window[data-app="about"] .sx-about-grid {
    grid-template-columns: 1fr;
  }
}
