/* =========================================
   1. 全局變數與基礎設定
========================================= */
:root {
    --bg-freshwater: #D6EAF8;
    --bg-white: #FFFFFF;
    --border-color: #2c3e50;
    --accent-jp: #FFB7B2;
    --accent-tw: #88D8B0;
    --text-main: #2c3e50;
    --pixel-border: 3px solid var(--border-color);
    --pixel-shadow: 4px 4px 0px var(--border-color);
    --pixel-shadow-hover: 2px 2px 0px var(--border-color);
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg-freshwater);
    font-family: 'Noto Sans TC', sans-serif;
    color: var(--text-main);
    margin: 0; padding: 0; line-height: 1.6;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
    background-size: 20px 20px;
    overflow-x: hidden; position: relative;
}

h1, h2, h3, h4, .pixel-btn, header, footer, .rate-value, .currency-label, .pixel-link, .digital-clock {
    font-family: 'DotGothic16', sans-serif;
    letter-spacing: 1px;
}

.container {
    max-width: 1000px; margin: 0 auto; padding: 0 20px;
    position: relative; z-index: 1;
}

/* =========================================
   2. Header & Logo
========================================= */
.pixel-header {
    background-color: var(--bg-white); border-bottom: var(--pixel-border);
    padding-bottom: 20px; text-align: center;
    position: sticky; top: 0; z-index: 100;
}
.logo-area { display: flex; align-items: center; justify-content: center; gap: 25px; padding: 25px 0; }
.pixel-flag { width: 60px; height: auto; display: block; shape-rendering: crispEdges; filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.2)); }
.site-branding { text-align: center; display: flex; flex-direction: column; align-items: center; }
.site-title { font-size: 2.5rem; margin: 0; color: var(--border-color); line-height: 1.2; }
.x-mark { color: #E74C3C; margin: 0 5px; font-size: 0.8em; }
.site-subtitle { font-size: 0.9rem; margin: 5px 0 0 0; color: #555; font-weight: bold; }
.heart { color: #E74C3C; }

.pixel-nav { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 20px; padding: 0 10px; }
.nav-group-home, .nav-group-lang { display: flex; gap: 15px; }
.pixel-btn {
    display: inline-block; background-color: #fff; border: var(--pixel-border); padding: 8px 20px;
    text-decoration: none; color: var(--text-main); box-shadow: var(--pixel-shadow); transition: all 0.1s;
    font-weight: bold; font-size: 1.1rem;
}
.pixel-btn:hover, .pixel-btn.active { transform: translate(2px, 2px); box-shadow: var(--pixel-shadow-hover); background-color: #FFFDE7; }
.pixel-btn:active { transform: translate(4px, 4px); box-shadow: none; }
.lang-btn { padding: 5px 15px; }
.lang-btn.current { background-color: var(--border-color); color: #fff; box-shadow: none; cursor: default; }

/* =========================================
   3. 內容區塊
========================================= */
.hero-section { padding: 40px 0; }
.category-section { padding: 10px 0 30px 0; text-align: center; }

.pixel-card { background: var(--bg-white); border: var(--pixel-border); box-shadow: var(--pixel-shadow); padding: 20px; margin-bottom: 20px; }
.hero-box { background-color: #FFF8E1; }
.hero-content { display: flex; align-items: center; gap: 20px; }
.avatar-box { font-size: 3rem; border: var(--pixel-border); padding: 10px; background: #fff; }
.section-title { border-left: 10px solid var(--border-color); padding-left: 15px; margin: 30px 0 30px 0; font-size: 1.8rem; text-align: left; }

/* 地圖 */
.map-container { display: flex; justify-content: center; gap: 60px; margin-top: 20px; flex-wrap: wrap; }
.map-wrapper {
    text-align: center; position: relative; background: #fff; border: var(--pixel-border);
    box-shadow: var(--pixel-shadow); padding: 20px; border-radius: 4px;
    background-image: radial-gradient(#eee 15%, transparent 16%); background-size: 10px 10px; display: flex; flex-direction: column; align-items: center;
}
.map-label { margin-top: 0; border-bottom: 2px dashed #ccc; padding-bottom: 10px; margin-bottom: 10px; color: var(--border-color); width: 100%; }
.pixel-map-svg { width: 300px; height: auto; overflow: visible; }
.map-region rect { transition: all 0.2s; cursor: pointer; }
.jp-region:hover rect { fill: #FFB7B2; transform: translate(-3px, -3px); }
.tw-region:hover rect { fill: #F5D0A9; transform: translate(-3px, -3px); }
.jp-region:hover, .tw-region:hover { filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.3)); }
.map-links { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.pixel-link {
    display: inline-block; background-color: #f0f8ff; border: 2px solid #2c3e50; padding: 5px 10px;
    color: #2c3e50; text-decoration: none; font-size: 0.9rem; transition: all 0.1s; box-shadow: 2px 2px 0px #2c3e50;
}
.pixel-link:hover { background-color: #FFB7B2; transform: translate(1px, 1px); box-shadow: 1px 1px 0px #2c3e50; }

/* =========================================
   4. 情報資訊局 (Dashboard) - 新樣式
========================================= */
.info-section { padding-bottom: 60px; }

/* 儀表板容器 */
.info-dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 通用卡片樣式 */
.dashboard-card {
    background: #222; /* 復古黑底 */
    color: #fff;
    border: 4px solid #555;
    box-shadow: 6px 6px 0px #000;
    padding: 15px;
    position: relative;
}

.card-label {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #aaa;
    border-bottom: 1px dashed #444;
    padding-bottom: 5px;
}

/* --- 匯率看板 --- */
.info-board { }
.exchange-grid { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 20px; }
.rate-box { text-align: center; border: 2px dashed #444; padding: 10px; min-width: 140px; background-color: #2a2a2a; }
.rate-box.highlight { border-color: #FFFF00; background-color: #333; }
.currency-label { font-size: 0.8rem; color: #aaa; }
.icon { font-size: 0.8rem; opacity: 0.5; margin: 0 5px; }
.rate-value { font-size: 1.5rem; color: #00FF00; text-shadow: 0 0 5px rgba(0, 255, 0, 0.5); margin: 5px 0; }
.highlight .rate-value { color: #FFFF00; }
.update-time { text-align: center; font-size: 0.7rem; color: #666; margin-top: 10px; border-top: 1px solid #444; padding-top: 5px; font-family: monospace; }

/* --- 小工具網格 (天氣 & 時鐘) --- */
.mini-widgets-grid {
    display: grid;
    /* 預設並排：兩欄 */
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* 天氣卡片 */
.weather-card { background-color: #2c3e50; /* 深藍底 */ border-color: #34495e; }
.weather-content { display: flex; align-items: center; justify-content: center; gap: 15px; }
.weather-icon-box {
    width: 40px; height: 40px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px; padding: 5px;
}
.pixel-w-icon { width: 100%; height: 100%; }
.temp-val { font-size: 1.5rem; font-weight: bold; }
.weather-desc { font-size: 0.8rem; opacity: 0.8; }

/* 時鐘卡片 */
.clock-card { background-color: #1a1a1a; border-color: #333; text-align: center; }
.digital-clock {
    font-size: 2rem; color: #0ff; /* 青色電子光 */
    font-family: 'Courier New', monospace; /* 模擬電子錶字體 */
    letter-spacing: 2px;
}

/* 單字卡片 */
.word-card { background-color: #FFF8E1; color: #333; border-color: #D4A373; text-align: center; }
.word-card .card-label { color: #8d6e63; border-color: #d7ccc8; }
.word-jp { font-size: 1.2rem; font-weight: bold; margin-bottom: 5px; }
.word-cn { font-size: 1rem; color: #666; margin-bottom: 10px; }
.small-btn { font-size: 0.8rem; padding: 4px 10px; background: #fff; }

/* =========================================
   5. 背景動畫 & Footer
========================================= */
.pixel-footer { text-align: center; padding: 40px 0; margin-top: 40px; border-top: var(--pixel-border); background-color: var(--bg-white); position: relative; z-index: 10; }
.pixel-decoration-container { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: -1; overflow: hidden; }
.pixel-deco { position: absolute; shape-rendering: crispEdges; filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.1)); }
.deco-cloud-1 { width: 80px; top: 15%; left: -100px; opacity: 0.8; animation: driftCloud 60s linear infinite; }
.deco-cloud-2 { width: 60px; top: 25%; left: -100px; opacity: 0.6; animation: driftCloud 45s linear infinite reverse; animation-delay: -20s; }
.deco-sakura { width: 15px; top: -20px; left: 10%; animation: fallingSakura 12s linear infinite, rotateSakura 8s linear infinite; }
.sakura-2 { left: 25%; animation-delay: 4s; }
.sakura-3 { left: 5%; animation-delay: 7s; }
.deco-torii { width: 50px; bottom: -5px; left: 20px; animation: bobbing 3s ease-in-out infinite alternate; }
.deco-boba { width: 40px; bottom: -5px; right: 20px; animation: bobbing 2.5s ease-in-out infinite alternate-reverse; }

@keyframes driftCloud { from { transform: translateX(0); } to { transform: translateX(calc(100vw + 200px)); } }
@keyframes fallingSakura { 0% { transform: translateY(0) translateX(0); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { transform: translateY(100vh) translateX(50px); opacity: 0; } }
@keyframes rotateSakura { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes bobbing { 0% { transform: translateY(0); } 100% { transform: translateY(-10px); } }

/* =========================================
   6. RWD 手機版
========================================= */
@media (max-width: 768px) {
    .site-title { font-size: 1.8rem; }
    .logo-area { gap: 15px; padding: 15px 0; }
    .pixel-flag { width: 45px; }
    
    .pixel-nav { flex-direction: column; gap: 15px; }
    .nav-group-home { width: 100%; justify-content: center; }
    .nav-group-home .pixel-btn { width: 100%; text-align: center; }
    .nav-group-lang { width: 100%; justify-content: center; gap: 10px; }
    .hero-content { flex-direction: column; text-align: center; }
    
    .map-container { flex-direction: column; gap: 40px; align-items: center; }
    .pixel-map-svg { width: 260px; }
    
    /* 情報局手機版優化 */
    .exchange-grid { flex-direction: column; } /* 匯率垂直堆疊 */
    .rate-box { width: 100%; }
    
    /* 在手機上，讓小工具網格依然保持並排 (一列兩個) */
    .mini-widgets-grid {
        gap: 10px;
        /* 手機字體稍微縮小以免爆版 */
        font-size: 0.9rem;
    }
    .temp-val { font-size: 1.2rem; }
    .digital-clock { font-size: 1.5rem; }
    
    .deco-torii, .deco-boba { opacity: 0.5; width: 30px; }
}