/* User display preferences. Loaded after style.css so the same tokens serve
   the timeline, account screens, dialogs, and messages. */
:root {
  --action-bg: var(--blue);
  --action-fg: #fff;
}

html[data-scheme="light"] {
  color-scheme: light;
  --paper: #fff;
  --soft: #f3f7f2;
  --ink: #101d2b;
  --muted: #526371;
  --edge: #dbe1e5;
  --link: #135781;
  --blue: #08699e;
  --action-bg: #08699e;
  --action-fg: #fff;
}

html[data-scheme="dark"] {
  color-scheme: dark;
  --paper: #17232d;
  --soft: #1c2b35;
  --ink: #edf4f5;
  --muted: #b4c4c8;
  --edge: #3a4b54;
  --link: #8dccf1;
  --blue: #72b9df;
  --action-bg: #8dccf1;
  --action-fg: #10212c;
}

html[data-scheme="dark"] body,
html[data-scheme="dark"] .timeline,
html[data-scheme="dark"] .stream-head,
html[data-scheme="dark"] .rail,
html[data-scheme="dark"] .mobile-nav {
  color: var(--ink);
  background: var(--paper);
}

html[data-scheme="dark"] .stream-shell,
html[data-scheme="dark"] .card,
html[data-scheme="dark"] .browse-filters,
html[data-scheme="dark"] .refresh-row {
  background: var(--paper);
  border-color: var(--edge);
}

html[data-scheme="dark"] button,
html[data-scheme="dark"] input,
html[data-scheme="dark"] select,
html[data-scheme="dark"] textarea {
  color: var(--ink);
  background: var(--soft);
  border-color: var(--edge);
}

html[data-scheme="dark"] .primary,
html[data-scheme="dark"] .message-send {
  color: var(--action-fg);
  background: var(--action-bg);
}

html[data-scheme="dark"] .tabs button,
html[data-scheme="dark"] .nav-item,
html[data-scheme="dark"] .text-button,
html[data-scheme="dark"] .refresh-row button,
html[data-scheme="dark"] #filter-toggle {
  color: var(--ink);
}

html[data-scheme="dark"] a,
html[data-scheme="dark"] .post-link,
html[data-scheme="dark"] .original-links a,
html[data-scheme="dark"] .message-lookup,
html[data-scheme="dark"] .message-login,
html[data-scheme="dark"] .message-newer,
html[data-scheme="dark"] .message-older {
  color: var(--link);
}

html[data-scheme="dark"] .meta,
html[data-scheme="dark"] .muted,
html[data-scheme="dark"] .message-preview,
html[data-scheme="dark"] .message-time,
html[data-scheme="dark"] .bubble-time {
  color: var(--muted);
}

html[data-scheme="dark"] .post-menu-items,
html[data-scheme="dark"] .preview,
html[data-scheme="dark"] .dialog-head,
html[data-scheme="dark"] .messages-head,
html[data-scheme="dark"] .messages-foot,
html[data-scheme="dark"] .message-thread-row,
html[data-scheme="dark"] .message-newer {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--edge);
}

html[data-scheme="dark"] .message-other {
  color: var(--ink);
  background: #293942;
}

html[data-scheme="dark"] .message-own {
  color: #08161e;
  background: #8dccf1;
}

html[data-scheme="dark"] dialog,
html[data-scheme="dark"] .messages-dialog {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--edge);
}

html[data-scheme="dark"] dialog::backdrop {
  background: #000b;
}

html[data-scheme="dark"] .resident-choice[aria-pressed="true"],
html[data-scheme="dark"] .image-option[aria-pressed="true"] {
  color: var(--ink);
  background: #29453d;
}

html[data-scheme="dark"] .image-grid,
html[data-scheme="dark"] .image-option,
html[data-scheme="dark"] .message-compose,
html[data-scheme="dark"] .message-own-code,
html[data-scheme="dark"] .message-list,
html[data-scheme="dark"] .message-empty {
  background: var(--paper);
}


html[data-surface="account"] body {
  background: var(--soft);
}

html[data-surface="account"] .panel,
html[data-surface="account"] .account-card,
html[data-surface="account"] .settings-card,
html[data-surface="account"] form {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--edge);
}

html[data-surface="account"] .primary,
html[data-surface="account"] [type="submit"],
html[data-surface="account"] .action-button {
  color: var(--action-fg);
  background: var(--action-bg);
}

html[data-text="large"] body {
  font-size: 17px;
}

