#forestScreen {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  background: #120e18;
  color: var(--ink);
}

#forestScene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #120e18;
}

#forestWorld {
  position: absolute;
  left: 0;
  top: 0;
  width: 1536px;
  height: 1024px;
  transform-origin: 0 0;
  will-change: transform;
  z-index: 1;
}

.forest-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 1536px;
  height: 1024px;
  object-fit: cover;
  pointer-events: none;
}

#forestBgNight {
  opacity: 0;
  transition: opacity 2.2s ease;
}

#forestScreen.is-night #forestBgNight { opacity: 1; }

#forestCabin {
  position: absolute;
  left: 1250px;
  bottom: 100px;
  width: 392px;
  transform: translateX(-50%);
  z-index: 2;
  filter: drop-shadow(-6px 10px 10px rgba(0,0,0,.35));
}

#forestGlow {
  position: absolute;
  left: 760px;
  top: 330px;
  width: 820px;
  height: 620px;
  margin-left: -410px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,186,92,.4) 0%, rgba(255,146,62,.18) 38%, rgba(255,120,40,0) 70%);
  z-index: 3;
  pointer-events: none;
  opacity: .85;
  transition: opacity .8s;
}

#forestWorld.fire-low #forestGlow {
  animation: fFireFlicker .9s infinite alternate;
}

#forestWorld.fire-out #forestGlow {
  opacity: 0;
}

#forestFire {
  position: absolute;
  left: 760px;
  bottom: 8px;
  width: 250px;
  transform: translateX(-50%);
  transform-origin: 50% 90%;
  z-index: 5;
  filter: drop-shadow(0 0 22px rgba(255,150,60,.5));
  animation: fireBreathe 2.2s ease-in-out infinite;
}

#forestFire.taken,
#forestFire.out {
  filter: grayscale(.7) brightness(.55);
  animation: none;
}

#forestParticles {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

#forestCharacter {
  position: absolute;
  left: 0;
  top: 0;
  width: 184px;
  height: 221px;
  z-index: 8;
  transform-origin: 50% 100%;
  will-change: transform;
}

#forestCharacter .char-figure {
  position: absolute;
  inset: 0;
  transition: opacity .18s;
}

#forestCharShadow {
  position: absolute;
  left: 0;
  top: 0;
  width: 118px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.44), rgba(0,0,0,0) 72%);
  z-index: 7;
  pointer-events: none;
}

#forestPrompt {
  z-index: 12;
  font-size: clamp(9px, .8vw, 12px);
}

#forestPickups, #forestWolves {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

#forestWolves { z-index: 7; }

.forest-pickup {
  position: absolute;
  transform: translateX(-50%);
  filter: drop-shadow(-4px 8px 7px rgba(0,0,0,.42));
}

.forest-pickup img {
  width: 100%;
  height: 100%;
}

.forest-wolf {
  position: absolute;
  width: 190px;
  height: 172px;
  transform: translateX(-50%);
  filter: drop-shadow(-10px 14px 12px rgba(0,0,0,.5));
  opacity: 0;
  transition: opacity .6s;
}

.forest-wolf img {
  display: block;
  width: 100%;
  height: 100%;
}

.forest-wolf.awake { opacity: 1; }

.forest-world-warning {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  padding: 6px 18px;
  background: rgba(217,78,66,.92);
  color: #fff3df;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 3px;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.4);
  z-index: 30;
  pointer-events: none;
  box-shadow: 0 4px 18px rgba(0,0,0,.4);
}

#forestHud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

#forestTopLeft {
  position: absolute;
  left: calc(clamp(8px,1.3vw,22px) + var(--safe-left));
  top: calc(clamp(8px,1.2vh,16px) + var(--safe-top));
  width: clamp(150px, 20vw, 300px);
  z-index: 12;
}

#forestTitleImg {
  width: 100%;
  height: auto;
  transform: rotate(-1.2deg);
  filter: drop-shadow(-4px 9px 9px rgba(0,0,0,.5));
}

#forestClock {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 10px 4px;
  transform: rotate(-1deg);
  clip-path: polygon(0 14%, 7% 2%, 19% 10%, 34% 1%, 51% 8%, 68% 0, 84% 7%, 100% 3%, 98% 90%, 86% 100%, 69% 92%, 52% 100%, 35% 93%, 18% 100%, 4% 90%);
}

