/* Circle workspace chrome. Match the compact panel breakpoint in responsive
   browsers as well as devices classified as phones. Other pages keep their navigation. */
html[data-candao-device="phone"] body:has(:is([data-feed-workspace],[data-circle-brain])) {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  --mobile-bottom-nav-height: 0px !important;
}
html[data-candao-device="phone"] body:has(:is([data-feed-workspace],[data-circle-brain])) > :is(.topbar,.sidebar,.mobile-app-topbar),
html[data-candao-device="phone"] body:has(:is([data-feed-workspace],[data-circle-brain])) :is(#mobile-offer-topbar,.mobile-shell-topbar,#candao-primary-nav,nav.bottom-nav,.mobile-shell-bottom-nav) {
  display: none !important;
}
html[data-candao-device="phone"] body:has(:is([data-feed-workspace],[data-circle-brain])) .main:has(:is([data-feed-workspace],[data-circle-brain])) {
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top,0px) !important;
  padding-bottom: env(safe-area-inset-bottom,0px) !important;
}
html[data-candao-device="phone"] body:has([data-circle-brain]) .main:has(:is([data-feed-workspace],[data-circle-brain])) { padding: 0 !important; }
html[data-candao-device="phone"] body .circle-brain {
  inset: 0 !important;
  height: auto !important;
  padding: env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);
}
html[data-candao-device="phone"] .circle-brain [data-brain-reader-max],
html[data-candao-device="phone"] .circle-brain .brain-reader__provenance:has(> .brain-thought-context:only-child) { display: none !important; }

/* Responsive emulation must use the same Circle layout as a real phone. */
@media (max-width: 1120px) {
  body:has(:is([data-feed-workspace],[data-circle-brain])) {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    --mobile-bottom-nav-height: 0px !important;
  }
  body:has(:is([data-feed-workspace],[data-circle-brain])) > :is(.topbar,.sidebar,.mobile-app-topbar),
  body:has(:is([data-feed-workspace],[data-circle-brain])) :is(#mobile-offer-topbar,.mobile-shell-topbar,#candao-primary-nav,nav.bottom-nav,.mobile-shell-bottom-nav) {
    display: none !important;
  }
  body:has(:is([data-feed-workspace],[data-circle-brain])) .main:has(:is([data-feed-workspace],[data-circle-brain])) {
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 100dvh;
    padding-top: env(safe-area-inset-top,0px) !important;
    padding-bottom: env(safe-area-inset-bottom,0px) !important;
  }
  body:has([data-circle-brain]) .main:has(:is([data-feed-workspace],[data-circle-brain])) { padding: 0 !important; }
  body .circle-brain {
    inset: 0 !important;
    height: auto !important;
    padding: env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px);
  }
  .circle-brain [data-brain-reader-max],
  .circle-brain .brain-reader__provenance:has(> .brain-thought-context:only-child) { display: none !important; }
}

/* Circle pages keep the navigation rail free of social and marketing links. */
body:has(:is([data-feed-workspace],[data-circle-brain])) .sidebar .sidebar-bottom { display: none !important; }

/* The title and anatomical icon form one keyboard/native-navigation link. */
[data-feed-workspace] .workspace-brain-title .workspace-brain-entry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  height: auto;
  width: auto;
  flex: 0 1 auto;
  min-width: 0;
  padding: 4px 8px;
  box-sizing: border-box;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
}
[data-feed-workspace] .workspace-brain-entry > h2 { margin: 0; }
[data-feed-workspace] .workspace-brain-entry > .brain-anatomy { flex: 0 0 24px; }
[data-feed-workspace] .workspace-brain-entry::after {
  content: "›";
  font: 22px/1 system-ui,sans-serif;
  color: currentColor;
  opacity: .7;
  margin-inline-start: 2px;
}
[data-feed-workspace] .workspace-brain-entry:hover > h2 { text-decoration: underline; text-underline-offset: 3px; }
[data-feed-workspace] .workspace-brain-entry:focus-visible { outline: 2px solid #8b7aeb; outline-offset: 3px; }
[data-feed-workspace] .workspace-brain-title { position: relative; }
[data-feed-workspace] .workspace-brain-entry-hint {
  position: absolute;
  inset-inline-start: 40px;
  top: -2px;
  margin: 0;
  white-space: nowrap;
  font-size: 10px;
  line-height: 12px;
  color: var(--workspace-muted,#737b91);
  pointer-events: none;
}
[data-feed-workspace] .workspace-brain-entry-hint [aria-hidden="true"] {
  display: inline-block;
  animation: brain-entry-arrow 1.1s ease-in-out .3s 3;
}
[data-feed-workspace] .workspace-brain-entry-hint[hidden] { display: none !important; }
@keyframes brain-entry-arrow { 0%,100% { transform: translateX(0); } 50% { transform: translateX(-3px); } }
@media (prefers-reduced-motion: reduce) {
  [data-feed-workspace] .workspace-brain-entry-hint [aria-hidden="true"] { animation: none; }
}

/* The shared offer app bar reserves64px with an ID-specific important rule. */
html[data-candao-device="phone"] body:has(#mobile-offer-topbar) .main:has(:is([data-feed-workspace],[data-circle-brain])) { margin-top:0 !important; }
@media (max-width:1120px) {
  body:has(#mobile-offer-topbar) .main:has(:is([data-feed-workspace],[data-circle-brain])) { margin-top:0 !important; }
}

/* Match the shared offer bar by ID so its mobile grid rule cannot reappear. */
html[data-candao-device="phone"] body:has(:is([data-feed-workspace],[data-circle-brain])) #mobile-offer-topbar { display:none !important; }
@media (max-width:1120px) {
  html body:has(:is([data-feed-workspace],[data-circle-brain])) #mobile-offer-topbar { display:none !important; }
}
