/* style.css - 終極修復版 v33.0 (介面文字補強與彈窗修復) */

:root {
    --color-bg-jungle: #2E8B57;
    --color-bg-dark: #1a5232;
    --color-magic-pluma: #00FF7F;
    --color-sky-azul: #00BFFF;
    --color-feather-accent: #FF8C00;
    --color-text-stone: #F5F5DC;
    --color-obsidian: #1a1a1a;
    --maztica-gold: #FFD700; 
    --maztica-glow: rgba(255, 215, 0, 0.6);
    --font-heading: 'Cinzel Decorative', serif;
    --font-body: 'Lato', 'Noto Sans TC', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--color-bg-jungle);
    background-image: url('images/texture_stone.webp');
    background-blend-mode: multiply; 
    background-size: cover; background-attachment: fixed; 
    color: var(--color-text-stone); font-family: var(--font-body);
    overflow-x: hidden; min-height: 100vh;
}

/* 全局隱藏系統游標 */
body, a, button, .map-pin, .wheel-item, .info-orb, .guide-parrot, .scenario-card, .contract-floating-icon, .popup-close-btn { cursor: none !important; }

/* 音量滑桿 */
input[type=range] {
    cursor: pointer !important; pointer-events: auto !important; 
    position: relative; z-index: 99999;
    -webkit-appearance: none; width: 80px; height: 8px;
    background: #555; border-radius: 4px; outline: none;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px;
    background: var(--color-magic-pluma); border-radius: 50%; 
    cursor: pointer; box-shadow: 0 0 5px var(--color-magic-pluma);
}

/* 字體顏色 */
h1, h2, h3, .section-title, .guild-sign, .text-gold {
    color: var(--maztica-gold);
    text-shadow: 0 0 5px rgba(0,0,0,0.8), 0 0 10px rgba(255, 140, 0, 0.5);
    font-weight: 700; letter-spacing: 1px;
}

/* 自訂游標 */
.custom-cursor {
    position: fixed; top: 0; left: 0; width: 32px; height: 32px;
    pointer-events: none; z-index: 9999;
    background-image: url('images/cursor_feather.webp'); 
    background-size: contain; background-repeat: no-repeat;
    transform: translate(-50%, -50%); transition: transform 0.1s ease-out;
}
.custom-cursor.hover { transform: translate(-50%, -50%) scale(1.3); background-image: url('images/cursor_obsidian.webp'); }

/* 視覺特效 */
.particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; overflow: hidden; }
.ember {
    position: absolute; bottom: -20px;
    background: radial-gradient(circle, var(--color-magic-pluma) 0%, transparent 70%);
    border-radius: 50%; opacity: 0; mix-blend-mode: screen;
    animation: emberRise linear infinite;
}
@keyframes emberRise {
    0% { opacity: 0; transform: translateY(0) translateX(0) scale(0.5); }
    10% { opacity: 0.6; } 50% { opacity: 0.4; }
    100% { opacity: 0; transform: translateY(-100vh) translateX(var(--drift-x)) scale(1.5); }
}
.ritual-vignette {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 990;
    background: radial-gradient(circle at 50% 50%, transparent 30%, rgba(20, 0, 0, 0.4) 60%, rgba(0, 0, 0, 0.95) 100%);
    mix-blend-mode: multiply; animation: ritualBreath 6s infinite ease-in-out;
}
@keyframes ritualBreath { 0%, 100% { opacity: 0.8; } 50% { opacity: 0.6; } }
.ritual-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 980; opacity: 0.05;
    background-image: url('images/texture_stone.webp');
    background-size: 200px; mix-blend-mode: overlay;
}

/* 導覽列 */
.game-hud { 
    position: fixed; top: 0; width: 100%; height: 70px; 
    background: linear-gradient(to bottom, rgba(10, 10, 10, 0.95), rgba(26, 26, 26, 0.8));
    border-bottom: 1px solid var(--color-obsidian); 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 0 2rem; z-index: 1000; 
}