#forestClock .label {
  font-size: clamp(7px, .68vw, 10px);
  letter-spacing: 1.6px;
  white-space: nowrap;
}

#fPhaseLabel {
  font-size: clamp(7px, .7vw, 10px);
  letter-spacing: 2px;
  color: var(--coral-deep);
  font-weight: 500;
}

#fTimer {
  font-size: clamp(12px, 1.15vw, 18px);
}

#forestStats {
  position: absolute;
  right: calc(clamp(8px,1.3vw,22px) + var(--safe-right));
  top: calc(clamp(46px,7vh,64px) + var(--safe-top));
  z-index: 12;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 16px);
  padding: 6px 12px 5px;
  transform: rotate(.8deg);
  clip-path: polygon(1% 10%, 11% 0, 25% 8%, 40% 1%, 57% 7%, 73% 0, 88% 7%, 100% 2%, 99% 90%, 87% 100%, 70% 93%, 53% 100%, 36% 93%, 19% 100%, 3% 90%);
}

.fstat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--text);
  font-weight: 700;
  font-size: clamp(7px, .66vw, 10px);
  letter-spacing: 1.4px;
}

.fstat-label { opacity: .6; }

.fstat b {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(10px, .95vw, 14px);
}

.fire-meter {
  width: clamp(52px, 7vw, 100px);
  height: 10px;
  background: rgba(58,47,66,.18);
  border: 1px solid rgba(58,47,66,.28);
  overflow: hidden;
}

.fire-meter i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #E2B23C, #E08C86);
  transition: width .2s, background .3s;
}

.fire-meter.low i { background: var(--coral-deep); }

.hearts {
  display: flex;
  gap: 2px;
}

.heart {
  width: clamp(10px, 1vw, 14px);
  height: clamp(10px, 1vw, 14px);
  clip-path: polygon(50% 100%, 4% 46%, 0 24%, 8% 6%, 26% 0, 42% 6%, 50% 18%, 58% 6%, 74% 0, 92% 6%, 100% 24%, 96% 46%);
  background: var(--coral-deep);
  transform: rotate(-4deg);
}

.heart.off {
  background: rgba(58,47,66,.2);
}

#forestTopRight {
  position: absolute;
  right: calc(clamp(8px,1.3vw,22px) + var(--safe-right));
  top: calc(clamp(8px,1.1vh,14px) + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 14;
  pointer-events: auto;
}

#forestTopRight .paper-tab {
  position: relative;
  right: auto;
  top: auto;
  width: clamp(28px, 2.5vw, 36px);
  height: clamp(28px, 2.5vw, 36px);
  font-family: var(--display);
  font-size: clamp(13px, 1.2vw, 18px);
  transform: rotate(-3deg);
}

#forestTopRight .mall-tab {
  width: auto;
  padding: 0 9px;
  font-family: var(--text);
  font-weight: 700;
  font-size: clamp(7px, .62vw, 10px);
  letter-spacing: 1.5px;
  transform: rotate(2deg);
}

#forestButtonsLeft,
#forestButtonsRight {
  position: absolute;
  bottom: calc(clamp(8px,1.4vh,18px) + var(--safe));
  z-index: 14;
  pointer-events: auto;
}

#forestButtonsLeft {
  left: calc(clamp(7px,1.5vw,24px) + var(--safe-left));
  display: flex;
  align-items: flex-end;
  gap: clamp(7px,1vw,16px);
}

#forestButtonsRight {
  right: calc(clamp(7px,1.5vw,24px) + var(--safe-right));
  display: flex;
  align-items: flex-end;
  gap: clamp(7px,1vw,16px);
}

#forestHint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--btn-row-h) + 8px + var(--safe));
  transform: translateX(-50%) rotate(.4deg);
  z-index: 13;
  padding: 5px 15px 4px;
  font-family: var(--text);
  font-weight: 700;
  font-size: clamp(6px, .64vw, 10px);
  letter-spacing: .6px;
  white-space: nowrap;
  opacity: .9;
  pointer-events: none;
}

