* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, sans-serif; background: #fff4d6; color: #3b2a4a; text-align: center; }
.tagasi { position: absolute; top: 10px; left: 12px; color: #7a4b8f; font-weight: bold; text-decoration: none; }
h1 { margin: 40px 10px 4px; font-size: clamp(1.6rem, 6vw, 2.6rem); }
#olek { margin: 0 0 10px; }
#kelder { position: relative; width: min(96vw, 900px); height: min(70vh, 460px); margin: 0 auto; overflow: hidden; border-radius: 20px;
  background-color: #c7835c;
  background-image: linear-gradient(#a8644a 3px, transparent 3px), linear-gradient(90deg, #a8644a 3px, transparent 3px);
  background-size: 60px 30px; }
.aken { position: absolute; top: 18px; left: 50%; width: 110px; height: 60px; margin-left: -55px; background: #9fe3ff; border: 6px solid #6b4a2f; border-radius: 6px;
  box-shadow: inset 0 0 0 3px #6b4a2f; background-image: linear-gradient(90deg, transparent 47%, #6b4a2f 47% 53%, transparent 53%); }
.lamp { position: absolute; top: 0; left: 22%; transform-origin: top center; animation: koigu 3s ease-in-out infinite; }
.juhe { display: block; width: 3px; height: 70px; background: #333; margin: 0 auto; }
.pirn { display: block; width: 28px; height: 34px; border-radius: 50% 50% 45% 45%; background: #ffe66b; box-shadow: 0 0 40px 20px rgba(255, 230, 107, .55); }
@keyframes koigu { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.riiul { position: absolute; top: 120px; right: 6%; width: 160px; border-bottom: 10px solid #6b4a2f; font-size: 28px; display: flex; justify-content: space-around; }
.kartul { position: absolute; bottom: 14%; font-size: 26px; }
.k1 { left: 6%; } .k2 { left: 10%; bottom: 13%; transform: rotate(40deg); }
.amblik { position: absolute; top: 4px; right: 4px; font-size: 40px; opacity: .8; }
.porand { position: absolute; left: 0; right: 0; bottom: 0; height: 18%; background: #8c8c8c; border-top: 6px solid #6e6e6e; }
#mutt { position: absolute; bottom: 8%; left: 0; width: 170px; height: 110px; cursor: pointer; outline: none;
  animation: kõnni 14s linear infinite; }
#mutt svg { width: 100%; height: 100%; display: block; overflow: visible; }
.keha { transform-origin: 85px 100px; animation: kiigu .4s ease-in-out infinite alternate; }
.jalg, .kapp { transform-box: fill-box; transform-origin: center; animation: samm .4s ease-in-out infinite alternate; }
.jalg.b, .kapp.b { animation-direction: alternate-reverse; }
.suu { transform-box: fill-box; transform-origin: center; animation: suu 1.2s ease-in-out infinite; }
.silmad { animation: pilgu 4s infinite; transform-box: fill-box; transform-origin: center; }
.muld { position: absolute; left: 50%; bottom: -6px; width: 0; height: 0; margin-left: 0; border-radius: 50% 50% 0 0; background: #6b4a2f; transition: all .3s; }
@keyframes kõnni {
  0% { left: 2%; transform: scaleX(1); }
  48% { left: calc(98% - 170px); transform: scaleX(1); }
  50% { left: calc(98% - 170px); transform: scaleX(-1); }
  98% { left: 2%; transform: scaleX(-1); }
  100% { left: 2%; transform: scaleX(1); }
}
@keyframes kiigu { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-3px) rotate(2deg); } }
@keyframes samm { from { transform: translateX(-4px); } to { transform: translateX(4px); } }
@keyframes suu { 0%,100% { transform: scaleY(1); } 50% { transform: scaleY(1.4); } }
@keyframes pilgu { 0%,94%,100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
#mutt.kaevab, #mutt.kaevab .keha, #mutt.kaevab .jalg, #mutt.kaevab .kapp { animation-play-state: paused; }
#mutt.kaevab svg { animation: kaeva 1.8s ease-in-out; }
#mutt.kaevab .muld { width: 120px; height: 30px; margin-left: -60px; }
@keyframes kaeva { 0% { transform: translateY(0); } 35%,60% { transform: translateY(80%); opacity: .2; } 100% { transform: translateY(0); opacity: 1; } }
/* Light switch: clicking the lamp darkens the cellar */
#lamp { z-index: 3; cursor: pointer; outline: none; padding: 0 12px 12px; }
#kelder::after { content: ""; position: absolute; inset: 0; z-index: 2; background: #0b0820; opacity: 0; pointer-events: none; transition: opacity .4s; }
#kelder.pime::after { opacity: .85; }
#kelder.pime .pirn { background: #9a9a9a; box-shadow: none; }
#jutt { z-index: 4; }
#jutt { position: absolute; top: 28%; left: 50%; transform: translateX(-50%); background: #fff; border-radius: 16px; padding: 8px 14px; font-weight: bold; font-size: 1.2rem;
  opacity: 0; transition: opacity .3s; pointer-events: none; }
#jutt.nahtav { opacity: 1; }
@media (max-width: 500px) { #mutt { width: 120px; height: 78px; } .riiul { width: 110px; font-size: 20px; top: 100px; } .aken { width: 80px; margin-left: -40px; } }
