/* Shared look of every page (Model, Assembly, Paint). Page-specific rules live in model-ui.css, assembly.css and paint.css.
   The shared header, footer, logo and loading screen are built by site.js. */
@font-face{font-family:Piece;src:url("assets/PieceOfSheet-Regular.woff2") format("woff2"),url("assets/PieceOfSheet-Regular.ttf") format("truetype")}
@font-face{font-family:"Google Sans Flex";src:url("assets/GoogleSansFlex.woff2") format("woff2"),url("assets/GoogleSansFlex.ttf") format("truetype");font-style:normal;font-weight:400;font-display:swap}

:root{
  /* UI colours (not the 3D scene). Near-identical shades were merged into one token each; the Model debug panel (D) edits them live
     and copies the result (ui-colors.js). Colours drawn by scripts (panel frames, slider thumb, separator lines) read these tokens too. */
  --pos-ink:#0b4f60;      /* dark teal (was olive #4d4c1e): outlines, filled buttons, title and logo */
  --pos-title:var(--pos-ink);
  --pos-label:#1b5579;    /* lettering on white buttons */
  --pos-lime:#75ff85;     /* light green: text on dark buttons, slider thumbs */
  --pos-blue:#227c7b;     /* language button, hover fill */
  --pos-logo-2:#1b6e83;   /* middle wave of the logo */
  --pos-paper:#fcfcfc;    /* page, buttons and panels */
  --pos-edge:#d8d6bd;     /* quiet lines: separators, slider tracks, layer borders */
  --pos-text:#333333;     /* body text (#222 merged in) */
  --pos-text-soft:#444444;/* footer, hints (#404040, #454545 merged in) */
  --pos-muted:#585858;    /* small labels */
  --pos-quiet:#4f617d;    /* headings in the credits list */
  --pos-focus:#9a9a8e;    /* outline of the focused button */
  --pos-focus-blue:#145dff; /* keyboard focus on the logo and the pencil link */
  --pos-orange:#20a9fe;   /* the auto-show ring (#ff7a1a merged in) */
  --pos-desk:#eceae6;     /* Paint: behind the flat sheet */
  /* the hand-written figure name (model-callout.js) takes one of these at random; #f25c19 was merged into the first */
  --callout-1:#ff6b1a;--callout-2:#ff8a00;--callout-3:#ff4f5e;--callout-4:#e8418c;--callout-5:#8a5cff;--callout-6:#2b7bff;--callout-7:#10a37f;
  --pos-tint:#f4f7dc;     /* (unused) light lime */
  --pos-gutter:clamp(20px,5vw,100px);
  --pos-top:clamp(24px,5vh,50px);
  --pos-bottom:clamp(16px,4.5vh,45px);
}
*{box-sizing:border-box}
html,body{margin:0;overflow:hidden}
body{background:var(--pos-paper);color:var(--pos-text);font:14px Arial,sans-serif}
main{position:relative;width:100%;height:100dvh;overflow:hidden}
main>canvas{width:100%;height:100dvh;display:block;touch-action:none}
[hidden]{display:none!important}
a{color:inherit}
small{font-size:12px;color:var(--pos-muted)}

/* header: title and navigation on the left, page controls on the right */
header,footer{position:absolute;left:var(--pos-gutter);right:var(--pos-gutter);display:flex;justify-content:space-between;gap:12px;pointer-events:none;z-index:3}
header{top:var(--pos-top);align-items:flex-start}
h1 a{color:inherit;text-decoration:none;pointer-events:auto}
h1{margin:0;font:normal clamp(34px,3.2vw,64px)/1 Piece,sans-serif;color:var(--pos-title)}
nav{pointer-events:auto;margin-top:12px;display:flex;flex-wrap:wrap;gap:10px}
a[aria-current]{cursor:default}
@media(min-width:541px){nav{margin-top:39px}.text-row{margin-top:30px}}   /* the row of text buttons (page links, Flat sheet, Reset view ...) sits 30px lower */
.controls{display:flex;flex-wrap:wrap;gap:10px;align-items:center;justify-content:flex-end;pointer-events:auto}

