/* Shared theme tokens, buttons and the footer game (both pages) */
/* Inter (rsms.me/inter), self-hosted: no font requests to other servers. SIL Open Font License, see fonts/LICENSE.txt */
@font-face{font-family:"InterVariable"; font-style:normal; font-weight:100 900; font-display:swap; src:url("/assets/fonts/InterVariable.woff2") format("woff2");}
@font-face{font-family:"InterVariable"; font-style:italic; font-weight:100 900; font-display:swap; src:url("/assets/fonts/InterVariable-Italic.woff2") format("woff2");}
:root{
  --paper:#ffffff; --ink:#0a0a0a; --muted:#8b8b8b; --body:#2a2a2a;
  --red:#e0492a; --neon:#d8ff00; --blue:#3b5bd9; --navy:#1c2541; --yellow:#f5c518; --violet:#6c4cf1;
  --line:rgba(10,10,10,.12); --line-2:rgba(10,10,10,.06);
  --cell:14px;
  --font:"InterVariable","Inter",system-ui,-apple-system,"Helvetica Neue",Arial,sans-serif;
  /* small labels use Inter too (uppercase, tracked, tabular numbers); only real code stays monospaced */
  --mono:var(--font);
  --code:ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace;
  /* pixel-stepped corner shapes */
  --px10:polygon(10px 0,calc(100% - 10px) 0,calc(100% - 10px) 5px,calc(100% - 5px) 5px,calc(100% - 5px) 10px,100% 10px,100% calc(100% - 10px),calc(100% - 5px) calc(100% - 10px),calc(100% - 5px) calc(100% - 5px),calc(100% - 10px) calc(100% - 5px),calc(100% - 10px) 100%,10px 100%,10px calc(100% - 5px),5px calc(100% - 5px),5px calc(100% - 10px),0 calc(100% - 10px),0 10px,5px 10px,5px 5px,10px 5px,10px 0);
  --px8:polygon(8px 0,calc(100% - 8px) 0,calc(100% - 8px) 4px,calc(100% - 4px) 4px,calc(100% - 4px) 8px,100% 8px,100% calc(100% - 8px),calc(100% - 4px) calc(100% - 8px),calc(100% - 4px) calc(100% - 4px),calc(100% - 8px) calc(100% - 4px),calc(100% - 8px) 100%,8px 100%,8px calc(100% - 4px),4px calc(100% - 4px),4px calc(100% - 8px),0 calc(100% - 8px),0 8px,4px 8px,4px 4px,8px 4px,8px 0);
  --px6:polygon(6px 0,calc(100% - 6px) 0,calc(100% - 6px) 3px,calc(100% - 3px) 3px,calc(100% - 3px) 6px,100% 6px,100% calc(100% - 6px),calc(100% - 3px) calc(100% - 6px),calc(100% - 3px) calc(100% - 3px),calc(100% - 6px) calc(100% - 3px),calc(100% - 6px) 100%,6px 100%,6px calc(100% - 3px),3px calc(100% - 3px),3px calc(100% - 6px),0 calc(100% - 6px),0 6px,3px 6px,3px 3px,6px 3px,6px 0);
  --px15:polygon(15px 0,calc(100% - 15px) 0,calc(100% - 10px) 0,calc(100% - 10px) 5px,calc(100% - 5px) 5px,calc(100% - 5px) 10px,calc(100% - 5px) calc(50% - 5px),100% calc(50% - 5px),100% calc(50% + 5px),calc(100% - 5px) calc(50% + 5px),calc(100% - 5px) calc(100% - 10px),calc(100% - 5px) calc(100% - 5px),calc(100% - 10px) calc(100% - 5px),calc(100% - 10px) 100%,calc(100% - 15px) 100%,15px 100%,10px 100%,10px calc(100% - 5px),5px calc(100% - 5px),5px calc(100% - 10px),5px calc(50% + 5px),0 calc(50% + 5px),0 calc(50% - 5px),5px calc(50% - 5px),5px 10px,5px 5px,10px 5px,10px 0);
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent;}
html{scroll-behavior:smooth;}
body{margin:0; background:var(--paper); color:var(--ink); overflow-x:hidden; font-family:var(--font); font-optical-sizing:auto; font-feature-settings:"calt" 1; font-weight:400; line-height:1.5; -webkit-font-smoothing:antialiased; }
a{color:inherit;}
.mono{font-family:var(--mono); font-size:11px; font-weight:500; letter-spacing:.12em; text-transform:uppercase; font-variant-numeric:tabular-nums; font-feature-settings:"case" 1;}

