/* A single feature layer: reading, optional backgrounds and personal preferences. */
:root[data-palette=pine] { --accent:#1a685b; --accent-soft:#e4f0eb; }
:root[data-palette=clay] { --accent:#874f31; --accent-soft:#f5ece4; }
:root[data-theme=dark][data-palette=pine] { --accent:#a5dec7; --accent-soft:#1d372f; }
:root[data-theme=dark][data-palette=clay] { --accent:#f5c9a1; --accent-soft:#3b2c23; }
:root[data-corners=soft] { --radius:16px; }
:root { --paper-surface:#fffdf9; --paper-text:#302e2a; }
:root[data-theme=dark] { --paper-surface:#211f1d; --paper-text:#f0ebe3; }
:root[data-paper=neutral] { --paper-surface:var(--surface); --paper-text:var(--text); }
:root[data-reader-font=sans] .reading-content { font-family:inherit; }
:root[data-reader-size=large] .reading-content { font-size:20px; }
.detail-panel,.collection-content { background:var(--paper-surface); color:var(--paper-text); }
.detail-panel > h2 { font-family:var(--font-reader); line-height:1.6; font-weight:600; }
:root[data-reader-font=sans] .detail-panel > h2 { font-family:inherit; }
.resource-facts { display:grid; grid-template-columns:1fr 1fr; border:1px solid var(--line); border-radius:var(--radius); margin:22px 0; background:var(--subtle); color:var(--text); }
.resource-facts > div { padding:12px 14px; }
.resource-facts > div + div { border-left:1px solid var(--line); }
.resource-facts dt { color:var(--muted); font-size:10px; letter-spacing:.04em; margin-bottom:6px; }
.resource-facts dd { margin:0; font-size:12px; font-weight:550; }
.detail-placeholder { background:var(--surface); border:1px dashed var(--line); border-radius:var(--radius); padding:90px 30px; }
.detail-toolbar { padding-bottom:14px; border-bottom:1px solid var(--line); }
.collection-content { padding:24px; border:1px solid var(--line); border-radius:var(--radius); }
.snapshot-card .reading-content { max-width:66ch; }
.welcome-actions { display:flex; flex-wrap:wrap; gap:10px; }
.welcome h2 { font-family:var(--font-reader); font-weight:550; max-width:24em; }
.welcome p { max-width:50em; }
.appearance-intro { display:flex; gap:14px; align-items:flex-start; padding:16px; background:var(--subtle); border:1px solid var(--line); border-radius:var(--radius); }
.appearance-intro svg { color:var(--accent); }
.appearance-intro strong { display:block; font-size:14px; margin-bottom:6px; }
.appearance-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.appearance-grid .field { margin:12px 0; }
#workspace-background { position:fixed; inset:0; z-index:-1; pointer-events:none; background:var(--canvas); }
#workspace-background img { width:100%; height:100%; object-fit:cover; opacity:.28; }
:root[data-background-strength=clear] #workspace-background img { opacity:.65; }
:root[data-theme=dark] #workspace-background img { opacity:.14; }
:root[data-theme=dark][data-background-strength=clear] #workspace-background img { opacity:.26; }
body { isolation:isolate; }
:root:not([data-wallpaper=none]) .tg-thread-panel { background:transparent; }
:root:not([data-wallpaper=none]) .tg-message-actions { background:var(--surface); border-radius:var(--radius); padding:0 4px; }
:root:not([data-wallpaper=none]) .tg-workspace[data-layout=flat] .tg-bubble { background:var(--surface); padding:14px; border-radius:var(--radius); }
:root:not([data-wallpaper=none]) .page-heading > div { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; width:100%; }
:root:not([data-wallpaper=none]) .overview-tiles,:root:not([data-wallpaper=none]) .recent,:root:not([data-wallpaper=none]) .inbox-main,:root:not([data-wallpaper=none]) .settings-section,:root:not([data-wallpaper=none]) .tasks,:root:not([data-wallpaper=none]) .sharing-intro,:root:not([data-wallpaper=none]) .grant-row { background:var(--surface); border-radius:var(--radius); padding:20px; }
.tg-dialog-row.active .tg-dialog-title small,.tg-dialog-row.active .tg-dialog-preview,.tg-dialog-row.active .tg-dialog-meta { color:var(--text); }
.resource-row.current .resource-excerpt,.resource-row.current .resource-meta,.resource-row.current .row-state small { color:var(--text); }
.tg-workspace .tg-message-actions .button { min-height:44px; }
.tg-reading-status { font-size:10px; }
.tg-composer-hint { font-size:10px; }
.tg-info-facts { font-size:11px; }
.tg-thread-title small { font-size:11px; }
.tg-cache-note { font-size:10px; }
.tg-thread-header .icon-button { min-width:44px; }
.tg-search .button,.tg-message-search .button,.tg-reading-status .button { min-height:44px; }
.tg-reading-status { min-height:44px; }
.sidebar-foot .button { width:100%; justify-content:flex-start; font-size:12px; }
@media (min-width:1200px) {
  .reading-content { min-height:160px; }
  .detail-panel { scrollbar-gutter:stable; }
}
@media (max-width:760px) {
  .top-actions .icon-button { display:inline-flex; width:36px; min-height:44px; padding:6px; }
  .topbar .task-link { display:none; }
  .topbar #add-button { min-width:44px; padding:10px; }
  .topbar #add-button span { display:none; }
  .library-list { padding:12px; }
  .resource-facts { margin:18px 0; }
  .resource-facts > div { padding:11px; }
  .detail-panel { background:var(--paper-surface); }
  .collection-content { padding:18px; }
  .is-reading .shell > .topbar,.is-reading .demo-strip,.is-reading .page-heading,.is-reading .footer,.is-reading .mobile-nav,.is-reading .activity-bar { display:none; }
  .is-reading .main { padding:0; min-height:100dvh; }
  .is-reading .detail-panel { min-height:100dvh; padding:0 20px calc(120px + env(safe-area-inset-bottom)); }
  .is-reading .detail-toolbar { position:sticky; top:0; z-index:11; background:var(--paper-surface); margin:0 -20px 24px; padding:12px 16px; border-bottom:1px solid var(--line); }
  .is-reading .detail-panel > h2 { font-size:27px; line-height:1.55; }
  .is-reading .detail-actions { position:fixed; bottom:0; left:0; right:0; z-index:15; padding:12px 16px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid var(--line); background:var(--surface); margin:0; box-shadow:0 -4px 24px #1b2a3d0c; }
  .is-reading .detail-actions .button { flex:1; padding:10px; font-size:12px; }
  .is-reading .reading-content { margin-top:28px; }
  .is-reading .toast { bottom:100px; }
  .appearance-grid { grid-template-columns:1fr; }
  .tg-thread-title small { font-size:10px; }
  .tg-reading-status { font-size:9px; }
  .tg-thread-header { flex-shrink:0; }
  .tg-thread-tools { flex-shrink:0; }
  .tg-compose-line textarea { max-height:100px; }
  .tg-composer-hint { font-size:9px; }
  .tg-workspace .tg-message-meta { font-size:11px; }
}
@media (max-height:600px) and (max-width:999px) {
  .tg-thread-tools { display:none; }
  .tg-composer-hint { display:none; }
  .tg-reading-status { min-height:32px; }
}
