/* BBBS desktop workspace: layout-only evolution of the existing theme.
   Keep the banners, background illustrations and community palettes in place.
   Only apply the master/detail layout where the shared feed is present. */

@media (min-width: 1181px) {
  #app-shell.shell {
    box-sizing: border-box;
    max-width: 1680px;
    padding-inline: clamp(14px, 1.5vw, 28px);
    grid-template-columns: 164px minmax(0, 1fr) 234px;
    column-gap: clamp(13px, 1.2vw, 21px);
    margin-top: 18px;
    align-items: start;
  }
  /* A slim, scrollable navigation region rather than a broad text sidebar. */
  #app-shell #community-navigation.col-left {
    top: 86px;
    max-height: calc(100dvh - 106px);
    padding: 12px 9px 16px;
    border-radius: 22px;
    border: 1px solid #ffffff7a;
    border-right: 1px solid #4b546c;
    gap: 0;
    scrollbar-width: thin;
  }
  #app-shell #community-navigation > .sidebar-primary a,
  #app-shell #community-navigation .sidebar-links a {
    min-height: 38px;
    padding: 7px 8px;
    font-size: .76rem;
    line-height: 1.2;
    border-radius: 12px;
  }
  #app-shell #community-navigation .sidebar-group > summary { padding-inline: 6px; }
  #app-shell #community-navigation > .sidebar-primary::before { margin-bottom: 5px; font-size: .69rem; }
  #app-shell #community-navigation .sidenav .ui-icon,
  #app-shell #community-navigation .sidebar-resources .ui-icon { flex: 0 0 auto; }
  #app-shell #community-navigation .sidebar-links .category-icon { width: 25px; height: 25px; padding: 4px; }
  #app-shell > .col-main { min-width: 0; padding: 0; }
  #app-shell > .col-right {
    min-width: 0;
    padding-left: 0;
    border-left: 0;
    gap: 14px;
    top: 86px;
  }
  #app-shell > .col-right > .side-card {
    padding: 17px;
    border-radius: 20px;
    box-shadow: 0 6px 22px #2732480d;
  }
  #app-shell .col-main > .community-header { border-radius: 21px; }
  #app-shell .col-main .category-banner { border-radius: 21px; }
  /* The feed toolbar and original banner remain above both reading columns. */
  #app-shell .feed-experience { min-width: 0; }
  #app-shell .feed-experience .feed-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 13px;
  }
  #app-shell .feed-experience .feed-toolbar > .feed-composer {
    flex: 1 1 300px;
    min-width: 0;
    margin-bottom: 0;
  }
  #app-shell .feed-experience .feed-toolbar > .no-composer { flex: 1 1 300px; margin-bottom: 0; }
  #app-shell .feed-experience .feed-toolbar > .feed-tabs { flex: none; margin-bottom: 0; }
  #app-shell .feed-reading-layout {
    display: grid;
    grid-template-columns: minmax(250px, .74fr) minmax(320px, 1.26fr);
    gap: clamp(12px, 1.15vw, 19px);
    align-items: start;
    min-width: 0;
  }
  #app-shell .feed-reading-panel,
  #app-shell .feed-focus-pane { min-width: 0; }
  #app-shell .feed-reading-panel {
    position: sticky;
    top: 86px;
    max-height: calc(100dvh - 102px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1px 4px 4px 1px;
    scrollbar-width: thin;
  }
  #app-shell .feed-focus-pane {
    position: sticky;
    top: 86px;
    max-height: calc(100dvh - 102px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1px 2px 5px 1px;
    scrollbar-width: thin;
  }
  #app-shell .feed-reading-panel .post-list { display: flex; flex-direction: column; gap: 9px; border: 0; }
  #app-shell .feed-reading-panel .post-list .post-card,
  body[data-category] #app-shell .feed-reading-panel .post-list .post-card {
    position: relative;
    margin: 0;
    padding: 15px;
    border: 1px solid #ffffffd9;
    border-radius: 19px;
    background: #fffdf9f2;
    box-shadow: 0 4px 14px #39435b0b;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  }
  #app-shell .feed-reading-panel .post-list .post-card:hover {
    background: #ffffff;
    box-shadow: 0 7px 22px #39435b16;
  }
  #app-shell .feed-reading-panel .post-list .post-card:focus-visible {
    outline: 2px solid var(--board-accent, #c3943b);
    outline-offset: -2px;
  }
  #app-shell .feed-reading-panel .post-list .post-card.is-selected {
    border-color: #dcb878;
    background: #fffaf0;
    box-shadow: inset 3px 0 #dfaf4d, 0 6px 17px #39435b12;
  }
  body[data-category] #app-shell .post-list .post-card.is-selected {
    border-color: var(--board-line);
    background: var(--board-surface);
    box-shadow: inset 3px 0 var(--board-accent), 0 6px 17px #39435b12;
  }
  #app-shell .feed-reading-panel .post-head { gap: 9px; margin-bottom: 8px; }
  #app-shell .feed-reading-panel .post-head .avatar { width: 38px; height: 38px; border-radius: 12px; }
  #app-shell .feed-reading-panel .post-head .author { font-size: .81rem; }
  #app-shell .feed-reading-panel .post-head .published-time { display: block; margin: 2px 0 0; font-size: .68rem; }
  #app-shell .feed-reading-panel .post-title { font-size: .96rem; line-height: 1.46; margin: 8px 0; }
  #app-shell .feed-reading-panel .post-list .post-card :is(.post-media, .post-tags, .post-actions, .feed-replies, .read-discussion, .post-title, .feed-preview-select) { display: none !important; }
  #app-shell .feed-reading-panel .feed-list-title { margin: 9px 0 6px; font-size: .94rem; line-height: 1.42; }
  #app-shell .feed-reading-panel .feed-list-title button {
    width: 100%; padding: 0; border: 0; background: none;
    text-align: left; color: inherit; font: inherit; font-weight: 750;
    cursor: pointer; overflow-wrap: anywhere;
  }
  #app-shell .feed-reading-panel .feed-list-title button:hover { color: var(--board-accent, #805d30); }
  #app-shell .feed-reading-panel .feed-list-title button:focus-visible { outline: 2px solid var(--board-accent, #d6a345); outline-offset: 3px; border-radius: 3px; }
  #app-shell .feed-reading-panel .post-list .post-card .feed-excerpt {
    display: block !important;
    margin: 0;
    max-height: 4.3em;
    overflow: hidden;
    font-size: .77rem;
    line-height: 1.55;
    color: var(--muted);
    -webkit-line-clamp: unset;
  }
  #app-shell .feed-reading-panel .feed-excerpt :is(p, h1, h2, h3, h4, blockquote, li, ul, ol) {
    margin: 0; padding: 0; font-size: inherit; line-height: inherit; font-weight: 400;
  }
  #app-shell .feed-reading-panel .feed-excerpt :is(img, picture, figure, iframe, video) { display: none !important; }
  #app-shell .feed-focus-article {
    padding: clamp(20px, 2.2vw, 33px);
    margin: 0;
    min-height: min(600px, calc(100dvh - 108px));
    border: 1px solid #ffffffef;
    border-radius: 24px;
    background: #fffdfafa;
    box-shadow: 0 10px 30px #27324814, inset 0 1px #fff;
  }
  #app-shell .feed-focus-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e8e5de;
    font-size: .75rem;
  }
  #app-shell .feed-focus-kicker { color: #937344; font-weight: 800; letter-spacing: .035em; }
  #app-shell .feed-focus-open { color: #646b7e; white-space: nowrap; }
  #app-shell .feed-focus-author { margin-bottom: 20px; }
  #app-shell .feed-focus-title { margin-bottom: 20px; font-size: clamp(1.2rem, 1.6vw, 1.65rem); }
  #app-shell .feed-focus-body { font-size: .95rem; line-height: 1.92; min-height: 140px; overflow-wrap: anywhere; }
  #app-shell .feed-focus-body img { max-width: 100%; height: auto; }
  #app-shell .feed-focus-article .post-media { margin-top: 14px; }
  #app-shell .feed-focus-article .post-tags { margin-top: 14px; }
  #app-shell .feed-focus-actions { margin-top: 22px; padding-top: 14px; border-top: 1px solid #e8e5de; flex-wrap: wrap; }
  #app-shell .feed-focus-discussion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 45px;
    margin-top: 22px;
    padding: 11px 15px;
    border-radius: 14px;
    background: #f6e8c9;
    color: #544327;
    font-size: .84rem;
    font-weight: 750;
    text-decoration: none;
  }
  #app-shell .feed-focus-discussion:hover { background: #f2dba8; text-decoration: none; }
  #app-shell .feed-focus-comments {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #e9e2d7;
  }
  #app-shell .feed-focus-comments-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 4px;
  }
  #app-shell .feed-focus-comments-heading h3 {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 1rem;
  }
  #app-shell .feed-focus-comment {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    padding: 16px 0;
    border-bottom: 1px solid #eee8dd;
    min-width: 0;
  }
  #app-shell .feed-focus-comment-avatar .avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
  }
  #app-shell .feed-focus-comment-content { min-width: 0; }
  #app-shell .feed-focus-comment-meta {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px 10px;
  }
  #app-shell .feed-focus-comment-meta .author { font-size: .83rem; }
  #app-shell .feed-focus-comment-parent { margin: 5px 0; }
  #app-shell .feed-focus-comment-body {
    display: block;
    max-height: none;
    min-height: 0;
    margin: 7px 0 5px;
    overflow: visible;
    overflow-wrap: anywhere;
    -webkit-line-clamp: unset;
    font-size: .85rem;
    line-height: 1.72;
  }
  #app-shell .feed-focus-comment-body :is(img, video, iframe) { max-width: 100%; }
  #app-shell .feed-focus-comment-reply { font-size: .75rem; color: #7f6b4c; }
  #app-shell .feed-focus-comments-status { padding: 12px 0; }
  body[data-category] #app-shell .feed-focus-discussion { background: var(--board-soft); color: var(--board-accent); }
  #app-shell .feed-focus-empty { min-height: 350px; display: grid; place-content: center; text-align: center; border-radius: 24px; }
  #app-shell .feed-focus-empty > span { color: #d5aa58; font-size: 2rem; }
  #app-shell .feed-focus-empty h2 { font-size: 1.1rem; margin: 10px 0 4px; }
  #app-shell .feed-focus-empty p { max-width: 270px; font-size: .82rem; color: var(--muted); }
}
@media (max-width: 1180px) {
  .feed-list-title { display: none !important; }
  .feed-reading-layout { display: block; }
  .feed-focus-pane { display: none !important; }
  .feed-preview-select { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  #app-shell .feed-reading-panel .post-card { transition: none; }
}


/* 2026-11 BBBS unified community reading workspace.
   Follow the approved compact four-lane mockup without replacing artwork or
   adding unsupported sorting, recommendation or social features. */
@media (min-width: 1181px) {
  body[data-layout="reader"] {
    --reader-cream: #fffdf8;
    --reader-border: #e5dbc9;
    --reader-ink: #31313b;
    --reader-honey: #e7b44b;
  }

  body[data-layout="reader"] .topbar-inner {
    max-width: 1740px;
    min-height: 58px;
    padding-top: 7px;
    padding-bottom: 7px;
    gap: 16px;
  }
  body[data-layout="reader"] .topbar-search { max-width: 760px; }

  /* One workspace envelope: a consistent 8px panel gutter, not floating tiles. */
  body[data-layout="reader"] #app-shell.shell {
    box-sizing: border-box;
    max-width: 1740px;
    display: grid;
    grid-template-columns: clamp(150px, 12.1vw, 194px) minmax(0, 1fr) clamp(218px, 17vw, 264px);
    column-gap: 8px;
    align-items: start;
    margin: 9px auto 0;
    padding: 8px;
    border: 1px solid #fffef5cf;
    border-radius: 19px;
    background: #fff9f0a8;
    box-shadow: 0 8px 34px #3c332b12;
  }
  body[data-layout="reader"] #app-shell > .col-main { min-width: 0; padding: 0; }

  /* Left navigation remains a single dark, stable rail. */
  body[data-layout="reader"] #app-shell #community-navigation.col-left {
    top: 75px;
    max-height: calc(100dvh - 89px);
    margin: 0;
    padding: 12px 10px 15px;
    border: 1px solid #4c536a;
    border-radius: 13px;
    box-shadow: 0 3px 9px #1f2b3b14, inset 0 1px #ffffff24;
  }
  body[data-layout="reader"] #app-shell #community-navigation > .sidebar-primary {
    gap: 1px;
    padding-bottom: 11px;
    margin-bottom: 3px;
  }
  body[data-layout="reader"] #app-shell #community-navigation > .sidebar-primary a,
  body[data-layout="reader"] #app-shell #community-navigation .sidebar-links a {
    min-height: 33px;
    padding: 6px 8px;
    border-radius: 9px;
    font-size: .78rem;
    line-height: 1.25;
  }
  body[data-layout="reader"] #app-shell #community-navigation > .sidebar-primary::before {
    margin: 0 0 4px;
    font-size: .7rem;
  }
  body[data-layout="reader"] #app-shell #community-navigation > .sidebar-group { padding: 7px 0; }
  body[data-layout="reader"] #app-shell #community-navigation .sidebar-group > summary {
    padding: 5px 6px 7px;
    font-size: .73rem;
  }
  body[data-layout="reader"] #app-shell #community-navigation .sidebar-links { gap: 1px; }
  body[data-layout="reader"] #app-shell #community-navigation .sidebar-links .category-icon {
    width: 25px;
    height: 25px;
    padding: 4px;
  }

  /* Banner belongs to the central two columns, preserving the existing scene. */
  body[data-layout="reader"][data-view="category"] #app-shell .category-banner {
    height: 112px;
    min-height: 112px;
    padding: 0;
    margin: 0 0 8px;
    overflow: hidden;
    border: 1px solid #f8eed9;
    border-radius: 13px;
    background: #fff8e5;
    box-shadow: none;
  }
  body[data-layout="reader"][data-view="category"] #app-shell .category-banner-content { display: none; }
  body[data-layout="reader"][data-view="category"] #app-shell .category-banner::before {
    background: linear-gradient(90deg, #fff8e12c, transparent 48%);
  }
  body[data-layout="reader"][data-view="category"] #app-shell .category-banner-art {
    object-fit: cover;
    object-position: center 46%;
  }

  /* Homepage keeps both its welcome illustration and real community stats. */
  body[data-layout="reader"][data-view="home"] #app-shell .col-main > .community-header {
    min-height: 78px;
    padding: 10px 14px;
    margin: 0 0 8px;
    border: 1px solid #fff7e6d9;
    border-radius: 13px;
  }
  body[data-layout="reader"][data-view="home"] #app-shell .community-emblem {
    width: 50px;
    height: 50px;
  }
  body[data-layout="reader"][data-view="home"] #app-shell .community-header h1 { font-size: 1.34rem; }
  body[data-layout="reader"][data-view="home"] #app-shell .community-stats {
    margin-bottom: 8px;
    padding: 9px 14px;
    border-radius: 13px;
  }
  body[data-layout="reader"][data-view="home"] #app-shell .community-counter dd { font-size: 1.05rem; }

  /* Second and third lanes are two continuous, equal-height application panes. */
  body[data-layout="reader"] #app-shell .feed-experience { min-width: 0; }
  body[data-layout="reader"] #app-shell .feed-reading-layout {
    display: grid;
    grid-template-columns: minmax(270px, .74fr) minmax(340px, 1.26fr);
    gap: 8px;
    align-items: start;
    min-width: 0;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel,
  body[data-layout="reader"] #app-shell .feed-focus-pane {
    box-sizing: border-box;
    position: sticky;
    top: 75px;
    width: 100%;
    min-width: 0;
    min-height: clamp(510px, calc(100dvh - 207px), 870px);
    max-height: clamp(510px, calc(100dvh - 207px), 870px);
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    border: 1px solid var(--reader-border);
    border-radius: 13px;
    background: #fffdf8f5;
    box-shadow: 0 2px 10px #463b310a;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel { background: #fffaf3f9; }

  /* The list heading and navigation modes are part of the list, not floating above the columns. */
  body[data-layout="reader"] #app-shell .feed-list-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 9px;
    padding: 13px 15px 12px;
    border-bottom: 1px solid var(--reader-border);
    background: linear-gradient(135deg, #fffdf8, #fff8eaf0);
  }
  body[data-layout="reader"] #app-shell .feed-list-heading-copy { min-width: 0; }
  body[data-layout="reader"] #app-shell .feed-list-eyebrow {
    display: block;
    margin-bottom: 3px;
    color: #998364;
    font-size: .64rem;
    font-weight: 750;
    letter-spacing: .06em;
  }
  body[data-layout="reader"] #app-shell .feed-list-heading h2 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--board-accent, #745323);
  }
  body[data-layout="reader"] #app-shell .feed-list-heading p {
    margin: 3px 0 0;
    color: #81776b;
    line-height: 1.45;
    font-size: .69rem;
  }
  body[data-layout="reader"] #app-shell .feed-list-compose-shortcut {
    flex: none;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid #e8d6ab;
    border-radius: 10px;
    background: #fff2cb;
    color: #805d22;
  }
  body[data-layout="reader"] #app-shell .feed-list-compose-shortcut .ui-icon { width: 17px; height: 17px; }
  body[data-layout="reader"] #app-shell .feed-list-compose-shortcut:hover { background: #ffe9a6; }

  body[data-layout="reader"] #app-shell .feed-experience .feed-toolbar {
    display: block;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--reader-border);
    background: #fffdf7f5;
  }
  body[data-layout="reader"] #app-shell .feed-toolbar > .feed-composer:not([open]),
  body[data-layout="reader"] #app-shell .feed-toolbar > .no-composer { display: none !important; }
  body[data-layout="reader"] #app-shell .feed-toolbar > .feed-composer[open] {
    display: block;
    margin: 7px 9px;
  }
  body[data-layout="reader"] #app-shell .feed-experience .feed-toolbar .feed-tabs,
  body[data-layout="reader"][data-category] #app-shell .feed-experience .feed-toolbar .feed-tabs {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    gap: 2px;
    margin: 0;
    padding: 4px 7px;
    border: 0;
    border-radius: 0;
    background: transparent !important;
  }
  body[data-layout="reader"] #app-shell .feed-toolbar .feed-tabs a,
  body[data-layout="reader"][data-category] #app-shell .feed-toolbar .feed-tabs a {
    display: inline-flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    min-height: 33px;
    margin: 0;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: #67625f;
    transform: none;
    font-size: .77rem;
  }
  body[data-layout="reader"] #app-shell .feed-toolbar .feed-tabs a.active,
  body[data-layout="reader"][data-category] #app-shell .feed-toolbar .feed-tabs a.active {
    border: 0;
    background: var(--board-soft, #ffe7aa) !important;
    box-shadow: inset 0 -2px var(--board-accent, #bf8e2e);
    color: var(--board-accent, #6c5020);
    font-weight: 800;
  }
  body[data-layout="reader"] #app-shell .feed-toolbar .feed-tabs a.active::after { display: none; }

  /* Compact mail-style topic list: touching rows, clear separators and selection. */
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 0;
    margin: 0;
    padding: 0;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-list .post-card,
  body[data-layout="reader"][data-category] #app-shell .feed-reading-panel .post-list .post-card {
    display: grid;
    grid-template-columns: 1fr auto;
    align-content: start;
    gap: 1px 7px;
    min-width: 0;
    min-height: 105px;
    margin: 0;
    padding: 10px 12px 11px 14px;
    border: 0;
    border-bottom: 1px solid #e9e1d5;
    border-left: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-list .post-card:hover {
    background: #fff4df;
    box-shadow: none;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-list .post-card.is-selected,
  body[data-layout="reader"][data-category] #app-shell .feed-reading-panel .post-list .post-card.is-selected {
    border-left-color: var(--board-accent, #c3943b);
    border-bottom-color: #e9d29a;
    background: var(--board-soft, #fff0c8);
    box-shadow: inset 0 0 0 1px #f6e0b0;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-head {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
    margin: 0 0 3px;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-head .avatar {
    width: 33px;
    height: 33px;
    border-radius: 9px;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-head .author {
    display: inline-block;
    max-width: 100%;
    font-size: .74rem;
    font-weight: 700;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-head .published-time {
    display: inline-block;
    margin: 0 0 0 5px;
    font-size: .64rem;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-head .chip {
    display: inline-block;
    padding: 2px 6px;
    font-size: .62rem;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .feed-list-title {
    grid-column: 1 / -1;
    min-width: 0;
    margin: 0 0 1px;
    line-height: 1.4;
    font-size: .82rem;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .feed-list-title button {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-width: 100%;
    overflow: hidden;
    line-height: 1.4;
    color: var(--reader-ink);
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .post-list .post-card .feed-excerpt {
    grid-column: 1;
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    max-height: 2.8em;
    font-size: .69rem;
    line-height: 1.45;
    color: #807872;
    overflow: hidden;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .feed-list-comment-count {
    display: inline-flex;
    grid-column: 2;
    align-items: center;
    align-self: end;
    justify-self: end;
    gap: 4px;
    white-space: nowrap;
    color: #9b8a72;
    font-size: .7rem;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .feed-list-comment-count {
    grid-column: 1 / -1;
    justify-self: start;
    align-self: center;
    gap: 5px;
    min-height: 25px;
    margin-top: 5px;
    padding: 4px 8px;
    border: 1px solid #e7dfd3;
    border-radius: 9px;
    background: #f5f2eb;
    color: #827d74;
    font-size: .71rem;
    font-weight: 650;
    text-decoration: none;
    line-height: 1.25;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .feed-list-comment-count.has-comments {
    color: var(--board-accent, #816024);
    border-color: var(--board-line, #eddaac);
    background: var(--board-soft, #fff0c8);
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .feed-list-comment-count:hover {
    border-color: var(--board-accent, #b69242);
    text-decoration: underline;
  }
  body[data-layout="reader"] #app-shell .feed-reading-panel .feed-list-comment-count:focus-visible {
    outline: 2px solid var(--board-accent, #c69f43);
    outline-offset: 2px;
  }
  body[data-layout="reader"] #app-shell .feed-list-comment-count .ui-icon {
    width: 14px;
    height: 14px;
  }

  /* The third lane reads like a single uninterrupted article surface. */
  body[data-layout="reader"] #app-shell .feed-focus-article,
  body[data-layout="reader"][data-category] #app-shell .feed-focus-article {
    margin: 0;
    min-height: 100%;
    padding: clamp(20px, 2vw, 32px);
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  body[data-layout="reader"] #app-shell .feed-focus-topline {
    margin-bottom: 21px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9e2d7;
  }
  body[data-layout="reader"] #app-shell .feed-focus-author { margin-bottom: 17px; }
  body[data-layout="reader"] #app-shell .feed-focus-title {
    margin: 16px 0 19px;
    font-size: clamp(1.23rem, 1.55vw, 1.62rem);
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  body[data-layout="reader"] #app-shell .feed-focus-body {
    min-height: 100px;
    font-size: .9rem;
    line-height: 1.78;
  }
  body[data-layout="reader"] #app-shell .feed-focus-actions {
    margin-top: 24px;
    padding-top: 14px;
  }
  body[data-layout="reader"] #app-shell .feed-focus-discussion {
    min-height: 42px;
    padding: 9px 12px;
    margin-top: 16px;
    border-radius: 11px;
  }
  body[data-layout="reader"] #app-shell .feed-focus-empty {
    margin: 0;
    min-height: 350px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  /* Dense, aligned utility stack. Use only the existing live account and topics. */
  body[data-layout="reader"] #app-shell > .col-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  body[data-layout="reader"] #app-shell > .col-right > .side-card {
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 13px 13px 14px;
    border: 1px solid var(--reader-border);
    border-radius: 13px;
    background: #fffdf8f4;
    box-shadow: 0 2px 10px #40352c0c;
  }
  body[data-layout="reader"] #app-shell > .col-right > .account-card {
    border-color: #cce6d9;
    background: #f3fcf6f7;
  }
  body[data-layout="reader"] #app-shell > .col-right > .trending-card {
    background: #fffaf3f7;
  }
  body[data-layout="reader"] #app-shell > .col-right > .resources-card {
    background: #f4f9fcf7;
  }
  body[data-layout="reader"] #app-shell > .col-right > .community-card {
    background: #faf7fff7;
  }
  body[data-layout="reader"] #app-shell .col-right > .side-card > .side-title {
    margin-bottom: 8px;
    font-size: .82rem;
  }
  body[data-layout="reader"] #app-shell .col-right .account-stats {
    margin-top: 8px;
    padding: 7px 0;
  }
  body[data-layout="reader"] #app-shell .col-right .account-links { gap: 5px; }
  body[data-layout="reader"] #app-shell .col-right .account-links-human a {
    min-height: 50px;
    padding: 6px 2px;
    font-size: .7rem;
  }
  body[data-layout="reader"] #app-shell .col-right .trending-card .sidebar-links a {
    min-height: 31px;
    padding: 5px 6px;
    font-size: .71rem;
  }
  body[data-layout="reader"] #app-shell > .col-right .resources-card .sidebar-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
  }
  body[data-layout="reader"] #app-shell > .col-right .resources-card .sidebar-links a {
    min-height: 34px;
    gap: 5px;
    padding: 5px 4px;
    font-size: .68rem;
  }
  body[data-layout="reader"] #app-shell .col-right .community-card .plain-list li {
    margin-bottom: 5px;
    padding-bottom: 5px;
    font-size: .7rem;
    line-height: 1.55;
  }
}
/* Preserve original phone/tablet composer, feed cards, navigation drawer,
   category hero content and full-width scrolling. */
@media (max-width: 1180px) {
  .feed-list-heading, .feed-list-comment-count { display: none !important; }
}
@media (prefers-reduced-transparency: reduce) and (min-width: 1181px) {
  body[data-layout="reader"] #app-shell.shell { background: #faf7f0; }
  body[data-layout="reader"] #app-shell .feed-reading-panel,
  body[data-layout="reader"] #app-shell .feed-focus-pane,
  body[data-layout="reader"] #app-shell > .col-right > .side-card { background-color: #fffdf8; }
}


/* Posts have one shared reader; no separate-open button or detail page layout. */
.feed-focus-back { display: none; }
.feed-focus-comment-form, .feed-focus-reply-form, .feed-focus-edit-form { margin: 12px 0 18px; }
.feed-focus-comment-form textarea, .feed-focus-reply-form textarea, .feed-focus-edit-form textarea { width: 100%; min-height: 75px; }
.feed-focus-reply-form { margin-top: 10px; }
.feed-focus-comment-form .composer-meta, .feed-focus-reply-form .composer-meta { justify-content: flex-end; margin-top: 6px; }
.feed-focus-comment-reply, .feed-reading-panel .post-title button {
  padding: 0; border: 0; color: inherit; background: transparent; font: inherit; cursor: pointer;
}
.feed-reading-panel .post-title button { text-align: left; font-weight: 700; }
.feed-focus-discussion { cursor: pointer; border: 0; width: 100%; }
.feed-list-comment-count, .read-discussion, .reply-thread-link { cursor: pointer; border: 0; background: transparent; }
@media (max-width: 1180px) {
  .feed-experience.is-reading-detail .feed-reading-panel { display: none !important; }
  #app-shell .feed-experience.is-reading-detail .feed-focus-pane {
    display: block !important; position: static; overflow: visible;
    max-height: none; width: 100%; padding: 0;
  }
  #app-shell .feed-experience.is-reading-detail .feed-focus-article {
    min-height: 0; margin: 0; padding: clamp(14px, 3vw, 23px);
    border-radius: 16px; background: #fffdfa;
  }
  /* Keep the return control at the outer right edge of the mobile reader header. */
  #app-shell .feed-experience.is-reading-detail .feed-focus-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }
  #app-shell .feed-experience.is-reading-detail .feed-focus-topline .feed-focus-kicker {
    min-width: 0;
  }
  #app-shell .feed-experience.is-reading-detail .feed-focus-topline .feed-focus-back {
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
    white-space: nowrap;
  }
  .feed-experience.is-reading-detail .feed-focus-back { display: inline-flex; }
  .feed-experience.is-reading-detail .feed-focus-comment { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 9px; padding: 14px 0; }
  .feed-experience.is-reading-detail .feed-focus-comment-avatar .avatar { width: 36px; height: 36px; }
  .feed-experience.is-reading-detail .feed-focus-comment-content { min-width: 0; }
  .feed-experience.is-reading-detail .feed-focus-comment-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; }
  .feed-experience.is-reading-detail .feed-focus-comment-body { overflow-wrap: anywhere; }
}

