/* Obstacle Course — game styles (builds on /assets/site.css and /assets/fun.css) */
[hidden] { display: none !important; }

/* ---------- menu ---------- */
.menu-main { padding: 28px 0 60px; }
.menu-head { text-align: center; max-width: 680px; margin: 0 auto 22px; }
.menu-head h1 { font-size: clamp(2.3rem, 7vw, 3.6rem); margin-bottom: .15em; }
.menu-head p { color: var(--ink-soft); font-weight: 700; }
.menu-head b { color: var(--ink); }
.menu-music {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 4px;
  font: 800 .95rem var(--font-body); color: var(--ink); cursor: pointer;
  background: var(--card); border: 0; border-radius: 999px; padding: 8px 16px; box-shadow: 0 3px 0 rgba(59,42,30,.12);
}
.menu-music svg { width: 20px; height: 20px; }
.music-toggle .mt-slash { display: none; }
.music-toggle[aria-pressed="false"] .mt-slash { display: inline; }
.music-toggle[aria-pressed="false"] { opacity: .75; }

.levels { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 30px; }
.level {
  font: inherit; cursor: pointer; border: 3px solid transparent; background: var(--card); color: var(--ink); border-radius: 20px;
  padding: 10px 22px 12px; min-width: 160px; text-align: center; box-shadow: 0 4px 0 rgba(59,42,30,.12);
  display: flex; flex-direction: column; align-items: center; line-height: 1.15;
}
.level b { font-family: var(--font-display); font-size: 1.25rem; }
.level small { color: var(--ink-soft); font-weight: 700; }
.lv-stars { color: var(--yellow-deep); font-size: 1.2rem; letter-spacing: 2px; }
.level[aria-checked="true"] { border-color: var(--red); background: #fff3d6; box-shadow: 0 4px 0 var(--red-deep); }

.pick-title { text-align: center; font-size: 1.8rem; margin-bottom: 16px; }
.stage-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; max-width: 900px; margin: 0 auto; }
.stage-card {
  font: inherit; color: var(--ink); cursor: pointer; padding: 12px 8px 10px; border: 0; position: relative; overflow: hidden;
  background: var(--amb); border-radius: 22px; box-shadow: var(--shadow); min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.stage-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0) 35%, rgba(255,250,240,.92) 66%); }
.stage-card > * { position: relative; }
.stage-card:hover:not(.locked) { transform: translateY(-4px); box-shadow: 0 0 0 4px rgba(255,210,63,.75), var(--shadow); }
.st-num { position: absolute; top: 8px; left: 10px; font: 800 1.9rem/1 var(--font-display); color: #fff;
  text-shadow: 0 2px 0 rgba(59,42,30,.45), 0 0 10px rgba(59,42,30,.25); }
.st-face { height: 64px; width: auto; filter: drop-shadow(0 3px 3px rgba(0,0,0,.3)); margin-top: 18px; }
.st-name { font: 800 .85rem/1.1 var(--font-body); text-align: center; }
.st-stars { font-size: 1.05rem; letter-spacing: 1px; color: #e3d3b4; min-height: 1.3em; }
.st-stars .on { color: var(--yellow); text-shadow: 0 1px 0 var(--yellow-deep); }
.st-go { font: 800 .8rem var(--font-body); font-style: normal; color: #fff; background: var(--red); border-radius: 999px; padding: 2px 10px; }
.stage-card.locked { cursor: not-allowed; }
.stage-card.locked .st-face, .stage-card.locked .st-name { filter: grayscale(1) opacity(.45); }
.stage-card.locked::after { content: ""; position: absolute; inset: 0; background: rgba(90,80,70,.28); }
.st-lock { position: absolute !important; z-index: 2; top: 50%; left: 50%; width: 46px; height: 46px; margin: -30px 0 0 -23px;
  display: grid; place-items: center; border-radius: 50%; background: rgba(255,250,240,.95); color: var(--ink-soft); box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.st-lock svg { width: 26px; height: 26px; }
.menu-msg { text-align: center; font-weight: 800; color: var(--red); margin-top: 22px; min-height: 1.5em; }
@media (max-width: 720px) { .stage-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; } }
@media (max-width: 520px) {
  .stage-grid { grid-template-columns: repeat(2, 1fr); }
  .level { min-width: 0; flex: 1 1 0; padding: 8px 6px 10px; }
  .level b { font-size: 1.05rem; }
  .level small { font-size: .72rem; }
}

/* ---------- play ---------- */
#play { position: relative; isolation: isolate; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); }
#play > :not(.ambient) { position: relative; z-index: 1; }
.ambient { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--amb, #fbe7b5); transition: background .8s; }
.ambient::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.35) 0%, transparent 60%); }
.amb-stars i { position: absolute; left: var(--x); top: var(--y); z-index: 1; font-style: normal; font-size: var(--s); line-height: 1; color: #fff;
  text-shadow: 0 0 6px #ffd23f, 0 0 14px rgba(255,190,40,.9); opacity: 0; animation: ambTwinkle var(--t) ease-in-out infinite; animation-delay: var(--d); }
@keyframes ambTwinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: 1; transform: scale(1) rotate(45deg); } }

.toolbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); }
.toolbar:has(.got) { min-height: 80px; align-items: flex-start; }
.tb-btn {
  flex: none; height: 46px; min-width: 46px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--card); color: var(--ink); box-shadow: 0 3px 0 rgba(59,42,30,.15);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 11px; font: 800 1rem var(--font-body);
}
.tb-btn svg { width: 24px; height: 24px; }
.tb-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(59,42,30,.15); }
.tb-btn.hint { background: var(--yellow); box-shadow: 0 3px 0 var(--yellow-deep); }
#soundBtn .snd-off { display: none; }
#soundBtn[aria-pressed="false"] .snd-on { display: none; }
#soundBtn[aria-pressed="false"] .snd-off { display: block; }
.tb-title { flex: 1; min-width: 0; text-align: center; }
.got { display: inline-block !important; margin-top: 6px !important; background: rgba(255,250,240,.92); border-radius: 999px; padding: 1px 12px 3px;
  box-shadow: 0 2px 8px rgba(59,42,30,.15); font-size: 1.35rem; letter-spacing: 3px; color: var(--yellow-deep); }
.got .pop { display: inline-block; animation: gotPop .6s cubic-bezier(.3,1.8,.5,1); }
@keyframes gotPop { 40% { transform: scale(1.8); } }
@media (max-width: 619px) {
  .tb-label { display: none; }
  .tb-btn { padding: 0 9px; height: 42px; min-width: 42px; }
  .toolbar:has(.got) { min-height: 0; }
  .toolbar .tb-title { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
  .got { margin-top: 0 !important; font-size: 1.1rem; }
}

/* the maze and the arrow pad: side by side on wide screens, pad under the maze on tall ones (sizes set by maze.js) */
.playarea { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 18px;
  padding: 4px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
.playarea.tall { flex-direction: column; gap: 10px; }
.board-wrap { position: relative; flex: none; }
.board {
  position: relative; width: var(--bw, 600px); height: var(--bh, 400px); border-radius: 14px; overflow: hidden;
  box-shadow: 0 0 0 5px #fff, 0 16px 40px rgba(59,42,30,.35); touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.things { position: absolute; inset: 0; pointer-events: none; }
.star-item { position: absolute; width: var(--c); height: var(--c); display: grid; place-items: center; font-size: calc(var(--c) * .62); line-height: 1;
  color: #ffd23f; text-shadow: 0 0 6px #fff, 0 2px 0 #d99a00, 0 0 14px rgba(255,200,40,.9); animation: starBob 1.6s ease-in-out infinite; }
@keyframes starBob { 50% { transform: translateY(-8%) scale(1.12) rotate(12deg); } }
.star-item.got { animation: starGot .6s ease-out forwards; }
@keyframes starGot { to { transform: translateY(-80%) scale(2.2); opacity: 0; } }
.goal { position: absolute; display: flex; align-items: flex-end; justify-content: center; }
.goal::before { content: ""; position: absolute; left: 8%; right: 8%; bottom: 4%; height: 34%; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,230,120,.95), rgba(255,200,60,.5) 55%, transparent 72%); animation: padGlow 1.4s ease-in-out infinite alternate; }
@keyframes padGlow { to { transform: scale(1.18); opacity: .7; } }
.goal img { position: relative; height: 92%; max-width: 100%; object-fit: contain; width: auto; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); animation: goalWave 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes goalWave { 50% { transform: translateY(-6%) rotate(-3deg); } }
.start-pad { position: absolute; border-radius: 50%; border: 3px dashed rgba(255,255,255,.85); background: rgba(255,255,255,.25); }

.player { position: absolute; left: 0; top: 0; width: var(--c); height: var(--c); will-change: transform; z-index: 3; pointer-events: none;
  background: none !important; }
/* the sprite: maze.js picks the frame from yy.webp with background-position */
.player .spr { position: absolute; left: 50%; bottom: 4%; width: var(--sw); height: var(--sh); margin-left: calc(var(--sw) / -2);
  background-image: url("yy.webp?v=2"); background-repeat: no-repeat; filter: drop-shadow(0 3px 2px rgba(0,0,0,.3));
  transform-origin: 50% 80%; }
.player.bump .spr { animation: bump .25s ease; }
@keyframes bump { 50% { scale: 1.1 .9; } }
.player.home .spr { animation: homeJump .5s ease-in-out 3; }
@keyframes homeJump { 50% { translate: 0 -22%; } }

.hint-dot { position: absolute; width: calc(var(--c) * .28); height: calc(var(--c) * .28); margin: calc(var(--c) * -.14) 0 0 calc(var(--c) * -.14);
  border-radius: 50%; background: #fff6b0; box-shadow: 0 0 0 3px #ffb800, 0 0 12px 4px rgba(255,190,40,.9); opacity: 0;
  animation: hintDot 2.6s ease-in-out forwards; animation-delay: var(--d); }
@keyframes hintDot { 10% { opacity: 1; transform: scale(1.3); } 25% { transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }

.toast {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 5; margin: 0; white-space: nowrap;
  background: rgba(255,250,240,.96); color: var(--ink); font-weight: 800; font-size: .95rem;
  padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.2); transition: opacity .3s; pointer-events: none;
}
.toast:empty { opacity: 0; }

/* the arrow pad: only up, down, left and right */
.dpad { flex: none; display: grid; grid-template: repeat(3, var(--dp, 64px)) / repeat(3, var(--dp, 64px)); gap: 6px; }
.dp { border: 0; border-radius: 22px; cursor: pointer; background: #fffaf0; color: var(--red); display: grid; place-items: center;
  box-shadow: 0 5px 0 rgba(59,42,30,.22), 0 8px 18px rgba(59,42,30,.15); touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none; }
.dp svg { width: 58%; height: 58%; fill: currentColor; }
.dp.up { grid-area: 1 / 2; } .dp.left { grid-area: 2 / 1; } .dp.right { grid-area: 2 / 3; } .dp.down { grid-area: 3 / 2; }
.dp.on, .dp:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(59,42,30,.22); background: #ffe38a; }
.playarea.tall .dpad { grid-template: repeat(2, var(--dp, 56px)) / repeat(4, var(--dp, 56px)); }
.playarea.tall .dp.left { grid-area: 1 / 1 / 3 / 2; } .playarea.tall .dp.up { grid-area: 1 / 2 / 2 / 4; }
.playarea.tall .dp.down { grid-area: 2 / 2 / 3 / 4; } .playarea.tall .dp.right { grid-area: 1 / 4 / 3 / 5; }

/* ---------- win ---------- */
.win { position: fixed; inset: 0; z-index: 50; background: rgba(40, 24, 10, .45); display: grid; place-items: center; padding: 16px; animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.win-card { background: var(--card); border-radius: 30px; padding: 22px 26px 22px; text-align: center; width: min(440px, 100%);
  box-shadow: 0 10px 0 rgba(59,42,30,.18), 0 30px 60px rgba(0,0,0,.25); animation: pop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { from { transform: scale(0); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.win-face { width: 120px; height: 120px; object-fit: contain; margin: -10px auto 0; display: block; animation: goalWave 1.6s ease-in-out infinite; }
.win-card h2 { font-size: 2.2rem; margin: 4px 0 2px; color: var(--red); }
.win-card p { font-weight: 700; color: var(--ink-soft); }
.win-stars { font-size: 3.2rem; line-height: 1; letter-spacing: 6px; }
.win-stars span { color: #eadcc0; display: inline-block; }
.win-stars span.on { color: var(--yellow); text-shadow: 0 3px 0 var(--yellow-deep); animation: pop .5s cubic-bezier(.3,1.8,.5,1) both; }
.win-stars span.on:nth-child(2) { animation-delay: .25s; }
.win-stars span.on:nth-child(3) { animation-delay: .5s; }
.win-buttons { display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin-top: 8px; }
.win-links { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.btn-link { background: none; border: 0; font: 800 1rem var(--font-body); color: var(--ink-soft); cursor: pointer; padding: 6px; text-decoration: underline; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; }

/* ---------- obstacle course extras ---------- */
#foeCv { pointer-events: none; z-index: 2; }
.player { z-index: 4; }
.start-pad { display: grid; place-items: center; }
.start-pad b { font: 800 calc(var(--c) * .22) var(--font-body); color: rgba(255,255,255,.95); text-shadow: 0 1px 2px rgba(0,0,0,.35); letter-spacing: 1px; }
/* touching something: a soft red glow and three little stars circling round his head (a smooth orbit, no shaking) */
.player.hit .spr { filter: drop-shadow(0 0 6px rgba(255,80,60,.9)) drop-shadow(0 3px 2px rgba(0,0,0,.3)); }
.dizzy { display: none; position: absolute; left: 50%; bottom: 105%; width: calc(var(--c) * .9); height: calc(var(--c) * .3); margin-left: calc(var(--c) * -.45); }
.player.hit .dizzy { display: block; }
.dizzy i { position: absolute; left: 50%; top: 50%; font-style: normal; font-size: calc(var(--c) * .26); line-height: 1; color: #ffd23f;
  text-shadow: 0 0 4px #fff, 0 1px 0 #d99a00; margin: -.5em 0 0 -.5em; animation: orbit 1.1s linear infinite; }
.dizzy i:nth-child(2) { animation-delay: -.37s; } .dizzy i:nth-child(3) { animation-delay: -.73s; }
@keyframes orbit {
  0% { transform: translate(calc(var(--c) * .4), 0) scale(1); } 25% { transform: translate(0, calc(var(--c) * .1)) scale(1.15); }
  50% { transform: translate(calc(var(--c) * -.4), 0) scale(1); } 75% { transform: translate(0, calc(var(--c) * -.1)) scale(.75); }
  100% { transform: translate(calc(var(--c) * .4), 0) scale(1); }
}
.lose-face { width: 130px; height: 130px; margin: -6px auto 0; background-repeat: no-repeat; }
.lose-card h2 { color: var(--blue, #2f5fb3); }
.toast { white-space: normal; text-align: center; width: max-content; max-width: 92%; }
.playarea.tall .toast { top: auto; bottom: 10px; }

/* ---------- how to play: the card before each stage ---------- */
.intro-card { width: min(440px, 100%); padding-top: 16px; }
.intro-stage { margin: 0; font-weight: 800; color: var(--ink-soft); font-size: .95rem; }
.intro-goal { display: flex; align-items: center; justify-content: center; gap: 8px; height: 96px; }
.intro-yy { width: 92px; height: 92px; background-repeat: no-repeat; flex: none; }
.intro-goal img { height: 88px; width: auto; filter: drop-shadow(0 3px 3px rgba(0,0,0,.25)); }
.intro-arrow { font-size: 2.6rem; line-height: 1; color: var(--red); animation: introPoint 1.1s ease-in-out infinite; }
@keyframes introPoint { 50% { transform: translateX(7px); } }
.intro-card h2 { font-size: clamp(1.5rem, 6vw, 1.95rem); margin: 4px 0 10px; color: var(--red); line-height: 1.1; }
.intro-rules { list-style: none; padding: 0; margin: 0 auto 16px; display: grid; gap: 8px; max-width: 330px; text-align: left; }
.intro-rules li { display: flex; align-items: center; gap: 12px; font-weight: 800; color: var(--ink); background: #fff3d6; border-radius: 16px; padding: 6px 12px; }
.intro-rules canvas, .intro-star, .intro-keys { width: 44px; height: 44px; flex: none; }
.intro-star { display: grid; place-items: center; font-size: 2rem; line-height: 1; color: #ffd23f; text-shadow: 0 2px 0 #d99a00; }
.intro-keys { fill: var(--red); }
#goBtn { min-width: 200px; font-size: 1.3rem; }

/* the FINISH label on the board */
.finish-tag { position: absolute; z-index: 3; transform: translate(-50%, -50%); background: var(--red); color: #fff; white-space: nowrap;
  font: 800 max(10px, calc(var(--c) * .19)) / 1 var(--font-body); letter-spacing: .5px; padding: 3px 7px; border-radius: 999px;
  box-shadow: 0 2px 0 var(--red-deep, #9e2a1a), 0 0 0 2px #fff; pointer-events: none; }

/* the arrow buttons glow until the first step */
.dpad.nudge .dp { animation: dpGlow 1.3s ease-in-out infinite; }
@keyframes dpGlow { 50% { box-shadow: 0 5px 0 rgba(59,42,30,.22), 0 0 0 4px rgba(255,210,63,.95), 0 0 20px 6px rgba(255,190,40,.6); } }
.hint-dot.long { animation: hintDotLong 5s ease-in-out forwards; animation-delay: var(--d); }
@keyframes hintDotLong { 4% { opacity: 1; transform: scale(1.35); } 9% { transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* no text selection or long-press menu on the game screen (holding an arrow down used to select the page) */
#play, #play * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* "A star!": the site-wide cheer badge (fun.css), with a gold star in front */
body .fun-cheer::before { content: "★ "; color: #f5b92e; }
