/*=========================================================================
   🎯 引入日系手遊 RPG 風格 Google Fonts 字體連結
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,300;0,600;0,900;1,400&family=Noto+Serif+TC:wght@500;900&family=Noto+Sans+TC:wght@400;700&display=swap');

/* 🔥 全局變數定義區 */
:root {
    --unit-base-height: 40vh; /* 預設角色高度 */
}

/*=========================================================================
   1.0 基底 CSS 樣式 (中文優先使用 Noto Serif TC，英文優先使用 Exo 2)
   ========================================================================= */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    position: fixed; /* 🔥 1. 鎖定視窗：徹底根治 iOS 亂跳 Bug */
    top: 0;
    left: 0;
    background-color: #000;
    font-family: 'Exo 2', 'Noto Serif TC', serif; 
    overflow: hidden;
    user-select: none;
    touch-action: none; /* 🔥 2. 禁用原生滑動，防止用家唔小心拉扯到 Safari UI */
}

body, button, input {
    font-family: 'Exo 2', 'Noto Serif TC', serif !important;
    letter-spacing: 1.5px; 
}

#game-canvas {
    position: absolute; /* 🔥 3. 絕對定位：強制釘死左上角，永遠唔會被 Flexbox 推上天花板 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%; /* 🔥 取代 100vh，直接跟隨被鎖死的 body 高度 */
    background: url('https://i.meee.com.tw/Lm4n3xH.jpg') no-repeat center top; 
    background-size: 100% 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    container-type: inline-size;
}

/* 🚀 背景魔法：瞬間切換為無魔法陣圖床 */
#game-canvas.no-magic-circle {
    background: url('https://i.meee.com.tw/juAHzMD.jpg') no-repeat center top; 
    background-size: 100% 100%;
}

/* 🚀 護盾格擋：勇者專屬受擊震動 */
.unit-wrapper.hero-shield-block {
    animation: hero-shield-shake 0.38s cubic-bezier(.36,.07,.19,.97) forwards !important;
}

@keyframes hero-shield-shake {
    10%, 90% { transform: translate3d(-4px, 2px, 0) rotate(-1deg); }
    20%, 80% { transform: translate3d(4px, -2px, 0) rotate(1deg); }
    30%, 50%, 70% { transform: translate3d(-8px, 4px, 0) rotate(-2deg); filter: brightness(1.5) drop-shadow(0 0 20px #00f0ff); }
    40%, 60% { transform: translate3d(8px, -4px, 0) rotate(2deg); filter: brightness(1.2) drop-shadow(0 0 10px #00f0ff); }
}

/* 🚀 塔層選單專用玻璃面板保留 */
.magic-frontend-panel-standard {
    position: absolute;
    left: 50%;                    
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 0.15cqw solid rgba(255, 255, 255, 0.8);
    border-radius: 1cqw;
    box-sizing: border-box;
    box-shadow: inset 0 0 0 0.4cqw rgba(255, 255, 255, 0.25), 0 1cqw 3cqw rgba(0, 0, 0, 0.4);
    z-index: 10;
}

/* =========================================================================
   🚀 登入面板精準嵌入設定
   ========================================================================= */
#login-panel { 
    position: absolute;
    left: 50%;                    
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    width: 23cqw; 
    top: 36%; 
    transition: all 0.3s ease;
}

#auth-main-view, #auth-grade-view { padding: 1.5cqw; box-sizing: border-box; }

#auth-login-view, #auth-register-view, #auth-google-profile-view {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01));
    backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px);
    border: 0.1cqw solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 0.1cqw 0.2cqw rgba(255, 255, 255, 0.15), 0 0.5cqw 2cqw rgba(0, 0, 0, 0.2);
    border-radius: 1cqw; padding: 1.5cqw; max-height: 18cqw; overflow-y: auto; overflow-x: hidden; box-sizing: border-box;
}

#auth-login-view::-webkit-scrollbar, #auth-register-view::-webkit-scrollbar, #auth-google-profile-view::-webkit-scrollbar { width: 6px; }
#auth-login-view::-webkit-scrollbar-track, #auth-register-view::-webkit-scrollbar-track, #auth-google-profile-view::-webkit-scrollbar-track { background: rgba(0, 240, 255, 0.1); border-radius: 4px; }
#auth-login-view::-webkit-scrollbar-thumb, #auth-register-view::-webkit-scrollbar-thumb, #auth-google-profile-view::-webkit-scrollbar-thumb { background: #325b84; border-radius: 4px; }
#auth-login-view::-webkit-scrollbar-thumb:hover, #auth-register-view::-webkit-scrollbar-thumb:hover, #auth-google-profile-view::-webkit-scrollbar-thumb:hover { background: #4271a1; }

/* =========================================================================
   🚀 公會懸賞任務板 (Guild Bounty Board) 
   ========================================================================= */
#level-menu { 
    display: none; width: 65cqw; top: 50%; padding: 6.5cqw 4cqw 3cqw 4cqw; 
    background: url('https://i.meee.com.tw/WEGyDMB.png') no-repeat center center !important;
    background-size: 100% 100% !important; background-color: transparent !important; 
    border: none !important; border-radius: 0 !important;
    box-shadow: none !important; filter: drop-shadow(0 1.5cqw 2cqw rgba(0,0,0,0.85)) !important;
    backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}

.auth-title { text-align: center; color: #1a365d; font-size: 1.3cqw; font-weight: 900; margin: 0 0 1cqw 0; letter-spacing: 1px; }

/* 🔥 方案 C：SSR 級劍刃流光動畫 (2秒優雅版) */
#auth-grade-view .auth-title {
    position: relative; display: block; width: fit-content; margin: 0 auto 1cqw auto; 
    color: #1a365d; overflow: hidden; text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8), -1px -1px 1px rgba(0, 0, 0, 0.2);
}
#auth-grade-view .auth-title::before {
    content: ''; position: absolute; top: 0; left: -150%; width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.3) 20%, rgba(255, 255, 255, 0.9) 50%, rgba(255, 255, 255, 0.3) 80%, transparent);
    transform: skewX(-25deg); animation: bladeShine 5s cubic-bezier(0.4, 0, 0.2, 1) infinite; pointer-events: none; z-index: 10;
}
@keyframes bladeShine { 0% { left: -150%; } 40% { left: 200%; } 100% { left: 200%; } }

