:root {
  --sky-top: #3b82f6;
  --sky-mid: #60a5fa;
  --sky-bottom: #bae6fd;
  --grass-light: #4ade80;
  --grass-mid: #22c55e;
  --grass-dark: #15803d;
}

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

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Noto Sans TC', 'Mochiy Pop One', -apple-system, sans-serif;
  height: 100vh;
  width: 100vw;
  user-select: none;
  background-color: #60a5fa;
}

/* 整個自然場景容器 */
.world-scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 35%, var(--sky-bottom) 65%);
}

/* 1. 藍天區域 */
.sky {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  pointer-events: none;
  z-index: 1;
}

/* 太陽 */
.sun {
  position: absolute;
  top: 30px;
  right: 70px;
  width: 95px;
  height: 95px;
  background: #fde047;
  border-radius: 50%;
  box-shadow: 0 0 50px rgba(250, 204, 21, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sunFloat 4s ease-in-out infinite alternate;
}

@keyframes sunFloat {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-8px) scale(1.04); }
}

.sun-glow {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(253, 224, 71, 0.45) 0%, transparent 70%);
  animation: sunGlowPulse 3s infinite alternate;
}

@keyframes sunGlowPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.2); opacity: 1; }
}

.sun-face {
  position: relative;
  width: 60px;
  height: 40px;
  z-index: 2;
}

.sun-eye {
  position: absolute;
  top: 10px;
  width: 8px;
  height: 8px;
  background: #78350f;
  border-radius: 50%;
}
.sun-eye.left { left: 14px; }
.sun-eye.right { right: 14px; }

.sun-smile {
  position: absolute;
  bottom: 8px;
  left: 20px;
  width: 20px;
  height: 10px;
  border-bottom: 3.5px solid #78350f;
  border-radius: 0 0 15px 15px;
}

/* 雲朵動畫 */
.cloud {
  position: absolute;
  background: #ffffff;
  border-radius: 50px;
  opacity: 0.95;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.05);
}

.cloud::before,
.cloud::after {
  content: '';
  position: absolute;
  background: #ffffff;
  border-radius: 50%;
}

.cloud-1 {
  width: 180px;
  height: 55px;
  top: 45px;
  animation: cloudDrift 45s linear infinite;
}
.cloud-1::before {
  width: 75px;
  height: 75px;
  top: -32px;
  left: 28px;
}
.cloud-1::after {
  width: 60px;
  height: 60px;
  top: -22px;
  left: 80px;
}

.cloud-2 {
  width: 230px;
  height: 66px;
  top: 120px;
  animation: cloudDrift 60s linear infinite;
  animation-delay: -22s;
  opacity: 0.88;
}
.cloud-2::before {
  width: 95px;
  height: 95px;
  top: -42px;
  left: 38px;
}
.cloud-2::after {
  width: 75px;
  height: 75px;
  top: -32px;
  left: 110px;
}

.cloud-3 {
  width: 140px;
  height: 45px;
  top: 85px;
  animation: cloudDrift 38s linear infinite;
  animation-delay: -12s;
  opacity: 0.8;
}
.cloud-3::before {
  width: 58px;
  height: 58px;
  top: -26px;
  left: 22px;
}
.cloud-3::after {
  width: 48px;
  height: 48px;
  top: -20px;
  left: 68px;
}

@keyframes cloudDrift {
  0% { transform: translateX(-300px); }
  100% { transform: translateX(calc(100vw + 200px)); }
}

/* 小鳥 */
.bird {
  position: absolute;
  display: flex;
  gap: 2px;
}
.bird-1 {
  top: 95px;
  left: 25%;
  animation: birdFly 20s linear infinite;
}
.bird-2 {
  top: 130px;
  left: 22%;
  transform: scale(0.75);
  animation: birdFly 24s linear infinite;
  animation-delay: -6s;
}
.wing {
  width: 15px;
  height: 8px;
  border-top: 3px solid #1e293b;
  border-radius: 50% 50% 0 0;
  animation: flap 0.6s ease-in-out infinite alternate;
}
.wing-left { transform: rotate(-25deg); }
.wing-right { transform: rotate(25deg); }

@keyframes flap {
  0% { transform: rotate(-35deg); }
  100% { transform: rotate(35deg); }
}

@keyframes birdFly {
  0% { transform: translateX(-150px) translateY(0); }
  50% { transform: translateX(50vw) translateY(-25px); }
  100% { transform: translateX(calc(100vw + 100px)) translateY(10px); }
}

/* 2. 頂部標題：小龜龜樂園 */
.header-board {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding-top: 28px;
}

