/* Device-local colours. Content, photos, video and exported share cards are not inverted. */
:root { color-scheme:light; --canvas:#ffffff; --surface:#ffffff; --raised:#f5f8f6; --primary-bg:#142720; --primary-ink:#ffffff; }
:root[data-theme="light"] { color-scheme:light; }
:root[data-theme="dark"] {
  color-scheme:dark;
  --canvas:#121416; --surface:#191c1f; --raised:#222629;
  --ink:#edf0f2; --secondary:#b4bdc4; --faint:#929da6; --line:#343a3e; --soft:#222629;
  --good:#67c9ad; --good-deep:#8fe0c6; --good-soft:#173b32;
  --bad:#f19b8c; --bad-deep:#ffb7a9; --bad-soft:#402826;
  --duala-check-frame:#ffab62;
  --neutral:#abb4bd; --neutral-deep:#d5dbe1; --neutral-soft:#2d3339;
  --primary-bg:#e5ece9; --primary-ink:#15241e;
  background:var(--canvas); color:var(--ink);
}
html,body { background:var(--canvas); }
.theme-setting select { cursor:pointer; }
html[data-theme="dark"] body { color:var(--ink); }
html[data-theme="dark"] ::selection { color:#e2fff4; background:#315c4d; }
html[data-theme="dark"] :is(.welcome-screen,.post-card,.discover-shell,.discover-inner,.composer-text) { background:var(--canvas); }
html[data-theme="dark"] :is(.sheet,.crop-panel,.upload-exit-panel,.media-viewer,.hidden-story,.person-card,.award-card,.topic-suggestions,.mention-suggestions,.activity-filters,.composer-topic) { background:var(--surface); border-color:var(--line); }
html[data-theme="dark"] .sheet { box-shadow:0 24px 100px #0008; }
html[data-theme="dark"] .sheet::backdrop { background:#0009; }
html[data-theme="dark"] .app-header { background:#121416ed; }
html[data-theme="dark"] .bottom-nav { background:#1b1f22f5; border-color:var(--line); box-shadow:0 9px 35px #0006; }
html[data-theme="dark"] :is(.text-input,.language-setting select,.safety-select,.recommendation-settings select,.reply-policy-field select,.crop-shape select) { background:var(--raised); border-color:var(--line); color:var(--ink); }
html[data-theme="dark"] .composer-topic>.text-input { background:transparent; }
html[data-theme="dark"] :is(input,textarea)::placeholder { color:var(--secondary); opacity:1; }
html[data-theme="dark"] :is(input,textarea,select):autofill { -webkit-text-fill-color:var(--ink); box-shadow:0 0 0 1000px var(--raised) inset; caret-color:var(--ink); }
html[data-theme="dark"] input:-webkit-autofill { -webkit-text-fill-color:var(--ink); -webkit-box-shadow:0 0 0 1000px var(--raised) inset; caret-color:var(--ink); }
html[data-theme="dark"] :is(.icon-button.primary:not(.danger),.compose-button,.sign-in-link,.terms-accept-submit,.tour-next,.tour-add) { background:var(--primary-bg); color:var(--primary-ink); border-color:var(--primary-bg); }
html[data-theme="dark"] :is(.icon-button.primary:not(.danger):hover,.compose-button:hover,.sign-in-link:hover,.terms-accept-submit:hover,.tour-next:hover) { background:#ffffff; color:var(--primary-ink); }
html[data-theme="dark"] .compose-button::after { background:var(--primary-bg); }
html[data-theme="dark"] .icon-button.primary.danger:hover { background:#57312c; }
html[data-theme="dark"] :is(.side-option.selected,.side-option[aria-pressed="true"]) { background:var(--raised); box-shadow:0 1px 4px #0004; }
html[data-theme="dark"] .side-option:is(.selected,[aria-pressed="true"])[data-side="good"] { background:var(--good-soft); }
html[data-theme="dark"] .side-option:is(.selected,[aria-pressed="true"])[data-side="bad"] { background:var(--bad-soft); }
html[data-theme="dark"] .side-option:is(.selected,[aria-pressed="true"])[data-side="neutral"] { background:var(--neutral-soft); }
html[data-theme="dark"] :is(.empty-icon,.new-stories-button,.gallery-thumb,.attachment-preview>.icon-button) { background:var(--raised); border-color:var(--line); color:var(--ink); }
html[data-theme="dark"] :is(.post-media-grid,.media-thumb,.discover-media,.crop-canvas-wrap,.share-content,.gallery-stage,.moderation-media img,.moderation-media video) { background:#101214; }
html[data-theme="dark"] :is(.story-video,.media-viewer video,.gallery-main-video) { background:#080a0b; }
html[data-theme="dark"] :is(.attachment-preview>.icon-button:hover,.inline-form-error) { background:var(--bad-soft); color:var(--bad-deep); border-color:#69423b; }
html[data-theme="dark"] #hashtag-error { color:var(--bad-deep); }
html[data-theme="dark"] .content-review-pending { background:var(--raised); }
html[data-theme="dark"] :is(.story-tag,.topic-chip,.composer-topic>span) { color:var(--secondary); }
html[data-theme="dark"] :is(.people-row,.discover-story) { scrollbar-color:#58636c transparent; }
html[data-theme="dark"] :is(.activity-item:hover,.continuation-link:hover,.mention-option:hover,.mention-option[aria-selected="true"],.story-vote-close:hover) { background:var(--raised); }
html[data-theme="dark"] :is(.comment-reply,.topic-row,.link-preview,.pin-side-switch .selected,.share-variant .selected) { border-color:var(--line); }
html[data-theme="dark"] .comment-highlight { background:var(--good-soft); outline-color:var(--good-soft); }
html[data-theme="dark"] .activity-filters .selected { box-shadow:inset 0 0 0 1px #31584b; }
html[data-theme="dark"] .profile-cover { background:linear-gradient(110deg,#18372e,#22272a 57%,#3a2525); }
html[data-theme="dark"] .profile-top>.avatar { outline-color:var(--canvas); }
html[data-theme="dark"] :is(.pinned-story[data-side="good"],.pin-option,.earned-award,.award-directions button[data-direction="support"][aria-pressed="true"]) { background:var(--good-soft); border-color:#31594b; }
html[data-theme="dark"] :is(.pinned-story[data-side="bad"],.pin-option[data-side="bad"],.earned-award[data-direction="disapprove"],.award-directions button[data-direction="disapprove"][aria-pressed="true"]) { background:var(--bad-soft); border-color:#68403a; }
html[data-theme="dark"] :is(.pinned-story[data-side="neutral"],.pin-option[data-side="neutral"]) { background:var(--neutral-soft); border-color:var(--line); }
html[data-theme="dark"] .award-directions button { background:var(--surface); }
html[data-theme="dark"] :is(.earned-award[data-direction="split"],.award-directions button[data-direction="split"][aria-pressed="true"]) { background:var(--soft); border-color:var(--secondary); color:var(--ink); }
html[data-theme="dark"] .person-card>.icon-button { border-color:#31594b; }
html[data-theme="dark"] .person-card>.icon-button[aria-pressed="true"] { background:var(--surface); border-color:var(--line); }
html[data-theme="dark"] .person-card>.icon-button:hover { background:#264a3d; border-color:#457562; }
html[data-theme="dark"] .hidden-story[data-side="good"] { border-color:#31594b; }
html[data-theme="dark"] .hidden-story[data-side="bad"] { border-color:#68403a; }
html[data-theme="dark"] .avatar { background:#263b32; color:#bed8ca; }
html[data-theme="dark"] .avatar:is([data-tone="sage"],[data-tone="green"],[data-tone="mint"]) { background:#263b32; color:#bed8ca; }
html[data-theme="dark"] .avatar:is([data-tone="clay"],[data-tone="coral"],[data-tone="peach"]) { background:#49312c; color:#edc2b3; }
html[data-theme="dark"] .avatar:is([data-tone="lavender"],[data-tone="purple"]) { background:#363145; color:#d3c4ed; }
html[data-theme="dark"] .avatar[data-tone="blue"] { background:#293c47; color:#b9d9ed; }
html[data-theme="dark"] .avatar:is([data-tone="amber"],[data-tone="gold"],[data-tone="yellow"]) { background:#403b26; color:#e5d6a5; }
html[data-theme="dark"] .avatar:is([data-tone="pink"],[data-tone="rose"]) { background:#45313c; color:#e5bdd2; }
html[data-theme="dark"] .auth-provider-google { background:#131314; color:#e3e3e3; border-color:#8e918f; }
html[data-theme="dark"] .auth-provider-google:hover { background:#25282a; }
html[data-theme="dark"] .auth-provider-phone { background:#131314; color:#e3e3e3; border-color:#8e918f; }
html[data-theme="dark"] .auth-provider-phone:hover { background:#25282a; }
html[data-theme="dark"] .auth-provider-apple { background:#ffffff; color:#000000; border-color:#ffffff; }
html[data-theme="dark"] .auth-provider-apple:hover { background:#e8e8e8; }
html[data-theme="dark"] .connection-status:not([data-status="synced"]):not([data-status="saving"]) { background:var(--surface); }
html[data-theme="dark"] .toast { background:#e5ece9; color:#15241e; box-shadow:0 8px 34px #0007; }
html[data-theme="dark"] .profile-rating-track { background:linear-gradient(90deg,#c77d6d,#707b80 50%,#309e83); }
html[data-theme="dark"] .profile-rating-center { background:#d4dfe080; }
html[data-theme="dark"] .story-vote-track,html[data-theme="dark"] .tour-scale { background:linear-gradient(90deg,#218c75,#657a73 52%,#bd7464); }
html[data-theme="dark"] .story-vote-range::-webkit-slider-thumb { background:#e8eeec; border-color:#a8bcb3; box-shadow:0 2px 5px #0005,0 6px 14px #0005; }
html[data-theme="dark"] .story-vote-range::-moz-range-thumb { background:#e8eeec; border-color:#a8bcb3; box-shadow:0 2px 5px #0005,0 6px 14px #0005; }
html[data-theme="dark"] :is(.tour-green,.tour-single-story,.tour-feed-lines i) { background:var(--good-soft); color:var(--good); border-color:var(--good); }
html[data-theme="dark"] :is(.tour-coral,.tour-feed-lines i:nth-child(2)) { background:var(--bad-soft); color:var(--bad); }
html[data-theme="dark"] .tour-dots .active { background:var(--good); }
/* Full public rules pages share the same locally chosen theme without signing in. */
html[data-theme="dark"] .legal-document :is(header,.documents,footer) { border-color:var(--line); }
html[data-theme="dark"] .legal-document :is(section p,.languages a,.documents a,.eyebrow,footer,.legal-back) { color:var(--secondary); }
html[data-theme="dark"] .legal-document :is(a,.languages a[aria-current],.documents a[aria-current]) { color:var(--good-deep); }
html[data-theme="dark"] .legal-document .brand { color:var(--ink); }
html[data-theme="dark"] .legal-document .legal-back:hover { background:var(--raised); }
@media(prefers-reduced-motion:reduce) {
  *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; animation-iteration-count:1!important; transition-duration:.01ms!important; }
}
@media print {
  html[data-theme="dark"]:has(.legal-document),html[data-theme="dark"] .legal-document { background:#fff; color:#142720; color-scheme:light; }
  html[data-theme="dark"] .legal-document :is(section p,a) { color:#33433b; }
}

html[data-theme="dark"] :is(.tour-skip,.tour-next):focus-visible { outline-color:var(--good-deep); }
