/* ============================================
   基礎與背景設定
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #333335; /* 深色背景更能凸顯玻璃感 */
}

#start-screen p{
    font-style: italic;
    font-size: 18px;
    font-weight: 700;
    color: rgba(255, 255, 255); /* 稍微透明的白色，增加質感 */
    /* 使用 8 個方向的位移來包圍文字，形成 2px 的實心黑邊 */
    text-shadow: 
        2px  2px 0 #000,
       -2px  2px 0 #000,
        2px -2px 0 #000,
       -2px -2px 0 #000,
        0px  2px 0 #000,
        0px -2px 0 #000,
        2px  0px 0 #000,
       -2px  0px 0 #000;
}

#start-screen h1{
    font-size: 60px;
}




/* 遊戲容器 */
#game-container {
    width: 393px;
    height: 800px;
    background-image: url('asset/bg_water.png');  
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    /*border-radius: 55px;  更圓潤的 iPhone 角落 */
    /* 外發光效果，模擬螢幕光 */
    box-shadow: 0 0 30px rgba(0, 122, 255, 0.3), 
                inset 0 0 20px rgba(255, 255, 255, 0.2);
    border: 8px solid rgba(255, 255, 255, 0.1); /* 模擬機身邊框 */
}

/* 背景動畫元素 (維持原樣，讓它們在玻璃下流動) */
#background-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   核心玻璃擬態模組 (Glassmorphism)
   ============================================ */
/* 這是所有玻璃元件的基礎樣式 */
.glass-panel, .info-box, .target-zone, .big-button, .end-button, #loading-screen, #end-screen {
    background: rgba(255, 255, 255, 0.15); /* 半透明白色 */
    backdrop-filter: blur(20px) saturate(180%); /* 核心模糊與飽和度效果 */
    -webkit-backdrop-filter: blur(20px) saturate(180%); /* Safari 支援 */
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3); /* 細緻的亮邊框 */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); /* 柔和陰影 */
    color: #fff;
}

/* ============================================
   畫面通用與標題
   ============================================ */
.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

h1 {
    font-size: 48px;
    font-weight: 800; /* SF Pro 的粗體 */
    background: linear-gradient(135deg, #fff 0%, #d0eaff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; /* 漸層文字 */
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: -1px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 40px;
    text-align: center;
    padding: 0 40px;
    line-height: 1.5;
}

/* ============================================
   按鈕 
   ============================================ */
.big-button {
    padding: 20px 80px;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(46, 255, 4, 0.8); 
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.big-button:hover {
    transform: scale(1.05);
    background: rgba(255, 12, 12, 0.9);
    box-shadow: 0 12px 40px rgba(3, 2, 2, 0.4);
}

.big-button:active {
    transform: scale(0.98);
}

.button-group {
    display: flex;
    gap: 15px;
}

.end-button {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.end-button.green { background: rgba(0, 122, 255, 0.8); } 
.end-button.blue { background: rgba(0, 122, 255, 0.8); }  

.end-button:hover { transform: translateY(-3px); }

/* ============================================
   遊戲中介面 (頂部資訊欄)
   ============================================ */
#game-info {
    position: absolute;
    top: 60px; /* 避開 iPhone 動態島區域 */
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 25px;
    z-index: 20;
}

.info-box {
    padding: 10px 20px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 30px; /* 更圓的膠囊狀 */
}

/* 計時器專屬樣式 */
#timer-display {
    min-width: 80px;
    text-align: center;
    transition: all 0.3s ease;
}

/* 當時間低於 5 秒時的警告狀態 */
#timer-display.warning {
    background: rgba(255, 59, 48, 0.6); /* iOS 警告紅 */
    color: #fff;
    transform: scale(1.1);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ============================================
   底部踩踏區 (重點互動區域)
   ============================================ */
#target-zones {
    position: absolute;
    bottom: 60px;
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 0 25px;
    z-index: 20;
}