/* Conversation identity and newest message share one compact row. */
body[data-view="messages"] .dm-thread-link { display: flex; align-items: flex-start; gap: 12px; min-width: 0; color: inherit; }
body[data-view="messages"] .dm-thread-avatar { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 12px; object-fit: cover; image-rendering: pixelated; background: #e4e9ec; }
body[data-view="messages"] .dm-thread-content { flex: 1; min-width: 0; }
body[data-view="messages"] .dm-thread-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; min-width: 0; }
body[data-view="messages"] .dm-thread-head strong { overflow-wrap: anywhere; }
body[data-view="messages"] .dm-thread-time { margin-left: auto; }
body[data-view="messages"] .dm-thread-preview { margin: 7px 0 2px; color: #566178; font-size: .92rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
body[data-view="messages"] .dm-thread-item.unread .dm-thread-preview { color: #303951; font-weight: 600; }
@media (max-width: 720px) {
  body[data-view="messages"] .dm-thread-avatar { flex-basis: 44px; width: 44px; height: 44px; }
}

/* Private conversation: compact chat-app layout, scoped to this page. */
body[data-view="conversation"] .dm-chat-shell {
  overflow: hidden;
  border: 1px solid #e8ddca;
  border-radius: 17px;
  background: #fffdf9;
  box-shadow: 0 4px 14px #34395910;
}
body[data-view="conversation"] .dm-chat-header {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 74px;
  padding: 12px 20px;
  border-bottom: 1px solid #e8ddca;
  background: #fff9ed;
}
body[data-view="conversation"] .dm-chat-back {
  flex: none;
  padding: 7px 12px;
  border: 1px solid #e8ddca;
  border-radius: 10px;
  background: #fff;
  color: #46506c;
  font-size: .82rem;
  font-weight: 600;
}
body[data-view="conversation"] .dm-chat-back:hover { background: #f7efe1; text-decoration: none; }
body[data-view="conversation"] .dm-chat-peer { display: flex; align-items: center; gap: 10px; min-width: 0; }
body[data-view="conversation"] .dm-chat-peer img,
body[data-view="conversation"] .dm-chat-avatar {
  display: block;
  flex: none;
  border-radius: 12px;
  object-fit: cover;
  image-rendering: pixelated;
  background: #e4e9ec;
}
body[data-view="conversation"] .dm-chat-peer-text { display: grid; min-width: 0; line-height: 1.3; }
body[data-view="conversation"] .dm-chat-peer-text strong { overflow-wrap: anywhere; color: #343959; }
body[data-view="conversation"] .dm-chat-peer-text span { margin-top: 3px; color: #7b7a82; font-size: .72rem; }
body[data-view="conversation"] .dm-chat-content { min-width: 0; }
body[data-view="conversation"] .message-list.dm-chat-history {
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: clamp(280px, 56dvh, 660px);
  max-height: none;
  margin: 0;
  padding: 24px 22px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fbf8f2;
}
body[data-view="conversation"] .dm-chat-message {
  display: flex;
  align-items: flex-end;
  gap: 11px;
  width: 100%;
  min-width: 0;
}
body[data-view="conversation"] .dm-chat-message.mine {
  flex-direction: row-reverse;
  /* The global .message-row.mine uses flex-end, which reverses the layout here. */
  justify-content: flex-start;
}
body[data-view="conversation"] .dm-chat-avatar-link { flex: 0 0 40px; align-self: flex-end; }
body[data-view="conversation"] .dm-chat-avatar { width: 40px; height: 40px; }
body[data-view="conversation"] .dm-chat-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(76%, 650px);
  min-width: 0;
}
body[data-view="conversation"] .dm-chat-message.mine .dm-chat-stack { align-items: flex-end; }
body[data-view="conversation"] .dm-chat-bubble {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 11px 14px;
  border: 1px solid #e7dccd;
  border-radius: 15px 15px 15px 4px;
  background: #fff;
  color: #343959;
  box-shadow: 0 2px 7px #3439590d;
  overflow-wrap: anywhere;
}
body[data-view="conversation"] .dm-chat-message.mine .dm-chat-bubble {
  border-color: #c5deb8;
  border-radius: 15px 15px 4px 15px;
  background: #e3f3d8;
}
body[data-view="conversation"] .dm-chat-bubble .msg-body { min-width: 0; overflow-wrap: anywhere; }
body[data-view="conversation"] .dm-chat-bubble .msg-body > :first-child { margin-top: 0; }
body[data-view="conversation"] .dm-chat-bubble .msg-body > :last-child { margin-bottom: 0; }
body[data-view="conversation"] .dm-chat-bubble img,
body[data-view="conversation"] .dm-chat-bubble video { max-width: 100%; height: auto; }
body[data-view="conversation"] .dm-chat-bubble pre { max-width: 100%; overflow-x: auto; }
body[data-view="conversation"] .dm-chat-time {
  margin-top: 5px;
  color: #7b7e8d;
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
body[data-view="conversation"] .dm-chat-composer {
  margin: 0;
  padding: 14px 18px 16px;
  border: 0;
  border-top: 1px solid #e8ddca;
  border-radius: 0;
  box-shadow: none;
  background: #fffdf9;
}
body[data-view="conversation"] .dm-chat-composer .composer-meta { justify-content: space-between; }
body[data-view="conversation"] .dm-chat-composer .btn { min-width: 90px; }
@media (max-width: 720px) {
  body[data-view="conversation"] .dm-chat-shell { border-radius: 13px; }
  body[data-view="conversation"] .dm-chat-header { min-height: 65px; padding: 10px 12px; gap: 10px; }
  body[data-view="conversation"] .dm-chat-back { padding: 6px 9px; }
  body[data-view="conversation"] .dm-chat-peer img { width: 36px; height: 36px; }
  body[data-view="conversation"] .message-list.dm-chat-history { height: clamp(300px, 55dvh, 600px); padding: 16px 10px; gap: 15px; }
  body[data-view="conversation"] .dm-chat-message { gap: 7px; }
  body[data-view="conversation"] .dm-chat-avatar-link { flex-basis: 34px; }
  body[data-view="conversation"] .dm-chat-avatar { width: 34px; height: 34px; border-radius: 10px; }
  body[data-view="conversation"] .dm-chat-stack { max-width: calc(100% - 41px); }
  body[data-view="conversation"] .dm-chat-bubble { padding: 10px 11px; font-size: .9rem; }
  body[data-view="conversation"] .dm-chat-composer { padding: 12px 10px; }
}


/* Compact author persona capsules in the post reader; keep the full set visible. */
#app-shell .post-author-persona-tags {
  margin: 4px 0 3px;
  gap: 4px;
}
#app-shell .post-author-persona-tags .chip {
  font-size: .66rem;
  line-height: 1.45;
  padding: 1px 7px;
  margin: 0;
}

/* Post readers expose other persona categories only when requested. */
#app-shell .post-author-persona-expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid #d9d3e3;
  border-radius: 7px;
  background: #f7f5fa;
  color: #615a79;
  cursor: pointer;
}
#app-shell .post-author-persona-expand:hover {
  background: #eeebf5;
  border-color: #bbb2cf;
}
#app-shell .post-author-persona-expand:focus-visible {
  outline: 2px solid #665b98;
  outline-offset: 2px;
}
#app-shell .post-author-persona-expand svg {
  width: 13px;
  height: 13px;
  transition: transform .15s ease;
}
#app-shell .post-author-persona-expand[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
@media (prefers-reduced-motion: reduce) {
  #app-shell .post-author-persona-expand svg { transition: none; }
}

