*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{
  margin:0;
  width:100%;
  height:100%;
  min-height:100%;
  background:
    radial-gradient(ellipse at 20% 10%, #ffb34755, transparent 45%),
    linear-gradient(180deg, #c45c26 0%, #8b4513 45%, #5c3317 100%);
  color:#fff7ed;
  font-family:"Segoe UI",system-ui,sans-serif;
  overflow:hidden;
  overscroll-behavior:none;
}
body{
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}
#app{
  width:100%;
  min-height:100vh;
  min-height:100dvh;
  display:grid;
  place-items:center;
  position:relative;
  overflow:hidden;
}
#game{
  width:min(100vw,1280px);
  aspect-ratio:16/9;
  box-shadow:0 24px 80px #00000066;
  border:1px solid #fbbf2440;
  background:#c45c26;
  border-radius:4px;
  overflow:hidden;
}
#game canvas,
canvas{
  width:100%!important;
  height:100%!important;
  display:block!important;
  touch-action:none!important;
}
#help{
  position:fixed;
  top:12px;
  left:50%;
  transform:translateX(-50%);
  padding:8px 16px;
  border-radius:999px;
  background:#451a03cc;
  backdrop-filter:blur(10px);
  font-size:13px;
  z-index:20;
  white-space:nowrap;
  border:1px solid #fbbf2433;
}
#mobile-controls{
  display:none;
  position:fixed;
  inset:0;
  pointer-events:none;
  z-index:60;
}
body.gameplay-active #mobile-controls{
  display:block;
}
.mobile-pad{
  position:absolute;
  top:55%;
  transform:translateY(-50%);
  display:flex;
  gap:8px;
  align-items:center;
  pointer-events:none;
}
.mobile-pad-left{
  left:max(8px,env(safe-area-inset-left));
}
.mobile-pad-right{
  right:max(8px,env(safe-area-inset-right));
}
#mobile-controls button{
  pointer-events:auto;
  touch-action:none;
  border:2px solid #fbbf2466;
  background:#5f2b0da8;
  color:#fff7ed;
  border-radius:16px;
  min-width:54px;
  height:52px;
  padding:0 9px;
  font-weight:900;
  font-size:16px;
  box-shadow:0 5px 18px #0007;
  opacity:.58;
  user-select:none;
  -webkit-user-select:none;
  transition:
    opacity .08s ease,
    transform .08s ease,
    background .08s ease;
}
#mobile-controls #jump{
  min-width:76px;
  height:66px;
  border-radius:20px;
  font-size:17px;
  background:#9a3412b8;
}
#mobile-controls #run{
  min-width:58px;
  height:48px;
  border-radius:15px;
  font-size:12px;
}
#mobile-controls button.pressed,
#mobile-controls button:active{
  transform:scale(.93);
  background:#c2410c;
  opacity:.96;
}
#rotate-notice{
  display:none;
  position:fixed;
  inset:0;
  z-index:1000;
  background:linear-gradient(180deg,#8b4513,#3b1b0b);
  color:#fff4d5;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:12px;
  text-align:center;
  padding:28px;
}
#rotate-notice strong{font-size:26px}
#rotate-notice span{font-size:15px;color:#f7d58a}
.rotate-phone{
  font-size:62px;
  line-height:1;
  animation:rotateHint 1.4s ease-in-out infinite alternate;
}
@keyframes rotateHint{
  from{transform:rotate(-20deg)}
  to{transform:rotate(70deg)}
}

@media (max-width:900px),(pointer:coarse){
  html,body,#app{
    width:100vw;
    height:100vh;
    height:100dvh;
    min-height:0;
  }
  #app{
    display:block;
    position:fixed;
    inset:0;
  }
  #game{
    position:absolute;
    inset:0;
    width:100vw!important;
    height:100vh!important;
    height:100dvh!important;
    max-width:none!important;
    aspect-ratio:auto!important;
    border:0;
    border-radius:0;
    box-shadow:none;
  }
  #help{display:none}
}

@media (pointer:coarse) and (orientation:portrait){
  #rotate-notice{display:flex}
  body.gameplay-active #mobile-controls{display:none}
}


@media (pointer:coarse) and (orientation:landscape) and (max-height:500px){
  .mobile-pad{
    top:50%;
    gap:6px;
  }
  #mobile-controls button{
    min-width:48px;
    height:46px;
    font-size:14px;
    border-radius:14px;
  }
  #mobile-controls #jump{
    min-width:68px;
    height:58px;
    font-size:15px;
  }
  #mobile-controls #run{
    min-width:52px;
    height:42px;
    font-size:11px;
  }
}