/* [新增] 左側容器與免責聲明 */
.hud-left { display: flex; flex-direction: column; align-items: flex-start; }
.disclaimer {
    font-size: 0.75rem; color: #aaa; font-style: italic;
    margin-top: 2px;
}

.nav-tabs {
    position: absolute; left: 50%; transform: translateX(-50%); 
    display: flex; background: rgba(0, 0, 0, 0.5); border-radius: 30px; padding: 5px; border: 1px solid #444;
    transition: opacity 1.5s ease, transform 1.5s ease;
}
.nav-tabs.hidden-init { opacity: 0; transform: translate(-50%, -20px); pointer-events: none; }
.nav-tabs.visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

.tab-btn {
    background: transparent; border: none; color: #888; padding: 10px 20px;
    font-family: var(--font-body); font-weight: bold; font-size: 1rem;
    cursor: pointer; position: relative; transition: all 0.3s ease; border-radius: 25px;
}
.tab-btn:hover { color: #ccc; background: rgba(255, 255, 255, 0.05); }
.tab-btn.active { color: var(--maztica-gold); text-shadow: 0 0 8px var(--maztica-glow); background: rgba(0, 0, 0, 0.6); box-shadow: inset 0 0 10px rgba(0,0,0,0.8); }
.tab-btn::after {
    content: ''; position: absolute; bottom: 5px; left: 50%; width: 0; height: 2px;
    background: var(--maztica-gold); box-shadow: 0 0 5px var(--maztica-glow);
    transition: all 0.3s ease; transform: translateX(-50%);
}
.tab-btn.active::after { width: 60%; }

/* [新增] 右側容器與GM聯絡資訊 */
.hud-right { display: flex; align-items: center; gap: 15px; }
.gm-contact {
    font-size: 0.8rem; color: #ccc; font-style: italic;
    margin-right: 5px;
}

.audio-control-panel {
    display: flex; align-items: center; gap: 15px;
    background: rgba(0, 0, 0, 0.3); padding: 5px 15px; border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000; pointer-events: auto;
    position: relative; 
}
.icon-btn { background: none; border: none; color: #ccc; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { color: var(--color-magic-pluma); }
.svg-icon { width: 24px; height: 24px; }
.hidden { display: none !important; }
.volume-slider-container { display: flex; align-items: center; gap: 5px; position: relative; z-index: 2001; }
.guide-parrot-trigger { margin-left: 5px; }

/* 場景控制 */
.game-scene { 
    display: none; 
    width: 100%; height: 100vh;
    padding-top: 70px; 
    animation: fadeInScene 0.5s ease-in-out; 
    position: relative; 
    overflow: hidden !important; 
    display: none; 
}
.game-scene.active { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
}
.game-scene:not(.active) { display: none !important; }

#intro.game-scene.active { display: flex; padding-top: 0; }
#guild.game-scene.active { padding-top: 0; }

#character.game-scene.active {
    justify-content: flex-start;
    padding-top: 120px; 
    
    /* [修改這裡] */
    /* 原本是 auto，改成 scroll 強制顯示捲軸軌道 */
    overflow-y: scroll !important; 
    
    /* [選用：現代瀏覽器優化] 防止捲軸佔用空間導致的位移 (如果瀏覽器支援) */
    scrollbar-gutter: stable;
}

@keyframes fadeInScene { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

/* 首頁與視差背景 */
#intro { height: 100vh; overflow: hidden; position: relative; justify-content: center; align-items: center; background: #000; }
.intro-background-group { 
    position: absolute; width: 100%; height: 100%; 
    transition: opacity 1.5s ease, transform 2.0s ease-out; 
    transform-origin: center center;
}

.parallax-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; z-index: 0; }
.parallax-layer { 
    position: absolute; top: -10%; left: -10%; width: 120%; height: 120%; 
    background-size: cover; background-position: center; 
    transition: transform 0.1s ease-out; opacity: 0;
    animation: layerFadeIn 3s ease-out forwards; 
}
.layer-bg-night { background-image: url('images/bg_night_sky.webp'); z-index: 1; animation-delay: 0s; }
.layer-mid-night { background-image: url('images/bg_night_pyramid.webp'); z-index: 2; animation-delay: 0.5s; }
.layer-fg-night { background-image: url('images/bg_night_jungle.webp'); z-index: 3; animation-delay: 1s; }
@keyframes layerFadeIn { from { opacity: 0; filter: blur(5px); } to { opacity: 1; filter: blur(0); } }

.fire-glow-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(255, 120, 30, 0.7) 0%, rgba(139, 0, 0, 0.3) 50%, transparent 90%);
    mix-blend-mode: color-dodge; pointer-events: none; z-index: 4;
    animation: fireFlicker 2.5s infinite alternate;
}
@keyframes fireFlicker { 0% { opacity: 0.8; } 100% { opacity: 0.85; filter: brightness(1.15); } }

