* { box-sizing: border-box; }
html, body, #canvas { margin: 0; padding: 0; border: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #102a23; }
body { color: #fff5cc; touch-action: none; font-family: system-ui, sans-serif; }
#canvas { display: block; width: 100%; height: 100%; }
#canvas:focus { outline: none; }
#status {
  position: fixed; inset: 0; z-index: 20; overflow: hidden;
  display: grid; place-items: center;
  background: #102a23 url("forest-hero-v1.webp") center / cover no-repeat;
  visibility: hidden;
}
#status::before {
  content: ""; position: absolute; inset: -15% -35%; opacity: .25; filter: blur(28px);
  background: radial-gradient(ellipse at 20% 30%, rgba(238,248,226,.5) 0 8%, transparent 25%), radial-gradient(ellipse at 70% 18%, rgba(255,245,205,.4) 0 10%, transparent 28%);
  animation: mist 24s linear infinite alternate;
}
#status::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 58% 25%, rgba(255,239,154,.3), transparent 20%), linear-gradient(rgba(3,17,12,.12), rgba(3,17,12,.58)); animation: glow 6s ease-in-out infinite alternate; }
.loader { position: relative; z-index: 2; width: min(880px, calc(100% - 28px)); text-align: center; }
.loader-logo { display: block; width: 90%; max-width: 680px; height: auto; max-height: 34vh; margin: 0 auto; object-fit: contain; filter: drop-shadow(0 12px 15px rgba(6,17,12,.5)); }
.loading-label { margin: -3px 0 20px; font-family: Georgia, serif; font-size: clamp(1rem, 2.4vw, 1.4rem); font-weight: 700; text-shadow: 0 2px 5px #112b1e; }
.trail-wrap { position: relative; width: min(720px, 92%); height: 112px; margin: 0 auto; }
.trail, .trail-fill { position: absolute; left: 0; right: 0; bottom: 18px; height: 22px; border-radius: 50%; transform: perspective(100px) rotateX(42deg); }
.trail { background: rgba(53,32,18,.68); box-shadow: 0 7px 0 rgba(29,45,25,.35), inset 0 3px 5px rgba(0,0,0,.35); }
.trail-fill { right: auto; width: 0%; background: linear-gradient(90deg, #d8b46c, #f2d68e); box-shadow: 0 0 13px rgba(255,226,128,.65), inset 0 3px rgba(255,246,194,.35); transition: width .18s linear; }
.walker { position: absolute; left: 0%; bottom: 26px; width: clamp(74px, 14vw, 118px); aspect-ratio: 517 / 760; transform: translateX(-35%); transition: left .42s linear; filter: drop-shadow(0 10px 7px rgba(18,25,16,.42)); }
.walker-sprite { width: 100%; height: 100%; background: url("mozgoroy-walk-right-v2.webp") 0 100% / 400% 100% no-repeat; animation: walk .72s steps(3, end) infinite; }
.percent { position: absolute; left: 50%; bottom: -12px; transform: translateX(-50%); min-width: 92px; padding: 7px 13px; border: 2px solid #542c18; border-radius: 999px; color: #fff2bd; background: rgba(83,46,25,.9); box-shadow: 0 5px 12px rgba(4,15,10,.35); font-weight: 900; }
#status-notice { display: none; width: min(620px, 92%); margin: 20px auto 0; padding: 18px 22px; border: 4px solid #5b311b; border-radius: 20px 9px 22px 12px; color: #402416; background: #f1d796; box-shadow: 0 10px 0 #321b12, 0 18px 28px rgba(0,0,0,.45); line-height: 1.45; }
.loader-version { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); z-index: 3; color: rgba(255,244,205,.85); font-size: .74rem; font-weight: 800; text-shadow: 0 2px 4px #172117; }
.branch { position: fixed; top: -4px; z-index: 3; width: min(30vw, 350px); height: 17px; border-radius: 50%; background: linear-gradient(#6b4524,#301d13); transform-origin: top center; }
.branch::after { content:""; position:absolute; left:16%; top:9px; width:36px; height:18px; border-radius:70% 20% 70% 20%; background:#557832; box-shadow: 55px 8px #315e2d, 112px -1px #71933c, 170px 11px #416b31; }
.branch-left { left:-45px; animation:sway-left 7s ease-in-out infinite alternate; }
.branch-right { right:-45px; transform:scaleX(-1); animation:sway-right 8s ease-in-out infinite alternate; }
@keyframes walk { from { background-position: 0 100%; } to { background-position: 100% 100%; } }
@keyframes bob { to { transform: translateY(-4px) rotate(1deg); } }
@keyframes mist { from { transform:translateX(-5%); } to { transform:translateX(10%); } }
@keyframes glow { from { opacity:.55; } to { opacity:1; } }
@keyframes sway-left { from { transform:rotate(6deg); } to { transform:rotate(10deg); } }
@keyframes sway-right { from { transform:scaleX(-1) rotate(6deg); } to { transform:scaleX(-1) rotate(10deg); } }
@media (orientation: landscape) and (max-height: 650px) and (max-width: 1100px) {
  .loader { width: calc(100% - 32px); max-width: 900px; }
  .loader-logo { width: 46vw; max-width: 520px; max-height: 26vh; }
  .loading-label { margin: -4px 0 4px; }
  .trail-wrap { width: min(660px, 76vw); height: 90px; }
  .walker { width: 72px; }
}
@media (prefers-reduced-motion: reduce) {
  #status::before, #status::after, .branch, .walker-sprite { animation: none; }
  .trail-fill, .walker { transition: none; }
}