/* logo (animated by site.js) */
#logo{position:absolute;left:50%;top:clamp(24px,4vh,40px);transform:translateX(-50%);width:75px;height:78px;z-index:4;pointer-events:auto;cursor:pointer}
#logo:focus-visible{outline:3px solid var(--pos-focus-blue);outline-offset:4px;border-radius:8px}
#logo svg{width:100%;height:100%;display:block}
.wave-logo{color:var(--pos-title)}
.wave-logo path:nth-child(2){stroke:var(--pos-logo-2)}

/* footer */
footer{bottom:var(--pos-bottom);align-items:center;font:400 12px/1.25 "Google Sans Flex",Arial,sans-serif;font-variation-settings:"GRAD" 0,"ROND" 0,"wdth" 100;color:var(--pos-text-soft)}
footer small{min-width:0;color:var(--pos-text-soft);text-align:right}
.footer-left{display:flex;flex:none;align-items:center;gap:17px;white-space:nowrap}
.footer-links{display:inline-flex;align-items:center;gap:12px}
.footer-left a{color:inherit;pointer-events:auto;text-underline-offset:2px}
.footer-mark{display:block;flex:none;overflow:visible}
.footer-mark-link{display:block;flex:none;transition:transform .18s ease}.footer-mark-link:hover{transform:scale(1.12)}   /* the mark links to haraf.pl */
.footer-rights-compact{display:none}

/* Reveal the scene after the progress label has reached 100%. */
body::before{content:"";position:fixed;inset:0;z-index:50;background:var(--pos-paper);transition:opacity .36s ease-in-out}
body.loaded::before{opacity:0;pointer-events:none}
#loading{position:fixed;inset:0;z-index:51;display:grid;place-items:center;pointer-events:none;transition:opacity .28s ease-in}
body.loaded #loading{opacity:0}
.loader-content{text-align:center;color:var(--pos-title)}
.loader-art{position:relative;width:clamp(128px,29vw,180px);aspect-ratio:1;margin:auto;animation:loader-enter .22s ease-out both}
.loader-art>.wave-logo{position:absolute;inset:14%;width:72%;height:72%}
.loader-progress{margin-top:4px;font:normal 24px/1 Piece,sans-serif;font-variant-numeric:tabular-nums;animation:loader-enter .18s .08s ease-out both}
@keyframes loader-enter{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:translateY(0)}}
@media(prefers-reduced-motion:reduce){.loader-art,.loader-progress{animation:none}}
/* moving between pages: the browser keeps the header and the footer still and cross-fades only the rest (View Transitions; Chrome, Edge, Safari) */
@view-transition{navigation:auto}
header h1{view-transition-name:pos-title}
header nav{view-transition-name:pos-nav}
#logo{view-transition-name:pos-logo}
#language{view-transition-name:pos-language}
#music{view-transition-name:pos-music}
footer .footer-left{view-transition-name:pos-footer}
::view-transition-group(*){animation-duration:.28s}
@media(prefers-reduced-motion:reduce){@view-transition{navigation:none}}

/* the music button: a pill with words ("Play music!" / "Silence!"), Piece Of Sheet face, as tall as the round buttons; it pulses while nobody has chosen */
#music{display:inline-flex;align-items:center;justify-content:center;height:40px;padding:0 22px;font:normal 28px/1 Piece,sans-serif;flex:none}
#music.nudge{animation:music-nudge 1.8s ease-in-out infinite}
@keyframes music-nudge{0%,100%{transform:scale(.97);opacity:.6}50%{transform:scale(1.06);opacity:1}}

/* buttons (Figma "buton"): 40px high pill, 4px olive border. Outlined version: Google Sans Flex 20px, olive-grey text (35:56).
   .primary and .on are the filled version: olive fill, lime lettering (35:22; .primary uses the Piece Of Sheet face, 30px). .blob-button is the round letter button */