.target-zone {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    /* 預設是更透明的玻璃 */
    background: rgba(255, 255, 255, 0.08); 
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* 彈性動畫 */
}

/* 踩下時的激活狀態 */
.target-zone.active {
    background: rgba(4, 29, 255, 0.9); /* iOS 黃色高亮 */
    color: #ffffff; /* 文字變深 */
    transform: scale(1.08); /* 輕微放大 */
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 30px rgba(57, 199, 255, 0.6), inset 0 0 20px rgba(255, 255, 255, 0.5);
}

/* ============================================
   掉落物件與其他
   ============================================ */
#objects-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 15;
}

/* 調整物件大小的地方 */
.falling-object {
    position: absolute;
    width: 80px;  /* 直接給定寬度 */
    height: auto; /* 高度自動依比例縮放 */
    object-fit: contain; /* 確保圖片不變形 */
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    transition: top 0.03s linear; /* 讓移動看起來更平滑 */
}

.falling-object {
    position: absolute;
    /* 這裡可以加一點陰影讓物件更有立體感 */
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

/* 獨木橋可以窄長一點 */
.falling-object.bridge {
    width: 60px;
}

/* 花朵可以圓潤一點 */
.falling-object.flower {
    width: 80px;
}

/* 橫木可以寬一點 */
.falling-object.log {
    width: 120px;
}


#end-screen h1{
    font-size: 40px;
}

#final-score {
    font-size: 42px;
    font-weight: 800;
}

/* 第二關物件：設定兩倍寬度 */
.falling-object.wide {
    width: 160px; 
}


/* 結束畫面圖片樣式 */
#end-result-image {
    width: 150px; /* 調整為適合的大小 */
    height: auto;
    margin: 20px 0;
    /* 增加陰影讓它看起來浮在玻璃面板上 */
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    /* 加入簡單的緩慢浮動動畫 */
    animation: floatImg 3s ease-in-out infinite;
}

@keyframes floatImg {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

#loading-screen, #end-screen {
    background: none; /* 移除背景色 */
    backdrop-filter: none; /* 移除模糊 */
    -webkit-backdrop-filter: none;
    border: none;
}

/* ============================================
   LOADING畫面
   ============================================ */
#loading-screen p{
    text-shadow: 
        2px  2px 0 #000,
       -2px  2px 0 #000,
        2px -2px 0 #000,
       -2px -2px 0 #000,
        0px  2px 0 #000,
        0px -2px 0 #000,
        2px  0px 0 #000,
       -2px  0px 0 #000;

}

/* ============================================
   霓虹彩虹漸層與閃爍效果
   ============================================ */

.neon-rainbow {
    /* 1. 彩虹漸層字體 */
    background: linear-gradient(
        to right, 
        #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8b00ff
    );
    background-size: 200% auto; /* 讓漸層可以流動 */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    
    /* 2. 霓虹發光與閃爍動畫 */
    animation: 
        rainbow-flow 3s linear infinite,
        neon-flicker 2s infinite;
    
    /* 增加一點間距讓發光效果不被裁切 */
    padding: 10px;
    display: inline-block;
}

/* 漸層流動動畫 */
@keyframes rainbow-flow {
    to { background-position: 200% center; }
}

/* 霓虹燈泡閃爍感動畫 */
@keyframes neon-flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        /* 正常的強烈發光狀態 */
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8)) 
                drop-shadow(0 0 15px rgba(0, 122, 255, 0.6))
                drop-shadow(0 0 30px rgba(0, 122, 255, 0.4));
    }

}

#loading-screen * {
    max-height: 100%; /* 防止任何子元素撐爆畫面 */
}

#next-btn {
    margin-top: 10px;
    min-width: 150px; /* 確保按鈕有固定寬度，不會變形 */
}

/* 確保外層載入畫面撐滿螢幕且不模糊 */
#loading-screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* 內層內容區塊也要設為 Flex 才會垂直置中 */
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 20px; /* 這裡會自動拉開標題、文字、按鈕的間距 */
    width: 90%;
}