.clean-title {
  color: #ffffff;
  font-size: clamp(2.2rem, 5.5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-shadow: 
    0 3px 14px rgba(15, 23, 42, 0.45),
    0 1px 4px rgba(0, 0, 0, 0.25);
  margin: 0;
  text-align: center;
}

/* 3. 遠景山丘 */
.hills-background {
  position: absolute;
  bottom: 36%;
  left: 0;
  width: 100%;
  height: 25%;
  z-index: 2;
  pointer-events: none;
}

.hill {
  position: absolute;
  border-radius: 50% 50% 0 0;
}
.hill-back-left {
  width: 70vw;
  height: 180px;
  left: -10vw;
  bottom: 0;
  background: linear-gradient(180deg, #86efac 0%, #4ade80 100%);
}
.hill-back-right {
  width: 65vw;
  height: 160px;
  right: -8vw;
  bottom: 0;
  background: linear-gradient(180deg, #a7f3d0 0%, #6ee7b7 100%);
}

/* 4. 樹木群 */
.forest-layer {
  position: absolute;
  bottom: 35%;
  left: 0;
  width: 100%;
  height: 190px;
  z-index: 3;
  pointer-events: none;
}

.tree {
  position: absolute;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: bottom center;
  animation: treeGentleSway 6s ease-in-out infinite alternate;
}

@keyframes treeGentleSway {
  0% { transform: rotate(-1.5deg); }
  100% { transform: rotate(1.5deg); }
}

.tree-pos-1 { left: 4%; }
.tree-pos-2 { left: 18%; animation-delay: -2s; }
.tree-pos-3 { left: 46%; transform: scale(0.68); animation-delay: -4s; }
.tree-pos-4 { right: 16%; animation-delay: -1s; }
.tree-pos-5 { right: 3%; animation-delay: -3s; }

/* 蓬鬆大圓樹 */
.tree-large .foliage {
  position: relative;
  background: #16a34a;
  border-radius: 50%;
  box-shadow: inset -6px -8px 0 rgba(0, 0, 0, 0.12);
}
.tree-large .foliage-top {
  width: 105px;
  height: 105px;
  background: #22c55e;
  z-index: 2;
}
.tree-large .foliage-left {
  position: absolute;
  top: 28px;
  left: -24px;
  width: 82px;
  height: 82px;
  background: #16a34a;
}
.tree-large .foliage-right {
  position: absolute;
  top: 28px;
  right: -24px;
  width: 82px;
  height: 82px;
  background: #15803d;
}

.foliage-apples {
  position: absolute;
  top: 24px;
  width: 100%;
  display: flex;
  justify-content: space-around;
  z-index: 3;
  font-size: 16px;
}
.apple.a1 { transform: rotate(-10deg); }
.apple.a2 { transform: rotate(15deg); }

/* 松樹 */
.tree-pine .pine-layer {
  width: 0;
  height: 0;
  border-left: 36px solid transparent;
  border-right: 36px solid transparent;
  border-bottom: 44px solid #15803d;
  margin-bottom: -18px;
  filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.1));
}
.tree-pine .p1 { border-left-width: 25px; border-right-width: 25px; border-bottom-color: #22c55e; border-bottom-width: 35px; z-index: 3; }
.tree-pine .p2 { border-left-width: 32px; border-right-width: 32px; border-bottom-color: #16a34a; border-bottom-width: 40px; z-index: 2; }
.tree-pine .p3 { border-left-width: 42px; border-right-width: 42px; border-bottom-color: #15803d; border-bottom-width: 48px; z-index: 1; }

.tree-small .foliage-round {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #4ade80;
}

.trunk {
  width: 18px;
  height: 45px;
  background: linear-gradient(90deg, #78350f, #92400e);
  border-radius: 4px;
}

/* 5. 前景草地 (高度提升，提供充足開闊的走動空間) */
.meadow-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 42%;
  min-height: 300px;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 25%, #16a34a 100%);
  border-top: 8px solid #86efac;
  box-shadow: 0 -10px 30px rgba(34, 197, 94, 0.4);
  z-index: 4;
}

.grass-texture {
  position: absolute;
  top: -8px;
  left: 0;
  width: 100%;
  height: 16px;
  background-image: repeating-linear-gradient(
    45deg,
    #86efac 0px,
    #86efac 4px,
    transparent 4px,
    transparent 12px
  );
  opacity: 0.8;
}

/* 小花與蘑菇 */
.plants {
  position: absolute;
  top: 10px;
  width: 100%;
  display: flex;
  justify-content: space-around;
  font-size: 22px;
  pointer-events: none;
  z-index: 5;
}

.flower { animation: flowerWiggle 3s ease-in-out infinite alternate; }
.flower.f1 { animation-delay: 0.2s; }
.flower.f2 { animation-delay: 1.1s; }
.flower.f3 { animation-delay: 0.8s; }
.flower.f4 { animation-delay: 2.1s; }
.flower.f5 { animation-delay: 1.6s; }
.mushroom { animation: mushroomWiggle 4s ease-in-out infinite alternate; }

@keyframes flowerWiggle {
  0% { transform: rotate(-8deg); }
  100% { transform: rotate(8deg); }
}
@keyframes mushroomWiggle {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

/* ★★★ 小烏龜主體與軌道設定 ★★★ */
.turtle-walker {
  position: absolute;
  width: 155px;
  height: 110px;
  cursor: pointer;
  z-index: 8;
  filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.22));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.turtle-walker:hover {
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.3));
}

.turtle-sprite {
  width: 100%;
  height: 100%;
  transform-origin: center center;
}

.turtle-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.turtle-name-tag {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 850;
  color: #14532d;
  background: rgba(255, 255, 255, 0.98);
  border: 2px solid #86efac;
  border-radius: 999px;
  padding: 3px 12px;
  margin-top: -4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.16);
  white-space: nowrap;
}

/* 烏龜 1 (鳳梨) - 上層草地，大幅往上移 (bottom: 145px) */
.turtle-bobo {
  bottom: 145px;
  animation: walkBobo 28s ease-in-out infinite;
}

.turtle-bobo .turtle-sprite {
  animation: flipBobo 28s ease-in-out infinite;
}

/* 烏龜 2 (釋迦) - 下層草地，往上移避免名字被擋 (bottom: 55px) */
.turtle-qiao {
  bottom: 55px;
  animation: walkQiao 32s ease-in-out infinite;
  animation-delay: -9s;
}

.turtle-qiao .turtle-sprite {
  animation: flipQiao 32s ease-in-out infinite;
  animation-delay: -9s;
}

/* ★ 波波走路路徑動畫 (左往右，再右往左) ★ */
@keyframes walkBobo {
  0% { left: 5%; }
  45% { left: 78%; }
  50% { left: 78%; }
  95% { left: 5%; }
  100% { left: 5%; }
}

@keyframes flipBobo {
  0% { transform: scaleX(1); }
  46% { transform: scaleX(1); }
  50% { transform: scaleX(-1); }
  96% { transform: scaleX(-1); }
  100% { transform: scaleX(1); }
}

/* ★ 巧巧走路路徑動畫 (右往左，再左往右) ★ */
@keyframes walkQiao {
  0% { left: 75%; }
  45% { left: 8%; }
  50% { left: 8%; }
  95% { left: 75%; }
  100% { left: 75%; }
}

@keyframes flipQiao {
  0% { transform: scaleX(-1); }
  46% { transform: scaleX(-1); }
  50% { transform: scaleX(1); }
  96% { transform: scaleX(1); }
  100% { transform: scaleX(-1); }
}

/* 烏龜肢體划動動畫 */
.leg-front-left {
  animation: paddleLeg1 0.85s ease-in-out infinite alternate;
  transform-origin: 58px 87px;
}
.leg-front-right {
  animation: paddleLeg2 0.85s ease-in-out infinite alternate;
  transform-origin: 118px 87px;
}
.leg-back-left {
  animation: paddleLeg2 0.85s ease-in-out infinite alternate;
  transform-origin: 45px 85px;
}
.leg-back-right {
  animation: paddleLeg1 0.85s ease-in-out infinite alternate;
  transform-origin: 105px 85px;
}

@keyframes paddleLeg1 {
  0% { transform: rotate(-16deg); }
  100% { transform: rotate(16deg); }
}

@keyframes paddleLeg2 {
  0% { transform: rotate(16deg); }
  100% { transform: rotate(-16deg); }
}

/* 烏龜探頭探腦 */
.turtle-head-group {
  animation: headBobbing 1.6s ease-in-out infinite alternate;
  transform-origin: 120px 65px;
}

@keyframes headBobbing {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-3.5px) rotate(3deg); }
}