button,select,.btn,.pick{font:400 20px/14px "Google Sans Flex",Arial,sans-serif;font-variation-settings:"GRAD" 0,"ROND" 0,"wdth" 100;color:var(--pos-label);background:var(--pos-paper);border:3px solid var(--pos-ink);border-radius:999px;padding:10px 36px;cursor:pointer;text-decoration:none;display:inline-block;text-align:center;--bw:3px}
/* the pill is two layers behind the lettering: ::before in the edge colour, ::after in the fill colour. Their shapes are masks made by site.js
   (shapeOf), the same uneven outline as the round buttons. Without the masks they fall back to plain rounded rectangles. */
.pill{position:relative;isolation:isolate;background:transparent;border-color:transparent;--fill:var(--pos-paper);--edge:var(--pos-ink);transition:transform .18s ease}
.pill::before,.pill::after{content:"";position:absolute;z-index:-1;border-radius:999px;transition:background .18s ease;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}
.pill::before{inset:calc(var(--bw) * -1);background:var(--edge);-webkit-mask-image:var(--m-out);mask-image:var(--m-out)}
.pill::after{inset:0;background:var(--fill);-webkit-mask-image:var(--m-in);mask-image:var(--m-in)}
/* hover everywhere: blue fill (the language button's blue), lime lettering */
.pill:hover:not(:disabled):not([data-c]){--fill:var(--pos-blue);--edge:var(--pos-blue);color:var(--pos-lime)}
.pick:hover .pick-arrow{color:var(--pos-lime)}
.pill:hover:not(:disabled){transform:scale(1.07)}   /* same small grow on hover as the round buttons */
.pill[aria-current]:hover{transform:none}
/* focus: no blue rectangle; a grey outline that follows the uneven shape (drop-shadows of the element, so the masks are respected) */
button:focus-visible,select:focus-visible,.btn:focus-visible,input:focus-visible{outline:2px solid var(--pos-focus);outline-offset:3px}
.pill:focus-visible,.blob-button:focus-visible{outline:none;filter:drop-shadow(2px 0 0 var(--pos-focus)) drop-shadow(-2px 0 0 var(--pos-focus)) drop-shadow(0 2px 0 var(--pos-focus)) drop-shadow(0 -2px 0 var(--pos-focus))}
button:disabled{opacity:.4;cursor:default}
.pill.on,.pill.primary{color:var(--pos-lime);--fill:var(--pos-ink)}
button.primary,.btn.primary{font:normal 30px/14px Piece,sans-serif}
/* selects and the colour picker sit flat inside a .pick wrapper, which is the pill; the arrow is a drawn chevron */
.pick{position:relative;display:inline-block;padding:0;border:3px solid transparent;border-radius:999px;--bw:3px}
.pick select,.pick input[type=color]{display:block;width:100%;-webkit-appearance:none;appearance:none;border:0;border-radius:0;background:transparent;color:inherit;font:inherit;cursor:pointer}
.pick select{padding:10px 40px 10px 20px;line-height:14px;text-overflow:ellipsis}
.pick select option{background:var(--pos-paper);color:var(--pos-label);font:400 16px "Google Sans Flex",Arial,sans-serif}
.pick-arrow{position:absolute;right:14px;top:50%;transform:translateY(-50%);width:18px;height:18px;color:var(--pos-ink);pointer-events:none}
.pick-arrow svg{display:block;width:100%;height:100%}
.pick input[type=color]{height:34px;padding:5px 12px}
.pick input[type=color]::-webkit-color-swatch-wrapper{padding:0}
.pick input[type=color]::-webkit-color-swatch{border:0;border-radius:999px}
.pick input[type=color]::-moz-color-swatch{border:0;border-radius:999px}
.pick select:focus-visible,.pick input:focus-visible{outline:none}
.pick:focus-within{outline:none;filter:drop-shadow(2px 0 0 var(--pos-focus)) drop-shadow(-2px 0 0 var(--pos-focus)) drop-shadow(0 2px 0 var(--pos-focus)) drop-shadow(0 -2px 0 var(--pos-focus))}
/* small buttons: the size of the tool buttons in the Paint panel (Brush, Eraser ...) */
/* every small button (nav links, Flat sheet, Hide tools, Download, panel buttons) has the same fixed height */
button.small,a.btn.small,.panel-col button:not(.blob-button){display:inline-flex;align-items:center;justify-content:center;height:30px;padding:0 14px;font-size:15px;line-height:11px;border-width:2px;--bw:2px}
button.small.primary,a.btn.small.primary{font-size:21px;line-height:10px;padding-top:2px}