#forestHint.fade { opacity: 0; transition: opacity .8s; }

#forestToast {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translateX(-50%) translateY(6px) rotate(-1.5deg);
  z-index: 20;
  padding: 7px 18px 6px;
  background: var(--cream);
  color: var(--plum);
  font-family: var(--text);
  font-weight: 700;
  font-size: clamp(9px, 1vw, 15px);
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.42));
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  clip-path: polygon(1% 12%, 10% 0, 24% 8%, 40% 1%, 57% 8%, 73% 0, 89% 7%, 100% 2%, 99% 88%, 88% 100%, 71% 92%, 54% 100%, 37% 93%, 20% 100%, 5% 92%);
}

#forestToast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-3px) rotate(.6deg);
}

#forestNightWash {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: .25;
  background: radial-gradient(ellipse at 46% 40%, rgba(8,6,14,0) 26%, rgba(8,6,14,.42) 72%, rgba(6,4,10,.76) 100%);
  transition: opacity 2s;
}

#forestScreen.is-night #forestNightWash { opacity: 1; }

#forestFx {
  position: absolute;
  inset: 0;
  width: 1536px;
  height: 1024px;
  z-index: 9;
  pointer-events: none;
}

.forest-end-mark {
  flex: none;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--plum);
  color: var(--mustard);
  font-family: var(--display);
  font-size: 24px;
  transform: rotate(-6deg);
  box-shadow: inset 0 0 0 2px rgba(226,178,60,.35);
}

#forestEndOverlay .end-stats { grid-template-columns: repeat(3, 1fr); }

#forestScreen .overlay { z-index: 40; }

@media (max-width: 760px) {
  #forestHint { display: none; }
  #forestTopLeft { width: clamp(128px, 38vw, 190px); }
  #forestStats {
    top: calc(clamp(42px,6vh,58px) + var(--safe-top));
    gap: 7px;
    padding: 5px 8px 4px;
  }
  .fire-meter { width: 48px; }
  #forestTopRight .mall-tab { padding: 0 6px; }
  #forestToast { font-size: 10px; letter-spacing: 1.4px; padding: 6px 12px 5px; max-width: 92vw; white-space: normal; text-align: center; }
}

@media (max-height: 520px) and (orientation: landscape) {
  :root { --btn: clamp(46px, 9.5vh, 62px); --btn-row-h: calc(var(--btn) + 16px); }
  #forestTopLeft { width: clamp(140px, 19vw, 210px); }
  #forestTitleImg { max-height: 96px; object-fit: contain; object-position: left center; }
  #forestClock { margin-top: 3px; padding: 3px 8px 2px; }
  #forestStats { top: calc(44px + var(--safe-top)); }
  #forestHint { display: block; font-size: 6px; padding: 3px 10px; bottom: calc(var(--btn-row-h) + 3px + var(--safe)); }
  #forestToast { top: 40%; }
}

@media (max-height: 430px) and (orientation: landscape) {
  #forestTitleImg { max-height: 74px; }
  #forestClock .label { font-size: 6px; }
  #forestStats { top: calc(38px + var(--safe-top)); gap: 5px; }
  .fstat { font-size: 6px; letter-spacing: .8px; gap: 3px; }
  .fire-meter { width: 40px; height: 8px; }
  .heart { width: 9px; height: 9px; }
  #forestHint { display: none; }
}

@keyframes fireBreathe {
  0%, 100% { transform: translateX(-50%) scale(1, 1) rotate(-.4deg); }
  40% { transform: translateX(-50%) scale(1.03, 1.06) rotate(.5deg); }
  70% { transform: translateX(-50%) scale(.97, .98) rotate(-.3deg); }
}

@keyframes fFireFlicker {
  0% { opacity: .55; }
  100% { opacity: .95; }
}

.forest-enter {
  cursor: pointer;
  transition: transform .16s, filter .16s;
}

.forest-enter:hover,
.forest-enter:focus-visible {
  transform: translateY(-1px) rotate(-.4deg);
  filter: drop-shadow(0 3px 5px rgba(58,47,66,.35));
  outline: none;
}

.forest-enter:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(226,178,60,.65);
}
