:root{--ink:#1b1c19;--mut:#70716b;--line:#dddeda;--gray:#f3f4f0;--green:#b5fb50;--pad:clamp(14px,1.55vw,28px)}
*{box-sizing:border-box}
body,h1,h2,p{margin:0}
body{font:12px/1.3 ui-monospace,'SFMono-Regular',Menlo,Consolas,monospace;color:var(--ink);background:#fff;display:grid;height:100vh;height:100dvh;grid-template-rows:58px minmax(440px,1fr) clamp(156px,25vh,340px);-webkit-font-smoothing:antialiased}
button,input,select,a{font:inherit;color:inherit;border:0;border-radius:0;background:none;text-decoration:none;padding:0;min-width:0}
button,a,select{cursor:pointer;touch-action:manipulation}
button,a,i{display:inline-flex;align-items:center;justify-content:center}
button{gap:8px;min-height:32px;min-width:32px;border-radius:5px;white-space:nowrap}
button:hover:not(:disabled),.outlined:hover,select:hover{background:#edeee9}
button:disabled{opacity:.3;cursor:default}
button[aria-pressed=true]{background:#e4e6df}
select{padding:5px;border-radius:3px}
input:focus{outline:none;box-shadow:0 1px 0 currentColor}
:focus-visible{outline:2px solid #588e19;outline-offset:2px}
i{pointer-events:none}
i svg{width:17px;height:17px;stroke:currentColor;stroke-width:1.65;fill:none;stroke-linejoin:round;stroke-linecap:round}
header,.toolbar,.heading,.under,.proofbar,.operations,.mirror,.pair{display:flex;align-items:center}
header{gap:10px;padding:0 var(--pad);border-bottom:1px solid var(--line)}
.home{gap:8px;color:#575951}.home:hover{color:black}.home:hover i{transform:translateX(-3px)}.home i{transition:transform .2s}
h1{font-size:13px;font-weight:600;letter-spacing:-.04em}
h1:before{content:'/';margin:0 14px 0 5px;color:#afb1ac;font-weight:400}
.family{display:flex;gap:7px;align-items:center;margin:auto;position:absolute;left:50%;transform:translateX(-50%)}
.family input{font-size:14px;font-weight:600;text-align:center;width:6ch;max-width:20vw;padding-block:3px}
.family i svg,.prooftext i svg{width:14px;height:14px}
#status{margin-left:auto;font-size:10px;color:var(--mut);margin-right:8px}
#restart{padding:0 9px;color:#52544f}
.outlined,.dark{border:1px solid var(--line);padding:0 12px;height:34px}
button.dark{background:var(--ink);color:#fff;border:0;gap:0}
.dark i{margin-left:12px}.dark span{white-space:pre}
button.dark:hover:not(:disabled){color:var(--ink);background:var(--green)}
main{display:grid;grid-template-columns:clamp(215px,19.5vw,336px) minmax(0,1fr) clamp(250px,21vw,348px);min-height:0}
aside{min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:#ccc transparent;overscroll-behavior:contain}
.library,.section{padding:var(--pad)}
.heading{justify-content:space-between;margin-bottom:15px;min-height:16px}
h2,.under,#code,.guides,.muted,.text{font-size:10.5px;letter-spacing:.065em;text-transform:uppercase;font-weight:500}
h2{font-weight:650;letter-spacing:.09em}
.muted,.under,#code,.guides,.text{color:var(--mut)}
.text{min-height:0;letter-spacing:0;text-transform:none;font-size:11px}
button.text:hover:not(:disabled){background:transparent;text-decoration:underline}
.segments{display:grid;grid-template-columns:repeat(4,1fr);border:1px solid var(--line);border-radius:5px;padding:3px;margin-bottom:14px;gap:2px}
.segments button{font-size:11px;min-height:26px;border-radius:3px}
.segments button[aria-pressed=true],.operations button[aria-pressed=true],#shapes button[aria-pressed=true]{background:var(--ink);color:white}
#letters{display:grid;grid-template-columns:repeat(5,1fr);gap:5px}
#letters button{background:#f6f6f3;position:relative;aspect-ratio:.83;min-width:0;min-height:0;border-radius:3px}
#letters button:hover{box-shadow:inset 0 0 0 1px #94958f}
#letters button[aria-pressed=true]{background:var(--green);color:var(--ink)}
#letters svg{height:63%;width:76%;margin-top:-5%}
#letters small{position:absolute;font:9px/1 monospace;color:#6d7069;bottom:3px;left:4px}
#letters button[aria-pressed=true] small{color:inherit}
.workspace{background:var(--gray);border-inline:1px solid var(--line);min-height:0;display:grid;grid-template-rows:52px minmax(0,1fr) 44px}
.toolbar,.under{padding-inline:14px;gap:3px}
#letter{font-size:17px;min-width:20px;text-align:center}
#code{margin-left:4px;letter-spacing:.025em}
.fill{flex:1}.rule{height:20px;width:1px;background:#d6d8d2;margin-inline:7px}
.stage{min-height:0;display:grid;place-items:center;container-type:size;overflow:hidden;position:relative}
.art{position:relative;height:min(94cqh,calc((100cqw - 108px) / var(--aspect,.6)));aspect-ratio:var(--aspect,.6);background:#fff;box-shadow:0 0 0 1px #c9cbc5}
#canvas{display:block;position:absolute;width:100%;height:100%;inset:0;overflow:visible;user-select:none;-webkit-user-select:none;touch-action:none;cursor:crosshair}
#ink{fill:var(--ink)}
#lines,#overlay{pointer-events:none}
#lines path,#overlay rect{vector-effect:non-scaling-stroke;fill:none}
.guides{position:absolute;inset:0;pointer-events:none}
.guides span{position:absolute;right:calc(100% + 16px);transform:translateY(-50%);font-size:9px}
.guides span:nth-child(2){top:20%}.guides span:nth-child(3){top:80%}
.under{justify-content:space-between;font-size:10px;letter-spacing:.04em;padding-inline:20px}
#tip{text-transform:none;letter-spacing:0;font-size:11px}
#snap{font-size:11px}
.section+.section{border-top:1px solid var(--line)}
#shapes{display:grid;grid-template-columns:repeat(6,1fr);gap:5px}
#shapes button{min-width:0;min-height:30px;aspect-ratio:1;background:var(--gray);border-radius:4px}
#shapes button:hover:not([aria-pressed=true]){background:#e0e2dc}
#shapes svg{width:55%;height:55%;fill:currentColor}
.operations{margin-top:10px;justify-content:space-between}
.operations button{flex:1}
.mirror,.pair{justify-content:space-between;gap:6px;margin-top:10px}
.mirror select,.pair input,#size{border:1px solid var(--line);padding:4px 6px;border-radius:4px;font-size:11px}
.mirror select{width:55%}
.range{display:grid;align-items:center;grid-template-columns:64px minmax(32px,1fr) 42px;gap:8px;min-height:31px;font-size:11.5px}
.range output{text-align:right;color:#52554d;font-variant-numeric:tabular-nums}
input[type=range]{appearance:none;width:100%;height:24px;margin:0;cursor:pointer;box-shadow:none}
input[type=range]::-webkit-slider-runnable-track{height:2px;background:linear-gradient(to right,var(--ink) var(--value),#dddeda var(--value))}
input[type=range]::-moz-range-track{height:2px;background:#d1d2cc}
input[type=range]::-webkit-slider-thumb{appearance:none;background:var(--ink);width:11px;height:11px;border-radius:50%;margin-top:-4.5px}
input[type=range]::-moz-range-thumb{background:var(--ink);width:11px;height:11px;border:0;border-radius:50%}
input[type=range]:focus-visible{outline:1px solid var(--ink)}
.pair label{margin-right:auto}.pair input{width:63px;font-size:12px;text-align:center}.pair #pair{width:42px}
.proof{display:flex;flex-direction:column;min-height:0;min-width:0;border-top:1px solid var(--line);--paper:var(--green);--print:var(--ink)}
.proofbar{height:46px;flex:none;gap:5px;padding-inline:var(--pad)}
.prooftext{display:flex;align-items:center;gap:10px;margin-left:20px;border-left:1px solid var(--line);padding-left:22px;color:#52544f;min-width:0}
#sample{width:clamp(130px,20vw,420px);padding:4px 0}
#size{min-width:68px}
#paper{overflow:auto;flex:1;display:flex;align-items:center;background:var(--paper);color:var(--print);scrollbar-width:thin}
#strip{padding:0 var(--pad);margin:auto;flex:none;display:flex;align-items:center}
#strip svg{display:block;fill:currentColor;overflow:visible;flex:none}
.proof.big{position:fixed;inset:0;z-index:8;background:white}
.proof.running #paper{overflow:hidden}
.proof.running #strip{margin:0;padding:0;animation:scroll var(--duration,16s) linear infinite}
@keyframes scroll{to{transform:translateX(-50%)}}
dialog{border:1px solid #cacbc5;border-radius:8px;background:white;color:var(--ink);padding:20px;width:min(370px,94vw);box-shadow:0 14px 56px #20221821}
dialog::backdrop{background:#1f211c38;backdrop-filter:blur(3px)}
dialog .heading{border-bottom:1px solid var(--line);padding-bottom:10px}
#choices button{display:flex;width:100%;min-height:42px;justify-content:space-between;text-align:left;padding-inline:10px}
#choices button span,#note{color:var(--mut);font-size:11px}
#note{padding:13px 10px 4px;line-height:1.5}
#notice{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:var(--ink);color:white;padding:10px 16px;z-index:12;border-radius:5px;max-width:90vw}
.mobile,[hidden]{display:none!important}
@media(max-height:790px) and (min-width:801px){
 .section{padding-block:13px}.heading{margin-bottom:10px}.range{min-height:27px}.operations,.mirror,.pair{margin-top:6px}
}
@media(max-width:1150px){#status{display:none}#restart{margin-left:auto}}
@media(min-width:801px) and (max-width:1030px){.family input{max-width:calc(95vw - 682px)}#restart i{display:none}}
@media(max-width:1030px){#letters{grid-template-columns:repeat(4,1fr)}#tip{display:none}.family{left:49%}}
@media(max-width:800px){
 body{grid-template-rows:auto auto auto;display:block;height:auto;--pad:14px}
 header{height:52px;gap:7px}.home span,h1:before,#project span,.dark span,.family{display:none}
 #restart{font-size:11px;padding:0 4px}#restart i{display:none}
 header .home{min-width:25px;height:40px;justify-content:flex-start}
 header button{height:34px;min-width:34px;padding:0 8px}h1{font-size:12px}
 .mobile{display:inline-flex!important}
 main{display:flex;flex-direction:column}
 .library{display:none}.library.open{display:block;position:fixed;inset:0;z-index:10;background:white;padding:max(18px,env(safe-area-inset-top)) 18px max(25px,env(safe-area-inset-bottom))}
 #letters{grid-template-columns:repeat(5,1fr)}#letters button{aspect-ratio:1.1}
 .workspace{height:clamp(350px,55svh,600px);border-inline:0;grid-template-rows:46px 1fr 34px}
 .toolbar{padding-inline:8px;gap:0}.rule{margin-inline:3px}
 #code{display:none}.under{padding-inline:14px}.toolbar button{min-width:29px}
 .inspector{display:grid;grid-template-columns:1fr 1fr;overflow:visible}
 .section:first-child{grid-column:1/-1;display:grid;grid-template-columns:1fr 1fr;column-gap:10px;padding-block:10px;border-bottom:1px solid var(--line)}
 .section:first-child .heading,#shapes{grid-column:1/-1}
 #shapes{grid-template-columns:repeat(12,1fr);gap:4px}
 #shapes button{width:100%;aspect-ratio:auto;height:36px}
 #shapes svg{width:70%;height:58%}
 .heading{margin-bottom:9px}.operations button{min-width:25px}
 .section+.section{border:0;padding-bottom:24px}.spacing{border-left:1px solid var(--line)!important}
 .range{grid-template-columns:1fr auto;gap:0}.range input{grid-area:2/1/3/3}.range output{grid-column:2}.pair{flex-wrap:wrap}
 .proof{height:162px;position:sticky;bottom:0;z-index:4;background:white;box-shadow:0 -3px 8px #00000004}
 .proofbar{height:42px;gap:0;padding:0 8px}.proofbar h2{display:none}.prooftext{margin:0;padding:0 0 0 6px;border:0;flex:1;gap:6px}
 #sample{width:100%;font-size:16px}#size{min-width:46px}
 .proof:not(.big){height:clamp(106px,17svh,162px)}
 .proof.big{height:100dvh}
 #browse{font-size:15px;font-weight:600}
 .pair input,dialog input{font-size:16px}
}
@media(max-width:530px){
 #shapes{grid-template-columns:repeat(6,1fr)}
 .workspace{height:clamp(330px,51svh,560px)}
 .section:first-child{grid-template-columns:1.15fr 1fr}
 .mirror{font-size:11px}.mirror select{flex:1}
 .operations button{height:36px}
 .proofbar button{min-width:29px}.range{font-size:11px}
}
@media(max-height:690px) and (max-width:800px){.proof:not(.big){position:static}.workspace{height:355px}}

@media(max-width:375px){
 header{padding-inline:9px;gap:5px}
 header .dark i{display:none}
 #project{padding:0;min-width:30px}
}
@media(max-width:345px){
 header{gap:3px;padding-inline:6px}
 header .home{min-width:20px}
 header h1{font-size:11px;white-space:nowrap}
 header .dark{padding:0 6px}
}