.text-row{flex:0 0 100%;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px}   /* the text buttons sit on their own row under the round ones */   /* wraps to two rows before it reaches the logo in the middle */
.pick.small{height:30px;border-width:2px;--bw:2px}
.pick.small select{height:26px;padding:0 34px 0 14px;font-size:15px;line-height:normal}
.pick.small .pick-arrow{right:11px;width:16px;height:16px}

/* THE BIG PDF BUTTON (.cta, Model "Print NAME!" and Paint). It is alive: site.js lets it play a different little trick every time (never the same one twice in a row),
   with a quiet rest between. All of them are soft and eased like the round buttons, with some weight, and none has a shadow:
   hop (crouch, spring, soft landing, two bounces) / sideways (pulled like dough, snaps back and jiggles) / hobble (hops on one corner, then on the other)
   / wobble (a tipsy rocking that dies down) / scoot (sneaks aside and back) / pop (a double heartbeat).
   They rest while hovered, focused or busy, and do not run at all with prefers-reduced-motion. */
.cta{transform-origin:50% 100%;animation:cta-hop 3.4s infinite}
@keyframes cta-hop{   /* crouch, spring up, soft landing, two bounces */
  0%,52%{transform:translateY(0) scale(1,1);animation-timing-function:ease-in-out}
  59%{transform:translateY(0) scale(1.05,.93);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  64%{transform:translateY(-10px) scale(.96,1.07);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  72%{transform:translateY(-24px) scale(.985,1.02);animation-timing-function:cubic-bezier(.5,0,.8,.5)}
  78%{transform:translateY(-1px) scale(.97,1.04);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  81%{transform:translateY(0) scale(1.07,.92);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  85%{transform:translateY(-6px) scale(.985,1.03);animation-timing-function:cubic-bezier(.5,0,.8,.5)}
  89.5%{transform:translateY(0) scale(1.04,.96);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  93%{transform:translateY(-1.5px) scale(.995,1.01);animation-timing-function:cubic-bezier(.5,0,.8,.5)}
  96%{transform:translateY(0) scale(1.015,.985);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  100%{transform:translateY(0) scale(1,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
}
@keyframes cta-sideways{   /* pulled sideways like dough, snaps back and jiggles */
  0%,30%{transform:scale(1,1) skewX(0);animation-timing-function:ease-in-out}
  43%{transform:scale(1.17,.9) skewX(-5deg);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  53%{transform:scale(.92,1.09) skewX(3deg);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  61%{transform:scale(1.06,.96) skewX(-2deg);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  69%{transform:scale(.98,1.025) skewX(1deg);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  77%{transform:scale(1.015,.99) skewX(0);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  86%,100%{transform:scale(1,1) skewX(0);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
}
@keyframes cta-hobble{   /* hops on one corner, then on the other */
  0%,26%{transform:rotate(0) translateY(0) scale(1,1);transform-origin:0 100%;animation-timing-function:ease-in-out}
  31%{transform:rotate(0) translateY(0) scale(1.03,.96);transform-origin:0 100%;animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  38%{transform:rotate(-7deg) translateY(-3px) scale(.99,1.03);transform-origin:0 100%;animation-timing-function:cubic-bezier(.5,0,.8,.5)}
  45%{transform:rotate(0) translateY(0) scale(1.03,.97);transform-origin:0 100%;animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  48%{transform:rotate(0) translateY(0) scale(1,1);transform-origin:100% 100%;animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  55%{transform:rotate(7deg) translateY(-3px) scale(.99,1.03);transform-origin:100% 100%;animation-timing-function:cubic-bezier(.5,0,.8,.5)}
  62%{transform:rotate(0) translateY(0) scale(1.03,.97);transform-origin:100% 100%;animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  70%,100%{transform:rotate(0) translateY(0) scale(1,1);transform-origin:50% 100%;animation-timing-function:cubic-bezier(.25,.1,.25,1)}
}
@keyframes cta-wobble{   /* tipsy rocking that dies down */
  0%,30%{transform:rotate(0) scale(1,1);animation-timing-function:ease-in-out}
  38%{transform:rotate(-6deg) scale(1.03,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  46%{transform:rotate(5deg) scale(1.02,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  54%{transform:rotate(-3.5deg) scale(1.01,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  62%{transform:rotate(2.4deg) scale(1,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  70%{transform:rotate(-1.2deg) scale(1,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  78%{transform:rotate(.6deg) scale(1,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  86%,100%{transform:rotate(0) scale(1,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
}
@keyframes cta-scoot{   /* sneaks sideways and back with two little hops */
  0%,24%{transform:translate(0,0) rotate(0) scale(1,1);animation-timing-function:ease-in-out}
  30%{transform:translate(0,0) rotate(0) scale(1.04,.95);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  38%{transform:translate(-10px,-6px) rotate(-3deg) scale(.97,1.05);animation-timing-function:cubic-bezier(.5,0,.8,.5)}
  44%{transform:translate(-12px,0) rotate(0) scale(1.05,.95);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  52%{transform:translate(-12px,0) rotate(0) scale(1,1);animation-timing-function:ease-in-out}
  60%{transform:translate(-12px,0) rotate(0) scale(1.04,.95);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  68%{transform:translate(2px,-6px) rotate(3deg) scale(.97,1.05);animation-timing-function:cubic-bezier(.5,0,.8,.5)}
  74%{transform:translate(0,0) rotate(0) scale(1.05,.95);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  82%,100%{transform:translate(0,0) rotate(0) scale(1,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
}
@keyframes cta-pop{   /* a double heartbeat */
  0%,30%{transform:scale(1,1);animation-timing-function:ease-in-out}
  36%{transform:scale(1.1,1.1);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  42%{transform:scale(.97,.97);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  48%{transform:scale(1.13,1.13);animation-timing-function:cubic-bezier(.22,.61,.36,1)}
  57%{transform:scale(.98,.98);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  65%{transform:scale(1.03,1.03);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
  74%,100%{transform:scale(1,1);animation-timing-function:cubic-bezier(.25,.1,.25,1)}
}
/* Hover: the button grows smoothly from its CENTRE (the CSS "scale" property is separate from the trick animations, which turn it around its bottom edge,
   so the growth is bottom-anchored plus half the growth in height, i.e. centred) and it does not wait for the trick: it is eased like the round buttons. */
.cta{transition:scale .32s cubic-bezier(.25,.1,.25,1),translate .32s cubic-bezier(.25,.1,.25,1)}
.cta:hover:not(:disabled){scale:1.07;translate:0 1.9px}
.cta.pill:hover:not(:disabled){transform:none}
.cta.still,.cta:disabled,.cta:focus-visible{animation:none!important}

/* sliders: olive rounded track, thumb is one of the uneven round blobs (--thumb, made by site.js) */
input[type=range]{-webkit-appearance:none;appearance:none;height:24px;background:transparent;cursor:pointer;accent-color:var(--pos-ink)}
input[type=range]::-webkit-slider-runnable-track{height:6px;border-radius:0;background:var(--line-1,var(--pos-ink)) 0 0/100% 100% no-repeat}   /* the same uneven line as the separators */
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:24px;height:24px;margin-top:-9px;border:0;border-radius:0;background:var(--thumb) center/100% 100% no-repeat}
input[type=range]::-moz-range-track{height:6px;border-radius:0;background:var(--line-1,var(--pos-ink)) 0 0/100% 100% no-repeat}
input[type=range]::-moz-range-thumb{width:24px;height:24px;border:0;border-radius:0;background:var(--thumb) center/100% 100% no-repeat}
input[type=checkbox]{accent-color:var(--pos-ink)}

.blob-button{position:relative;display:inline-grid;place-items:center;flex:none;width:40px;height:40px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--pos-lime);font:normal 30px/1 Piece,sans-serif;isolation:isolate;transition:width .46s cubic-bezier(.25,.1,.25,1),height .46s cubic-bezier(.25,.1,.25,1),font-size .46s cubic-bezier(.25,.1,.25,1),transform .18s ease;user-select:none}
.blob-button:hover:not(:disabled){background:transparent;transform:scale(1.07)}
.blob-button:focus-visible{outline:none}
.blob-button>svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible;z-index:-1;pointer-events:none}
.blob-button>svg path{fill:var(--pos-ink);stroke:var(--pos-ink);stroke-width:3;vector-effect:non-scaling-stroke}
.blob-button span{position:relative;z-index:1}
.blob-button:hover:not(:disabled):not(.language):not(#_){color:var(--pos-lime)}
.blob-button:hover:not(:disabled):not(.language):not(#_)>svg path{fill:var(--pos-blue);stroke:var(--pos-blue)}
.blob-button.language>svg path{fill:var(--pos-blue);stroke:var(--pos-blue)}
.controls .blob-button[aria-pressed="true"]:not(.language){color:var(--pos-ink)}
.controls .blob-button[aria-pressed="true"]:not(.language)>svg path{fill:var(--pos-paper)}

/* round buttons that hold an icon (Paint tools); .on is the chosen one */
.blob-button svg.icon{display:block;width:22px;height:22px}
.blob-button.on{color:var(--pos-ink)}
.blob-button.on>svg path{fill:var(--pos-paper)}
.blob-button.on:hover:not(:disabled):not(#_){color:var(--pos-lime)}

/* floating panels (Paint tools, camera debug) */
.panel{position:absolute;background:color-mix(in srgb,var(--pos-paper) 96%,transparent);border:1.5px solid var(--pos-ink);border-radius:16px;padding:12px;z-index:2}
.panel.framed{border:0;border-radius:0;padding:28px;background:var(--frame) 0 0/100% 100% no-repeat}
#status{position:absolute;left:var(--pos-gutter);right:var(--pos-gutter);top:calc(var(--row3,110px) + 12px);width:max-content;max-width:min(480px,calc(100% - 2 * var(--pos-gutter)));color:var(--pos-text);font-size:13px;overflow-wrap:anywhere;pointer-events:none;z-index:4}
#status:not(:empty){padding:6px 10px;background:var(--pos-paper);border-radius:4px}
@media(max-width:540px){#status{left:18px;right:18px;top:calc(var(--row3,98px) + 60px);max-width:calc(100% - 36px)}}

@media(min-width:541px) and (max-width:900px){h1{font-size:28px}#logo{width:56px;height:58px}.controls{max-width:calc(50% - 50px)}footer small{display:none}}   /* narrow windows: smaller title and logo (the logo stays in the middle), the right-hand buttons wrap before they reach it, no help line in the footer */
@media(max-width:540px){
  /* phones: row 1 = title, small logo, round buttons; row 2 = page links; row 3 = the page's text buttons (all left aligned) */
  :root{--pos-top:14px}
  header,footer{left:18px;right:18px}
  header{flex-wrap:wrap;row-gap:8px}
  [data-site-title]{display:contents}
  h1{font-size:28px;max-width:112px;margin-right:auto}
  #logo{top:14px;width:41px;height:44px}   /* always in the middle; 15% bigger than before */
  .controls{gap:6px;max-width:none;flex:none;flex-wrap:nowrap;justify-content:flex-end}
  h1{order:1}.controls{order:2}
  header nav{position:fixed;top:var(--row2,58px);left:18px;right:18px;display:flex;flex-direction:row;flex-wrap:wrap;gap:8px;margin:0}   /* the page links sit at the same height on every page (--row2 from site.js) */
  /* HEADER SYSTEM (phones), shared by every page:
       row 1  title | logo in the middle | EN + music            (--row2 = just under it, measured by site.js)
       row 2  the page links in one row                          (--row3 = just under them)
       line   an uneven line across the page at --row3           (#rule, made by site.js)
       row 3  the page's own controls right under the line, at --row3 + 14px:
              Model P / L, Assembly piece + Reset view (.text-row), Paint undo/redo + tabs (paint.css)
     Pages only place their own controls on row 3; everything above it comes from here. */
  #rule{display:block;position:fixed;left:18px;right:18px;top:var(--row3,98px);height:6px;background:var(--line-1) 0 0/100% 100% no-repeat;z-index:3;pointer-events:none}
  .text-row{position:fixed;left:18px;right:18px;top:calc(var(--row3,98px) + 14px);margin:0;justify-content:flex-start}
  button,.btn{font-size:15px;line-height:11px;padding:9px 16px;border-width:2px;--bw:2px}
  .pick{border-width:2px;--bw:2px}.pick select{padding:9px 32px 9px 16px;font-size:15px;line-height:11px}.pick-arrow{right:11px;width:16px;height:16px}
  button.primary,.btn.primary{font-size:21px;line-height:10px}
  .controls .blob-button{width:34px;height:34px;font-size:24px}
  #music{order:9;height:34px;padding:0 9px;font-size:15px;line-height:1}   /* phones: small enough to share the first row with EN; after the round buttons */
  .controls{max-width:calc(50vw - 40px);flex-wrap:wrap}   /* stops short of the logo in the middle */
  button.small,a.btn.small,.pick.small{height:34px}
  .pick.small select{height:30px}
  footer small{display:none}
}
@media(prefers-reduced-motion:reduce){
  body::before,#loading{transition:none}
  .blob-button{transition:none}
  .blob-button:hover,.pill:hover{transform:none}
  #music.nudge,.cta{animation:none!important}
}

/* The footer link opens the credits dialog (site.js). */
.credits-footer{padding-block:6px}
.footer-left a:hover,.footer-left a:focus-visible{color:var(--pos-title)}
#credits{border:0;padding:0;background:transparent;max-width:calc(100vw - 32px);overflow:visible}
#credits::backdrop{background:color-mix(in srgb,var(--pos-paper) 72%,transparent)}
.credits-box{position:relative;width:min(460px,calc(100vw - 32px));padding:30px 34px 28px;background:var(--pos-paper);color:var(--pos-text)}
.panel-title{margin:0 0 14px;padding-right:42px;font:normal 40px/1 Piece,sans-serif;color:var(--pos-title)}
.credits-list{margin:0;display:flex;flex-direction:column;gap:3px;font:400 14px/1.4 "Google Sans Flex",Arial,sans-serif}
.credits-list dt{margin-top:10px;font-size:12px;color:var(--pos-quiet)}
.credits-list dd{margin:0;color:var(--pos-text)}
.credits-list a{color:inherit;text-underline-offset:2px}
.panel-close{position:absolute;top:14px;right:14px}
.credits-box.panel{position:relative}
#preferences{position:fixed;z-index:52;right:var(--pos-gutter);bottom:calc(var(--pos-bottom) + 40px);width:min(380px,calc(100% - 32px));max-height:calc(100dvh - 90px);overflow:auto;color:var(--pos-text);font:400 13px/1.4 "Google Sans Flex",Arial,sans-serif}
#preferences.framed{padding:22px}
#preferences[hidden],body:not(.loaded) #preferences,#preferences button[hidden]{display:none}
#preferences p{margin:0 0 8px}
.preferences-actions{display:flex;flex-wrap:wrap;gap:8px}
.preferences-actions button{min-width:86px}
@media(max-width:540px){
  header nav{gap:6px}
  header nav a.btn.small{padding:0 10px;font-size:13.5px}   /* four page links fit one row at 360px, also in Polish */
  .footer-left,.footer-links{column-gap:clamp(2px,calc((100vw - 300px) / 10),6px)}
  footer{font-size:clamp(9.75px,3vw,11px)}
}
@media(max-width:900px){
  .footer-rights-full{display:none}
  .footer-rights-compact{display:inline}
}