/* 尾巴輕輕擺動 */
.turtle-tail {
  animation: tailWiggle 1s ease-in-out infinite alternate;
  transform-origin: 26px 76px;
}

@keyframes tailWiggle {
  0% { transform: rotate(-12deg); }
  100% { transform: rotate(14deg); }
}

/* 對話氣泡 (點擊或彈出) */
.speech-bubble {
  position: absolute;
  top: -46px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  color: #166534;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 25;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0;
  border-style: solid;
  border-color: #ffffff transparent;
}

/* 6. 底部提示列 */
.footer-bar {
  position: absolute;
  bottom: 0;
  width: 100%;
  background: rgba(20, 83, 45, 0.9);
  backdrop-filter: blur(4px);
  color: #bbf7d0;
  font-size: 0.78rem;
  padding: 6px 12px;
  text-align: center;
  z-index: 10;
  pointer-events: none;
}

/* 手機版與平板適應 */
@media (max-width: 768px) {
  .sun {
    width: 65px;
    height: 65px;
    top: 15px;
    right: 20px;
  }
  .header-board { padding-top: 15px; }
  
  .meadow-ground {
    height: 44%;
    min-height: 250px;
  }
  .turtle-walker {
    width: 120px;
    height: 85px;
  }
  .turtle-bobo { bottom: 120px; }
  .turtle-qiao { bottom: 45px; }
  .turtle-name-tag { font-size: 0.75rem; padding: 2px 8px; }
  
  .forest-layer { height: 130px; bottom: 38%; }
  .tree-large .foliage-top { width: 75px; height: 75px; }
  .tree-large .foliage-left,
  .tree-large .foliage-right { width: 55px; height: 55px; }
}
