/* Retain the existing spatial carrier. No destination tiles or Home portal. */
body[data-shadow-carrier="matter-world-r1"] #shadow-matter-world .mw-top {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}
#shadow-matter-world .mw-top .shadow-global-menu-trigger { margin-left: auto; flex: 0 0 auto; }
#shadow-matter-world .mw-top .mw-truth { margin-left: auto; }
#shadow-matter-world .mw-top .mw-matter-anchor { min-width: 0; }
body[data-shadow-carrier="matter-world-r1"] #shadow-matter-world.mw-world.ls-enabled #mw-recovery.mw-recovery:not([hidden]) {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 20px 16px !important;
}
#shadow-account-settings {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  width: min(640px, 96vw);
  max-height: calc(100dvh - 56px);
  background: #101a24;
  color: #e5edf2;
}
#shadow-account-settings::backdrop { background: #050a116b; backdrop-filter: blur(2px); }
#shadow-spatial-preferences-r97 { display: block; margin: 24px 0; }
#shadow-spatial-preferences-r97[hidden] { display: none !important; }
#shadow-spatial-preferences-r97 section { border: 0; border-radius: 0; background: none; padding: 0; margin: 24px 0; }
#shadow-spatial-preferences-r97 label { display: block; margin: 20px 0 7px; font-size: 14px; }
#shadow-spatial-preferences-r97 input, #shadow-spatial-preferences-r97 select {
  width: 100%; min-height: 44px; color: inherit; background: #172939;
  border: 0; border-bottom: 1px solid #7f9caf; border-radius: 0;
  font: inherit; padding: 10px 12px;
}
#shadow-spatial-preferences-r97 p { font-size: 13px; line-height: 1.6; color: #b6c7d3; }
#shadow-spatial-preferences-r97 button { min-height: 44px; margin: 10px 12px 0 0; }
#shadow-spatial-preferences-r97 :focus-visible { outline: 2px solid #ebc88b; outline-offset: 4px; }
#shadow-matter-world .shadow-matter-selector-r97 {
  position: absolute; z-index: 65; top: 76px; bottom: 84px; left: 0;
  width: min(360px, 88vw); max-width: none; overflow: auto;
  display: flex; flex-direction: column; padding: 20px 24px;
  background: linear-gradient(90deg, #101a24 92%, #101a2400);
  border: 0; border-radius: 0; box-shadow: none; transform: none;
}
#shadow-matter-world .shadow-matter-selector-r97[hidden] { display: none !important; }
#shadow-matter-world .shadow-matter-selector-r97 .sw-matter-item {
  border: 0; border-bottom: 1px solid #8cabb540; border-radius: 0;
  box-shadow: none; background: transparent; min-height: 48px;
}
#shadow-matter-world .shadow-matter-selector-r97 .sw-matter-item:focus-visible,
#shadow-matter-world .shadow-matter-list-return-r97:focus-visible {
  outline: 2px solid var(--ls-gold, #ebc88b); outline-offset: 3px;
}
#shadow-matter-world .shadow-matter-list-return-r97 { min-height: 44px; margin-bottom: 18px; }
/* Semantic depth remains a continuous list of attached choices. */
#shadow-matter-world .mw-plane-grid, #shadow-matter-world .mw-subdepth-grid {
  display: flex; flex-direction: column; gap: 0;
}
#shadow-matter-world .mw-plane-grid > button, #shadow-matter-world .mw-subdepth-grid > button {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px;
  border: 0; border-bottom: 1px solid #8cabb52e; border-radius: 0;
  box-shadow: none; background: transparent; text-align: left;
  min-height: 48px; padding: 13px 0;
}
#shadow-matter-world .mw-plane-grid > button:focus-visible,
#shadow-matter-world .mw-subdepth-grid > button:focus-visible {
  outline: 2px solid var(--ls-gold, #ebc88b); outline-offset: 4px;
}
html[data-shadow-theme="light"] #shadow-account-settings { background: #edf1ed; color: #172d35; }
html[data-shadow-theme="light"] #shadow-spatial-preferences-r97 p { color: #405c65; }
html[data-shadow-theme="light"] #shadow-spatial-preferences-r97 input,
html[data-shadow-theme="light"] #shadow-spatial-preferences-r97 select { background: #e1e9e6; border-color: #536f7a; }
@media (prefers-color-scheme: light) {
  html[data-shadow-theme="system"] #shadow-account-settings { background: #edf1ed; color: #172d35; }
  html[data-shadow-theme="system"] #shadow-spatial-preferences-r97 p { color: #405c65; }
  html[data-shadow-theme="system"] #shadow-spatial-preferences-r97 input,
  html[data-shadow-theme="system"] #shadow-spatial-preferences-r97 select { background: #e1e9e6; border-color: #536f7a; }
}
@media (max-width: 600px) {
  #shadow-matter-world .mw-top { padding-left: 14px; padding-right: 14px; gap: 8px; }
  #shadow-matter-world .mw-top .mw-truth { max-width: 84px; font-size: 10px; white-space: normal; }
  #shadow-account-settings { max-height: calc(100dvh - 24px); padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  #shadow-account-settings, #shadow-spatial-preferences-r97 { scroll-behavior: auto; }
}