/* Compact author actions remain beside the nickname, above persona chips. */
#app-shell .reader-author-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; min-width: 0; }
#app-shell .reader-author-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; min-width: 0; }
#app-shell .reader-author-action { display: inline-flex; align-items: center; justify-content: center; gap: 3px; min-height: 23px; padding: 2px 7px; border: 1px solid #d7d1e1; border-radius: 7px; background: #f7f5fc; color: #555172; font: inherit; font-size: .67rem; font-weight: 700; line-height: 1.35; text-decoration: none; cursor: pointer; }
#app-shell .reader-author-action:hover { background: #ebe7f7; color: #39345e; text-decoration: none; }
#app-shell .reader-author-action[aria-pressed="true"] { background: #e9f3e3; border-color: #bbd5b0; color: #35653b; }
#app-shell .reader-author-action:disabled { opacity: .6; cursor: wait; }
#app-shell .reader-author-action:focus-visible { outline: 2px solid #6a5b9c; outline-offset: 2px; }
#app-shell .reader-author-action .ui-icon { width: 12px; height: 12px; }
#app-shell .reader-author-action-error { color: #ac3649; font-size: .69rem; }

/* Reddit-style reply branches: shared by the main reader and activity reader.
   Child comments stay grouped under the comment they reply to. */
#app-shell .feed-focus-comment-list {
  --thread-step: clamp(13px, 1.3vw, 19px);
  --thread-line: #d2d3d3;
  display: block;
  min-width: 0;
  margin-top: 12px;
}
#app-shell .feed-focus-comment-list .feed-focus-comment {
  position: relative;
  min-width: 0;
  margin: 0 0 0 calc(var(--comment-level, 0) * var(--thread-step));
  padding: 12px 0 13px;
  border-bottom: 1px solid #ede7dc;
  background: transparent;
}
#app-shell .feed-focus-comment-list .feed-focus-comment.is-thread-reply {
  padding-left: 12px;
  border-left: 2px solid var(--thread-line);
}
#app-shell .feed-focus-comment-list .feed-focus-comment.is-thread-reply::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 0;
  width: 10px;
  border-top: 2px solid var(--thread-line);
}
#app-shell .feed-focus-comment-list .feed-focus-comment.is-thread-root:not(:first-child) {
  margin-top: 8px;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-avatar .avatar {
  width: 34px;
  height: 34px;
}
#app-shell .feed-focus-comment-list .feed-focus-comment {
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 9px;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-parent {
  margin: 3px 0 0;
  font-size: .69rem;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-parent a {
  color: var(--board-accent, #80612b);
  text-decoration: none;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-parent a:hover {
  text-decoration: underline;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-body {
  margin: 5px 0 7px;
  min-width: 0;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-reply,
#app-shell .feed-focus-comment-list .feed-focus-thread-toggle {
  min-height: 26px;
  padding: 3px 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #78664f;
  font: inherit;
  font-size: .72rem;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-reply:hover,
#app-shell .feed-focus-comment-list .feed-focus-thread-toggle:hover {
  background: #f6ecd8;
  color: #59462b;
}
#app-shell .feed-focus-comment-list .feed-focus-comment-reply:disabled {
  opacity: .5;
  cursor: not-allowed;
}
@media (max-width: 720px) {
  #app-shell .feed-focus-comment-list { --thread-step: 11px; }
  #app-shell .feed-focus-comment-list .feed-focus-comment {
    grid-template-columns: 30px minmax(0, 1fr);
    column-gap: 7px;
    padding-top: 11px;
  }
  #app-shell .feed-focus-comment-list .feed-focus-comment.is-thread-reply {
    padding-left: 7px;
  }
  #app-shell .feed-focus-comment-list .feed-focus-comment-avatar .avatar {
    width: 30px;
    height: 30px;
  }
  #app-shell .feed-focus-comment-list .feed-focus-comment.is-thread-reply::before {
    top: 26px;
    width: 6px;
  }
}
