/* ---------- dark mode: html[data-theme="dark"] (toggle in the header, remembered per browser) ---------- */
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="dark"] body{--bg:#081226;--card:#0F1D3A;--ink:#E6EDF9;--body:#C3CEE4;--muted:#8EA2C6;--line:#1E2F55;--shadow:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.35);background:var(--bg);color:var(--body)}
html[data-theme="dark"] :is(.card,.tile.text,.path,.rank,.cat,.mega,.entry,.toc,.sidecard,.share,.abox,.sub,.flist a,.track,.libtabs button,.tmonth a,.pnav a,.minilist a,.bookcard,.prail a,.prail button,.sidead,.values>div,.ccard,.lesson,.stage,.pathnav a,.pathfaq details,.pager a,.pager span,.ptags a,.siblings a,.cmdk .box,.drawer .pane,.toc-m,.dsearch input,.drawer .grid a,.cform input,.cform select,.cform textarea,.mega a.it:hover){background:var(--card);border-color:var(--line);color:var(--body)}
html[data-theme="dark"] .tile.text{background:linear-gradient(135deg,#10234A,#0F1D3A)}
html[data-theme="dark"] .lib{background:linear-gradient(180deg,#0F1D3A,#0B1834);border-color:var(--line)}
html[data-theme="dark"] .island{background:rgba(12,24,50,.82);border-color:rgba(255,255,255,.08);box-shadow:0 10px 40px rgba(0,0,0,.45)}
html[data-theme="dark"] .island nav a.top{color:#D6DFF2}
html[data-theme="dark"] .island nav a.top:hover,html[data-theme="dark"] .island nav>div:hover>a.top{background:rgba(255,255,255,.07);color:#93C5FD}
html[data-theme="dark"] .sbtn{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.1);color:#AFC0DE}
html[data-theme="dark"] .sbtn kbd,html[data-theme="dark"] .cmdk kbd{background:#0F1D3A;border-color:var(--line);color:#AFC0DE}
html[data-theme="dark"] .search{background:#0F1D3A;box-shadow:0 20px 50px rgba(0,0,0,.5)}
html[data-theme="dark"] .search input,html[data-theme="dark"] .cmdk input{color:var(--ink);background:transparent}
html[data-theme="dark"] .cmdk .sugg a{background:#16284E;color:var(--ink)}
html[data-theme="dark"] :is(.sh h2,.cbody h3,.path h3,.cat b,.sub>b,.rank li a,.flist b,.tsteps b,.lesson .lt,.shead h2,.book h4,.abox b,.toch b,.toc>b,.sidecard>b,.sidecard a,.pnav b,.minilist a,.values b,.ccard b,.share b,.cform label,.tmonth h3,.tmonth span,.pathfaq summary,.entry h2,.entry h3,.entry h4,.bookcard dd,.mega a.it b){color:var(--ink)}
html[data-theme="dark"] .entry{color:#D3DCEE}
html[data-theme="dark"] .entry blockquote{background:#10234A;color:#BFD4FF}
html[data-theme="dark"] .entry code{background:#16284E}
html[data-theme="dark"] .entry th{background:#16284E;color:var(--ink)}
html[data-theme="dark"] .entry td,html[data-theme="dark"] .entry th{border-color:var(--line)}
html[data-theme="dark"] .entry a:not(#c4t-dl):not([href*="drive.google.com"]):not([href*="mediafire.com"]){color:#93C5FD}
html[data-theme="dark"] .entry .code-block{background:transparent}
html[data-theme="dark"] .steps i,html[data-theme="dark"] .sidecard a .num,html[data-theme="dark"] .lesson .ln,html[data-theme="dark"] .shead .wk,html[data-theme="dark"] .tmonth time{background:#16284E;color:#93C5FD}
html[data-theme="dark"] .bar,html[data-theme="dark"] .tocbar{background:#1E2F55}
html[data-theme="dark"] .stip{background:#0E2A22;border-color:#14532D;color:#A7F3D0}
html[data-theme="dark"] .tsteps .n{background:#0F1D3A;box-shadow:0 0 0 6px #0F1D3A}
html[data-theme="dark"] .shead .sn{box-shadow:0 0 0 6px #0F1D3A}
html[data-theme="dark"] .cimg,html[data-theme="dark"] .flist .fth,html[data-theme="dark"] .pnav .th{background:#16284E}
html[data-theme="dark"] .rank li::before{-webkit-text-stroke-color:#60A5FA}
html[data-theme="dark"] .ad{background:none;border-color:var(--line)}
/* logos: dark wordmark in light mode, white wordmark in dark mode */
.island .logo .lg-dark,.drawer .dtop .lg-dark{display:none}
html[data-theme="dark"] .island .logo .lg-light,html[data-theme="dark"] .drawer .dtop .lg-light{display:none}
html[data-theme="dark"] .island .logo .lg-dark,html[data-theme="dark"] .drawer .dtop .lg-dark{display:block}
/* toggle button */
.tbtn{width:44px;height:44px;border-radius:14px;display:grid;place-items:center;background:#F1F5F9;border:1px solid var(--line);color:#334155;cursor:pointer;transition:.2s}
.tbtn:hover{border-color:#BFDBFE;color:var(--blue)}
.tbtn .sun{display:none}
html[data-theme="dark"] .tbtn{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.1);color:#FCD34D}
html[data-theme="dark"] .tbtn .sun{display:block}
html[data-theme="dark"] .tbtn .moon{display:none}
