/* LPM UI hierarchy. Explicit markers distinguish interface headings from authored
   article/notes HTML and the fixed player. Keep these rules in every shell so
   client-side navigation and full page loads have the same presentation. */
:root {
  --ui-page-size: 2rem;
  --ui-section-size: 1.375rem;
  --ui-card-size: 1.0625rem;
  --ui-heading-gap: 16px;
  --ui-section-gap: 32px;
  --ui-panel-padding: 24px;
}
[data-ui-heading] {
  color: #f3f7fc !important;
  font-family: inherit !important;
  font-weight: 750 !important;
  line-height: 1.3 !important;
  letter-spacing: -.02em !important;
  text-transform: none !important;
  overflow-wrap: anywhere;
  min-width: 0;
}
[data-ui-heading="page"] { font-size: var(--ui-page-size) !important; }
[data-ui-heading="section"] { font-size: var(--ui-section-size) !important; }
[data-ui-heading="card"] { font-size: var(--ui-card-size) !important; line-height: 1.4 !important; letter-spacing: -.01em !important; }
/* These are UI header containers, not rich-text heading selectors. The fallback
   covers dialogs/sections inserted by existing JS as well as server templates. */
:is(.surface-header,.mobile-section-head,.desktop-stream-section-head,.public-blog-section-head,.lpm-ce-followup-heading,.lpm-section-heading,.community-heading,.community-polls-heading,.poll-editor-header,.community-confirm,.trial-panel > header,.emergece-state) :is(h2,h3) {
  margin: 0 !important;
  font-size: var(--ui-section-size) !important;
  line-height: 1.3 !important;
  font-weight: 750 !important;
  letter-spacing: -.02em !important;
  text-transform: none !important;
  color: #f3f7fc !important;
}
:is(.page-header,.public-page-header) [data-ui-heading="page"] { margin: 0 !important; }
:is(.mobile-section-head,.desktop-stream-section-head,.public-blog-section-head,.lpm-ce-followup-heading,.lpm-section-heading) {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px !important;
  margin: 0 0 var(--ui-heading-gap) !important;
  min-width: 0;
}
:is(.mobile-section-head,.desktop-stream-section-head,.public-blog-section-head,.lpm-section-heading) > div { min-width: 0; }
:is(.mobile-section-head,.desktop-stream-section-head,.public-blog-section-head) > a,
.lpm-heading-action {
  font-family: inherit !important;
  font-size: .8125rem !important;
  font-weight: 650 !important;
  line-height: 1.4 !important;
  color: #80dff2 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}
.lpm-heading-action {
  appearance: none;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 6px;
  padding: 8px 4px !important;
  min-height: 36px;
  width: auto !important;
  flex: 0 0 auto;
  cursor: pointer;
}
.lpm-heading-action:hover { text-decoration: underline; }
.lpm-heading-action:focus-visible { outline: 2px solid #80dff2; outline-offset: 3px; }
.lpm-heading-action:disabled { opacity: .5; cursor: wait; }
.lpm-heading-with-action { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
/* Full-width subscription entries retain their panel, with the title outside. */
.home-subscriptions {
  width: 100%;
  min-width: 0;
  padding: 0 !important;
  margin: var(--ui-section-gap) 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.home-subscriptions > .home-subscriptions-panel {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,280px),1fr));
  padding: var(--ui-panel-padding);
  gap: 12px;
  border: 1px solid rgba(126,175,209,.18);
  border-radius: 22px;
  background: rgba(12,27,44,.7);
}
.lpm-resume-section { min-width: 0; margin: var(--ui-section-gap) 0; }
.lpm-resume-section .mobile-resume-feature { margin: 0 !important; }
:is(.mobile-listener-home,.desktop-stream-home) :is(.mobile-app-section,.desktop-stream-section,.lpm-ce-followup) {
  margin-top: var(--ui-section-gap) !important;
}
/* Shared backend panels use one inset; nested editors and player controls retain
   their own geometry. No overflow, fixed height, or scroll locking is introduced. */
.app-content .surface > .surface-header { padding: 20px var(--ui-panel-padding); gap: 16px; flex-wrap: wrap; }
.app-content .surface > .surface-body { padding: var(--ui-panel-padding); }
.app-content .surface > .surface-footer { padding: 16px var(--ui-panel-padding); }
.app-content .surface-header > div { min-width: 0; }
@media (max-width: 760px) {
  :root { --ui-page-size: 1.625rem; --ui-section-size: 1.25rem; --ui-card-size: 1rem; --ui-heading-gap: 14px; --ui-section-gap: 26px; --ui-panel-padding: 18px; }
  .home-subscriptions > .home-subscriptions-panel { grid-template-columns: minmax(0,1fr); }
  .lpm-heading-action { min-height: 44px; }
}

/* Community headings are built by JS, so style their stable containers too. */
.community-heading,.community-polls-heading { margin-bottom: var(--ui-heading-gap) !important; }
.poll-question { font-size: var(--ui-card-size) !important; font-weight: 750 !important; line-height: 1.4 !important; letter-spacing: -.01em !important; }

/* Homepage alignment · 0.20.183. Match the established episode-rail gutters.
   Mobile already receives its gutter from .mobile-listener-home. */
.lpm-heading-with-action { flex: 1 1 auto; }
.lpm-heading-with-action > .lpm-heading-action { margin-left: auto; }
@media (min-width: 1181px) {
  body.desktop-listener-app .desktop-stream-home {
    --home-content-gutter: 48px;
  }
  body.desktop-listener-app .desktop-stream-home > :is(.lpm-discovery-hero,.home-subscriptions,.desktop-stream-section,[data-ce-followup-slot="desktop"]) {
    box-sizing: border-box;
    width: calc(100% - var(--home-content-gutter) * 2) !important;
    max-width: none;
    margin-left: var(--home-content-gutter) !important;
    margin-right: var(--home-content-gutter) !important;
  }
  body.desktop-listener-app .desktop-stream-home > :is(.home-subscriptions,.desktop-stream-section,[data-ce-followup-slot="desktop"]) {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  body.desktop-listener-app .desktop-stream-home :is(.lpm-section-heading,.desktop-stream-section-head,.lpm-ce-followup-heading) {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body.desktop-listener-app .desktop-stream-home > .lpm-discovery-hero {
    margin-top: var(--ui-section-gap);
  }
}
@media (min-width: 1181px) and (max-width: 1280px) {
  body.desktop-listener-app .desktop-stream-home { --home-content-gutter: 32px; }
}
