/* Shared look of the panda games: Nunito (rounded, friendly, very readable from across a room), white type
   with soft shadows over the forest, a deep bamboo green and a warm sunny yellow for highlights. */
@font-face { font-family: "Nunito"; src: url("../assets/fonts/nunito-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: block; }
@font-face { font-family: "Nunito"; src: url("../assets/fonts/nunito-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: block; }
@font-face { font-family: "Nunito"; src: url("../assets/fonts/nunito-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-display: block; }
@font-face { font-family: "Nunito"; src: url("../assets/fonts/nunito-latin-900-normal.woff2") format("woff2"); font-weight: 900; font-display: block; }

:root {
  --bg: #0b2117; --bg-2: #123524; --green: #1f5a3c; --leaf: #7fd18b;
  --sun: #ffd25e; --sun-ink: #2e2200; --ink: #ffffff; --ink-2: rgba(255,255,255,.82);
  --peach: #ff9b7a; --sky: #8fd3ff; --pink: #ff8fc7;
  --shadow: 0 2px 4px rgba(0,0,0,.45), 0 0 28px rgba(0,0,0,.35);
  --font: "Nunito", "Segoe UI", system-ui, sans-serif;
  --edge: clamp(14px, 2.2vw, 34px);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font); cursor: none;
  -webkit-font-smoothing: antialiased; user-select: none; }
body.mouse { cursor: default; }
#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100% !important; height: 100% !important; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
video.cam { display: none; }

/* ---------------------------------------------------------------- loading */
.p-loading { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; text-align: center;
  background: radial-gradient(1100px 700px at 50% 35%, #1d4a33 0%, var(--bg) 70%); transition: opacity .9s ease; }
.p-loading.hide { opacity: 0; pointer-events: none; }
.p-loading .mark { width: clamp(90px, 11vw, 150px); aspect-ratio: 1; margin: 0 auto 18px; animation: bob 2.4s ease-in-out infinite; }
.p-loading h1 { font-weight: 900; font-size: clamp(34px, 5vw, 70px); line-height: 1.05; letter-spacing: -.01em; }
.p-loading p { color: var(--ink-2); font-weight: 700; font-size: clamp(15px, 1.5vw, 22px); margin-top: 8px; }
.p-loading .bar { width: min(420px, 60vw); height: 10px; margin: 26px auto 0; border-radius: 99px; background: rgba(255,255,255,.14); overflow: hidden; }
.p-loading .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--sun); transition: width .3s ease; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-3deg); } }

/* ---------------------------------------------------------------- in-game HUD */
.p-top { position: fixed; left: 0; right: 0; top: 0; z-index: 4; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: var(--edge); pointer-events: none; }
.p-chip { display: inline-flex; align-items: center; gap: 10px; background: rgba(8, 26, 17, .55); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 8px 18px 8px 10px; font-weight: 900;
  font-size: clamp(16px, 1.6vw, 26px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.p-chip svg { width: 1.6em; height: 1.6em; flex: none; }
.p-meter { flex: 1; max-width: 640px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.p-meter .label { font-weight: 900; font-size: clamp(16px, 1.6vw, 26px); text-shadow: var(--shadow); }
.p-meter .track { width: 100%; height: clamp(16px, 1.8vw, 26px); border-radius: 99px; background: rgba(8, 26, 17, .55);
  border: 2px solid rgba(255,255,255,.35); overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.p-meter .fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, #ffe08a, var(--sun) 60%, #ffb43c);
  transition: width .35s cubic-bezier(.3,1.4,.5,1); box-shadow: inset 0 -4px 0 rgba(0,0,0,.12); }
.p-meter.pulse .track { animation: pulse .5s ease; }
@keyframes pulse { 40% { transform: scale(1.04); } }
.p-timer { width: clamp(54px, 5.4vw, 84px); aspect-ratio: 1; position: relative; }
.p-timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.p-timer circle { fill: rgba(8, 26, 17, .55); stroke: rgba(255,255,255,.2); stroke-width: 8; }
.p-timer circle.run { fill: none; stroke: var(--sun); stroke-linecap: round; stroke-dasharray: 289; transition: stroke-dashoffset .3s linear; }
.p-timer span { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: clamp(18px, 1.9vw, 30px); }

.p-prompt { position: fixed; left: 50%; bottom: calc(var(--edge) + 6px); z-index: 4; transform: translate(-50%, 0); text-align: center;
  transition: opacity .6s ease, transform .6s ease; pointer-events: none; width: max-content; max-width: 92vw; }
.p-prompt.hide { opacity: 0; transform: translate(-50%, 20px); }
.p-prompt .big { font-weight: 900; font-size: clamp(26px, 3.4vw, 56px); line-height: 1.1; text-shadow: var(--shadow); }
.p-prompt .small { margin-top: 6px; font-weight: 800; font-size: clamp(15px, 1.5vw, 24px); color: var(--ink-2); text-shadow: var(--shadow); }
.p-prompt em, .p-final em { font-style: normal; color: var(--sun); }

.p-final { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .9s ease; }
.p-final.on { opacity: 1; }
.p-final .card { text-align: center; padding: clamp(22px, 3vw, 44px) clamp(28px, 4vw, 64px); border-radius: 32px;
  background: rgba(8, 26, 17, .62); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.2);
  box-shadow: 0 20px 60px rgba(0,0,0,.35); transform: scale(.9); transition: transform .9s cubic-bezier(.3,1.5,.5,1); }
.p-final.on .card { transform: scale(1); }
.p-final h2 { font-weight: 900; font-size: clamp(36px, 5.4vw, 92px); line-height: 1.02; }
.p-final p { margin-top: 12px; font-weight: 800; font-size: clamp(18px, 2vw, 32px); color: var(--ink-2); }
.p-final .stars { font-size: clamp(30px, 4vw, 64px); color: var(--sun); letter-spacing: .1em; margin-bottom: 4px; }

.p-notice { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 7; padding: 12px 22px; border-radius: 16px;
  background: rgba(0,0,0,.6); font-weight: 800; font-size: 18px; display: none; }
.p-notice.on { display: block; }
.p-debug { position: fixed; left: 8px; bottom: 8px; z-index: 60; font: 12px/1.4 ui-monospace, monospace; color: #fff; background: rgba(0,0,0,.55);
  padding: 4px 8px; display: none; white-space: pre; pointer-events: none; }
.p-debug.on { display: block; }
.p-fade { position: fixed; inset: 0; background: #000; z-index: 100; pointer-events: none; transition: opacity .9s ease; }
.p-fade.clear { opacity: 0; }
.p-credit { position: fixed; right: 10px; bottom: 6px; z-index: 5; font-size: 10px; font-weight: 700; color: rgba(255,255,255,.45); pointer-events: none; }

/* browsers keep sound off until the first click: say so (hidden in the Windows app, where sound just plays) */
.p-sound { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 8; font-weight: 800; font-size: 14px;
  color: rgba(255,255,255,.85); background: rgba(8,26,17,.6); border: 1px solid rgba(255,255,255,.2); border-radius: 999px;
  padding: 6px 14px; pointer-events: none; transition: opacity .5s ease; }
.p-sound.off { opacity: 0; }
