@font-face{font-family:"Press Start 2P";src:url(press-start-2p.woff2) format("woff2");font-display:swap}

:root{
  color-scheme:light dark;
  --sky-top:#8ec9ff;--sky-bot:#eaf5ff;
  --text-1:#10202f;--text-2:#364a60;--text-3:#4a5d74;
  --surface:rgb(255 255 255 / .66);--hairline:rgb(16 32 47 / .12);
  --accent:#3e7a22;--accent-ink:#fff;
  --cloud:.9;
  --ease:cubic-bezier(.23,1,.32,1);
  --sans:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Segoe UI",system-ui,sans-serif;
  --mono:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  --pixel:"Press Start 2P",ui-monospace,monospace;
}
/* time of day: set by time.js from the visitor's clock; prefers-color-scheme is only the no-JS fallback */
:root[data-theme="golden"]{--sky-top:#9db4ea;--sky-bot:#ffd9b3;--cloud:.8}
@media (prefers-color-scheme:dark){:root:not([data-theme]){
    --sky-top:#0a1426;--sky-bot:#16264a;
    --text-1:#eef4fb;--text-2:#c3d0e0;--text-3:#9db0c6;
    --surface:rgb(18 30 52 / .62);--hairline:rgb(238 244 251 / .14);
    --accent:#6db84a;--accent-ink:#0b1a07;
    --cloud:.1;color-scheme:dark;
}}
:root[data-theme="night"]{
    --sky-top:#0a1426;--sky-bot:#16264a;
    --text-1:#eef4fb;--text-2:#c3d0e0;--text-3:#9db0c6;
    --surface:rgb(18 30 52 / .62);--hairline:rgb(238 244 251 / .14);
    --accent:#6db84a;--accent-ink:#0b1a07;
    --cloud:.1;color-scheme:dark;
}

*{box-sizing:border-box;margin:0}
html{-webkit-text-size-adjust:100%}
body{
  font:400 16px/1.5 var(--sans);color:var(--text-1);
  background:linear-gradient(180deg,var(--sky-top) 0,var(--sky-bot) 720px) no-repeat,var(--sky-bot);
  min-height:100vh;min-height:100svh;overflow-x:hidden;padding-top:env(safe-area-inset-top);display:flex;flex-direction:column;
  -webkit-font-smoothing:antialiased;
}
.orb{position:absolute;left:var(--orb-x,50%);top:var(--orb-y,48px);width:48px;height:48px;margin-left:-24px;background-size:100% 100%;image-rendering:pixelated;pointer-events:none;display:none;z-index:0}
:root[data-theme="day"] .sun,:root[data-theme="golden"] .sun{display:block;background-image:url(tex/sun.png)}
:root[data-theme="night"] .moon{display:block;background-image:url(tex/moon.png)}
@media (max-height:760px){.orb{display:none!important}}
.stars{position:absolute;left:0;top:0;width:2px;height:2px;background:#fff;box-shadow:43vw 11vh #fff, 52vw 43vh #fff, 8vw 6vh #fff, 70vw 8vh #fff, 48vw 39vh #fff, 9vw 34vh #fff, 29vw 4vh #fff, 13vw 29vh #fff, 55vw 6vh #fff, 32vw 7vh #fff, 72vw 29vh #fff, 9vw 38vh #fff, 17vw 16vh #fff, 82vw 42vh #fff, 76vw 5vh #fff, 75vw 39vh #fff, 52vw 5vh #fff, 30vw 4vh #fff, 73vw 10vh #fff, 39vw 28vh #fff, 20vw 36vh #fff, 17vw 38vh #fff, 41vw 37vh #fff, 89vw 13vh #fff, 15vw 39vh #fff, 75vw 42vh #fff, 26vw 25vh #fff, 14vw 37vh #fff, 93vw 6vh #fff, 74vw 5vh #fff, 81vw 15vh #fff, 65vw 45vh #fff, 70vw 29vh #fff, 42vw 31vh #fff, 76vw 31vh #fff, 48vw 21vh #fff, 33vw 13vh #fff, 91vw 17vh #fff, 12vw 38vh #fff, 40vw 35vh #fff, 65vw 23vh #fff, 95vw 30vh #fff, 38vw 40vh #fff, 11vw 9vh #fff;opacity:.85;pointer-events:none;display:none}
:root[data-theme="night"] .stars{display:block}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.cloud{position:absolute;background:#fff;opacity:var(--cloud);pointer-events:none;
  clip-path:polygon(0 50%,12% 50%,12% 25%,35% 25%,35% 0,65% 0,65% 25%,88% 25%,88% 50%,100% 50%,100% 100%,0 100%)}
.c1{top:96px;left:6%;width:128px;height:40px}
.c2{top:48px;right:12%;width:96px;height:32px}
.c3{top:312px;left:46%;width:80px;height:24px}
.is3d .c3{display:none}

main{flex:1;display:flex;align-items:center;width:100%;max-width:1040px;margin:0 auto;padding:0 max(24px,env(safe-area-inset-right)) 0 max(24px,env(safe-area-inset-left));position:relative}
.hero{width:100%;display:grid;grid-template-columns:1.1fr .9fr;align-items:center;gap:32px;padding:48px 0 24px}
.badge{display:inline-flex;align-items:center;gap:8px;padding:4px 12px 4px 8px;border-radius:999px;font-size:14px;font-weight:500;color:var(--text-2);
  background:var(--surface);border:1px solid var(--hairline);-webkit-backdrop-filter:blur(20px) saturate(1.4);backdrop-filter:blur(20px) saturate(1.4)}
.swatch{display:inline-block;width:16px;height:16px;border-radius:2px;background-size:16px 16px;image-rendering:pixelated;flex:none;box-shadow:inset 0 0 0 1px rgb(0 0 0 / .25)}
.swatch-grass{background-image:url(tex/grass_top.png)}
h1{font:400 40px/1.3 var(--pixel);margin:16px 0;letter-spacing:0;text-wrap:balance;text-shadow:0 3px 0 rgb(255 255 255 / .55)}
@media (prefers-color-scheme:dark){:root:not([data-theme]) h1{text-shadow:0 3px 0 rgb(0 0 0 / .45)}}
:root[data-theme="night"] h1{text-shadow:0 3px 0 rgb(0 0 0 / .45)}
.lede{font-size:20px;line-height:1.4;color:var(--text-2);max-width:30ch}

.address{display:flex;align-items:center;gap:12px;margin-top:32px;padding:8px 8px 8px 24px;max-width:480px;border-radius:999px;
  background:var(--surface);border:1px solid var(--hairline);-webkit-backdrop-filter:blur(20px) saturate(1.4);backdrop-filter:blur(20px) saturate(1.4);
  box-shadow:0 8px 24px rgb(16 32 47 / .08)}
#addr{flex:1;min-width:0;font:500 16px/1 var(--mono);color:var(--text-1);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
button{font:600 14px/1 var(--sans);min-width:88px;height:44px;padding:0 24px;border:0;border-radius:999px;cursor:pointer;
  color:var(--accent-ink);background:var(--accent);
  box-shadow:inset 0 3px 0 rgb(255 255 255 / .28),inset 0 -3px 0 rgb(0 0 0 / .25);
  transition:transform 100ms ease-out;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button:active{transform:scale(.97)}
button:focus-visible,canvas:focus-visible{outline:2px solid var(--text-1);outline-offset:3px}
.fine{margin-top:16px;font-size:14px;color:var(--text-2);max-width:44ch}
.fine+.fine{margin-top:4px}

.stage{position:relative;display:grid;place-items:center;height:340px;touch-action:pan-y;cursor:grab;user-select:none;-webkit-user-select:none;perspective:900px}
.stage:active{cursor:grabbing}
.cube{--s:clamp(140px,22vw,208px);position:relative;width:var(--s);height:var(--s);transform-style:preserve-3d;transform:rotateX(-24deg) rotateY(-32deg);will-change:transform}
.face{position:absolute;inset:0;background-size:100% 100%;image-rendering:pixelated;backface-visibility:hidden;box-shadow:inset 0 0 0 1px rgb(0 0 0 / .18)}
.f0,.f1,.f2,.f3{background-image:url(tex/grass_side.png)}
.f0{transform:translateZ(calc(var(--s) / 2));filter:brightness(.94)}
.f1{transform:rotateY(90deg) translateZ(calc(var(--s) / 2));filter:brightness(.78)}
.f2{transform:rotateY(180deg) translateZ(calc(var(--s) / 2));filter:brightness(.94)}
.f3{transform:rotateY(-90deg) translateZ(calc(var(--s) / 2));filter:brightness(.78)}
.top{background-image:url(tex/grass_top.png);transform:rotateX(90deg) translateZ(calc(var(--s) / 2));filter:brightness(1.08)}
.bottom{background-image:url(tex/dirt.png);transform:rotateX(-90deg) translateZ(calc(var(--s) / 2));filter:brightness(.6)}
.shadow{position:absolute;bottom:32px;width:clamp(140px,20vw,200px);height:28px;border-radius:50%;background:rgb(0 0 0 / .22);filter:blur(10px)}

/* block palette */
.hotbar{display:flex;gap:8px;justify-content:center;padding:8px 16px 12px;position:relative;z-index:1}
button.tool{min-width:0;width:40px;height:40px;padding:0;border-radius:6px;background-color:var(--surface);background-size:32px 32px;background-position:center;background-repeat:no-repeat;image-rendering:pixelated;
  border:2px solid var(--hairline);box-shadow:none;-webkit-backdrop-filter:blur(20px);backdrop-filter:blur(20px)}
button.tool[aria-pressed="true"]{border-color:var(--text-1);background-color:var(--surface)}
.t-planks{background-image:url(tex/planks.png)}.t-cobble{background-image:url(tex/cobble.png)}.t-stonebrick{background-image:url(tex/stonebrick.png)}.t-glass{background-image:url(tex/glass.png)}
.t-log{background-image:url(tex/log.png)}.t-roof{background-image:url(tex/roof.png)}.t-torch{background-image:url(tex/torch.png)}.t-pick{background-image:url(tex/pick.png)}

/* build scene */
.scene{position:relative;width:100%;flex:none;line-height:0}
#world{display:block;width:100%;cursor:pointer;touch-action:manipulation;image-rendering:pixelated}
.bubble{position:absolute;left:0;top:0;z-index:2;max-width:220px;padding:8px 12px;border-radius:16px;font:500 14px/1.3 var(--sans);color:var(--text-1);
  background:var(--surface);border:1px solid var(--hairline);-webkit-backdrop-filter:blur(20px) saturate(1.4);backdrop-filter:blur(20px) saturate(1.4);pointer-events:none}
.bubble[hidden]{display:none}

@media (max-width:860px){
  .hero{grid-template-columns:1fr;gap:0;padding-top:32px}
  .stage{order:-1;height:216px}
  h1{font-size:28px}
  .c1{width:96px;height:32px}.c3{display:none}
}
/* phones (iPhone 18 is 402pt wide, 18 Pro Max 440pt): copy up top, the build scene fills the rest of the screen */
@media (max-width:500px){
  main{flex:none;padding:0 max(16px,env(safe-area-inset-right)) 0 max(16px,env(safe-area-inset-left))}
  .hero{padding:24px 0 8px}
  .stage{display:none}
  h1{margin:12px 0 8px}
  .lede{font-size:18px}
  .address{margin-top:24px;padding-left:16px}
  #addr{font-size:14px}
  .fine{margin-top:12px}
  .c1,.orb{display:none!important}
  .c2{top:12px;right:6%}
  .stars{top:56vh;opacity:.7}
  .hotbar{gap:6px;padding:16px 16px 4px}
  button.tool{width:min(44px,calc((100vw - 74px) / 8));height:auto;aspect-ratio:1;background-size:75% 75%}
  .scene{flex:1 0 auto;padding-bottom:env(safe-area-inset-bottom)}
  #world{position:absolute;inset:0;height:100%}
}
/* iOS 26 Safari floats its toolbar over the bottom ~84pt of the page: keep the ground above it, dirt runs underneath */
@supports (-webkit-touch-callout:none){
  @media (max-width:500px){.scene{padding-bottom:max(88px,env(safe-area-inset-bottom))}}
}
/* phones on their side: drop the cube so the scene stays on screen */
@media (max-height:500px) and (orientation:landscape){
  .hero{grid-template-columns:1fr;padding:16px 0 8px}
  .stage{display:none}
}

.d0{--i:0}.d1{--i:1}.d2{--i:2}.d3{--i:3}.d4{--i:4}
@media (prefers-reduced-motion:no-preference){
  .reveal{opacity:0;transform:translateY(8px);animation:rise 240ms var(--ease) forwards;animation-delay:calc(var(--i,0) * 60ms)}
  @keyframes rise{to{opacity:1;transform:none}}
}
