/* Maze Paint — one self-hosted variable font, no third parties. The page is night: the canvas paints the sky,
   the lake and the maze; everything here is glass and starlight laid over it. */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/fredoka.woff2) format('woff2');
}

:root {
  --ink: #ece9ff;
  --muted: #a9a6d6;
  --glass: rgba(190, 195, 255, 0.10);
  --glass-edge: rgba(210, 215, 255, 0.20);
  --paint: #7fe0cf;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #04051a; overflow: hidden; font-family: 'Fredoka', system-ui, sans-serif; color: var(--ink); }
body { display: flex; align-items: center; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(ellipse at 50% 30%, #121640 0%, #070920 55%, #03041a 100%); }
button { font-family: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#stage { flex-shrink: 0; position: relative; width: 100vw; height: 100vh; height: 100dvh; max-width: 560px; background: #070920; overflow: hidden; }
@media (min-aspect-ratio: 3/4) { #stage { width: calc(100dvh * 0.56); max-width: 560px; box-shadow: 0 0 80px rgba(120, 110, 255, 0.12); } }
canvas#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ===== HUD ===== */
#hud { position: absolute; inset: 0; pointer-events: none; }
.hud-top { position: absolute; left: 0; right: 0; top: var(--safe-top); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px calc(10px + var(--sp-menu-w, 0px)) 0 10px; }   /* the Sleepy Pines corner stays clear */
.hud-spacer { justify-self: end; }
.badge { text-align: center; line-height: 1.05; text-shadow: 0 0 14px rgba(160, 150, 255, 0.55), 0 1px 2px rgba(0, 0, 20, 0.8); }
.badge b { display: block; font-size: 22px; font-weight: 600; letter-spacing: .03em; }
.badge small { display: block; font-size: 12px; color: var(--muted); min-height: 14px; letter-spacing: .02em; }
.hud-bottom { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 14px); display: flex; justify-content: center; gap: 18px; padding-right: 60px;   /* the lower-right 80 x 80 stays clear */ }
.round { pointer-events: auto; width: 52px; height: 52px; border: 1px solid var(--glass-edge); border-radius: 50%; background: var(--glass); color: var(--ink);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: 0 0 18px rgba(140, 130, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  display: flex; align-items: center; justify-content: center; padding: 0; transition: transform .15s, box-shadow .3s, background .3s; }
.round svg { width: 25px; height: 25px; filter: drop-shadow(0 0 4px rgba(200, 195, 255, 0.5)); }
.round:hover { background: rgba(190, 195, 255, 0.16); box-shadow: 0 0 24px rgba(160, 150, 255, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.round:active { transform: scale(.94); }
.round.ghost { background: transparent; border-color: transparent; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--muted); }
.round:disabled { opacity: .3; }
#homeBtn { justify-self: start; }
.toast { position: absolute; left: 50%; bottom: calc(var(--safe-bottom) + 84px); transform: translateX(-50%); background: rgba(20, 22, 60, 0.75); border: 1px solid var(--glass-edge); color: var(--ink); border-radius: 14px; padding: 8px 14px; font-size: 14px; white-space: nowrap; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* ===== screens ===== */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: max(24px, var(--safe-top)) 22px max(22px, var(--safe-bottom)); }
#title { justify-content: flex-start; pointer-events: none; }   /* taps fall through to the lake and the sky */
#title button { pointer-events: auto; }
.title-top { text-align: center; margin-top: 6vh; }
#title .title-mid { margin-top: auto; margin-bottom: 3vh; }
.wordmark { margin: 0; font-size: clamp(44px, 13vw, 66px); font-weight: 600; letter-spacing: .02em; line-height: 1; }
.wordmark span { display: inline-block; color: var(--paint); text-shadow: 0 0 18px currentColor, 0 0 2px rgba(255, 255, 255, 0.6); animation: drift 6s ease-in-out infinite; }
.wordmark span:nth-child(1) { color: #7fe0cf; } .wordmark span:nth-child(2) { color: #8db8ff; animation-delay: -.6s; }
.wordmark span:nth-child(3) { color: #b49cff; animation-delay: -1.2s; } .wordmark span:nth-child(4) { color: #d6a8ff; animation-delay: -1.8s; }
.wordmark span:nth-child(5) { color: #ff9fc6; animation-delay: -2.4s; } .wordmark span:nth-child(6) { color: #ffb08f; animation-delay: -3s; }
.wordmark span:nth-child(7) { color: #ffd28a; animation-delay: -3.6s; } .wordmark span:nth-child(8) { color: #9fe6a8; animation-delay: -4.2s; }
.wordmark span:nth-child(9) { color: #7fe0cf; animation-delay: -4.8s; }
@keyframes drift { 0%, 100% { transform: translateY(0); opacity: 1; } 50% { transform: translateY(-4px); opacity: .82; } }
@media (prefers-reduced-motion: reduce) { .wordmark span { animation: none; } }
.tagline { margin: 12px 0 0; color: var(--muted); font-size: 17px; letter-spacing: .02em; text-shadow: 0 0 10px rgba(140, 130, 255, 0.5); }
.title-mid { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.play { pointer-events: auto; border: 1px solid var(--glass-edge); border-radius: 22px; background: rgba(190, 195, 255, 0.12); color: var(--ink); padding: 15px 46px;
  display: flex; flex-direction: column; align-items: center; line-height: 1.1; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 34px rgba(150, 140, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14); transition: transform .15s, box-shadow .3s; animation: breathe 5s ease-in-out infinite; }
.play b { font-size: 26px; font-weight: 600; letter-spacing: .03em; text-shadow: 0 0 12px rgba(200, 190, 255, 0.7); }
.play span { font-size: 14px; color: var(--muted); margin-top: 3px; }
.play:active { transform: scale(.96); }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 26px rgba(150, 140, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.14); } 50% { box-shadow: 0 0 44px rgba(150, 140, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.14); } }
@media (prefers-reduced-motion: reduce) { .play { animation: none; } }
.statsrow { display: flex; gap: 34px; text-shadow: 0 0 10px rgba(140, 130, 255, 0.5); }
.statsrow div { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.statsrow b { font-size: 22px; font-weight: 600; } .statsrow span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.title-foot { display: flex; gap: 10px; align-items: center; }

.card { justify-content: center; gap: 14px; background: radial-gradient(ellipse at 50% 45%, rgba(10, 12, 40, 0.15), rgba(4, 5, 24, 0.55)); }
.win-word { font-size: clamp(40px, 12vw, 58px); font-weight: 600; letter-spacing: .03em; color: #fff;
  text-shadow: 0 0 22px var(--paint), 0 0 4px rgba(255, 255, 255, 0.8); animation: rise 1.1s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes rise { from { transform: translateY(14px); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }
.win-sub { color: var(--ink); opacity: .85; font-size: 16px; margin-bottom: 10px; text-shadow: 0 0 10px rgba(0, 0, 20, 0.9); animation: rise 1.1s .15s cubic-bezier(.2, .8, .3, 1) both; }
#win .play { animation: rise 1.1s .3s cubic-bezier(.2, .8, .3, 1) both, breathe 5s 1.4s ease-in-out infinite; }