.hero-content { 
    z-index: 10; padding: 3rem; 
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); 
    max-width: 900px; 
    box-shadow: 0 0 80px rgba(0,0,0,0.8); 
    display: flex; flex-direction: column; align-items: center; 
    transition: opacity 1.0s ease;
}

.hero-narrative.wide-narrative { 
    color: #fff; line-height: 1.8; text-shadow: 0 0 10px #000; text-align: left; 
    max-width: 900px; 
}
.hero-narrative p { margin-bottom: 0.5rem; opacity: 0; } 
.hero-narrative .highlight {
    color: var(--maztica-gold);
    font-size: 1.3rem; font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    text-align: center; display: block; margin-top: 1rem;
}

@keyframes textFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.hero-zoom-effect .intro-background-group { opacity: 0; transform: scale(2.0); }
.hero-zoom-effect .hero-content { opacity: 0; }

.cta-button { background: rgba(0,0,0,0.8); color: #00ffff; border: 2px solid #00ffff; padding: 15px 40px; font-size: 1.5rem; cursor: pointer; transition: all 0.3s; border-radius: 5px; }
.cta-button:hover { background: #00ffff; color: #000; box-shadow: 0 0 30px #00ffff; }

/* 光球 */
.orb-flotation-area { position: absolute; top: 0; bottom: 0; width: calc(50% - 420px); pointer-events: none; z-index: 15; }
.left-orbs { left: 0; border-right: 1px solid rgba(0, 255, 255, 0.2); }
.right-orbs { right: 0; border-left: 1px solid rgba(0, 255, 255, 0.2); }
.info-orb { position: absolute; width: 120px; height: 120px; z-index: 20; pointer-events: auto; cursor: help; will-change: transform; }
.orb-visual {
    width: 100%; height: 100%; background-image: url('images/icon_soul_orb.webp'); 
    background-size: contain; background-repeat: no-repeat; background-position: center;
    mix-blend-mode: screen; filter: drop-shadow(0 0 15px #00ffff);
    animation: soulPulse 3s infinite ease-in-out;
}
.info-orb:hover .orb-visual { filter: drop-shadow(0 0 30px #00ff7f) brightness(1.5); }
.orb-vanish { transform: scale(0) !important; opacity: 0 !important; transition: transform 0.8s ease-in, opacity 0.8s ease-in; }
@keyframes soulPulse { 0% { transform: scale(0.9); } 50% { transform: scale(1.1); } 100% { transform: scale(0.9); } }
.orb-tooltip {
    position: fixed; background: rgba(26, 26, 26, 0.95); border: 1px solid var(--color-feather-accent); 
    padding: 15px; max-width: 320px; border-radius: 8px; color: var(--color-text-stone); 
    text-align: center; opacity: 0; transition: opacity 0.2s ease; 
    pointer-events: none; z-index: 9999; box-shadow: 0 0 20px rgba(0,0,0,0.8);
}
.orb-tooltip strong { color: #00ffff; display: block; padding-bottom: 8px; border-bottom: 1px solid #555; margin-bottom: 8px; }
.orb-tooltip.active { opacity: 1; }

/* 命運輪盤 */
.fate-layout { 
    display: flex; justify-content: center; align-items: stretch; 
    gap: 20px; width: 100%; max-width: 1400px; 
}

.prophecy-panel { 
    width: 300px; 
    height: 600px; /* [新增] 強制高度與輪盤一致，避免版面伸縮 */
    color: var(--color-text-stone); 
    display: flex; 
    flex-direction: column; 
    padding-top: 20px; 
    flex-shrink: 0; 
}
.left-panel { text-align: right; align-items: flex-end; }
.right-panel { text-align: left; align-items: flex-start; }
.prophecy-content { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; } 

.desc-scroll-box {
    flex: 1;           /* 自動填滿剩餘空間 */
    min-height: 0;     /* 允許壓縮，觸發滾動 */
    overflow-y: auto;  /* 超出時顯示內部捲軸 */
    
    /* 以下維持原樣 */
    margin-bottom: 1.5rem; 
    padding-right: 5px; 
    scrollbar-color: var(--color-magic-pluma) #333; 
}
.desc-scroll-box::-webkit-scrollbar { width: 6px; }
.desc-scroll-box::-webkit-scrollbar-track { background: #1a1a1a; border-radius: 3px; }
.desc-scroll-box::-webkit-scrollbar-thumb { background: var(--color-magic-pluma); border-radius: 3px; }

#race-desc, #class-desc { font-size: 1.1rem; line-height: 1.6; color: #ccc; margin: 0; }
.tags-container { display: flex; gap: 10px; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tag { padding: 6px 16px; color: #FFD700; background: #1a1a1a; border: 1px solid #555; border-radius: 4px; }

.right-panel .tags-container { justify-content: flex-end; }

.stats-box-mini {
    position: absolute; 
    top: -55px; 
    right: 0;
    width: 130px; 
    background: rgba(0,0,0,0.5); padding: 5px; border-radius: 5px; border: 1px solid #555;
    transform: scale(0.85); transform-origin: top right;
}
.stat-row-mini { display: flex; align-items: center; gap: 5px; margin-bottom: 3px; font-size: 0.8rem; }
.mini-label { width: 30px; color: #aaa; text-align: right; font-weight: bold; font-size: 0.75rem;}
.bar-mini { flex: 1; height: 4px; background: #333; border-radius: 2px; overflow: hidden; }
.bar-mini div { height: 100%; background: var(--color-magic-pluma); transition: width 0.5s ease; }


.aztec-wheel-container { 
    position: relative; width: 600px; height: 600px; flex-shrink: 0; 
    background: url('images/wheel_bg.webp') no-repeat center center; 
    background-size: contain; border-radius: 50%; box-shadow: 0 0 50px rgba(0,0,0,0.8); 
}
.wheel-ring { 
    position: absolute; top: 50%; left: 50%; width: 0; height: 0; 
    transform-origin: center center; transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}
.wheel-item { 
    position: absolute; width: 70px; height: 70px; margin-left: -35px; margin-top: -35px;
    display: flex; justify-content: center; align-items: center; cursor: pointer; 
    transition: transform 0.3s ease, filter 0.3s ease;
}
.wheel-item img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(100%); transition: all 0.3s ease; }
.wheel-item:hover { transform: scale(1.2) translateY(-5px); z-index: 20; }
.wheel-item:hover img { filter: grayscale(0%) brightness(1.2) drop-shadow(0 0 10px var(--maztica-gold)); }
.wheel-item.active img { filter: grayscale(0%) brightness(1.2); transform: scale(1.3); z-index: 10; }
.wheel-item.magic-pluma.active img { filter: drop-shadow(0 0 15px #FF8C00); }   
.wheel-item.magic-hishna.active img { filter: drop-shadow(0 0 15px #00FF7F); }   
.wheel-item.magic-tonalli.active img { filter: drop-shadow(0 0 15px #FFFFFF); }  
.wheel-item.magic-elemental.active img { filter: drop-shadow(0 0 15px #00BFFF); } 

#main-portrait { 
    width: 100%; height: 100%; object-fit: cover; 
    transition: opacity 0.5s ease-in-out; opacity: 1; 
    animation: portraitBreathe 5s infinite ease-in-out;
}
@keyframes portraitBreathe {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

#main-portrait.loading { opacity: 0; }
.wheel-core-display { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 220px; height: 220px; z-index: 0; }
.portrait-frame { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; background: #000; }
.portrait-rim { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; border: 4px solid var(--color-magic-pluma); transition: border-color 0.5s, box-shadow 0.5s; }
.wheel-core-display.magic-pluma .portrait-rim { border-color: #FF8C00; box-shadow: 0 0 20px #FF8C00; }
.wheel-core-display.magic-hishna .portrait-rim { border-color: #00FF7F; box-shadow: 0 0 20px #00FF7F; }
.wheel-core-display.magic-tonalli .portrait-rim { border-color: #FFFFFF; box-shadow: 0 0 20px #FFFFFF; }
.wheel-core-display.magic-elemental .portrait-rim { border-color: #00BFFF; box-shadow: 0 0 20px #00BFFF; }

/* 公會大廳 */
.guild-hall-scene {
    display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
    position: relative; overflow: hidden;
}
.guild-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: url('images/bg_guild_hall.webp') no-repeat center bottom; 
    background-size: cover; z-index: 0;
}
.guild-bg::after { 
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 50% 50%, transparent 50%, rgba(0,0,0,0.8) 100%);
}

.contract-floating-icon {
    position: absolute; top: -40px; right: -20px; z-index: 50;
    width: 80px; text-align: center; text-decoration: none; color: #fff;
    transition: transform 0.3s;
    display: block; 
}
.contract-floating-icon img { width: 100%; filter: brightness(1.3) saturate(1.2) drop-shadow(0 0 10px gold); animation: floatIcon 3s infinite ease-in-out; }
.contract-floating-icon:hover { transform: scale(1.1); }
.icon-label { display: block; font-size: 0.9rem; margin-top: 5px; text-shadow: 0 0 5px #000; font-weight: bold; }
@keyframes floatIcon { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* 手風琴樣式 */
.scenario-accordion {
    position: absolute; 
    top: 45%; left: 55%; transform: translate(-50%, -50%);
    display: flex; gap: 10px;
    width: 90%; max-width: 800px;
    height: 450px;
    z-index: 10;
}

.scenario-card {
    position: relative;
    flex: 1; /* 收起狀態 */
    border: 2px solid #555;
    border-radius: 10px; 
    overflow: hidden; 
    transition: flex 0.6s cubic-bezier(0.25, 1, 0.5, 1), height 0.6s ease, border-color 0.3s;
    background: #000;
    cursor: pointer;
}

.scenario-card:hover { border-color: #888; }
.scenario-card.active { 
    flex: 3.5; /* 展開狀態 */
    border-color: var(--maztica-gold); 
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.card-visual {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    transition: all 0.6s ease;
}
.card-visual img { 
    width: 100%; height: 100%; object-fit: cover; 
    transition: transform 0.6s ease, filter 0.6s ease;
}
.visual-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent 60%);
    transition: opacity 0.4s;
}

.scenario-card.active .card-visual img { transform: scale(1.1); filter: brightness(0.4); }
.scenario-card.active .visual-overlay { opacity: 0; } 

.card-title-overlay {
    position: absolute; bottom: 20px; left: 0; width: 100%;
    text-align: center; color: var(--maztica-gold);
    font-size: 1.2rem; text-shadow: 0 0 10px #000;
    transition: opacity 0.3s; z-index: 2;
    background: rgba(0,0,0,0.6); padding: 10px 0;
}
.scenario-card.active .card-title-overlay { opacity: 0; pointer-events: none; } 

.scenario-details {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    padding: 30px;
    opacity: 0; pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.5s ease 0.2s, transform 0.5s ease 0.2s; 
    display: flex; flex-direction: column; 
    justify-content: flex-start;
    background: rgba(0, 0, 0, 0.6); 
    backdrop-filter: blur(3px);
    overflow-y: auto; 
}

.scenario-details::-webkit-scrollbar { width: 6px; }
.scenario-details::-webkit-scrollbar-track { background: transparent; }
.scenario-details::-webkit-scrollbar-thumb { background: var(--color-magic-pluma); border-radius: 3px; }

.scenario-card.active .scenario-details { opacity: 1; pointer-events: auto; transform: translateY(0); }

.detail-title {
    font-size: 1.8rem; margin-bottom: 1rem;
    border-bottom: 1px solid var(--color-feather-accent);
    padding-bottom: 10px; display: inline-block;
}

.detail-meta { display: flex; gap: 20px; margin-bottom: 1.5rem; flex-shrink: 0; }

.meta-tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 15px; border-radius: 20px;
    border: 1px solid #555; font-size: 0.9rem; color: #ccc;
    display: flex; align-items: center; gap: 8px;
}

.detail-desc { font-size: 1.1rem; line-height: 1.6; color: #eee; }
.detail-desc p { margin-bottom: 1rem; }

/* NPC 與對話框 */
.npc-container {
    position: absolute; bottom: 0; left: 0; 
    width: 400px; height: auto; z-index: 20; pointer-events: none;
}
.npc-img { width: 100%; height: auto; filter: drop-shadow(0 0 20px rgba(0,0,0,0.5)); }

.dialogue-box {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    z-index: 30; width: 90%; max-width: 1000px; 
    background: rgba(10, 10, 10, 0.9); border: 3px solid #4a3b2a; border-radius: 10px;
    padding: 20px 30px; box-shadow: 0 0 20px rgba(0,0,0,0.8);
    overflow: visible !important; 
    opacity: 1 !important; 
    transition: none; 
}
.dialogue-name {
    position: absolute; top: -20px; left: 30px;
    background: #8B0000; color: #fff; padding: 5px 20px;
    font-weight: bold; border-radius: 5px; border: 2px solid #aaa;
}
.dialogue-text { font-size: 1.1rem; line-height: 1.6; color: #eee; min-height: 60px; }

.guide-parrot { 
    position: fixed; bottom: 20px; right: 20px; width: 100px; height: 100px; 
    cursor: pointer; z-index: 1000; 
    animation: floatParrot 3s infinite ease-in-out; 
}
@keyframes floatParrot {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); } 
}
.guide-parrot img { width: 100%; height: 100%; object-fit: contain; }
.guide-parrot:hover img { transform: scale(1.1) rotate(-10deg); transition: transform 0.2s; }
.speech-bubble { position: fixed; right: 30px; bottom: 130px; background: #fff; color: #000; padding: 15px; border-radius: 15px; width: 200px; font-weight: bold; z-index: 1001; opacity: 0; transition: all 0.3s; pointer-events: none; }

/* 地圖彈窗樣式 */
.map-intro-text { 
    max-width: 800px; 
    margin-bottom: 1rem; 
    background: rgba(0, 0, 0, 0.5); 
    padding: 20px 30px; 
    border-radius: 10px; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    margin-top: 20px; 
}

.map-stage-container { 
    position: relative; 
    width: auto; max-width: 95%; height: 55vh; 
    aspect-ratio: 16 / 9; margin: 0 auto; 
    background: #000; 
    border: 3px solid var(--color-text-stone); 
    border-radius: 10px; 
    overflow: visible; 
}

.map-viewport-wide { width: 100%; height: 100%; background-image: url('images/map_maztica.webp'); background-size: cover; background-position: center; }
.map-pin { 
    position: absolute; width: 40px; height: 40px; 
    transform: translate(-50%, -50%); 
    cursor: pointer; z-index: 100; pointer-events: auto; 
    background-image: url('images/icon_arrow.webp');
    background-size: contain; background-repeat: no-repeat;
    animation: arrowBounce 1s infinite alternate;
}
@keyframes arrowBounce { from { margin-top: 0; } to { margin-top: -15px; } }

.map-pin:hover { transform: translate(-50%, -50%) scale(1.3); z-index: 120; }

/* 資訊面板樣式 (支援左右側滑入) */
.location-popup { 
    position: fixed; 
    top: 15%; bottom: 15%; 
    width: 380px; 
    background: rgba(10, 10, 10, 0.95); 
    border: 2px solid var(--color-text-stone); 
    border-radius: 10px; 
    visibility: hidden; /* [修正] 預設隱藏 */
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.3s ease, transform 0.3s ease; 
    z-index: 3000; 
    box-shadow: 0 0 50px rgba(0,0,0,0.9); 
    display: flex; flex-direction: column;
}

.location-popup.side-right {
    right: 20px; left: auto;
    transform: translateX(20px);
}

.location-popup.side-left {
    left: 20px; right: auto;
    transform: translateX(-20px);
}

.location-popup.active { 
    visibility: visible; /* [修正] 啟動時顯示 */
    opacity: 1; 
    pointer-events: auto; 
    transform: translateX(0); 
}

.popup-close-btn {
    position: absolute; top: 10px; right: 10px;
    background: rgba(0,0,0,0.5); border: 1px solid #555;
    color: #fff; width: 30px; height: 30px;
    border-radius: 50%; font-size: 1.2rem; line-height: 1;
    z-index: 10; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.popup-close-btn:hover { background: #8B0000; border-color: red; transform: scale(1.1); }

.popup-visual { 
    width: 100%; height: 200px; 
    flex-shrink: 0; position: relative; overflow: hidden; 
    border-bottom: 2px solid var(--color-feather-accent); 
}
.popup-visual img { width: 100%; height: 100%; object-fit: cover; }

.popup-content { 
    padding: 1.5rem; text-align: left; 
    overflow-y: auto; flex-grow: 1;
}
.popup-content::-webkit-scrollbar { width: 6px; }
.popup-content::-webkit-scrollbar-track { background: #111; }
.popup-content::-webkit-scrollbar-thumb { background: var(--color-feather-accent); border-radius: 3px; }

/* ==========================================================================
   手機版與窄螢幕適配 (Mobile Responsiveness)
   ========================================================================== */
@media (max-width: 768px) {
    .guild-sign { font-size: 1.2rem; }
    .tab-btn { padding: 5px 10px; font-size: 0.9rem; }
    .hero-content { padding: 1.5rem; width: 95%; }
    .hero-narrative.wide-narrative { font-size: 0.9rem; }
    .map-intro-text { padding: 10px; font-size: 0.9rem; }
    .map-stage-container { 
        width: 100%; max-width: 100%; 
        height: 50vh; 
        aspect-ratio: auto;
    }
    
    .location-popup.side-left,
    .location-popup.side-right {
        right: 0; left: 0; bottom: 0; top: auto; 
        width: 100%; 
        height: 60vh; 
        border-radius: 20px 20px 0 0;
        transform: translateY(100%); 
    }
    .location-popup.active { transform: translateY(0); }
    .popup-visual { height: 150px; }

    .fate-layout { flex-direction: column; align-items: center; gap: 40px; }
    #character.game-scene.active { padding-top: 80px; }
    .prophecy-panel { width: 90%; text-align: center; padding-top: 0; }
    .left-panel, .right-panel { align-items: center; text-align: center; }
    .stats-box-mini { top: 0; right: 10px; position: relative; margin: 0 auto 10px auto; }
    .aztec-wheel-container { transform: scale(0.65); margin: -60px 0; }
    .desc-scroll-box { 
        height: 200px; /* 手機版維持固定高度，確保版面穩定 */
        min-height: 0;
    } 

    .scenario-accordion {
        width: 95%; height: auto;
        left: 50%; top: 55%; 
        transform: translate(-50%, -50%);
        flex-direction: column; 
        gap: 5px;
    }
    .scenario-card { width: 100%; height: 60px; flex: none !important; transition: height 0.5s ease; }
    .scenario-card.active { height: 400px; box-shadow: 0 0 15px rgba(255, 215, 0, 0.4); }
    .card-title-overlay { font-size: 1rem; bottom: 15px; }
    .detail-title { font-size: 1.4rem; }
    .detail-meta { font-size: 0.8rem; gap: 10px; }
    
    .npc-container { width: 250px; left: auto; right: -50px; bottom: 120px; opacity: 0.8; }
    .dialogue-box { width: 95%; padding: 15px; bottom: 10px; }
    .dialogue-text { font-size: 0.95rem; min-height: 50px; }
    .contract-floating-icon { top: -30px; width: 60px; }
}


