* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #0d1310;
  overscroll-behavior: none;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  color: #f2ead9;
}

#stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(58,92,60,.35), transparent 60%),
    radial-gradient(ellipse at 50% -20%, rgba(40,60,90,.3), transparent 55%),
    linear-gradient(180deg, #101712 0%, #0b100d 100%);
}

#game {
  display: block;
  height: 100%;
  width: 100%;
  max-width: 540px;
  touch-action: none;
  background: #4a3230;
  box-shadow: 0 0 60px rgba(0,0,0,.7);
}

.hidden { display: none !important; }

#hud {
  position: absolute;
  inset: 0;
  max-width: 540px;
  margin: 0 auto;
  pointer-events: none;
  padding-top: env(safe-area-inset-top);
}

#hud-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
}

#score-box {
  background: rgba(20,14,10,.55);
  border-radius: 10px;
  padding: 6px 10px;
  min-width: 86px;
  backdrop-filter: blur(3px);
}

#score {
  font-size: 24px;
  font-weight: 800;
  color: #ffcf6e;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0,0,0,.4);
}

#best {
  font-size: 11px;
  font-weight: 600;
  color: #b9a98d;
  margin-top: 3px;
}

#stamina-box {
  flex: 1;
  background: rgba(20,14,10,.55);
  border-radius: 10px;
  padding: 7px 10px 9px;
  backdrop-filter: blur(3px);
}

#stamina-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #c9b795;
  margin-bottom: 4px;
}

#stamina-bar {
  position: relative;
  height: 12px;
  background: rgba(0,0,0,.5);
  border-radius: 7px;
  overflow: hidden;
}

#stamina-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  background: linear-gradient(90deg, #8ee05c, #5ec24a);
  border-radius: 7px;
  transition: background .25s;
}

#stamina-fill.warn { background: linear-gradient(90deg, #ffd45c, #f0a738); }
#stamina-fill.danger { background: linear-gradient(90deg, #ff7b5c, #e04a3a); }

#stamina-ghost {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 0;
  background: rgba(255,255,255,.55);
  border-radius: 7px;
  opacity: 0;
}

#mute-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: rgba(20,14,10,.55);
  color: #e8d9b5;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(3px);
}

#mute-btn:active { transform: scale(.92); }

#rain-banner {
  position: absolute;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(24,36,64,.78);
  border: 1.5px solid rgba(140,180,255,.5);
  color: #cfe2ff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1.5px;
  padding: 7px 14px;
  border-radius: 999px;
  animation: pulse .6s infinite alternate;
}

#rain-banner.raining {
  background: rgba(64,26,30,.82);
  border-color: rgba(255,140,120,.6);
  color: #ffd9cd;
  animation: none;
}

#rain-banner.sheltered {
  background: rgba(26,64,36,.82);
  border-color: rgba(140,255,170,.5);
  color: #d2ffe0;
  animation: none;
}

#rain-countdown { font-variant-numeric: tabular-nums; }

@keyframes pulse {
  from { transform: translateX(-50%) scale(1); }
  to   { transform: translateX(-50%) scale(1.06); }
}

#wetness-wrap {
  position: absolute;
  top: 108px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
}

#wetness-bar {
  height: 6px;
  background: rgba(0,0,0,.5);
  border-radius: 4px;
  overflow: hidden;
}

#wetness-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6fc3ff, #3a8fe0);
  border-radius: 4px;
}

#hint {
  position: absolute;
  bottom: 26%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,10,8,.75);
  color: #ffe9b0;
  font-weight: 700;
  font-size: 15px;
  padding: 9px 16px;
  border-radius: 12px;
  white-space: nowrap;
  max-width: 92%;
  text-align: center;
  transition: opacity .4s;
}

#joy {
  position: absolute;
  inset: 0;
  max-width: 540px;
  margin: 0 auto;
  pointer-events: none;
}

#joy-base {
  position: absolute;
  left: 22px;
  bottom: calc(26px + env(safe-area-inset-bottom));
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: rgba(20,14,10,.35);
  border: 2.5px solid rgba(255,235,190,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .2s;
}

#joy.active #joy-base {
  background: rgba(20,14,10,.5);
  border-color: rgba(255,235,190,.6);
}

#joy-knob {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9b8, #c99a4e);
  box-shadow: 0 3px 8px rgba(0,0,0,.45);
  transform: translate(0, 0);
}

#joy-label {
  position: absolute;
  left: 22px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  width: 128px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(255,235,190,.55);
  text-transform: uppercase;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8,6,5,.55);
  backdrop-filter: blur(2px);
  z-index: 10;
  padding: 20px;
}

.panel {
  background: linear-gradient(180deg, rgba(38,26,20,.96), rgba(26,17,13,.96));
  border: 2px solid rgba(255,210,140,.25);
  border-radius: 22px;
  padding: 28px 26px 24px;
  text-align: center;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: pop-in .3s ease-out;
}

@keyframes pop-in {
  from { transform: scale(.85); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

h1 {
  font-size: 40px;
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 1px;
  color: #ffd98a;
  text-shadow: 0 3px 0 rgba(0,0,0,.35);
  margin: 10px 0 8px;
}

h2 {
  font-size: 30px;
  font-weight: 900;
  color: #ff9d7a;
  margin-bottom: 6px;
}

.tagline {
  color: #cbb994;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.45;
}

.howto {
  text-align: left;
  background: rgba(0,0,0,.25);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.how-row { display: flex; gap: 10px; align-items: baseline; }

.how-key {
  flex: 0 0 58px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #8fd06a;
}

.how-desc { font-size: 13px; color: #d8c9a8; line-height: 1.4; }
.how-desc b { color: #ffe9b0; }

.big-btn {
  font-family: inherit;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #3a2410;
  background: linear-gradient(180deg, #ffd36e, #f0a738);
  border: none;
  border-radius: 16px;
  padding: 14px 34px;
  cursor: pointer;
  box-shadow: 0 5px 0 #a86a1e, 0 10px 20px rgba(0,0,0,.4);
  transition: transform .06s;
}

.big-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #a86a1e; }

.footnote {
  margin-top: 14px;
  font-size: 11px;
  color: #8a7a5f;
}

#death-cause { color: #d8c9a8; font-size: 14px; margin-bottom: 12px; }

.final-score {
  font-size: 52px;
  font-weight: 900;
  color: #ffd98a;
  text-shadow: 0 3px 0 rgba(0,0,0,.35);
  line-height: 1;
}

#new-best {
  margin-top: 6px;
  color: #8fd06a;
  font-weight: 900;
  letter-spacing: 2px;
  font-size: 14px;
  animation: pulse2 .5s infinite alternate;
}

@keyframes pulse2 { from { transform: scale(1); } to { transform: scale(1.1); } }

#final-best { margin-top: 6px; color: #b9a98d; font-size: 13px; margin-bottom: 16px; }

.mini-spider {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, #4a4f5c 0 18%, transparent 19%),
    radial-gradient(circle at 68% 30%, #4a4f5c 0 14%, transparent 15%),
    radial-gradient(circle at 50% 60%, #2b2f38 55%, #23262d 100%);
  position: relative;
  animation: bob 2.4s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