/* pixel field behind the page */
.field{position:fixed; inset:0; width:100%; height:100%; display:block; z-index:0; pointer-events:none;}

/* pixel flicker layer used by buttons */
.pxfx{position:absolute; inset:0; z-index:1; display:grid; pointer-events:none; grid-template-columns:repeat(auto-fill,9px); grid-auto-rows:9px; overflow:hidden;}
.pxfx i{display:block; width:100%; height:100%; background:#fff; opacity:0;}
.lbl{position:relative; z-index:2;}

/* ===== footer: building-block skyline + playable game ===== */
footer{position:relative; z-index:2; height:calc(var(--cell)*9); background:transparent; overflow:hidden; cursor:pointer; transition:height .55s cubic-bezier(.16,1,.3,1);}
footer.playing{height:min(52vh,390px); cursor:default;}
footer .city{position:absolute; left:0; bottom:0; width:100%; height:calc(var(--cell)*9); z-index:2; display:block; pointer-events:none;}
footer.playing .city{top:0; bottom:auto; height:min(52vh,390px);}
.play-btn{position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); z-index:4; border:0; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; font-family:var(--font); font-size:clamp(15px,1.2vw,18px); font-weight:500; letter-spacing:0.01em; padding:16px 36px; background:var(--ink); color:#fff; clip-path:var(--px10); transition:opacity .35s, transform .35s, background .2s;}
.play-btn:hover{background:var(--blue);}
footer.playing .play-btn{opacity:0; pointer-events:none; transform:translate(-50%,-50%) scale(.86);}
.play-btn .blocks{display:inline-block; margin-left:9px; vertical-align:-3px;}
.play-btn .blocks canvas{display:block; width:20px; height:16px;}
.game{position:absolute; inset:0; z-index:3; display:none; pointer-events:none; font-family:var(--mono);}
footer.playing .game{display:block;}
.game .score{position:absolute; top:18px; left:22px; font-size:clamp(15px,2vw,22px); letter-spacing:.08em; color:var(--ink);}
.game .hint{position:absolute; left:50%; bottom:22px; transform:translateX(-50%); text-align:center; font-size:11px; line-height:1.7; color:var(--muted); letter-spacing:.02em;}
.game .pad{position:absolute; right:20px; bottom:20px; display:grid; grid-template-columns:repeat(2,44px); gap:8px; pointer-events:auto;}
.game .pad button, .game .close{border:0; background:#fff; color:var(--ink); cursor:pointer; display:grid; place-items:center; pointer-events:auto; box-shadow:0 2px 12px rgba(10,10,10,.14); clip-path:var(--px8); transition:background .15s,color .15s;}
.game .pad button{width:44px; height:44px;}
.game .pad button svg, .game .close svg{width:18px; height:18px; display:block;}
.game .pad button:hover, .game .close:hover{background:var(--ink); color:#fff;}
.game .close{position:absolute; top:18px; right:20px; width:38px; height:38px; z-index:6;}
.game .over{position:absolute; inset:0; z-index:5; display:none; flex-direction:column; align-items:center; justify-content:center; gap:14px; text-align:center; pointer-events:auto; background:rgba(255,255,255,.86); backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px);}
.game.is-over .over{display:flex;}
.game .over .ttl{font-family:var(--font); font-size:clamp(22px,3.2vw,34px); letter-spacing:0.0em; color:var(--ink); line-height:1;}
.again{position:relative; border:0; cursor:pointer; display:inline-flex; align-items:center; font-family:var(--font); font-size:14px; font-weight:500; padding:13px 30px; background:var(--ink); color:#fff; clip-path:var(--px10); transition:background .2s;}
.again:hover{background:var(--blue);}
@media(max-width:680px){
  .play-btn{font-size:11px; letter-spacing:.18em; padding:11px 18px;}
  footer.playing{height:min(58vh,460px);}
  footer.playing .city{height:calc(min(58vh,460px) - 88px);}
  .game .close{top:10px; right:12px; width:36px; height:36px;}
  .game .hint{display:none;}
  .game .pad{left:50%; right:auto; bottom:22px; transform:translateX(-50%); grid-template-columns:repeat(4,52px);}
  .game .pad button{width:52px; height:52px;}
}
@media(prefers-reduced-motion:reduce){ *{animation-duration:.01ms !important; transition-duration:.01ms !important;} }

/* ===== pixel cursor (assets/cursor.js): desktop with a mouse only ===== */
html.pxcur-on, html.pxcur-on *{cursor:none !important;}
.pxcur{position:fixed; left:0; top:0; z-index:10000; pointer-events:none; opacity:0; transition:opacity .2s; will-change:transform;}
.pxcur-in{transform-origin:50% 50%;}
.pxcur-in.flip{animation:pxflip .16s steps(4);}
@keyframes pxflip{0%{transform:scaleY(1);} 45%{transform:scaleY(.1);} 100%{transform:scaleY(1);}}
.pxcur canvas{display:block; image-rendering:pixelated; filter:drop-shadow(0 1px 0 rgba(255,255,255,.9));}
.pxcur-fx{position:fixed; inset:0; z-index:9999; pointer-events:none;}
.pxcur-fx > span{position:absolute;}
.pxfx-heart{animation:pxheart 1s cubic-bezier(.16,1,.3,1) forwards;}
.pxfx-heart canvas{display:block; image-rendering:pixelated;}
@keyframes pxheart{0%{transform:translate(-50%,-50%) scale(.5); opacity:0;} 15%{opacity:1;} 100%{transform:translate(-50%,-260%) scale(1); opacity:0;}}
.pxfx-ink{width:6px; height:6px; margin:-3px 0 0 -3px; background:#1f3fbf; box-shadow:6px 3px 0 -1px #1f3fbf, -6px 6px 0 -2px #1f3fbf, 3px -6px 0 -2px #1f3fbf, -3px -3px 0 0 #1f3fbf; animation:pxfade 1.1s ease-out forwards;}
.pxfx-burst{width:3px; height:3px; margin:-1px 0 0 -1px; background:#1f1f1f; box-shadow:0 -9px #1f1f1f, 0 9px #1f1f1f, -9px 0 #1f1f1f, 9px 0 #1f1f1f, 6px 6px #1f1f1f, -6px -6px #1f1f1f, 6px -6px #1f1f1f, -6px 6px #1f1f1f; animation:pxburst .5s steps(5) forwards;}
.pxfx-beep{font-size:10px; font-weight:600; letter-spacing:.12em; text-transform:uppercase; color:#fff; background:#1f1f1f; padding:3px 6px; transform:translate(-50%,-100%); animation:pxfade 1s ease-out forwards;}
@keyframes pxfade{0%{opacity:1;} 70%{opacity:1;} 100%{opacity:0;}}
@keyframes pxburst{0%{transform:scale(.4); opacity:1;} 100%{transform:scale(1.8); opacity:0;}}
.pxfx-yum{font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:#fff; background:#f38020; padding:3px 6px; transform:translate(-50%,-260%); animation:pxfade 1s ease-out forwards;}

/* ===== themes: light (default), dark (html[data-theme=dark]), and inverted black sections (.inv) ===== */
:root{ --text:#1c1c1c; --soft:#f2f2f2; color-scheme:light; }
html[data-theme=dark]{ --paper:#0b0b0b; --ink:#f2f2f2; --muted:#8c8c8c; --body:#c8c8c8; --text:#e4e4e4; --soft:#1c1c1c; --line:rgba(255,255,255,.14); --line-2:rgba(255,255,255,.07); --navy:#3b4a7a; color-scheme:dark; }
.inv{ --paper:#0a0a0a; --ink:#f2f2f2; --muted:#8c8c8c; --body:#c8c8c8; --text:#e4e4e4; --soft:#1c1c1c; --line:rgba(255,255,255,.16); --line-2:rgba(255,255,255,.08); --navy:#3b4a7a; background:var(--paper); color:var(--ink); }
html[data-theme=dark] .inv{ --paper:#171717; }
html{ background:var(--paper); }
/* surfaces that sit on the ink colour need the paper colour for their text */
html[data-theme=dark] :is(.btn, .slide .go, .arrow, .play-btn, .again, .tags .ink),
.inv :is(.btn, .slide .go, .arrow, .play-btn, .again, .tags .ink){ color:var(--paper); }
html[data-theme=dark] .pxfx i, .inv .pxfx i{ background:#000; }
html[data-theme=dark] .game .pad button, html[data-theme=dark] .game .close{ background:var(--soft); color:var(--ink); }
html[data-theme=dark] .game .over{ background:rgba(11,11,11,.86); }
html[data-theme=dark] .playhint{ background:rgba(18,18,18,.88); color:var(--ink); border-color:var(--line); }
html[data-theme=dark] .face rect[fill="#0a0a0a"]{ fill:#f2f2f2; }

/* theme switch: a small pixel button, bottom right */
.theme-btn{position:fixed; right:14px; bottom:14px; z-index:400; width:40px; height:40px; display:grid; place-items:center; border:0; padding:0; cursor:pointer; background:var(--ink); color:var(--paper); clip-path:var(--px8); transition:background .2s, transform .2s;}
.theme-btn:hover{background:var(--blue); color:#fff;}
.theme-btn svg{width:20px; height:20px; display:block; shape-rendering:crispEdges;}
.theme-btn .moon{display:none;} html[data-theme=dark] .theme-btn .moon{display:block;} html[data-theme=dark] .theme-btn .sun{display:none;}
@media(max-width:680px){ .theme-btn{right:10px; bottom:10px; width:36px; height:36px;} }
.party-fx{position:fixed; inset:0; width:100%; height:100%; z-index:9998; pointer-events:none;}
.pxfx-party{font-size:13px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; color:#fff; background:#ff2bd6; padding:4px 8px; transform:translate(-50%,-300%); animation:pxparty 1.6s ease-out forwards;}
@keyframes pxparty{0%{background:#ff2bd6;} 25%{background:#00e5ff;} 50%{background:#8a3dff;} 75%{background:#ff5e00; opacity:1;} 100%{background:#d8ff00; opacity:0;}}

/* treat reactions (cursor.js): a coloured badge per treat, stars and music notes */
.pxfx-badge{font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; padding:3px 7px; transform:translate(-50%,-260%); animation:pxfade 1.1s ease-out forwards; color:#0a0a0a;}
.pxfx-love{background:#ff2bd6; color:#fff;} .pxfx-wow{background:#00e5ff;} .pxfx-yum{background:#c8f000;} .pxfx-boom{background:#ff5e00; color:#fff;} .pxfx-tune{background:#8a3dff; color:#fff;}
.pxfx-star{width:6px; height:6px; margin:-3px 0 0 -3px; background:#00e5ff; box-shadow:0 -6px #00e5ff, 0 6px #00e5ff, -6px 0 #00e5ff, 6px 0 #00e5ff; animation:pxstar .9s cubic-bezier(.16,1,.3,1) forwards;}
.pxfx-s0{--dx:0px; --dy:-60px;} .pxfx-s1{--dx:42px; --dy:-42px;} .pxfx-s2{--dx:60px; --dy:0px;} .pxfx-s3{--dx:42px; --dy:42px;}
.pxfx-s4{--dx:0px; --dy:60px;} .pxfx-s5{--dx:-42px; --dy:42px;} .pxfx-s6{--dx:-60px; --dy:0px;} .pxfx-s7{--dx:-42px; --dy:-42px;}
@keyframes pxstar{0%{transform:translate(0,0) scale(.4); opacity:1;} 100%{transform:translate(var(--dx),var(--dy)) scale(1); opacity:0;}}
.pxfx-note{font-size:20px; font-weight:700; color:#8a3dff; animation:pxnote 1.2s ease-out forwards;}
@keyframes pxnote{0%{transform:translate(-50%,0) rotate(-8deg); opacity:0;} 15%{opacity:1;} 100%{transform:translate(-50%,-70px) rotate(10deg); opacity:0;}}

/* the heart balloon (red treat): rises out of the window on a string, swaying */
.pxfx-balloon{position:absolute; transform:translate(-50%,-100%); animation:pxrise 4.8s cubic-bezier(.45,.05,.55,.95) forwards;}
.pxfx-balloon .sway{display:flex; flex-direction:column; align-items:center; transform-origin:50% 100%; animation:pxsway 1.6s ease-in-out infinite alternate;}
.pxfx-balloon canvas{display:block; image-rendering:pixelated;}
.pxfx-balloon .string{display:block; width:2px; height:34px; margin-top:-2px; background:repeating-linear-gradient(180deg, var(--ink,#1f1f1f) 0 3px, transparent 3px 5px); opacity:.7;}
@keyframes pxrise{0%{transform:translate(-50%,-100%) scale(.4); opacity:0;} 8%{transform:translate(-50%,-100%) scale(1.08); opacity:1;} 14%{transform:translate(-50%,-100%) scale(1);} 100%{transform:translate(-50%, calc(-100% + var(--rise))) scale(1); opacity:1;}}
@keyframes pxsway{0%{transform:translateX(-14px) rotate(-7deg);} 100%{transform:translateX(14px) rotate(7deg);}}
.pxfx-love{background:#ff2d4b !important;}

/* meteor cursor (the "agents type" section): sparks behind it, and a bomb that goes off where you click */
.pxfx-spark{width:5px; height:5px; margin:-2px 0 0 -2px; animation:pxspark .7s ease-out forwards;}
@keyframes pxspark{0%{transform:translate(0,0) scale(1); opacity:1;} 100%{transform:translate(8px,14px) scale(.3); opacity:0;}}
.pxfx-bomb{transform:translate(-50%,-50%); animation:pxbomb .82s ease-in forwards;}
.pxfx-bomb canvas{display:block; image-rendering:pixelated; filter:drop-shadow(0 0 1px rgba(255,255,255,.9));}
@keyframes pxbomb{0%{transform:translate(-50%,-120%) scale(.5); opacity:0;} 18%{transform:translate(-50%,-50%) scale(1.1); opacity:1;} 30%{transform:translate(-50%,-50%) scale(1);} 70%{transform:translate(-50%,-50%) scale(1.06) rotate(-6deg);} 80%{transform:translate(-50%,-50%) scale(1.12) rotate(6deg);} 100%{transform:translate(-50%,-50%) scale(1.35); opacity:1;}}
.shake{animation:pxshake .34s steps(6);}
@keyframes pxshake{0%,100%{transform:none;} 20%{transform:translate(-4px,2px);} 40%{transform:translate(4px,-2px);} 60%{transform:translate(-3px,-1px);} 80%{transform:translate(3px,1px);}}

/* Bug Hunt: three phone buttons (left, right, fire) */
.game .pad{grid-template-columns:repeat(3,44px) !important;}
@media(max-width:680px){ .game .pad{grid-template-columns:repeat(3,56px) !important;} .game .pad button{width:56px !important; height:56px !important;} }
.game .score{white-space:pre;}
html.gaming .theme-btn{opacity:0; pointer-events:none;} /* out of the way of the game buttons */

/* Bavarian (and Japanese) treats: they float up like the heart, without a string, slowly turning */
.pxfx-balloon.food .sway{animation:pxsway 1.3s ease-in-out infinite alternate;}
.pxfx-brezel{background:#a0612b; color:#fff;} .pxfx-beer{background:#f2b705;} .pxfx-sushi{background:#ff9a76;}
/* the dino's speech bubble (rides along with the cursor) */
.pxsay{position:absolute; left:100%; bottom:100%; margin:0 0 -4px -6px; padding:4px 8px 5px; white-space:nowrap; font-size:11px; font-weight:800; letter-spacing:.06em; text-transform:uppercase; color:var(--say,#1f1f1f); background:#fff; border:2px solid #1f1f1f; clip-path:var(--px6); opacity:0; transform:scale(.4); transform-origin:0 100%; transition:opacity .12s, transform .18s cubic-bezier(.34,1.56,.64,1); pointer-events:none;}
.pxsay::after{content:""; position:absolute; left:6px; bottom:-2px; width:6px; height:2px; background:#1f1f1f;}
.pxsay.on{opacity:1; transform:scale(1);}
.pxcur.touch{transition:opacity .25s;}

/* touch: the dino stays on screen, except while the footer game runs */
html.gaming .pxcur.touch{opacity:0 !important;}

/* phone: the rising treats are smaller, so is the string */
.pxfx-balloon.sm .string{height:20px; width:1px;}

/* phone: small hearts float up over the dino's head in "When I'm not building" */
.pxfx-floatheart{position:absolute; animation:pxlove 1.6s ease-out forwards;}
.pxfx-floatheart canvas{display:block; width:22px; height:auto; image-rendering:pixelated;}
@keyframes pxlove{0%{transform:translate(-50%,-50%) scale(.4); opacity:0;} 20%{opacity:1;} 100%{transform:translate(calc(-50% + var(--dx,0px)),-420%) scale(1); opacity:0;}}
@media(prefers-reduced-motion:reduce){ .pxfx-floatheart{display:none;} }

/* the meteor's bomb: twice the size and a harder shake (the blast itself is drawn in pixels, cursor.js) */
.pxfx-bomb canvas{width:66px; height:auto;}
.shake{animation:pxshake .56s steps(10);}
@keyframes pxshake{0%,100%{transform:none;} 10%{transform:translate(-11px,5px);} 20%{transform:translate(10px,-6px);} 30%{transform:translate(-9px,-3px);} 40%{transform:translate(8px,4px);} 50%{transform:translate(-6px,2px);} 60%{transform:translate(5px,-3px);} 70%{transform:translate(-3px,1px);} 80%{transform:translate(2px,-1px);} 90%{transform:translate(-1px,0);}}