html[data-text="large"] .post-body,
html[data-text="large"] .image-caption,
html[data-text="large"] .message-own,
html[data-text="large"] .message-other,
html[data-text="large"] .message-preview,
html[data-text="large"] .dialog-body,
html[data-text="large"] .settings-card,
html[data-text="large"] .account-card {
  font-size: 1.08em;
}

html[data-text="large"] .meta,
html[data-text="large"] .muted,
html[data-text="large"] .message-time,
html[data-text="large"] .bubble-time {
  font-size: 0.92em;
}

html[data-text="large"] button,
html[data-text="large"] input,
html[data-text="large"] select,
html[data-text="large"] textarea {
  font-size: 1em;
}

@media (max-width: 700px) {
  html[data-text="large"] .card {
    padding-top: 15px;
    padding-bottom: 5px;
  }

  html[data-text="large"] .mobile-nav .nav-item {
    font-size: 11px;
  }

  html[data-text="large"] .messages-head {
    min-height: 64px;
  }
}

/* Profiles and settings share the same column and navigation as the timeline. */
.nav-item, html[data-scheme="dark"] a.nav-item { color:var(--ink); text-decoration:none; }
.nav-item[aria-current="page"] { font-weight:800; }
html[data-surface="account"] body:not(.account-ready) .timeline > * { visibility:hidden; }
.account-page { color:var(--ink); background:var(--paper); padding-bottom:5rem; }
.account-page :is(a,button,input,select,summary):focus-visible { outline:3px solid var(--blue); outline-offset:2px; }
.account-head { position:sticky; top:0; z-index:2; min-height:54px; display:flex; align-items:center; gap:8px; padding:4px 12px 4px 6px; background:var(--paper); border-bottom:1px solid var(--edge); }
.account-head h1 { flex:1; min-width:0; font-size:1.15rem; color:var(--ink); }
.account-icon { display:grid; place-items:center; width:44px; height:44px; flex:none; border-radius:50%; }
.account-icon, html[data-scheme="dark"] .account-icon { color:var(--ink); }
.account-icon:hover, .settings-row:hover { background:var(--soft); }
.account-notice { margin:12px 16px 0; color:var(--link); overflow-wrap:anywhere; }
.account-action, .account-outline, .account-quiet { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:7px 15px; border-radius:99px; font-weight:700; text-decoration:none; text-align:center; }
.account-outline, html[data-scheme="dark"] .account-outline { color:var(--ink); background:var(--paper); border:1px solid var(--edge); }
.account-quiet, html[data-scheme="dark"] .account-quiet { color:var(--link); background:transparent; border:0; }
.account-page .account-action, html[data-scheme="dark"] .account-page .account-action { color:var(--paper); background:var(--ink); border:0; }
.profile-cover { width:100%; aspect-ratio:3.2; overflow:hidden; background:var(--soft); border-bottom:1px solid var(--edge); }
.profile-cover img { width:100%; height:100%; object-fit:cover; object-position:50% 32%; }
.profile-summary { padding:0 18px 15px; overflow-wrap:anywhere; }
.profile-topline { display:flex; justify-content:space-between; align-items:flex-start; gap:8px; }
.profile-topline > .avatar { width:clamp(74px,15vw,94px); height:auto; aspect-ratio:1; border:4px solid var(--paper); margin-top:clamp(-44px,-7vw,-32px); position:relative; }
.profile-actions { display:flex; justify-content:flex-end; align-items:center; gap:4px; margin-top:8px; flex-wrap:wrap; }
.share-profile { display:grid; place-items:center; width:44px; height:44px; padding:0; border-radius:50%; border:1px solid var(--edge); color:var(--ink); background:var(--paper); }
.share-profile .glyph { width:20px; height:20px; }
.profile-identity { margin:8px 0; line-height:1.32; }
.profile-identity h2 { font-size:1.35rem; letter-spacing:-.025em; }
.profile-handle, .profile-count, .profile-kind, .profile-post-meta span { color:var(--muted); }
.profile-kind, .profile-count { font-size:.86em; }
.profile-count { margin-top:10px; }
.profile-count strong { color:var(--ink); margin-right:3px; }
.profile-kind + .profile-bio { margin-top:6px; }
.profile-bio { white-space:pre-wrap; }
.profile-tabs { border-bottom:1px solid var(--edge); }
.profile-post { display:grid; grid-template-columns:40px minmax(0,1fr); align-items:start; gap:10px; padding:14px 16px; border-bottom:1px solid var(--edge); }
.profile-post-meta { display:flex; align-items:baseline; gap:6px; flex-wrap:wrap; }
.profile-post-meta span { font-size:.8em; }
.profile-post-inner > a { display:block; }
.profile-post-image { border:1px solid var(--edge); border-radius:14px; margin:8px 0; max-height:28rem; width:auto; height:auto; max-width:100%; object-fit:contain; }
.profile-media { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:3px; padding:3px 0; }
.profile-tile { width:100%; height:100%; object-fit:cover; }
.profile-tile-link { display:block; aspect-ratio:1; overflow:hidden; }
.profile-guest, .account-empty { padding:24px 18px; }
.profile-guest h2, .account-empty h2 { font-size:1.2rem; }
.profile-guest p { margin:6px 0 16px; color:var(--muted); }
.account-empty :is(a,button) { margin:16px 8px 0 0; }
.edit-identity { display:flex; align-items:flex-end; gap:10px; padding:0 16px 14px; }
.edit-identity .avatar { width:66px; height:66px; margin-top:-22px; border:3px solid var(--paper); position:relative; }
.edit-identity strong { padding-bottom:8px; }
.edit-group, .settings-section { margin:0; padding:12px 16px; border-top:1px solid var(--edge); }
.edit-group summary { min-height:44px; padding-block:10px; color:var(--ink); }
.edit-group > label, .settings-section h2 { font-size:1.05em; }
.edit-group select { font-size:1rem; margin-top:8px; min-height:44px; }
.profile-choices, .cover-choices { display:grid; gap:8px; padding:4px 0 10px; grid-template-columns:repeat(3,minmax(0,1fr)); }
.cover-choices { grid-template-columns:repeat(2,minmax(0,1fr)); }
.profile-choice, .cover-choice { position:relative; display:grid; justify-items:center; align-content:start; gap:6px; color:var(--ink); background:var(--paper); border:1px solid var(--edge); padding:9px 4px; min-width:0; font-size:.85em; overflow-wrap:anywhere; }
.profile-choice .avatar { width:42px; height:42px; }
.cover-choice { padding:5px; }
.cover-choice img { width:100%; aspect-ratio:2.6; object-fit:cover; border-radius:5px; }
.profile-choice[aria-pressed=true], .cover-choice[aria-pressed=true] { box-shadow:inset 0 0 0 2px var(--blue); }
.profile-choice[aria-pressed=true]::after, .cover-choice[aria-pressed=true]::after { content:"✓"; position:absolute; right:4px; top:4px; display:grid; place-items:center; width:19px; height:19px; border-radius:100%; background:var(--action-bg); color:var(--action-fg); font-size:12px; }
.settings-section { padding-block:17px; }
.settings-section:first-child { border-top:0; }
.settings-section h2 { margin-bottom:12px; }
.preference-group { min-width:0; margin:0 0 15px; padding:0; border:0; }
.preference-group:last-child { margin-bottom:0; }
.preference-group legend { margin-bottom:6px; padding:0; color:var(--muted); font-size:.9em; }
.preference-options { display:flex; flex-wrap:wrap; gap:6px; }
.preference-option { display:flex; align-items:center; gap:6px; min-height:44px; padding:6px 11px; font-weight:500; font-size:.92em; border:1px solid var(--edge); border-radius:10px; cursor:pointer; }
.preference-option:has(:checked) { color:var(--ink); background:var(--soft); border-color:var(--blue); }
.preference-option input { width:16px; height:16px; margin:0; accent-color:var(--blue); }
.settings-row { display:flex; min-height:46px; justify-content:space-between; align-items:center; gap:8px; text-decoration:none; color:var(--ink); }
.settings-row::after { content:"›"; color:var(--muted); font-size:22px; }
.settings-status { color:var(--muted); }
@media(max-width:700px) {
  html[data-surface="account"] body { background:var(--paper); }
  .account-head { padding-top:max(4px,env(safe-area-inset-top)); }
  .profile-summary { padding-inline:14px; }
  .profile-actions .account-outline { padding-inline:12px; font-size:.9em; }
  .account-page { padding-bottom:calc(72px + env(safe-area-inset-bottom)); }
}

