:root {
  --sky-top: #ebf9ff;
  --sky-mid: #dfeeff;
  --sky-bottom: #fef4fb;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-border: rgba(105, 187, 255, 0.4);
  --blue: #2f9eea;
  --blue-deep: #1d7bcb;
  --pink: #ff7abc;
  --pink-deep: #ff529f;
  --purple: #8ea3ff;
  --text: #1f4062;
  --shadow: rgba(32, 110, 167, 0.18);
  --ground: #d8f5ff;
  --ground-deep: #a9e6ff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Nunito", sans-serif;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-mid) 45%, var(--sky-bottom));
  color: var(--text);
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-mid) 45%, var(--sky-bottom));
}

.sky {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.cloud {
  position: absolute;
  width: 140px;
  height: 46px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 30px 12px 0 8px rgba(255, 255, 255, 0.7), 70px 8px 0 6px rgba(255, 255, 255, 0.6);
}

.cloud-a { top: 80px; left: 8%; }
.cloud-b { top: 120px; right: 10%; transform: scale(1.2); }
.cloud-c { top: 220px; left: 22%; transform: scale(0.9); }

.bg-letters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.bg-word {
  position: absolute;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2.2rem, 11vw, 7rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(77, 129, 196, 0.12);
  user-select: none;
}

.bg-word-left {
  left: 6%;
  top: 15%;
  transform: rotate(-7deg);
}

.bg-word-middle {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-6deg);
  font-size: clamp(2.2rem, 8vw, 5rem);
  color: rgba(77, 129, 196, 0.18);
  z-index: 0;
}

.bg-word-right {
  right: 4%;
  bottom: 17%;
  transform: rotate(7deg);
}

.heart {
  position: absolute;
  font-size: 1.7rem;
  color: rgba(255, 104, 170, 0.6);
  text-shadow: 0 0 18px rgba(255, 104, 170, 0.35);
}

.heart-a { top: 180px; left: 16%; }
.heart-b { top: 220px; right: 18%; }
.heart-c { bottom: 190px; left: 48%; }

.game-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 760px);
  height: 100vh;
  padding: 18px 10px 16px;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.game-wrap {
  display: flex;
  justify-content: center;
  height: 100%;
}

.game-ui {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 6;
}

.hud-box {
  flex: 1;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(105, 187, 255, 0.4);
  border-radius: 12px;
  padding: 6px 8px;
  text-align: center;
  box-shadow: 0 8px 18px rgba(32, 110, 167, 0.08);
}

.hud-box span {
  display: block;
  font-size: 0.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(36, 55, 83, 0.72);
  margin-bottom: 1px;
}

.hud-box strong {
  font-size: 0.82rem;
  color: var(--blue-deep);
}

