/* Dark version of the whole app. The colour rules first are generated from styles.css and lesson-phone.css so they keep the same order; the hand-tuned rules are at the end. Phones stay light because they are other people's screens. */
html[data-theme=dark]{--ink:#f5f5f7;--ink-2:#a9adb6;--line:#ffffff1c;--glass:#1e2533cc;--glass-edge:#ffffff26}
html[data-theme=dark] .room-target:hover{background:#ffffff0f}
html[data-theme=dark] .devices button:hover{color:#f2dd88}
html[data-theme=dark] .history{background:#ffffff0f;border:1px solid #ffffff18}
html[data-theme=dark] .primary{background:#473e1f;color:#f5f5f7}
html[data-theme=dark] .feedback{background:#ffffff0f}
html[data-theme=dark] .toggle{background:#473e1f;color:#f5f5f7}
html[data-theme=dark] .access-panel{background:#ffffff0f;border:1px solid #ffffff18}
html[data-theme=dark] .turn-all-off{color:#f28888}
html[data-theme=dark] .model-tools button, html[data-theme=dark] .room-model-reset{border:1px solid #ffffff1a;background:#ffffff0f}
html[data-theme=dark] .model-tools button:hover, html[data-theme=dark] .room-model-reset:hover{background:#ffffff0f}
html[data-theme=dark] .floor-selector button:hover{background:#ffffff0f}
html[data-theme=dark] .edu-primary{background:#47401f;color:#f5f5f7}
html[data-theme=dark] .edu-primary:hover{background:#473e1f}
html[data-theme=dark] #screen::after{background:#ffffff08}
html[data-theme=dark] #screen.dimmed::after{background:#ffffff29}
html[data-theme=dark] .history, html[data-theme=dark] .access-panel, html[data-theme=dark] .edu-panel{border:1px solid #ffffff17}
html[data-theme=dark] dialog{border:1px solid #ffffff12}
html[data-theme=dark] .hairline{background:#ffffff12}
html[data-theme=dark] .hairline.main{background:#ffffff29}
html[data-theme=dark] .round svg.icon{color:#f5f5f7}
html[data-theme=dark] .round:hover{background:#1e2533e6}
html[data-theme=dark] .round:hover svg.icon{color:#f5f5f7}
html[data-theme=dark] .alarm svg.bell{color:#f5f5f7}
html[data-theme=dark] .floor-selector button[aria-pressed=true]{background:#1e2533}
html[data-theme=dark] .marker{background:#1e2533;color:#f5f5f7}
html[data-theme=dark] .marker.paused{background:#1e2533b0}
html[data-theme=dark] .devices button:hover{background:#1e2533e6}
html[data-theme=dark] .devices b{color:#88f2a2}
html[data-theme=dark] #filter{background:#ffffff24}
html[data-theme=dark] #filter option{color:#f5f5f7}
html[data-theme=dark] .access-badge{background:#ffffff24}
html[data-theme=dark] .hairline.main{background:#ffffff29}
html[data-theme=dark] .switch{background:#1e2533}
html[data-theme=dark] .switch i{background:#1e2533}
html[data-theme=dark] .switch[aria-checked=true]{background:#34c759}
html[data-theme=dark] .turn-all-off{color:#ff3b30}
html[data-theme=dark] #screen.dimmed::after{background:#ffffff29}
html[data-theme=dark] dialog{background:#1e2533f2}
html[data-theme=dark] dialog .secondary{background:#ffffff1e}
html[data-theme=dark] dialog input{background:#ffffff1e}
html[data-theme=dark] .toggle{color:#88f2a2}
html[data-theme=dark] .toggle[aria-checked=false]{background:#ffffff24}
html[data-theme=dark] .edu-card{background:#1e2533b0}
html[data-theme=dark] button.edu-card:hover{background:#1e2533}
html[data-theme=dark] .edu-preference[aria-pressed=true], html[data-theme=dark] .edu-select[aria-checked=true]{background:#1e2533}
html[data-theme=dark] .edu-primary:disabled{background:#ffffff29}
html[data-theme=dark] .edu-card{background:#1e2533}
html[data-theme=dark] button.edu-card:hover{background:#1e2533}
html[data-theme=dark] .edu-preference[aria-pressed=true], html[data-theme=dark] .edu-select[aria-checked=true]{background:#1f3047}
html[data-theme=dark] .avatar-placeholder{background:#1e2533;color:#b4b8c1}
html[data-theme=dark] .learn-side p{color:#b4b8c1}
html[data-theme=dark] .learn-device{background:#1e2533}
html[data-theme=dark] .learn-device svg{color:#b4b8c1}
html[data-theme=dark] .learn-device small{color:#b4b8c1}
html[data-theme=dark] .learn-guess button{background:#1e2533}
html[data-theme=dark] .learn-guess button[aria-pressed=true]{background:#1f3247}
html[data-theme=dark] .learn-result{background:#1e2533}
html[data-theme=dark] .learn-verdict.same{background:#1f472a;color:#88f2a4}
html[data-theme=dark] .learn-verdict.more{background:#47351f;color:#f2bf88}
html[data-theme=dark] .learn-verdict.less{background:#1e2533;color:#b4b8c1}
html[data-theme=dark] .learn-switch{background:#1e2533}
html[data-theme=dark] .event button:active{background:#ffffff1e}
html[data-theme=dark] #stage-markers .marker:not(.paused), html[data-theme=dark] #screen:has(#room:not([hidden])) #stage-markers .marker:not(.paused){color:#f5f5f7;background:#1e2533}
html[data-theme=dark] #stage-markers .marker:not(.paused), html[data-theme=dark] #screen:has(#room:not([hidden])) #stage-markers .marker:not(.paused){color:#f5f5f7;background:#1e2533}
html[data-theme=dark] #stage-markers .marker.group:not(.paused){color:#f5f5f7}
html[data-theme=dark] .device-icon{background:#1e2533;color:#f5f5f7}
html[data-theme=dark] .access-panel, html[data-theme=dark] .quick-settings, html[data-theme=dark] .history, html[data-theme=dark] .pane, html[data-theme=dark] .devices button, html[data-theme=dark] .no-devices{background:#1e2533c7}
html[data-theme=dark] .list-row:active, html[data-theme=dark] .plain-row:active{background:#ffffff1e}
html[data-theme=dark] .plain-row.danger{color:#ff3b30}
html[data-theme=dark] .decide-no{background:#ffffff24}
html[data-theme=dark] .db-table{background:#1e2533}
html[data-theme=dark] .db-empty{background:#1e2533}
html[data-theme=dark] #filter-btn{background:#ffffff1e}
html[data-theme=dark] #filter-btn:active{background:#ffffff29}
html[data-theme=dark] #filter-menu{background:#1e2533}
html[data-theme=dark] #filter-menu button:active{background:#ffffff1e}
html[data-theme=dark] dialog{background:#1e2533}
html[data-theme=dark] dialog input, html[data-theme=dark] #access-name{background:#ffffff1e}
html[data-theme=dark] #scrim{background:#ffffff29}
html[data-theme=dark] .sheet-panel{background:#1e2533}
html[data-theme=dark] #close{background:#ffffff1e}
html[data-theme=dark] .contact-grid button{background:#ffffff1e}
html[data-theme=dark] .contact-grid i{background:#1f3147;color:#b4b8c1}
html[data-theme=dark] #filter-chips button{background:#ffffff1e}
html[data-theme=dark] .devices button:not(.ic) svg{color:#f5f5f7}
html[data-theme=dark] .row-icon{color:#f5f5f7}
html[data-theme=dark] .learn-side p{color:#b4b8c1}
html[data-theme=dark] .learn-dots i{background:#ffffff29}
html[data-theme=dark] .learn-big{background:#1e2533}
html[data-theme=dark] .learn-yn button{background:#1e2533}
html[data-theme=dark] .learn-device svg{color:#f5f5f7}
html[data-theme=dark] .learn-device small{color:#b4b8c1}
html[data-theme=dark] .learn-hero-side p{color:#b4b8c1}
html[data-theme=dark] .learn-device.seen em{background:#34c759}
html[data-theme=dark] .learn-device.seen{background:#1e2533a6}
html[data-theme=dark] .fc-face{background:#1e2533}
html[data-theme=dark] .fc-face svg{color:#f5f5f7}
html[data-theme=dark] .name-field{background:#ffffff1e}
html[data-theme=dark] .name-field em{color:#b4b8c1}
html[data-theme=dark] .name-note{color:#f2bf88}
html[data-theme=dark] .keys button{background:#ffffff24}
html[data-theme=dark] .keys button:active{background:#ffffff29}
html[data-theme=dark] .sheet-panel .primary:disabled{background:#ffffff1e}
html[data-theme=dark] #name-page{background:#1e2533}
html[data-theme=dark] .kb-field{background:#1e2533b0}
html[data-theme=dark] .kb-glyph{color:#f5f5f7}
html[data-theme=dark] #name-field u{background:#007aff}
html[data-theme=dark] #name-close{background:#1e2533b0;color:#f5f5f7}
html[data-theme=dark] .kb-note{color:#f2bf88}
html[data-theme=dark] #name-suggest p{color:#b4b8c1}
html[data-theme=dark] #name-suggest button{color:#b4b8c1}
html[data-theme=dark] #name-suggest i{background:#1f3147;color:#b4b8c1}
html[data-theme=dark] .kb-panel{background:#1e2533}
html[data-theme=dark] .kb-emoji{color:#f5f5f7}
html[data-theme=dark] .kb-hints{background:#ffffff2c}
html[data-theme=dark] .kb-hints button{color:#f5f5f7}
html[data-theme=dark] .kb-hints button:active{background:#ffffff29}
html[data-theme=dark] .kb-key{background:#1e2533;color:#f5f5f7}
html[data-theme=dark] .kb-key:active{background:#1e2533}
html[data-theme=dark] .kb-return{background:#007aff}
html[data-theme=dark] .kb-return:disabled{background:#1e2533}
html[data-theme=dark] .choose-list{background:#1e2533}
html[data-theme=dark] .choose-list button:active{background:#ffffff1e}
html[data-theme=dark] .learn-bar{background:#ffffff29}
html[data-theme=dark] .learn-back{background:#1e2533}
html[data-theme=dark] .learn-back:active{background:#1e2533}
html[data-theme=dark] .choose-list button:focus-visible{background:#ffffff1e}
html[data-theme=dark] .flow-node i{background:#1e2533}
html[data-theme=dark] .flow-node svg{color:#f5f5f7}
html[data-theme=dark] .flow-lines path{stroke:#1e2533}
html[data-theme=dark] .flow-end{background:#1e2533}
html[data-theme=dark] .day-bars i.none{background:#1e2533}
html[data-theme=dark] .guide p{background:#1e2533}
html[data-theme=dark] .learn-back{background:#ffffff1e}
html[data-theme=dark] .quiz-item button{background:#1e2533}
html[data-theme=dark] .quiz-item.right button{background:#1f472a}
html[data-theme=dark] .quiz-item.right [aria-checked=true] i{background:#34c759}
html[data-theme=dark] .mile{background:#1e2533}
html[data-theme=dark] .miles .chev{color:#b4b8c1}
html[data-theme=dark] .lesson-head>i{background:#ffffff1e;color:#b4b8c1}
html[data-theme=dark] .lesson.done .lesson-head>i{background:#34c759}
html[data-theme=dark] .steps i{background:#1e2533}
html[data-theme=dark] .steps .done i{background:#34c759}
html[data-theme=dark] .steps li+li::before{background:#1e2533}
html[data-theme=dark] .steps li.done+li::before{background:#34c759}
html[data-theme=dark] .win-rule{background:#1e2533}
html[data-theme=dark] .flow.route .to-you, html[data-theme=dark] .flow.route .to-them{stroke:#1e2533}
html[data-theme=dark] .clips i{background:#1e2533}
html[data-theme=dark] .year{background:#1e2533}
html[data-theme=dark] .year-bars i.gone{background:#1e2533}
html[data-theme=dark] .year-bars i.none{background:#1e2533}
html[data-theme=dark] .policy-line{background:#1e2533}
html[data-theme=dark] .policy-hi{color:#f5f5f7}
html[data-theme=dark] .chain{background:#1e2533}
html[data-theme=dark] .chain-node i{background:#1e2533;color:#f5f5f7}
html[data-theme=dark] .policy-card{background:#1e2533}
html[data-theme=dark] .ask-card{background:#1e2533}
html[data-theme=dark] .who-list, html[data-theme=dark] .changed-list{background:#1e2533}
html[data-theme=dark] .who-list .chev, html[data-theme=dark] .changed-list .chev{color:#b4b8c1}
html[data-theme=dark] .sheet section{background:#1e2533}
html[data-theme=dark] .quiz-item.open button{background:#1e2533}
html[data-theme=dark] .education[data-kind] .quiz-item{background:#1e2533}
html[data-theme=dark] .education[data-kind] .quiz-item.right{background:#1f472a}
html[data-theme=dark] .education[data-kind] .quiz-item.wrong{background:#47221f}
html[data-theme=dark] .off-grid{background:#1e2533}
html[data-theme=dark] .education[data-kind] .quiz-item.wrong p{color:#f28e88}
html[data-theme=dark] .education[data-kind] .win .learn-nav>.learn-text{background:#ffffff0f}

/* Hand-tuned */
html[data-theme=dark]{--ink-2:#b4b8c1}
html[data-theme=dark] body,html[data-theme=dark] .stage{background:#0b0e14}
html[data-theme=dark] .screen{background:#141a26;color:var(--ink)}
html[data-theme=dark] #screen::before{display:none}
html[data-theme=dark] .phone,html[data-theme=dark] .mini-phone,html[data-theme=dark] .ph-screen{--ink:#1d1d1f;--ink-2:#6e6e73;--line:#0000000f}
html[data-theme=dark] .education[data-step="0"] h1{color:#c7cbd3}
html[data-theme=dark] .learn-primary:disabled{background:#ffffff1c;color:#8b909a}

/* Glass tags over the house */
html[data-theme=dark] #stage-markers .marker:not(.paused),html[data-theme=dark] #screen:has(#room:not([hidden])) #stage-markers .marker:not(.paused){color:#fff;background:#ffffff26;box-shadow:inset 0 0 0 1px #ffffff40,0 4px 16px #00000040;-webkit-backdrop-filter:blur(14px) saturate(160%);backdrop-filter:blur(14px) saturate(160%)}
html[data-theme=dark] #stage-markers .marker.group:not(.paused){color:#fff}
#screen:has(.education[data-kind=night]:not([hidden])) #stage-markers .marker{min-width:44px;height:44px;padding:0 12px;border-radius:22px}
#screen:has(.education[data-kind=night]:not([hidden])) #stage-markers .marker>svg{width:24px;height:24px}
#screen:has(.education[data-kind=night]:not([hidden])) #stage-markers .marker span{font-size:22px;font-weight:500;margin-left:6px}
html[data-theme=dark] .know-card{--ink:#1d1d1f;--ink-2:#6e6e73}
html[data-theme=dark] .night-phone .mini-title{color:#1d1d1f}
html[data-theme=dark] .switch{background:#3a4152}
html[data-theme=dark] .switch i{background:#fff}
html[data-theme=dark] .switch[aria-checked=true]{background:#34c759}
html[data-theme=dark] .mini-phone .mini-title{color:#1d1d1f}
html[data-theme=dark] .off-grid{background:#1e2533}
html[data-theme=dark] .policy-card{background:#1e2533}
html[data-theme=dark] .policy-hi{color:#f5f5f7}
html[data-theme=dark] .policy-line{background:#ffffff1f}

/* Contrast for older readers: white on the button 4.7:1, accent text on cards 5.9:1 */
html[data-theme=dark] .learn-primary:not(:disabled),html[data-theme=dark] .fc-back{background:#0071e3}
html[data-theme=dark] .fc-front small{color:#4da3ff}
html[data-theme=dark] .policy-hi mark{color:#7cc0ff}
html[data-theme=dark] .flow-lines path{stroke:#6b7280;stroke-width:2}
html[data-theme=dark] .who-list .avatar-placeholder{background:#0b0e14;color:var(--ink)}
html[data-theme=dark] .sheet-panel{background:#1e2533}
html[data-theme=dark] #scrim,html[data-theme=dark] .scrim{background:#05070bb3}
