body {
    margin: 0; padding: 0;
    font-family: -apple-system, sans-serif;
    background-color: #f0f2f5;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    overflow-y: auto; /* 允許垂直滾動 */
    user-select: none;
}

.sidebar {
    width: 320px;
    background: #ffffff;
    padding: 25px;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

/* --- 標題列版面配置 --- */
.sidebar-header {
    display: flex;
    flex-direction: column; /* 電腦版預設：垂直排列（標題換行） */
    gap: 8px;
    margin-bottom: 25px;
}

.sidebar-header h1 {
    font-size: 1.4rem;
    color: #2c3e50;
    margin: 0;
}

.back-link {
    text-decoration: none;
    color: #78909c;
    font-size: 0.9rem;
    font-weight: bold;
    display: inline-block;
}

/* 控制項與卡片 */
.control-group { background: #f8f9fa; padding: 20px; border-radius: 12px; margin-bottom: 25px; }
.label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.badge { background: #e1f5fe; color: #0288d1; padding: 4px 10px; border-radius: 20px; font-weight: bold; }
input[type="range"] { width: 100%; cursor: pointer; }

.info-card { border-top: 1px solid #eceff1; padding-top: 20px; }
.info-card h3 { font-size: 1rem; color: #37474f; margin-bottom: 15px; }
.info-card ul { list-style: none; padding: 0; margin: 0; }
.info-card li { margin-bottom: 12px; font-size: 0.9rem; color: #546e7a; padding-left: 20px; position: relative; }
.dot { position: absolute; left: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; }
.dot.orange { background: #FF9800; }
.dot.brown { background: #8D6E63; }
.dot.pink { background: #F48FB1; }

/* 畫布區域 */
.canvas-area { flex: 1; background: #E3F2FD; position: relative; min-height: 400px; }
svg { width: 100%; height: 100%; display: block; }

/* 互動效果 */
.cloud-btn { cursor: pointer; transition: transform 0.4s; transform-box: fill-box; transform-origin: center; }
.cloud-btn:hover { transform: scale(1.1); }
.wind-line { stroke-dasharray: 20; stroke-dashoffset: 20; opacity: 0; }
@keyframes wind-blow { 0% { stroke-dashoffset: 20; opacity: 0; } 20% { opacity: 1; } 100% { stroke-dashoffset: -50; opacity: 0; } }
.blowing .wind-line { animation: wind-blow 1.2s ease-out forwards; }

#hyacinth-body { transform-origin: 0 0; }
@keyframes gentle-sway { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(1.2deg); } }
.swaying-now { animation: gentle-sway 4s ease-in-out forwards; }

/* 生物動畫 */
@keyframes swim-lr { from { transform: translateX(-150px); } to { transform: translateX(950px); } }
@keyframes swim-rl { from { transform: translateX(950px) scaleX(-1); } to { transform: translateX(-150px) scaleX(-1); } }
.swim-lr { animation: swim-lr linear; }
.swim-rl { animation: swim-rl linear; }

/* --- 新增：天氣互動樣式 --- */
#sun-group { cursor: pointer; transition: filter 0.3s; transform-box: fill-box; transform-origin: center; }
#sun-group:hover { filter: drop-shadow(0 0 8px #FFF176); }
.sun-rotating { animation: sun-spin 10s linear infinite; }
@keyframes sun-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

#cloud-middle-group { cursor: pointer; transition: fill 0.5s; }
#cloud-middle-group:hover .cloud-path { fill: #f5f5f5; }
.raining-cloud .cloud-path { fill: #90A4AE !important; } /* 下雨時雲變灰 */

.rain-drop {
    stroke: #64B5F6;
    stroke-width: 2;
    stroke-linecap: round;
    animation: rainfall 0.8s linear forwards;
}

@keyframes rainfall {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(300px); opacity: 0; }
}

/* --- RWD 手機版修正 --- */
@media (max-width: 768px) {
    body {
        flex-direction: column-reverse; /* 畫布在上，控制項在下 */
        height: auto;
    }
    .sidebar {
        width: 100%;
        height: auto;
        padding: 20px;
        box-sizing: border-box;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    /* 手機版：標題與返回鍵在同一行 */
    .sidebar-header {
        flex-direction: row; 
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }
    .sidebar-header h1 {
        font-size: 1.1rem; /* 手機版標題略縮小 */
    }
    .back-link {
        font-size: 0.8rem;
    }
    .canvas-area {
        width: 100%;
        height: 55vh; /* 畫布佔螢幕高度一半以上 */
        flex: none;
    }
}

/* 烏龜樣式 */
.turtle {
    font-size: 100px;
    transition: transform 0s ease-in-out;
    user-select: none;
}

/* 讓文字（Emoji）置中對齊座標點 */
.turtle-text {
    dominant-baseline: middle;
    text-anchor: middle;
}

/* 向右走時翻轉 Emoji */
.facing-right {
    transform: scaleX(-1);
}

/* 蝸牛樣式 (與烏龜類似，但稍微小一點) */
.snail {
    font-size: 40px;
    transition: transform 0s linear;
    user-select: none;
}



/* 定義下沉再浮起的動畫 */
@keyframes sinkEffect {
    0% { transform: translateY(0); }
    40% { transform: translateY(20px); }
    100% { transform: translateY(0); }    /* 回到原位 */
}

.clicked-sink {
    /* 這裡的時間要跟 JS 的 setTimeout 一致，例如 0.6s = 600ms */
    animation: sinkEffect 0.8s ease-in-out;
}

/* --- 飛行物體樣式與動畫 --- */
.flying-emoji {
    font-size: 40px;
    dominant-baseline: middle;
    text-anchor: middle;
    pointer-events: none; /* 避免干擾點擊 */
}

@keyframes fly-lr {
    from { transform: translateX(-60px); }
    to { transform: translateX(860px); }
}

@keyframes fly-rl {
    from { transform: translateX(860px) scaleX(-1); } /* 往左飛時翻轉 */
    to { transform: translateX(-60px) scaleX(-1); }
}

.fly-animation-lr {
    animation: fly-lr 8s linear forwards;
}

.fly-animation-rl {
    animation: fly-rl 8s linear forwards;
}