.card-byline > .profile-link { position:absolute; left:14px; top:12px; display:grid; place-items:center; width:44px; height:44px; border-radius:50%; }
.card-byline > div { min-width:0; overflow-wrap:anywhere; }
.profile-name, .message-peer-link, html[data-scheme="dark"] :is(.profile-name,.message-peer-link) { color:var(--ink); text-decoration:none; font-weight:700; }
.profile-name:hover, .message-peer-link:hover { text-decoration:underline; }
.card-byline .profile-handle, .reply-byline .profile-handle { font-size:.83em; margin-inline-start:5px; overflow-wrap:anywhere; }
.reply-byline { flex-wrap:wrap; }
.message-head-handle { display:block; font-size:.7em; font-weight:500; color:var(--muted); }
.message-row-head .profile-handle { font-size:.8em; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.message-profile-link { display:grid; place-items:center; flex:none; width:44px; height:44px; }
.message-muse-row { border-inline-start:3px solid var(--blue); }
.message-ai-form { flex-wrap:wrap; gap:6px; }
.message-ai-input { flex:1 1 100%; width:100%; min-height:48px; resize:vertical; padding:10px 12px; border:1px solid var(--edge); border-radius:12px; color:var(--ink); background:var(--paper); font:inherit; }
.message-image-gallery { flex:1 1 100%; border:1px solid var(--edge); border-radius:12px; padding:8px 10px; background:var(--paper); }
.message-image-gallery summary { cursor:pointer; color:var(--link); font-weight:650; }
.message-image-selected { display:block; margin:6px 0; color:var(--muted); font-size:.84em; }
.message-image-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(82px,1fr)); gap:6px; }
.message-image-option { min-width:0; display:grid; gap:3px; padding:4px; border:1px solid var(--edge); border-radius:9px; background:var(--paper); color:var(--ink); font:inherit; font-size:.72em; cursor:pointer; }
.message-image-option img { width:100%; aspect-ratio:1; object-fit:cover; border-radius:6px; }
.message-image-option.selected { outline:2px solid var(--blue); outline-offset:1px; }
.message-ai-auto-label, .message-ai-disclosure { display:inline-flex; align-items:center; gap:6px; min-height:44px; color:var(--muted); font-size:.88em; }
.message-image { display:block; max-width:min(240px,70vw); max-height:220px; margin-top:8px; border-radius:12px; object-fit:cover; }
.message-image[role="button"] { cursor:zoom-in; }
.message-ai-disclosure { flex-wrap:wrap; }
.messages-dialog .message-ai-form input[type="checkbox"] {
  width:18px; height:18px; min-height:0; flex:0 0 18px; margin:0;
}
.message-ai-cancel { min-height:34px; padding-inline:10px; }
.message-mode { display:block; margin-top:4px; font-size:.72em; opacity:.72; }
@media(max-width:700px) {
  .card-byline > .profile-link { top:10px; left:6px; }
  .card-byline > .profile-link .avatar { width:36px; height:36px; }
}
html[data-scheme="dark"] .nav-item, html[data-scheme="dark"] .tabs button { background:transparent; }
html[data-scheme="dark"] .nav-item:hover { background:var(--soft); }
html[data-surface="account"] .home-view-menu summary { font-weight:500; }
.mobile-nav .nav-item { color:var(--muted); text-decoration:none; }
.mobile-nav .nav-item[aria-current="page"], html[data-surface="timeline"] .mobile-nav .home-view-menu summary { color:var(--ink); font-weight:750; }
.mobile-nav .nav-item[aria-current="page"] .glyph, html[data-surface="timeline"] .mobile-nav .home-view-menu summary .glyph { stroke-width:2.5; }
@media(max-width:700px) {
  html[data-surface="account"] .stream-shell { margin-bottom:0; }
}
.card-byline a.profile-handle, .reply-byline a.profile-handle { color:var(--muted); text-decoration:none; }
.card-byline a.profile-handle:hover, .reply-byline a.profile-handle:hover { text-decoration:underline; }
html[data-scheme="dark"] .image-viewer { background:#000; }

.card-actions .original-links a, .profile-post .original-links a { color:var(--link); font-weight:600; text-decoration:underline; text-underline-offset:3px; }
.card.source-featured-card { padding:8px 12px; }
.source-featured-card > original-post-embed {
  width:min(100%,550px);
  margin-inline:auto;
  background:var(--paper);
  color-scheme:inherit;
}
html[data-surface="timeline"][data-scheme="dark"] {
  --paper:#15202b;
  --soft:#1e2d3b;
  --edge:#38444d;
}
.source-featured-card iframe { color-scheme:inherit; background:transparent; }
.card.source-featured-card { padding:5px 8px; }
.source-featured-card > original-post-embed { border-radius:12px; overflow:clip; }
@media(max-width:700px) {
  .card.source-featured-card { padding:4px; }
}
