:root { --ink: #e9ecf4; --dim: #9aa6c2; --night: #05070f; --gold: #f3d79a; color-scheme: dark; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { font-family: "Nunito", "Avenir Next", "Segoe UI", system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; }

.round { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(220, 228, 255, .16); background: rgba(14, 20, 38, .55);
  display: grid; place-items: center; cursor: pointer; padding: 0; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  transition: transform .15s ease, background .2s ease; }
.round svg { width: 22px; height: 22px; }
.round:active { transform: scale(.93); }
.round.big { width: 72px; height: 72px; background: rgba(243, 215, 154, .14); border-color: rgba(243, 215, 154, .45); color: var(--gold); }
.round.big svg { width: 32px; height: 32px; }
.round:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* the HUD: the Sleepy Pines corners (both top corners, 60 x 60 + safe area on the platform, 0 elsewhere) stay clear */
#hud { position: fixed; top: 0; left: 0; right: 0; height: 56px; pointer-events: none;
  padding-top: env(safe-area-inset-top); }
#hud[hidden], #title[hidden], #done[hidden], #mapbtn[hidden] { display: none; }
#home { position: absolute; top: calc(6px + env(safe-area-inset-top)); left: calc(8px + var(--sp-home-w, 0px)); pointer-events: auto; }
#mid { position: absolute; top: calc(6px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); height: 44px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px 0 8px; border-radius: 22px; background: rgba(8, 12, 26, .42); }
#lvl { font-weight: 700; font-size: 19px; letter-spacing: .04em; min-width: 1.2em; text-align: center; color: var(--ink); }
#stars { display: flex; gap: 4px; }
.star { width: 15px; height: 15px; }
.star path { fill: rgba(200, 210, 240, .18); transition: fill .4s ease; }
.star.got path { fill: var(--gold); }

/* the title: the live maze plays behind a quiet lowercase wordmark */
#title { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(76px + env(safe-area-inset-top)) 20px calc(40px + env(safe-area-inset-bottom)); pointer-events: none;
  transition: opacity .7s ease; }
#title.out { opacity: 0; }
#mark { margin: 0; font-weight: 300; font-size: clamp(34px, 10vw, 58px); letter-spacing: .32em; text-indent: .32em; color: #eef1fa;
  text-shadow: 0 0 24px rgba(190, 210, 255, .35), 0 2px 10px rgba(0, 0, 0, .6); }
#mark span { display: inline-block; animation: breathe 7s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { opacity: .82; } 50% { opacity: 1; } }
#tbtns { display: flex; gap: 18px; align-items: center; pointer-events: auto; }
#tsmall { display: flex; gap: 12px; align-items: center; pointer-events: auto; }
#tlvl { font-size: 15px; letter-spacing: .14em; color: var(--dim); }
#snd.off #sndWave { opacity: 0; }

/* the map button (bottom centre, clear of the lower-right corner) and the map itself */
#mapbtn { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(14, 20, 38, .6); border-color: rgba(220, 228, 255, .14); color: rgba(200, 210, 235, .38); transition: color .4s ease, border-color .4s ease, background .4s ease, box-shadow .4s ease; }
#mapbtn:active { transform: translateX(-50%) scale(.93); }
#mapbtn.ready { color: #f1e6c6; border-color: rgba(214, 226, 255, .7); background: rgba(70, 86, 130, .5); box-shadow: 0 0 28px rgba(190, 210, 255, .45); animation: moonready 2.6s ease-in-out infinite; }
@keyframes moonready { 50% { box-shadow: 0 0 40px rgba(190, 210, 255, .7); } }
#mapbtn.nope { animation: nope .35s ease; }
@keyframes nope { 25% { transform: translateX(calc(-50% - 5px)); } 75% { transform: translateX(calc(-50% + 5px)); } }
#mapv { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(3, 5, 10, .55); opacity: 0; transition: opacity .3s ease; }
#mapv[hidden] { display: none; }
#mapv.in { opacity: 1; }
#mapc { border-radius: 4px; box-shadow: 0 14px 50px rgba(0, 0, 0, .6), 0 0 60px rgba(180, 200, 255, .18); transform: scale(.96) rotate(-.6deg); transition: transform .3s ease; }
#mapv.in #mapc { transform: scale(1) rotate(-.6deg); }

/* the end of a wood */
#done { position: fixed; left: 50%; bottom: calc(10vh + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 16px; animation: rise .8s ease both; }
#doneStars { display: flex; gap: 10px; }
#doneStars .star { width: 30px; height: 30px; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

#veil { position: fixed; inset: 0; background: var(--night); opacity: 1; pointer-events: none; transition: opacity .6s ease; }
#veil.clear { opacity: 0; }

@media (prefers-reduced-motion: reduce) { #mark span { animation: none; } #done { animation: none; } }
