/* The footer control preserves the original duck and its footprint in blue. */
.theme-toggle{appearance:none;display:grid;align-items:center;justify-content:center;flex:0 0 auto;width:52px;height:49px;min-width:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:4px;background:transparent;line-height:0;color:inherit;touch-action:manipulation}.theme-toggle:not(:disabled){cursor:pointer}.theme-toggle:disabled{opacity:1}.theme-toggle:focus-visible{outline:3px solid var(--cyan);outline-offset:4px}.theme-toggle .footer-water{display:block;width:52px;height:auto;max-width:none;object-fit:contain;grid-area:1/1;z-index:0;pointer-events:none}.theme-toggle .footer-duck{flex:0 0 auto;grid-area:1/1;z-index:1;opacity:1;transition:opacity .24s ease;pointer-events:none}
@media(max-width:760px){.theme-toggle{width:46px;height:44px}.theme-toggle .footer-water{width:46px;height:auto}}

/* The selected tile is opaque and unmodified: no wash, filter, or blend layer. */
html[data-theme="duck"]{--navy:#4d3015;--navy-deep:#3c2918;--fog:#fff7df;--fog-light:#fffaed;--text:#513a20;--muted:#665038;--line:#d6b1a3;--gold:#a32121;--gold-light:#ff9c8c;--cyan:#ff9c8c;--teal:#a32121;background-color:#ffca28;background-image:url("duck-pattern-ffca28-v1.svg");background-repeat:repeat;background-size:352px 304px;color:var(--text)}
html[data-theme="duck"] body{background:transparent}
html[data-theme="duck"] ::selection{background:#ffc7bc;color:#3c2918}
html[data-theme="duck"] .site-header{background:#3c2918;border-bottom-color:#a6443e;color:#f9e5b7}
html[data-theme="duck"] .brand{color:#fff0cb}
html[data-theme="duck"] .brand-mark{border-right-color:#99645b}
html[data-theme="duck"].js .menu-toggle{color:#f9e5b7;border-color:#99645b}
html[data-theme="duck"] .site-footer{background:#3c2918;border-top-color:#a6443e;color:#f9e5b7}
html[data-theme="duck"] .footer-dot{color:#ff9c8c}
html[data-theme="duck"] .theme-toggle .footer-duck{opacity:0}
html[data-theme="duck"] .home-intro{background:#47301b;color:#f8e8c4}
html[data-theme="duck"] .home h1{color:#fff3d2}
html[data-theme="duck"] .hello,html[data-theme="duck"] .chinese-name{color:#ff9c8c}
html[data-theme="duck"] .home-focus{color:#e6cfaa}
html[data-theme="duck"] .home .quiet-link{color:#f8e8c4}
html[data-theme="duck"] .button-outline{border-color:#ff9c8c}
html[data-theme="duck"] .button-outline:hover{background:#613327}
html[data-theme="duck"] .home-directions{background-color:#ffca28;background-image:url("duck-pattern-ffca28-v1.svg");background-repeat:repeat;background-size:352px 304px}
html[data-theme="duck"] .directions-inner{background:#fff7df;box-shadow:0 0 0 16px #fff7df}
html[data-theme="duck"] .direction-link{border-bottom-color:#d6b1a3}
html[data-theme="duck"] .content-shell{background:#fff7df}
html[data-theme="duck"] :is(.direction-link p,.network-caption,.group-title>span,.authors,.pub-summary,.link-detail,.page-bottom-note p,.about-section .role-line,.distinctions p,.representation-scope){color:var(--muted)}
html[data-theme="duck"] :is(.research-copy>p,.research-points li,.earlier-copy>p,.about-section>p,.math-proof p,.paper-abstract p,.paper-figure figcaption p){color:var(--text)}
html[data-theme="duck"] :is(.group-title,.publication,.distinctions li,.math-proof,.topic-index,.section-number){border-color:var(--line)}
html[data-theme="duck"] .inline-chinese{color:#765328}
html[data-theme="duck"] .status-label{color:#a32121;border-color:#c99386}
html[data-theme="duck"] figcaption{color:var(--muted)}
html[data-theme="duck"] .paper-resource{background:#ffe8dd;border-color:#c99386;color:var(--teal)}
html[data-theme="duck"] .paper-resource:hover{background:#ffdbcf;border-color:#a32121;color:#84261f}
html[data-theme="duck"] .paper-resource-primary{background:#a32121;border-color:#a32121;color:#fff7df}
html[data-theme="duck"] .paper-resource-primary:hover{background:#84261f;border-color:#84261f;color:#fff7df}
html[data-theme="duck"] .paper-summary,html[data-theme="duck"] #bibtex-text{background:#fff0c9;border-color:var(--line);color:var(--text)}
html[data-theme="duck"] .paper-summary{border-left-color:var(--gold)}
html[data-theme="duck"] .citation-actions button,html[data-theme="duck"] .citation-actions a{border-color:#c99386}
html[data-theme="duck"] .citation-actions button:hover:not(:disabled),html[data-theme="duck"] .citation-actions a:hover{background:#ffdbcf;border-color:var(--teal)}
html[data-theme="duck"] .paper-figure-link{border-color:var(--line)}
/* Theme switching changes paint only; layout always comes from style.css. */
html[data-theme="duck"] .distinctions p span{color:var(--gold)}
html[data-theme="duck"] .paper-link,html[data-theme="duck"] .contact-address{border-bottom-color:#c99386}
/* Yellow-theme research UI. Paint-only overrides; the blue theme is untouched.
   Keep the Coverage canvas pixel algorithm, figure images, geometry, and type intact. */
html[data-theme="duck"] :is(.demo-panel,.figure-panel,.education-panel){
  --navy:#47301b;--navy-deep:#3c2918;--fog:#fff7df;--fog-light:#fffaed;
  --text:#fff7df;--muted:#e6cfaa;--line:#ad8064;--gold:#ff9c8c;
  --gold-light:#ff9c8c;--cyan:#ff9c8c;--teal:#ffb3ad;
  --panel-ink:#fff7df;--panel-muted:#e6cfaa;--panel-dim:#d4b897;
  --panel-line:#ad8064;--panel-surface:#573b25;--panel-hover:#684831;
  --diagram-one:#80ded0;--diagram-two:#ff9c8c;--diagram-three:#a9cafa;
  background:#47301b;color:var(--panel-ink);border-color:var(--panel-line);
}
/* Explanatory copy outside the dark panels. */
html[data-theme="duck"] :is(.research-questions li,.group-intro,.example-copy>p:not(.example-kicker)){color:#513a20}
html[data-theme="duck"] :is(.example-index a,.no-script-note,.concept-note small){color:#665038}
html[data-theme="duck"] .example-copy .scope-note{color:#665038!important}
html[data-theme="duck"] :is(.example-index,.math-example+.math-example,.concept-note){border-color:#c99386}
html[data-theme="duck"] .example-index a:hover{color:#a32121}

/* Shared panel labels, legends, metrics, and separators. */
html[data-theme="duck"] :is(.demo-topline,.figure-header,.path-legend,.demo-status,.demo-fallback,.histogram-label){color:var(--panel-ink)}
html[data-theme="duck"] :is(.figure-tag,.demo-tag,.education-panel .eyebrow){color:#ffb3ad}
html[data-theme="duck"] :is(.control-hint,.diagram-note,.result-label,.advanced-controls label,.sample-toolbar p,.sparse-topology label,.trajectory-caption,.percolation-alpha,.percolation-actions label,.percolation-legend,.deletion-list-selects label,.deletion-output-set h4,.deletion-list-legend,.deletion-candidates p,.candidate-word-list small,.ba-counts,.histogram-label>span){color:var(--panel-muted)}
html[data-theme="duck"] .ba-toolbar+.control-hint{color:var(--panel-muted)}
html[data-theme="duck"] :is(.graph-metrics dt,.coverage-metrics dt,.deletion-list-metrics dt,.percolation-metrics dt){color:var(--panel-muted)}
html[data-theme="duck"] :is(.graph-metrics dd,.deletion-list-metrics dd,.percolation-metrics dd,.ba-counts strong,.deletion-output-set h4>span,.candidate-word-list strong){color:var(--panel-ink)}
html[data-theme="duck"] :is(.graph-metrics dd[data-connected=true],.deletion-list-metrics dd[data-unique=true]){color:var(--diagram-one)}
html[data-theme="duck"] :is(.graph-metrics dd[data-connected=false],.deletion-list-metrics dd[data-unique=false]){color:#ffb3ad}
html[data-theme="duck"] :is(.demo-status,.graph-metrics,.mac-records,.coverage-metrics,.ba-counts,.sparse-components,.trajectory-inspector,.deletion-list-metrics,.percolation-metrics,.path-pair svg+svg){border-color:var(--panel-line)}

/* Native controls: preserve all hit areas, spacing, and disabled behavior. */
html[data-theme="duck"] :is(.demo-controls button,.replay-controls button,.advanced-controls button,.advanced-controls select,.sparse-topology select,.deletion-list-presets button,.deletion-list-selects select,.percolation-actions select,.percolation-actions button,.character-buttons button,.deletion-output-set button){background:var(--panel-surface);color:var(--panel-ink);border-color:var(--panel-line)}
html[data-theme="duck"] :is(.demo-controls button,.replay-controls button,.advanced-controls button,.advanced-controls select,.sparse-topology select,.deletion-list-presets button,.deletion-list-selects select,.percolation-actions select,.percolation-actions button,.character-buttons button,.deletion-output-set button):hover:not(:disabled){background:var(--panel-hover);color:var(--panel-ink);border-color:#e6cfaa}
html[data-theme="duck"] :is(.demo-controls button,.advanced-controls button,.deletion-list-presets button,.character-buttons button,.deletion-output-set button)[aria-pressed=true]{background:#fff7df;color:#a32121;border-color:#a32121}
html[data-theme="duck"] :is(.demo-controls button,.advanced-controls button,.deletion-list-presets button,.character-buttons button,.deletion-output-set button)[aria-pressed=true]:hover:not(:disabled){background:#ffe8dd;color:#84261f;border-color:#84261f}
html[data-theme="duck"] :is(.character-buttons button>small,.deletion-output-set button small){color:var(--panel-muted)}
html[data-theme="duck"] :is(.character-buttons button[aria-pressed=true]>small,.deletion-output-set button[aria-pressed=true] small){color:#a32121}
html[data-theme="duck"] .demo-panel :is(button,input,select,summary):focus-visible{outline-color:#ffb3ad}
html[data-theme="duck"] :is(.coverage-controls input,.percolation-alpha input){accent-color:#ff9c8c}

/* String paths and deletion: teal and coral remain separate channels. */
html[data-theme="duck"] .key-cyan{background:var(--diagram-one)}
html[data-theme="duck"] .key-gold{background:var(--diagram-two)}
html[data-theme="duck"] .lattice-grid{stroke:#b59779}
html[data-theme="duck"] :is(.step-a,.remaining-step){stroke:var(--diagram-one)}
html[data-theme="duck"] :is(.step-b,.removed-step){stroke:var(--diagram-two)}
html[data-theme="duck"] :is(.path-vertex,.path-origin){fill:var(--panel-ink)}
html[data-theme="duck"] .path-end{fill:var(--diagram-one);stroke:#3c2918}
html[data-theme="duck"] .original-step{stroke:#d4b897}
html[data-theme="duck"] :is(.svg-word,.svg-step-label,.svg-coordinate){fill:var(--panel-ink)}
html[data-theme="duck"] .svg-tick{fill:var(--panel-muted)}
html[data-theme="duck"] .deletion-result>span:first-child{color:var(--diagram-one)}

/* Finite deletion lists: shared outputs keep their dashed outline and diamond. */
html[data-theme="duck"] .deletion-output-set button[data-shared=true]:not([aria-pressed=true]){border-color:#ffb3ad}
html[data-theme="duck"] .deletion-output-set button[data-shared=true]:not([aria-pressed=true]) small{color:#ffb3ad}
html[data-theme="duck"] :is(.deletion-candidates,.percolation-reachable){background:#573b25;border-color:#ff9c8c}
html[data-theme="duck"] :is(.deletion-candidates h4,.percolation-reachable h4,.percolation-reachable p){color:var(--panel-ink)}
html[data-theme="duck"] .binary-word{color:#ffb3ad}

/* Prefix percolation: retained / absent edge patterns and reachability rings persist. */
html[data-theme="duck"] .prefix-absent{stroke:#c6ab8b}
html[data-theme="duck"] .prefix-kept{stroke:#e6cfaa}
html[data-theme="duck"] .prefix-reachable-edge{stroke:var(--diagram-one)}
html[data-theme="duck"] .prefix-node-body{fill:#573b25;stroke:#d4b897}
html[data-theme="duck"] .prefix-node text{fill:var(--panel-ink)}
html[data-theme="duck"] .prefix-reachable .prefix-node-body{fill:#315047;stroke:var(--diagram-one)}
html[data-theme="duck"] .prefix-reach-ring{stroke:var(--diagram-one)}
html[data-theme="duck"] .prefix-selected .prefix-node-body{fill:#6a3528;stroke:var(--diagram-two)}
html[data-theme="duck"] .prefix-node .prefix-start-marker{fill:var(--diagram-two)}
html[data-theme="duck"] .prefix-node:focus-visible .prefix-node-body{stroke:#fff7df}

/* Sparsification: circles, squares, diamonds pair with teal, coral, and blue. */
html[data-theme="duck"] .edge-kept{stroke:var(--diagram-one)}
html[data-theme="duck"] .edge-dropped{stroke:#c6ab8b}
html[data-theme="duck"] .edge-bridge{stroke:var(--diagram-two)}
html[data-theme="duck"] .graph-node{fill:#573b25;stroke:#d4b897}
html[data-theme="duck"] :is(.graph-label,.sparse-node-label){fill:var(--panel-ink)}
html[data-theme="duck"] .sparse-node :is(circle,rect,path){fill:#315047;stroke:var(--diagram-one)}
html[data-theme="duck"] .sparse-node.component-2 rect{fill:#6a3528;stroke:var(--diagram-two)}
html[data-theme="duck"] .sparse-node.component-3 path{fill:#3d4560;stroke:var(--diagram-three)}
html[data-theme="duck"] .sparse-edge.edge-kept.component-2{stroke:var(--diagram-two)}
html[data-theme="duck"] .sparse-edge.edge-kept.component-3{stroke:var(--diagram-three)}
html[data-theme="duck"] .sparse-components p{color:var(--panel-muted)}
html[data-theme="duck"] .sparse-components strong{color:var(--panel-ink)}
html[data-theme="duck"] .component-symbol.component-1{color:var(--diagram-one)}
html[data-theme="duck"] .component-symbol.component-2{color:var(--diagram-two)}
html[data-theme="duck"] .component-symbol.component-3{color:var(--diagram-three)}

/* MAC: retain solid speech and dashed summary flows; include SVG marker fills. */
html[data-theme="duck"] .region-one{fill:var(--diagram-one);stroke:var(--diagram-one)}
html[data-theme="duck"] .region-two{fill:var(--diagram-two);stroke:var(--diagram-two)}
html[data-theme="duck"] :is(.session-title,.board-title,.agent-label){fill:var(--panel-ink)}
html[data-theme="duck"] .board-subtitle{fill:var(--panel-muted)}
html[data-theme="duck"] :is(.blackboard,.agent-node){fill:#573b25;stroke:#d4b897}
html[data-theme="duck"] .mac-target.is-selected :is(.agent-node,.blackboard){fill:#6a3528;stroke:var(--diagram-two)}
html[data-theme="duck"] .mac-target:focus-visible :is(.agent-node,.blackboard){stroke:#fff7df}
html[data-theme="duck"] .memory-flow{stroke:var(--diagram-one)}
html[data-theme="duck"] .summary-flow{stroke:var(--diagram-two)}
html[data-theme="duck"] #mac-drawing #memory-arrow path{fill:var(--diagram-one)}
html[data-theme="duck"] #mac-drawing #summary-arrow path{fill:var(--diagram-two)}
html[data-theme="duck"] :is(.mac-records h4,.record-columns p.record-label,.record-columns strong){color:var(--panel-ink)}
html[data-theme="duck"] :is(.mac-records h4>span,.record-columns p,.record-columns li){color:var(--panel-muted)}
html[data-theme="duck"] .record-columns h5{color:var(--diagram-one)}
html[data-theme="duck"] .record-columns section+section h5{color:#ffb3ad}

/* Coverage changes only its surrounding UI; preserve the original white canvas. */
html[data-theme="duck"] :is(.coverage-canvas-wrap,.trajectory-field-wrap){border-color:var(--panel-line)}
html[data-theme="duck"] .trajectory-inspector summary{color:var(--panel-ink)}
html[data-theme="duck"] :is(.coverage-controls output,.coverage-metrics dd,.trajectory-inspector summary>span,.percolation-alpha output,.percolation-reachable h4 span){color:#ffb3ad}

/* Preferential attachment: coral newest-node state against teal existing nodes. */
html[data-theme="duck"] .ba-edge{stroke:#c6ab8b}
html[data-theme="duck"] .ba-new-edge{stroke:var(--diagram-two)}
html[data-theme="duck"] .ba-node{fill:var(--diagram-one);stroke:#3c2918}
html[data-theme="duck"] .ba-new-node{fill:var(--diagram-two);stroke:#fff7df}
html[data-theme="duck"] .hist-axis{stroke:#d4b897}
html[data-theme="duck"] .hist-tick{fill:var(--panel-muted)}
html[data-theme="duck"] .hist-bar{fill:var(--diagram-two)}

/* Other existing dark panels use the same warm local palette, leaving art intact. */
html[data-theme="duck"] :is(.figure-takeaway,.education-panel h2,.education-panel dd){color:var(--panel-ink)}
html[data-theme="duck"] :is(.education-panel>.education-rule+p,.education-panel dt){color:var(--panel-muted)}
html[data-theme="duck"] .education-rule{background:#ad8064}
html[data-theme="duck"] .education-panel .degree{color:var(--panel-ink)}
html[data-theme="duck"] .education-panel .degree-honours{color:#ffb3ad}

@media print{html[data-theme="duck"]{background:#fff}html[data-theme="duck"] .content-shell,html[data-theme="duck"] .home-directions,html[data-theme="duck"] .directions-inner{background:#fff;box-shadow:none}.theme-toggle{display:none}}

/* C1 is an equal-sized, yellow-theme-only mark; the original blue mark remains. */
.brand-mark>.brand-mark-duck{display:none}
html[data-theme="duck"] .brand-mark>img:first-child{display:none}
html[data-theme="duck"] .brand-mark>.brand-mark-duck{display:block}

/* Same intrinsic image box: swap only the decorative network artwork. */
.network-art-duck{display:none}
html[data-theme="duck"] .network-wrap>.network-art:first-child{display:none}
html[data-theme="duck"] .network-art-duck{display:block}

/* The fixed water layer never fades; reduced-motion users get an immediate change. */
@media(prefers-reduced-motion:reduce){.theme-toggle .footer-duck{transition:none}}

/* Publication years only; venue labels and links retain the red accent. */
html[data-theme="duck"] .publication-shell .pub-year{color:#24513b}

/* Original gold typography becomes green; semantic diagram palettes stay separate. */
html[data-theme="duck"] .eyebrow,
html[data-theme="duck"] .direction-num,
html[data-theme="duck"] .topic-index span,
html[data-theme="duck"] .section-number,
html[data-theme="duck"] .pub-year,
html[data-theme="duck"] .small-heading>span,
html[data-theme="duck"] .research-questions li:before,
html[data-theme="duck"] .example-index a>span:first-child,
html[data-theme="duck"] .example-kicker,
html[data-theme="duck"] .concept-note>span,
html[data-theme="duck"] .paper-summary h2,
html[data-theme="duck"] .distinctions p span{color:#24513b}
html[data-theme="duck"] :is(.home-intro .eyebrow,.figure-tag,.demo-tag,.education-panel .eyebrow,.footer-dot){color:#b2d8bd}
html[data-theme="duck"] .section-number{border-right-color:#24513b}
html[data-theme="duck"] .paper-summary{border-left-color:#24513b}
html[data-theme="duck"] .email-line{background:#b2d8bd}
html[data-theme="duck"] .research-points li:before{background:#24513b}
html[data-theme="duck"] :is(.graph-metrics dd[data-connected=false],.record-columns section+section h5,.deletion-list-metrics dd[data-unique=false]){color:#b2d8bd}
html[data-theme="duck"] .character-buttons button[aria-pressed=true],
html[data-theme="duck"] .character-buttons button[aria-pressed=true]:hover:not(:disabled){color:#24513b}