.auth-label { font-size: 0.8cqw; color: #2d3748; font-weight: 700; margin-bottom: 0.2cqw; margin-left: 0.2cqw; text-align: left; width: 100%; }
.auth-input { width: 100%; background: #ffffff; border: 1px solid #cbd5e0 !important; outline: none !important; padding: 0.5cqw 0.8cqw; border-radius: 0.4cqw; font-size: 0.85cqw; font-weight: 700; color: #2d3748; box-sizing: border-box; }
.auth-input:focus { border-color: #4299e1 !important; box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.3) !important; }

.main-auth-btn { width: 85% !important; margin: 0 auto; display: block; font-size: 1cqw !important; padding: 0.7cqw !important; box-shadow: 0 0.5cqw 1cqw rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); }
.auth-action-btn { width: 100%; padding: 0.6cqw; background: #e6e6fa; color: #3232cd; border: 1px solid #ccccff; font-size: 0.9cqw; font-weight: 900; cursor: pointer; border-radius: 0.4cqw; transition: 0.2s; margin-top: 0.3cqw; }
.auth-action-btn:hover { background: #dcdcdc; }

.auth-or { text-align: center; margin: 0.6cqw 0; font-size: 0.75cqw; font-weight: 700; color: #718096; position: relative; }
.auth-or::before, .auth-or::after { content: ''; position: absolute; top: 50%; width: 35%; height: 1px; background: #cbd5e0; }
.auth-or::before { left: 0; } .auth-or::after { right: 0; }

.google-btn { width: 100%; padding: 0.5cqw; background: #ffffff; color: #2d3748; border: 1px solid #cbd5e0; font-size: 0.8cqw; font-weight: 700; cursor: pointer; border-radius: 0.4cqw; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 0.6cqw; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.google-btn img { width: 1cqw; height: 1cqw; }
.google-btn:hover { background: #f7fafc; box-shadow: 0 2px 5px rgba(0,0,0,0.15); }

.auth-back { text-align: center; margin-top: 0.8cqw; font-size: 0.85cqw; font-weight: 700; color: #3182ce; cursor: pointer; }
.auth-back:hover { text-decoration: underline; color: #2b6cb0; }

.input-group { margin-bottom: 0.8cqw; width: 100%; }

.grade-box { display: flex; gap: 0.6cqw; margin-bottom: 1cqw; width: 100%; }
.grade-btn { flex: 1; padding: 0.6cqw 0; background: rgba(255, 255, 255, 0.95); border: 0.16cqw solid #cbd5e0; color: #4a76a8; font-size: 0.95cqw; font-weight: 700; cursor: pointer; border-radius: 0.4cqw; transition: 0.2s; }
.grade-btn.active { background: #2c5282; border-color: #2c5282; color: white; }
#start-btn { width: 100%; padding: 0.7cqw; background: rgba(160, 174, 192, 0.8); color: #e2e8f0; border: none; font-size: 1cqw; font-weight: 700; cursor: not-allowed; border-radius: 0.4cqw; transition: 0.2s; }
#start-btn.light-up { background: #4299e1; color: white; cursor: pointer; box-shadow: 0 0 10px rgba(66,153,225,0.6); }

.nav-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1cqw; padding: 0 1.5cqw; }
#pageTitle { color: #fdf6e3; margin: 0; font-size: 1.8cqw; font-weight: 900; text-shadow: 2px 2px 4px rgba(0,0,0,0.8), 0 0 10px rgba(0,0,0,0.6); letter-spacing: 2px; }

.arrow-btn { font-size: 2.2cqw; cursor: pointer; color: #8b2b2b; border: none; background: none; font-weight: 900; padding: 0.2cqw; text-shadow: 1px 1px 2px rgba(0,0,0,0.6); transition: all 0.3s ease; }
.arrow-btn.active { color: #e53e3e; text-shadow: 0 0 10px rgba(229, 62, 62, 0.6); }
.arrow-btn.active:hover { transform: scale(1.1); color: #fc8181; }
 
.level-table { width: 100%; border-collapse: separate; border-spacing: 1.2cqw; table-layout: fixed; }
.level-btn.bounty-poster { width: 100%; height: 9cqw; padding: 1.8cqw 0.5cqw 0.5cqw 0.5cqw; background: #fdf6e3; color: #3e2723; border: none; border-radius: 3px 12px 4px 18px; cursor: pointer; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); display: flex; flex-direction: column; align-items: center; justify-content: flex-start; text-align: center; white-space: normal; word-break: break-word; position: relative; overflow: hidden; box-shadow: inset 0 0 1.5cqw rgba(101, 67, 33, 0.4), inset 0 0 0.5cqw rgba(139, 69, 19, 0.25), 0 0.4cqw 0.8cqw rgba(0,0,0,0.6); background-image: radial-gradient(circle at center, transparent 0%, rgba(139, 69, 19, 0.05) 100%); }
.level-btn.bounty-poster:hover { background: #fffde7; transform: scale(1.1) rotate(0deg) !important; box-shadow: inset 0 0 1.5cqw rgba(101, 67, 33, 0.4), inset 0 0 0.5cqw rgba(139, 69, 19, 0.25), 0 0 1.5cqw #00f0ff, 0 1cqw 2cqw rgba(0,0,0,0.8); z-index: 5; }
.level-btn.bounty-poster::after { content: ''; position: absolute; bottom: 0.5cqw; right: 0.5cqw; width: 4.8cqw; height: 4.8cqw; background: url('https://i.meee.com.tw/sNZDFt1.png') no-repeat center center; background-size: contain; opacity: 0.45; transform: rotate(-12deg); pointer-events: none; z-index: 1; mix-blend-mode: multiply; }

.pin { position: absolute; top: 0.5cqw; left: 50%; transform: translateX(-50%); width: 0.95cqw; height: 0.95cqw; background: radial-gradient(circle at 35% 35%, #7a7a7a, #3b3b3b, #151515); border-radius: 50%; box-shadow: 0.2cqw 0.3cqw 0.5cqw rgba(0,0,0,0.8); z-index: 3; }
.pin::after { content: ''; position: absolute; top: 20%; left: 20%; width: 0.25cqw; height: 0.25cqw; background: rgba(255,255,255,0.15); border-radius: 50%; }

.bounty-title, .bounty-sub { position: relative; z-index: 2; }
.bounty-title { font-size: 1.15cqw; font-weight: 900; margin-bottom: 0.4cqw; border-bottom: 2px dashed #5d4037; padding-bottom: 0.3cqw; width: 90%; color: #271610; }
.bounty-sub { font-size: 0.9cqw; font-weight: 700; color: #4e342e; line-height: 1.3; padding: 0 0.4cqw; }

.footer-actions { margin-top: 1cqw; display: flex; justify-content: center; }
.back-btn { padding: 0.5cqw 2cqw; background: #e53e3e; color: white; border: none; border-radius: 0.4cqw; cursor: pointer; font-size: 1cqw; font-weight: 700; box-shadow: 0 0.2cqw 0.5cqw rgba(0,0,0,0.6); }

.text-banner { position: absolute; top: 30%; left: -100%; width: 100%; background: rgba(0, 0, 0, 0.85); color: #00f0ff; text-align: center; padding: 1.5cqw 0; font-size: 2.5cqw; font-weight: 900; letter-spacing: 0.2cqw; box-shadow: 0 0.5cqw 2cqw rgba(0,0,0,0.8); z-index: 99999; white-space: nowrap; text-shadow: 0 0 1cqw #4299e1; border-top: 0.2cqw solid #4299e1; border-bottom: 0.2cqw solid #4299e1; display: none; }
@keyframes sweep { 0% { left: -100%; } 15% { left: 0%; } 85% { left: 0%; } 100% { left: 100%; } }

#battle-stage { display: none; position: absolute; width: 100%; height: 100%; top: 0; left: 0; background: url('https://i.meee.com.tw/oZPBviT.jpg') no-repeat center center; background-size: 100% 100%; z-index: 20; box-sizing: border-box; }

/* =========================================================================
   🔒 戰鬥介面專用 (HUD 控制) - 支援 env(safe-area-inset)
   ========================================================================= */
.battle-timer-hud { position: absolute; top: calc(20px + env(safe-area-inset-top)) !important; right: calc(20px + env(safe-area-inset-right)) !important; bottom: auto !important; font-family: 'Rajdhani', sans-serif !important; font-size: 1.6cqw; font-weight: 900; color: #00f0ff; text-shadow: 0 0 10px rgba(0, 240, 255, 0.6); background: rgba(10, 25, 45, 0.85); border: 1px solid rgba(0, 240, 255, 0.5) !important; padding: 0.4cqw 1.4cqw; border-radius: 0.3cqw; z-index: 35; letter-spacing: 2px; box-shadow: 0 0 15px rgba(0, 240, 255, 0.1); transition: all 0.3s ease; }
.battle-timer-hud.timer-hidden-transition { opacity: 0 !important; display: none !important; transition: none !important; }
.timer-urgent { color: #ff4a4a !important; border-color: #ff4a4a !important; animation: timer-pulse-flash 0.8s infinite alternate ease-in-out !important; }
@keyframes timer-pulse-flash { 0% { text-shadow: 0 0 4px #ff4a4a; box-shadow: 0 0 5px rgba(255,74,74,0.2); filter: brightness(1); } 100% { text-shadow: 0 0 16px #ff4a4a; box-shadow: 0 0 18px rgba(255,74,74,0.6); filter: brightness(1.3); } }

.combo-counter-hud { position: absolute; top: calc(20px + env(safe-area-inset-top)); left: calc(32vw + env(safe-area-inset-left)); font-family: 'Rajdhani', sans-serif !important; font-size: 2.2cqw; font-weight: 900; color: #fff; text-shadow: 0 0 8px rgba(255,255,255,0.6); background: linear-gradient(135deg, rgba(6,15,28,0.9), rgba(10,25,45,0.7)); border-left: 4px solid #fff; padding: 0.3cqw 1.5cqw; border-radius: 0 0.4cqw 0.4cqw 0; z-index: 35; letter-spacing: 1px; box-shadow: 0 4px 15px rgba(0,0,0,0.4); opacity: 0; transform: scale(0.8); transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); pointer-events: none; }
.combo-counter-hud.combo-active { opacity: 1; transform: scale(1); border-left-color: #ffd700; color: #ffd700; text-shadow: 0 0 12px rgba(255,215,0,0.8); box-shadow: 0 4px 20px rgba(255,215,0,0.15); }
.combo-counter-hud.combo-pop { animation: combo-heartbeat 0.25s ease-out forwards !important; }
.combo-counter-hud.combo-hidden-transition { opacity: 0 !important; display: none !important; transform: scale(0.75) !important; transition: none !important; }
@keyframes combo-heartbeat { 0% { transform: scale(1); } 40% { transform: scale(1.3); filter: brightness(1.5); } 100% { transform: scale(1); } }

/* 🔥 加入額外的 safe-area-inset-bottom 緩衝區防禦網址列 */
#tactical-panel { position: absolute; left: 0; top: 0; bottom: 0; width: 30vw; background: rgba(6, 15, 28, 0.95); border: none; border-right: 2px solid #00f0ff; border-radius: 0; padding: calc(1.5vw + env(safe-area-inset-top)) 1.5vw calc(2.5vw + env(safe-area-inset-bottom)) calc(1.5vw + env(safe-area-inset-left)); box-sizing: border-box; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; z-index: 25; }
.panel-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(0, 240, 255, 0.3); padding-bottom: 0.8vw; }
.scan-status { color: #00f0ff; font-size: 0.8vw; font-weight: 700; letter-spacing: 1px; text-shadow: 0 0 5px rgba(0, 240, 255, 0.5); }
.exit-btn { background: rgba(229, 62, 62, 0.2); color: #ff4a4a; border: 1px solid #ff4a4a; padding: 0.3vw 0.8vw; border-radius: 0.2cqw; font-size: 0.9vw; font-weight: 900; cursor: pointer; transition: 0.2s; }
.exit-btn:hover { background: #e53e3e; color: white; box-shadow: 0 0 1cqw #e53e3e; }

.question-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; position: relative; overflow-y: auto; overflow-x: hidden; width: 100%; box-sizing: border-box; padding-right: 2px; }
.question-container::-webkit-scrollbar { width: 4px; }
.question-container::-webkit-scrollbar-track { background: rgba(0, 240, 255, 0.05); border-radius: 2px; }
.question-container::-webkit-scrollbar-thumb { background: rgba(0, 240, 255, 0.6); border-radius: 2px; box-shadow: 0 0 5px rgba(0,240,255,0.4); }
.question-container::-webkit-scrollbar-thumb:hover { background: #00f0ff; }

/* 🔒 【絕對防禦結界】 */
.question-text { font-family: 'Times New Roman', 'Noto Sans TC', sans-serif !important; color: #fff; font-size: 1.5vw; font-weight: 500; text-align: center; line-height: 1.4; text-shadow: 0 2px 8px rgba(0,0,0,0.8); position: relative; z-index: 2; width: 100%; display: block; box-sizing: border-box; margin: auto 0; padding: 1vw 0; }
.question-text i { font-style: italic !important; font-family: 'Rajdhani', sans-serif !important; padding: 0 2px; }
.question-text img { display: block !important; margin: 10px auto 4px auto !important; max-height: 25vh !important; height: auto !important; max-width: 95% !important; object-fit: contain !important; filter: drop-shadow(0 0 8px rgba(255,255,255,0.15)) drop-shadow(0 2px 5px rgba(0,0,0,0.65)) !important; -webkit-user-drag: none !important; user-drag: none !important; pointer-events: none !important; }

.scanner-laser { position: absolute; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg, transparent, #fff, #00f0ff, transparent); box-shadow: 0 0 12px #00f0ff, 0 0 4px #fff; z-index: 3; top: -10%; opacity: 0; }
.scanner-laser.scan-active { animation: laser-sweep-down 0.75s cubic-bezier(0.4, 0, 0.2, 1) forwards !important; }
@keyframes laser-sweep-down { 0% { top: -5%; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { top: 105%; opacity: 0; } }

.chips-grid { display: grid; grid-template-columns: 1fr; grid-template-rows: repeat(4, 1fr); gap: 0.8vw; position: relative; z-index: 10; }
.option-chip { font-family: 'Times New Roman', 'Noto Sans TC', sans-serif !important; background: rgba(10, 25, 45, 0.9); border: 1px solid rgba(0, 240, 255, 0.5); border-radius: 0.3cqw; color: #fff; padding: 0.8vw 1vw; font-size: 1.05vw; font-weight: 500; text-align: left; cursor: pointer; transition: all 0.2s ease; box-sizing: border-box; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 10; }
.option-chip:hover:not(:disabled) { background-color: rgba(0, 240, 255, 0.15); border-color: #00f0ff; box-shadow: 0 0 1.2cqw rgba(0, 240, 255, 0.4); transform: translateY(-2px); z-index: 20; }
.option-chip.correct { background: rgba(46, 204, 113, 0.8) !important; border: 1px solid #2ecc71 !important; box-shadow: 0 0 1.5cqw #2ecc71 !important; }
.option-chip.wrong { background: rgba(231, 76, 60, 0.8) !important; border: 1px solid #e74c3c !important; box-shadow: 0 0 1.5cqw #e74c3c !important; }
.option-chip i { font-style: italic !important; font-family: 'Rajdhani', sans-serif !important; padding: 0 1px; }
.katex { font-size: 1em !important; font-weight: 500 !important; }

/* 🔥 加入額外的 safe-area-inset-bottom 緩衝區防禦網址列 */
#battle-zone { position: absolute; left: 31vw; right: 0; top: 2.5vh; bottom: 2.5vh; display: flex; align-items: flex-end; justify-content: space-around; padding-bottom: calc(7.5vh + env(safe-area-inset-bottom)); box-sizing: border-box; z-index: 20; }
.hud-hide { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }

.unit-wrapper { display: flex; flex-direction: column; align-items: center; position: relative; width: 45%; height: 60vh !important; justify-content: flex-end !important; box-sizing: border-box; transition: transform 0.4s ease-in-out; transform-origin: bottom center !important; animation: pc-unified-breathe 2.6s infinite ease-in-out !important; z-index: 5 !important; }
.unit-wrapper.hero-dash-attack { animation: hero-dash-blitz 0.45s cubic-bezier(0.25, 1, 0.2, 1) forwards !important; }
@keyframes hero-dash-blitz { 0% { transform: translateX(0); filter: brightness(1); } 15% { transform: translateX(-15px) translateY(5px); } 30% { transform: translateX(25vw) skewX(-10deg); filter: brightness(1.8) drop-shadow(0 0 20px #00f0ff); } 45% { transform: translateX(25vw) translateY(-4px); filter: brightness(1.3); } 60% { transform: translateX(25vw) translateY(0); } 100% { transform: translateX(0) translateY(0); filter: brightness(1); } }
.unit-wrapper.monster-dash-attack { animation: monster-dash-blitz 0.45s cubic-bezier(0.25, 1, 0.2, 1) forwards !important; }
@keyframes monster-dash-blitz { 0% { transform: translateX(0) rotate(0deg); } 25% { transform: translateX(10px) rotate(4deg); } 45% { transform: translateX(-22vw) rotate(-12deg); } 100% { transform: translateX(0) rotate(0deg); } }
.unit-wrapper.sprite-hurt { animation: hit-shake-red 0.4s ease-in-out !important; filter: invert(0.1) sepia(1) saturate(6) hue-rotate(-55deg) drop-shadow(0 0 15px #e53e3e) !important; }
@keyframes hit-shake-red { 0%, 100% { transform: translateX(0) translateY(0); } 15%, 55%, 85% { transform: translateX(-12px) translateY(-2px); } 35%, 75% { transform: translateX(12px) translateY(2px); } }

.quantum-shield-effect { position: absolute; left: 34%; bottom: 12%; width: 140px; height: 320px; border-radius: 50% / 20%; background: radial-gradient(ellipse at center, rgba(0, 240, 255, 0.45) 0%, transparent 75%); border-left: 5px double rgba(0, 240, 255, 0.85); box-shadow: -15px 0 35px rgba(0, 240, 255, 0.5), inset 10px 0 20px rgba(0, 240, 255, 0.3); z-index: 4; pointer-events: none; opacity: 0; transform: scaleY(0.4) scaleX(0.4); transition: none; }
.quantum-shield-effect::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: inherit; border-left: 4px solid rgba(0, 240, 255, 0.9); opacity: 0; transform: scale(1); pointer-events: none; }
.quantum-shield-effect.active { animation: shield-burst 0.45s ease-out forwards !important; }
.quantum-shield-effect.active::after { animation: shield-ripple-expand 0.45s ease-out forwards !important; }
@keyframes shield-burst { 0% { opacity: 0; transform: scaleY(0.4) scaleX(0.4); filter: drop-shadow(0px #00f0ff); } 25% { opacity: 1; transform: scaleY(1.1) scaleX(1.1); filter: drop-shadow(0 0 20px #00f0ff); } 50% { opacity: 1; transform: scaleY(1) scaleX(1); box-shadow: -25px 0 50px rgba(0, 240, 255, 0.7); } 100% { opacity: 0; transform: scaleY(0.6) scaleX(0.1); filter: drop-shadow(0px #00f0ff); } }
@keyframes shield-ripple-expand { 0% { opacity: 0; transform: scale(0.9); } 25% { opacity: 1; } 100% { opacity: 0; transform: scale(1.4); filter: blur(5px); } }

.slash-vfx-node { position: absolute; top: 40%; left: 10%; width: 160px; height: 18px; background: linear-gradient(90deg, transparent, #fff, #00f0ff, transparent); transform: rotate(-35deg) skewX(-20deg); box-shadow: 0 0 20px #00f0ff, 0 0 6px #fff; z-index: 99; pointer-events: none; animation: slash-sweep-flash 0.22s cubic-bezier(0.1, 0.8, 0.2, 1) forwards !important; }
@keyframes slash-sweep-flash { 0% { width: 0%; opacity: 0; transform: rotate(-35deg) skewX(-20deg) scaleX(0.3); } 25% { opacity: 1; width: 120%; } 100% { width: 150%; opacity: 0; transform: rotate(-35deg) skewX(-20deg) scaleX(1.3) translateX(40px); filter: blur(4px); } }
.damage-pop-node { position: absolute; bottom: 85%; font-family: 'Rajdhani', sans-serif !important; font-size: 2.8cqw; font-weight: 900; z-index: 999; pointer-events: none; will-change: transform, opacity; animation: damage-float-up 1.4s cubic-bezier(0.1, 0.9, 0.2, 1) forwards !important; }
.dmg-gold { color: #ffd700; text-shadow: 3px 3px 6px rgba(255,215,0,0.6); }
.dmg-red { color: #ff3333; text-shadow: 3px 3px 6px rgba(255,51,51,0.6); }
@keyframes damage-float-up { 0% { transform: translateY(15px) scale(0.4); opacity: 0; } 15% { transform: translateY(-8px) scale(1.35); opacity: 1; } 30% { transform: translateY(-12px) scale(1.1); opacity: 1; } 55% { transform: translateY(-22px) scale(1); opacity: 0.9; } 100% { transform: translateY(-75px) scale(0.85); opacity: 0; } }

.hud-status { position: absolute !important; bottom: calc(100% - 28px) !important; top: auto !important; width: 280px !important; max-width: 280px !important; z-index: 10 !important; }
#heroWrapper .hud-status { left: 50%; transform: translateX(-50%) !important; }
#monsterWrapper .hud-status { left: 50%; transform: translateX(-50%) !important; }
.hud-info { display: flex; justify-content: space-between; align-items: baseline !important; margin-bottom: 0.3cqw; width: 100% !important; }
.hud-name { color: #fff; font-size: 1.1cqw; font-weight: 900; text-shadow: 0 2px 4px rgba(0,0,0,0.8); line-height: 1; white-space: nowrap !important; }
.hud-hp-val { color: #fff; font-size: 1cqw; font-weight: 700; line-height: 1; white-space: nowrap !important; }

.hp-bar-container { width: 100%; height: 1cqw; background: rgba(0, 0, 0, 0.6); border-radius: 0.2cqw; overflow: hidden; box-sizing: border-box; border: 1px solid rgba(255,255,255,0.2); position: relative; }
.hp-fill { height: 100%; position: absolute; left: 0; top: 0; }
.player-fill { background: linear-gradient(90deg, #0096ff, #00f0ff); box-shadow: 0 0 8px #00f0ff; z-index: 3; }
.monster-fill { background: linear-gradient(90deg, #b026ff, #ef40ff); box-shadow: 0 0 8px #ef40ff; z-index: 3; }
.hp-ghost-fill { background: #ff3333 !important; width: 100%; z-index: 2; transition: width 0.55s cubic-bezier(0.25, 0.8, 0.25, 1) !important; transition-delay: 0.4s !important; }
.no-transition { transition: none !important; }

.arena-floor { position: absolute; bottom: 8.5%; left: 2%; width: 96%; height: 26%; border-radius: 4px; background: radial-gradient(ellipse at center, rgba(0, 240, 255, 0.22) 0%, transparent 85%), linear-gradient(rgba(0, 240, 255, 0.45) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 240, 255, 0.45) 1px, transparent 1px); background-size: 100% 100%, 4cqw 3vh, 4cqw 3vh; background-position: center; border: 2px dashed rgba(0, 240, 255, 0.6); box-shadow: 0 0 35px rgba(0, 240, 255, 0.25), inset 0 0 25px rgba(0, 240, 255, 0.15); transform: perspective(400px) rotateX(76deg); transform-origin: bottom center; z-index: 1; pointer-events: none; }

/* 🔥 角色高度統一綁定為變數 */
#heroUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; transform-origin: bottom center !important; }
#monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; transform-origin: bottom center !important; }

#game-canvas[data-current-level="1"] #monsterWrapper, #game-canvas[data-current-level="2"] #monsterWrapper, #game-canvas[data-current-level="3"] #monsterWrapper, #game-canvas[data-current-level="4"] #monsterWrapper, #game-canvas[data-current-level="5"] #monsterWrapper, #game-canvas[data-current-level="6"] #monsterWrapper, #game-canvas[data-current-level="7"] #monsterWrapper, #game-canvas[data-current-level="8"] #monsterWrapper, #game-canvas[data-current-level="9"] #monsterWrapper, #game-canvas[data-current-level="10"] #monsterWrapper, #game-canvas[data-current-level="11"] #monsterWrapper { transform-origin: bottom center !important; }
#game-canvas[data-current-level="1"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; filter: drop-shadow(0 0 20px rgba(168,85,247,0.4)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="2"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; filter: drop-shadow(0 0 25px rgba(0,240,255,0.45)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="3"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; filter: drop-shadow(0 0 25px rgba(220,38,38,0.45)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="4"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; filter: drop-shadow(0 0 25px rgba(56,161,105,0.45)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="5"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; filter: drop-shadow(0 0 25px rgba(0,150,255,0.5)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="6"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) !important; filter: drop-shadow(0 0 25px rgba(156,39,176,0.5)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="7"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) scale(1.15) !important; filter: drop-shadow(0 0 25px rgba(226,232,240,0.6)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="8"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) scale(1.35) !important; filter: drop-shadow(0 0 25px rgba(255,69,0,0.6)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="9"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) scale(1) !important; filter: drop-shadow(0 0 25px rgba(128,0,128,0.7)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.85)) !important; }
#game-canvas[data-current-level="10"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) scale(1) !important; filter: drop-shadow(0 0 25px rgba(75,0,130,0.8)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.9)) !important; }
#game-canvas[data-current-level="11"] #monsterUnit { height: var(--unit-base-height) !important; transform: translateY(0) scale(1) !important; filter: drop-shadow(0 0 25px rgba(43,108,176,0.8)) drop-shadow(0 1cqw 1.5cqw rgba(0,0,0,0.9)) !important; }
#heroWrapper .hud-status, #monsterWrapper .hud-status { margin-bottom: -4.5vh !important; } 
@keyframes pc-unified-breathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.sprite-dead { transform: scale(0) !important; opacity: 0; transition: all 0.4s ease-in !important; }

/* 🔥 將原本 100vw 同 100vh 轉做 100% 等佢跟隨 Body 的精準高度 */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.7); display: flex !important; justify-content: center !important; align-items: center !important; z-index: 9999; opacity: 1; visibility: hidden; transition: all 0.2s; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.custom-dialog { background: #ffffff; border: 0.4cqw solid #2c5282; width: 34cqw; padding: 2.2cqw 1.8cqw; text-align: center; box-shadow: 0 1cqw 3cqw rgba(0,0,0,0.5); border-radius: 0.4cqw; }
.dialog-header-title { font-size: 1.5cqw; font-weight: 900; color: #e53e3e; margin-bottom: 12px; letter-spacing: 1px; }
.dialog-text { font-size: 1.3cqw; font-weight: 700; color: #2d3748; margin-bottom: 2cqw; line-height: 1.6; }
.dialog-btn-group { display: flex; justify-content: center; gap: 1.2cqw; width: 100%; }
.diag-btn-spec { width: 100%; padding: 0.8cqw; background: #2c5282; color: white; border: none; border-radius: 0.3cqw; font-size: 1.1cqw; font-weight: 700; cursor: pointer; }

.math-fraction-capsule { inline-size: auto; display: inline-flex !important; flex-direction: column !important; vertical-align: middle !important; text-align: center !important; padding: 0 4px !important; line-height: 1 !important; }
.fraction-numerator { border-bottom: 1px solid #fff !important; padding-bottom: 2px !important; }
.fraction-denominator { padding-top: 2px !important; }

.btn-red-return { background: #e53e3e !important; color: white !important; border: none !important; }
.btn-red-return:hover { background: #c53030 !important; box-shadow: 0 0 12px rgba(229,62,62,0.6) !important; }
.btn-green-confirm { background: #38a169 !important; color: white !important; border: none !important; }
.btn-green-confirm:hover { background: #2f855a !important; box-shadow: 0 0 12px rgba(56,161,105,0.6) !important; }

#game-canvas[data-current-level="5"] #optionsGrid { grid-template-columns: 1fr 1fr !important; grid-template-rows: 1fr 1fr !important; gap: 0.6vw !important; }

.inventory-bar-hud { position: relative; width: 100%; background: rgba(5, 12, 24, 0.7); border: 1px solid rgba(0, 240, 255, 0.3); border-radius: 0.3cqw; padding: 0.4vw; display: flex; justify-content: center; gap: 1.5vw; box-sizing: border-box; }
.item-slot { position: relative; width: 46px; height: 46px; background: rgba(2, 6, 12, 0.9); border: 1px solid rgba(0, 240, 255, 0.3); border-radius: 4px; cursor: pointer; display: flex; justify-content: center; align-items: center; outline: none; padding: 0; overflow: hidden; transition: all 0.2s ease; }
.item-slot img { width: 36px !important; height: 36px !important; object-fit: contain !important; pointer-events: none; }
.item-slot.locked { opacity: 0.2 !important; filter: grayscale(1) !important; border-color: rgba(255, 255, 255, 0.1) !important; pointer-events: none !important; cursor: not-allowed; }
.item-slot.active { opacity: 1 !important; filter: grayscale(0) drop-shadow(0 0 6px #00f0ff) !important; border-color: #00f0ff !important; pointer-events: auto !important; cursor: pointer; animation: itemHudPulse 2s infinite ease-in-out; }
@keyframes itemHudPulse { 0%, 100% { box-shadow: 0 0 4px rgba(0,240,255,0.2); filter: grayscale(0) drop-shadow(0 0 4px #00f0ff); } 50% { box-shadow: 0 0 12px rgba(0, 240, 255, 0.6); filter: grayscale(0) drop-shadow(0 0 10px #00f0ff) brightness(1.2); } }
.item-slot.shield-activated { border-color: #ffd700 !important; box-shadow: 0 0 20px #ffd700 !important; filter: drop-shadow(0 0 12px #ffd700) !important; animation: shieldActivePulse 1s infinite alternate ease-in-out !important; }
@keyframes shieldActivePulse { 0% { filter: brightness(1) drop-shadow(0 0 6px #ffd700); } 100% { filter: brightness(1.4) drop-shadow(0 0 18px #ffd700); } }
.option-chip.magic-blurred { filter: blur(3px) opacity(0.2) !important; pointer-events: none !important; cursor: not-allowed !important; border-color: rgba(255, 74, 74, 0.2) !important; background: rgba(0,0,0,0.6) !important; }
.skill-toast-overlay { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); font-family: 'Rajdhani', sans-serif !important; color: rgba(0, 240, 255, 0.9); font-size: 1.3rem; font-weight: 900; letter-spacing: 2px; white-space: nowrap; pointer-events: none; z-index: 999; text-shadow: 0 0 8px #00f0ff, 0 0 20px rgba(0,240,255,0.6); opacity: 0; }
@keyframes skillPopBlast { 0% { transform: translateX(-50%) scale(0.5); opacity: 0; } 8% { transform: translateX(-50%) scale(1.15); opacity: 1; } 15% { transform: translateX(-50%) scale(1); opacity: 1; filter: blur(0); } 75% { transform: translateX(-50%) scale(1); opacity: 1; filter: blur(0); } 100% { transform: translateX(-50%) translateY(-35px); opacity: 0; filter: blur(4px); } }
#music-container { position: fixed; bottom: calc(30px + env(safe-area-inset-bottom)); right: calc(30px + env(safe-area-inset-right)); z-index: 9999; width: 54px !important; height: 54px !important; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.5s ease; background: #000000 !important; border: 2px solid #00f0ff !important; color: rgba(135, 206, 235, 0.85); box-shadow: 0 0 12px rgba(0, 240, 255, 0.3); }
#music-container.spinning { animation: rotateMagic 8s linear infinite; }
@keyframes rotateMagic { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
#play-btn { background: none; border: none; padding: 0; cursor: pointer; width: 100%; height: 100%; color: inherit; display: flex; align-items: center; justify-content: center; }
#magic-circle { width: 46px !important; height: 46px !important; }
.monster-escape-slide { transform: translateX(120vw) skewX(-35deg) scale(0.3) rotate(15deg) !important; opacity: 0 !important; filter: blur(4px) brightness(1.8) !important; transition: transform 1.0s cubic-bezier(0.4, 0, 1, 1), opacity 1.0s ease, filter 1.0s ease !important; }
.dialog-text-settlement { font-size: 1.25cqw; font-weight: 700; color: #2d3748; margin-bottom: 2cqw; line-height: 1.85; }
#heroUnit, #monsterUnit { -webkit-user-drag: none !important; user-drag: none !important; -webkit-user-select: none !important; user-select: none !important; pointer-events: auto; }
.zoom-btn { display: inline-block; margin: 5px 0 10px 0; padding: 6px 15px; background: linear-gradient(180deg, #0f2027, #203a43); color: #00f0ff; border: 1px solid #00f0ff; border-radius: 6px; cursor: pointer; font-size: 0.9em; font-weight: bold; box-shadow: 0 0 10px rgba(0, 240, 255, 0.3); transition: all 0.2s; position: relative; z-index: 1000; pointer-events: auto; }
.zoom-btn:hover { background: #00f0ff; color: #000; box-shadow: 0 0 15px rgba(0, 240, 255, 0.8); }

/* 🔥 將原本 100vw 同 100vh 轉做 100% 等佢跟隨 Body 的精準高度 */
#lightbox-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 99999; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
#lightbox-overlay.active { opacity: 1; pointer-events: auto; }
#lightbox-img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 0 25px rgba(0, 240, 255, 0.5); object-fit: contain; }
.lightbox-close { position: absolute; top: 30px; left: 30px; color: #ff3333; font-size: 45px; cursor: pointer; font-weight: bold; text-shadow: 0 0 15px rgba(255, 51, 51, 0.8); user-select: none; transition: transform 0.2s ease; z-index: 100000; }
.lightbox-close:hover { transform: scale(1.2); }

/* =========================================================================
   🚀 側邊欄菜單系統 (Sidebar Hamburger Menu)
   ========================================================================= */
#hamburger-btn {
    position: absolute; top: calc(2cqw + env(safe-area-inset-top)); left: calc(2cqw + env(safe-area-inset-left)); font-size: 2.5cqw; color: #fff;
    background: rgba(10, 25, 45, 0.7); border: 2px solid #00f0ff; border-radius: 0.5cqw;
    cursor: pointer; z-index: 10001; width: 4cqw; height: 4cqw;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.4); transition: all 0.3s ease;
}
#hamburger-btn:hover { box-shadow: 0 0 20px #00f0ff; transform: scale(1.1); }
#hamburger-btn.hidden { display: none !important; }

#sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.3); backdrop-filter: blur(8px);
    z-index: 10000; opacity: 0; pointer-events: none; transition: opacity 0.4s;
}
#sidebar-overlay.active { opacity: 1; pointer-events: auto; }

/* 🔥 將原本 100vh 轉做 100% 等佢跟隨 Body 的精準高度 */
#sidebar-menu {
    position: fixed; top: 0; left: -25vw; width: 22vw; height: 100%;
    background: rgba(10, 25, 45, 0.85); backdrop-filter: blur(15px);
    border-right: 2px solid #00f0ff; box-shadow: 5px 0 25px rgba(0,0,0,0.8);
    z-index: 10002; transition: left 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex; flex-direction: column; padding: 4vw 2vw; box-sizing: border-box;
}
#sidebar-menu.open { left: 0; }

.sidebar-msg { color: #cbd5e0; font-size: 1.2vw; text-align: center; margin-top: 50%; font-weight: 700; line-height: 1.6; }

.menu-item {
    color: #fff; font-size: 1.5vw; font-weight: 700; padding: 1vw 0; margin-bottom: 1vw;
    cursor: pointer; position: relative; display: flex; align-items: center; gap: 1vw;
    transition: all 0.3s ease; width: fit-content; margin-left: auto; margin-right: auto;
}
.menu-item::after {
    content: ''; position: absolute; bottom: 0; left: 50%; width: 0; height: 3px;
    background: #00f0ff; box-shadow: 0 0 10px #00f0ff; transition: all 0.3s ease;
}
.menu-item:hover { transform: scale(1.1); text-shadow: 0 0 15px rgba(0,240,255,0.8); color: #00f0ff; }
.menu-item:hover::after { width: 100%; left: 0; }

/* =========================================================================
   🛡️ 白玻璃面板系統 (玩家檔案 / 冒險紀錄 / 重新命名 / 排行榜)
   ========================================================================= */
/* 🔥 將原本 100vw 同 100vh 轉做 100% 等佢跟隨 Body 的精準高度 */
.profile-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px);
    display: none; justify-content: center; align-items: center;
    z-index: 10005; opacity: 0; transition: opacity 0.3s ease;
}
.profile-modal-overlay.active { opacity: 1; }

.profile-panel {
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 0.15cqw solid rgba(218, 165, 32, 0.6); 
    border-radius: 1cqw; width: 45cqw; 
    max-height: 80vh; 
    padding: 2.5cqw; box-sizing: border-box;
    box-shadow: 0 1cqw 3cqw rgba(0, 0, 0, 0.2), inset 0 0 1cqw rgba(255, 255, 255, 0.5);
    position: relative; color: #1a365d; transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column;
}
.profile-modal-overlay.active .profile-panel { transform: scale(1); }

.profile-close {
    position: absolute; top: 1cqw; right: 1.5cqw; font-size: 2cqw; font-weight: 900;
    color: #a0aec0; cursor: pointer; transition: all 0.2s; text-shadow: none;
}
.profile-close:hover { transform: scale(1.2); color: #4a5568; }

.profile-header {
    text-align: center; font-size: 1.8cqw; font-weight: 900; color: #1a365d;
    margin-bottom: 2cqw; letter-spacing: 2px; text-shadow: none;
    border-bottom: 2px solid rgba(26, 54, 93, 0.2); padding-bottom: 1cqw;
}

.profile-section-block {
    border-left: 4px solid #2c5282; padding-left: 1.5cqw; margin-bottom: 2cqw; text-align: left;
}

.profile-row { display: flex; align-items: baseline; margin-bottom: 0.8cqw; font-size: 1.1cqw; }
.profile-label { color: #4a5568; font-weight: 700; width: auto; margin-right: 0.8cqw; }
.profile-value { font-weight: 900; color: #1a365d; display: flex; align-items: center; gap: 0.5cqw; }
.title-value { color: #b7791f; text-shadow: 0 0 2px rgba(183, 121, 31, 0.2); } 
.highlight-val { color: #2b6cb0; font-weight: 900; text-shadow: none; }

.rename-icon { cursor: pointer; font-size: 1.2cqw; transition: transform 0.2s, filter 0.2s; color: #4a5568; filter: none; }
.rename-icon:hover { transform: scale(1.2) rotate(10deg); filter: drop-shadow(0 0 4px rgba(0,0,0,0.2)); color: #1a365d; }

.exp-bar-bg { width: 100%; height: 0.6cqw; background: #e2e8f0; border-radius: 0.3cqw; overflow: hidden; border: none; margin: 0.5cqw 0; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); }
.exp-bar-fill { height: 100%; background: linear-gradient(90deg, #63b3ed, #2b6cb0); box-shadow: none; transition: width 0.8s cubic-bezier(0.25, 0.8, 0.25, 1); }
.exp-text { text-align: center; font-size: 0.9cqw; color: #718096; font-weight: 700; display: block; width: 100%; }

#rename-modal .profile-panel { width: 25cqw; max-height: none; }
.rename-input { width: 100%; padding: 0.8cqw; background: #ffffff; border: 1px solid #cbd5e0; color: #1a365d; font-size: 1cqw; border-radius: 0.4cqw; outline: none; margin-bottom: 1cqw; box-sizing: border-box; text-align: center; font-weight: 700; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.rename-input:focus { border-color: #2b6cb0; outline: none; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 0 0 3px rgba(43, 108, 176, 0.2); }
.btn-navy-confirm { background: #1a365d !important; color: white !important; border: none !important; transition: all 0.3s ease; }
.btn-navy-confirm:hover { background: #2c5282 !important; box-shadow: 0 0 15px rgba(218, 165, 32, 0.8) !important; transform: translateY(-2px); }

/* 📜 冒險紀錄專屬：雙欄極簡列版 (方案 B) - 自動換行與邊緣漸隱 */
.progress-scroll-area { 
    max-height: 32vh; 
    overflow-y: auto; padding: 1.5vh 0.5cqw; margin-top: 0.5cqw; box-sizing: border-box;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 8%, #000 92%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, #000 8%, #000 92%, transparent 100%);
}
.progress-scroll-area::-webkit-scrollbar { width: 4px; }
.progress-scroll-area::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 2px; }
.progress-scroll-area::-webkit-scrollbar-thumb { background: #2c5282; border-radius: 2px; }

.quest-row { display: flex; justify-content: space-between; align-items: center; padding: 0.8cqw 0.5cqw; border-bottom: 1px solid rgba(26, 54, 93, 0.15); transition: background 0.2s; }
.quest-row:hover { background: rgba(44, 82, 130, 0.05); border-radius: 0.2cqw; }

/* 完美自動換行，為右邊留位 */
.quest-name { flex: 1; text-align: left; font-size: 0.95cqw; font-weight: 700; color: #1a365d; line-height: 1.4; padding-right: 1cqw; word-break: break-word; }

/* 固定寬度，嚴格向右對齊 */
.quest-score { min-width: 6cqw; text-align: right; font-size: 0.95cqw; font-weight: 900; white-space: nowrap; }

/* 調深未完成 ---- 嘅顏色及字體粗度，確保清晰可讀 */
.quest-score.unplayed { color: #718096; font-weight: 700; }

.quest-score.perfect { color: #b7791f; text-shadow: 0 0 2px rgba(183, 121, 31, 0.2); }

/* 🏆 伺服器排行榜專屬樣式 */
.leaderboard-container { width: 100%; display: flex; flex-direction: column; }
.lb-header-row { display: flex; padding: 0.8cqw; border-bottom: 2px solid #2c5282; font-weight: 900; color: #1a365d; font-size: 1cqw; }
.lb-row { display: flex; padding: 0.8cqw; border-bottom: 1px solid rgba(26, 54, 93, 0.15); font-weight: 700; color: #1a365d; font-size: 1cqw; align-items: center; transition: background 0.2s; }
.lb-row:hover { background: rgba(44, 82, 130, 0.05); }

/* 四個對齊欄位 */
.lb-col-rank { flex: 0.8; text-align: center; font-weight: 900; }
.lb-col-name { flex: 2; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-col-level { flex: 1; text-align: center; }
.lb-col-exp { flex: 1.5; text-align: right; font-weight: 900; }

/* 殿堂級發光特效 */
.rank-1 { color: #d4af37 !important; text-shadow: 0 0 8px rgba(212, 175, 55, 0.6); font-size: 1.1cqw; }
.rank-2 { color: #9ca3af !important; text-shadow: 0 0 8px rgba(156, 163, 175, 0.6); }
.rank-3 { color: #b7791f !important; text-shadow: 0 0 8px rgba(183, 121, 31, 0.6); }

/* 排行榜滾動區 */
.lb-list-area { max-height: 40vh; overflow-y: auto; padding-right: 0.5cqw; }
.lb-list-area::-webkit-scrollbar { width: 4px; }
.lb-list-area::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); border-radius: 2px; }
.lb-list-area::-webkit-scrollbar-thumb { background: #2c5282; border-radius: 2px; }

/* 自己排名鎖死底行 */
.lb-my-row { border-top: 3px solid #2c5282; border-bottom: none; background: rgba(229, 62, 62, 0.05); margin-top: 0.5cqw; border-radius: 0 0 0.5cqw 0.5cqw; }
.lb-my-row .lb-col-name { color: #e53e3e; }
.lb-my-row .lb-col-exp { color: #e53e3e; }

/* =========================================================================
   📱 裝置響應式微調 (Responsive Tweaks)
   ========================================================================= */

/* 1. 手機橫屏微調：修正角色浮空問題 (覆蓋所有大螢幕手機) */
@media screen and (max-width: 1000px) and (orientation: landscape) {
    #heroWrapper, #monsterWrapper {
        margin-bottom: -2.5vh !important; /* 🔥 回調下沉幅度，確保完美貼返魔法陣 */
    }
    #battle-zone {
        padding-bottom: env(safe-area-inset-bottom) !important;
    }
    /* 🔥 專門調整血條，防止血條跟住角色沉得太低 */
    #heroWrapper .hud-status, #monsterWrapper .hud-status {
        margin-bottom: -3.5vh !important; 
    }
}

/* 2. 平板/iPad 微調：修正角色比例過大問題 (覆蓋 4:3 至 16:10 的平板) */
@media screen and (min-width: 768px) and (max-aspect-ratio: 16/10) {
    :root {
        --unit-base-height: 35vh; /* 🔥 放返大少少高度，重拾打王氣勢 */
    }
    /* 🔥 角色調整後，將血條再拉低少少，貼近角色頭頂 */
    #heroWrapper .hud-status, #monsterWrapper .hud-status {
        margin-bottom: -8.5vh !important; 
    }
}