/* Meantly optional dark mode (activated by theme.js -> html[data-theme="dark"]). Screen only: print/PDF stays light. */
.theme-tog,.hdr-ico{display:inline-grid;place-items:center;width:34px;height:34px;padding:0;flex:0 0 auto;border:1px solid var(--rule);border-radius:8px;background:var(--surface);color:var(--ink);cursor:pointer;line-height:0}
.theme-tog:hover,.hdr-ico:hover{border-color:var(--accent);color:var(--accent)}
.theme-tog:focus-visible,.hdr-ico:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.theme-float{position:fixed;left:16px;bottom:16px;z-index:30;box-shadow:0 4px 14px rgba(0,0,0,.15)}

@media screen{
html[data-theme="dark"]{
  color-scheme:dark;
  --ground:#0F1115;--surface:#171A21;--sunk:#1D2129;--ink:#E7E9EE;--muted:#9AA3B2;--rule:#2C313C;--line:#2C313C;
  --accent:#6E78F7;--accent-soft:#1E2242;--accent-ink:#FFFFFF;
  --up:#F07167;--down:#4CC38A;--bad:#F07167;--good:#4CC38A;--meant:#E8A03D;
  --off:#E5675A;--on:#5B9BE0;--mix:#7D8594;--mid:#2C313C
}
html[data-theme="dark"] body{background:var(--ground);color:var(--ink)}
html[data-theme="dark"] img:not([src$=".svg"]){filter:brightness(.92)}

/* landing page */
html[data-theme="dark"] .site-h{background:rgba(15,17,21,.9)}
html[data-theme="dark"] .ex-foot{background:var(--sunk)}
html[data-theme="dark"] .btn-ghost:hover,html[data-theme="dark"] .social .soc:hover{border-color:#4A5160}

/* highlights and chips: tint against the dark surface instead of white */
html[data-theme="dark"] mark,html[data-theme="dark"] .hx-said mark{background:color-mix(in oklab,var(--c) 32%,var(--surface))}
html[data-theme="dark"] .chip{background:color-mix(in oklab,var(--c) 18%,var(--surface))}
html[data-theme="dark"] .slogan .meant{color:#E8A03D}
html[data-theme="dark"] .slogan .meant::after{background:#E8A03D}

/* "most controversial" block */
html[data-theme="dark"] .hot{--hot:#F07862;--hot-soft:#2A1714;border-color:#5A2A22}
html[data-theme="dark"] .hot-sep{background:#5A2A22}

/* market / notice tags */
html[data-theme="dark"] .mkt,html[data-theme="dark"] .notice{background:#2B2312;color:#F0C27A;border-color:#4A3B1C}
html[data-theme="dark"] .mkt.risk_off{background:#2E1717;color:#F2A19A;border-color:#5A2A26}
html[data-theme="dark"] .mkt.risk_on{background:#14233A;color:#9CC3F0;border-color:#26406A}
html[data-theme="dark"] .notice-inline{color:#F0C27A}
html[data-theme="dark"] .lang{background:var(--sunk)}
html[data-theme="dark"] .msg.err{background:#2E1717;border-color:#5A2A26;color:#F2A19A}
html[data-theme="dark"] .new{border-color:#2E3570}

/* elements that sit on var(--ink): ink is light in dark mode, so use dark text */
html[data-theme="dark"] .seg button[aria-pressed="true"],
html[data-theme="dark"] .tabs button[aria-pressed="true"],
html[data-theme="dark"] .tip,html[data-theme="dark"] .toast{color:var(--ground)}

/* small chart bits with hard-coded dark strokes */
html[data-theme="dark"] .st-bar .now{border-color:var(--surface);box-shadow:0 0 0 1px var(--muted)}
html[data-theme="dark"] .st-bar .pr{background:var(--muted)}
html[data-theme="dark"] .hxp-norm,html[data-theme="dark"] .hxp-keys i{border-top-color:var(--ink)}
html[data-theme="dark"] #dec-backdrop{background:rgba(0,0,0,.6)}

/* Meantly read widget (reads.js): hard-coded light note and score colours */
html[data-theme="dark"] .mr-open{background:#2B2312;color:#F0C27A}
html[data-theme="dark"] .mr-meta b{filter:brightness(1.7)}

/* research / feed SVG charts (logos excluded) */
html[data-theme="dark"] svg:not(.mark):not(.ld-mark) [fill="#fff"]{fill:var(--surface)}
html[data-theme="dark"] svg:not(.mark):not(.ld-mark) [stroke="#DDE1E7"]{stroke:var(--rule)}
html[data-theme="dark"] svg:not(.mark):not(.ld-mark) [stroke="#2F3BD6"]{stroke:var(--accent)}
html[data-theme="dark"] svg:not(.mark):not(.ld-mark) [fill="#2F3BD6"]{fill:var(--accent)}
html[data-theme="dark"] svg:not(.mark):not(.ld-mark) [stroke="#5A6272"]{stroke:var(--muted)}
html[data-theme="dark"] svg:not(.mark):not(.ld-mark) [fill="#8A91A0"]{fill:var(--muted)}
}
