/* Algorithmics source: computational-style touch control and shared theme tokens. */
:root{--page:#fff;--ink:#151515;--muted:#555;--bar:#151515;--bar-ink:#fff;--panel:#fff;--line:#aaa;--soft:#f1f1f1;--viewport:#ededed}
:root[data-theme="dark"]{--page:#151515;--ink:#f5f5f5;--muted:#c8c8c8;--bar:#f5f5f5;--bar-ink:#151515;--panel:#202020;--line:#707070;--soft:#2d2d2d;--viewport:#292929}
html,body{background:var(--page);color:var(--ink)}
/* All public titles share the restrained half-scale; pages differ by content, not heading scale. */
h1{font-size:clamp(19.2px,3vw,36.8px)!important;line-height:.9!important}
.page-control.theme-toggle{position:fixed;right:20px;bottom:20px;z-index:1000;width:48px;height:48px;margin:0;padding:0;border:1px solid var(--ink);border-radius:50%;display:grid;place-items:center;background:var(--bar);color:var(--bar-ink);cursor:pointer;box-shadow:0 2px 10px rgb(0 0 0 / .18);transition:transform .16s ease,background-color .16s ease,color .16s ease}
.page-control.theme-toggle:hover{transform:scale(1.06)}
.page-control.theme-toggle:focus-visible{outline:2px solid var(--ink);outline-offset:4px}
.page-control-disc{width:30px;height:30px;display:grid;place-items:center}
.theme-icon{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.25}.theme-icon-fill{fill:currentColor;stroke:none}
:root[data-theme="dark"] :is(input:not([type="range"]),select,textarea,fieldset,#controls,.work>form,button:not(.page-control),.view button,.export,.pick-restore){background-color:var(--panel);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] :is(p,label,output,.note,.info,.meta,.heading p){color:var(--muted)!important}
:root[data-theme="dark"] :is(.viewport,#viewport){background:var(--viewport)}
/* Paper and exported SVG/PNG stages retain their physical white-paper contract. */
:root[data-theme="dark"] :is(.paper,#paper-preview,svg){color-scheme:light}
@media (prefers-reduced-motion:reduce){.page-control.theme-toggle{transition:none}}

/* Single-choice dropdowns: equal text and chevron inset across scaffold modules. */
:root{--select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23151515' stroke-width='1.4'/%3E%3C/svg%3E")}
:root[data-theme="dark"]{--select-chevron:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%23f5f5f5' stroke-width='1.4'/%3E%3C/svg%3E")}
select:not([multiple]):not([size]),select:not([multiple])[size="1"]{-webkit-appearance:none!important;appearance:none!important;padding-left:8px!important;padding-right:28px!important;background-image:var(--select-chevron)!important;background-repeat:no-repeat!important;background-position:right 8px center!important;background-size:10px 6px!important}
@media(forced-colors:active){select:not([multiple]):not([size]),select:not([multiple])[size="1"]{-webkit-appearance:auto!important;appearance:auto!important;background-image:none!important}}

/* Flat control blocks: override browser bevels without changing tabs or list rows. */
:where(button:not(.page-control):not([role="tab"]):not([data-work-id]),input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="image"]),select,textarea){border:1px solid var(--line)!important;border-radius:0!important;box-shadow:none!important;background-color:var(--panel)!important;color:var(--ink)!important}
:where(button:not(.page-control):not([role="tab"]):not([data-work-id]),input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="image"]),textarea){-webkit-appearance:none!important;appearance:none!important}
input::file-selector-button{border:1px solid var(--line);border-radius:0;box-shadow:none;background:var(--panel);color:var(--ink);font:inherit}
:where(button:not(.page-control),input,select,textarea):focus-visible{outline:1px solid var(--ink);outline-offset:2px}

/* Scaffold links stay monochrome, including native visited/active states. */
a:any-link,a:any-link:hover,a:any-link:focus-visible,a:any-link:active{color:inherit!important}

/* Resting text links are unadorned; interaction stays visible. */
a:any-link{text-decoration:none!important}
a:any-link:hover,a:any-link:focus-visible{text-decoration:underline!important;text-underline-offset:3px;text-decoration-thickness:1px}