.game-area {
  position: relative;
  width: min(100%, 420px);
  height: min(100%, 680px);
  min-height: 500px;
  border-radius: 30px;
  overflow: hidden;
  background: linear-gradient(180deg, #dff6ff 0%, #d0f1ff 40%, #effdff 100%);
  border: 2px solid rgba(63, 119, 196, 0.18);
  box-shadow: 0 25px 50px var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.elephant-name {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: "Baloo 2", cursive;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(29, 123, 203, 0.9);
  text-transform: lowercase;
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(62, 146, 214, 0.4);
  border-radius: 999px;
  padding: 2px 9px 1px;
  box-shadow: 0 8px 16px rgba(61, 116, 205, 0.08);
  z-index: 5;
}

.elephant {
  position: absolute;
  left: 58px;
  top: 220px;
  width: 118px;
  height: 82px;
  filter: drop-shadow(0 12px 16px rgba(34, 118, 203, 0.18));
  user-select: none;
  transform: rotate(-4deg);
  z-index: 3;
}

.body {
  position: absolute;
  width: 62%;
  height: 52%;
  left: 18%;
  bottom: 14%;
  border-radius: 42% 46% 38% 36%;
  background: linear-gradient(160deg, #a4ddff, #67bbff);
  border: 3px solid #2d8ed6;
}

.head {
  position: absolute;
  width: 42%;
  height: 42%;
  left: 6%;
  top: 20%;
  border-radius: 46%;
  background: linear-gradient(140deg, #a3defc, #63b9ff);
  border: 3px solid #2d8ed6;
}

.ear {
  position: absolute;
  width: 26%;
  height: 28%;
  top: 18%;
  border-radius: 50%;
  background: #8ecff6;
  border: 3px solid #2d8ed6;
}

.ear::after {
  content: "";
  position: absolute;
  inset: 13%;
  border-radius: inherit;
  background: #cfefff;
}

.ear-left {
  left: 2%;
}

.ear-right {
  left: 26%;
}

.eye {
  position: absolute;
  width: 4.5%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #0a3250;
  top: 40%;
}

.eye-left {
  left: 17%;
}

.eye-right {
  left: 29%;
}

.cheek {
  position: absolute;
  width: 6%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffb8cd;
  top: 47%;
  opacity: 0.8;
}

.cheek-left {
  left: 13%;
}

.cheek-right {
  left: 32%;
}

.trunk {
  position: absolute;
  width: 20%;
  height: 18%;
  left: 6%;
  top: 47%;
  border-radius: 36px;
  background: linear-gradient(150deg, #8fd2ff, #5db4fa);
  border: 3px solid #2d8ed6;
  transform: rotate(-8deg);
}

.trunk-tip {
  position: absolute;
  width: 9%;
  height: 8%;
  left: 2.5%;
  top: 52%;
  border-radius: 40px;
  background: #a9deff;
  border: 3px solid #2d8ed6;
}

.leg {
  position: absolute;
  width: 13%;
  height: 19%;
  bottom: 2%;
  border-radius: 28px;
  background: linear-gradient(180deg, #88d0ff, #5eb4fa);
  border: 3px solid #2d8ed6;
}

.leg-1 {
  left: 24%;
}

.leg-2 {
  left: 38%;
}

.leg-3 {
  left: 53%;
}

.leg-4 {
  left: 67%;
}

.tail {
  position: absolute;
  width: 9%;
  height: 3%;
  right: 10%;
  top: 46%;
  border-radius: 20px;
  background: #2d8ed6;
  transform: rotate(14deg);
}

.ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72px;
  background: linear-gradient(180deg, var(--ground) 0%, var(--ground-deep) 100%);
  border-top: 3px solid rgba(53, 117, 152, 0.2);
}

.obstacle {
  position: absolute;
  width: 60px;
  background: linear-gradient(180deg, rgba(72, 158, 245, 0.9), rgba(31, 104, 194, 1));
  border: 3px solid rgba(21, 70, 143, 0.35);
  border-radius: 16px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.18);
}

.obstacle::before,
.obstacle::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 84px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.obstacle::before { top: 12px; }
.obstacle::after { bottom: 12px; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(19, 58, 94, 0.14);
  backdrop-filter: blur(2px);
  text-align: center;
  z-index: 4;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 1rem 1.2rem;
}

.overlay h2 {
  margin: 0;
  font-family: "Baloo 2", cursive;
  font-size: clamp(2rem, 4vw, 3rem);
  color: white;
  text-shadow: 0 7px 18px rgba(29, 123, 203, 0.4);
}

.overlay p {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  background: rgba(56, 115, 169, 0.28);
  border-radius: 999px;
  padding: 0.6rem 1rem;
}

@media (max-width: 560px) {
  body {
    padding: 0;
  }

  .game-shell {
    width: 100%;
    height: 100vh;
    padding-inline: 0;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
  }

  .game-ui {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 4px;
  }

  .hud-box {
    padding: 6px 5px;
  }

  .game-area {
    width: 100%;
    height: 100%;
    min-height: 100%;
    border-radius: 0;
  }

  .elephant-name {
    top: 70px;
    font-size: 0.75rem;
  }

  .elephant {
    left: 42px;
    top: 200px;
    width: 100px;
    height: 72px;
  }

  .overlay p {
    font-size: 0.85rem;
    padding: 0.45rem 0.7rem;
  }

}
