/* ====================
   全域變數與基礎設定
==================== */
:root {
    --bg-color: #f8fafc;
    --text-main: #334155;
    --text-light: #64748b;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --accent-color: #38bdf8;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --card-bg: #ffffff;
}

html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: '微軟正黑體', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.8;
}

/* 頂部跑馬燈警告 */
.warning-banner {
    background-color: var(--danger-color);
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    animation: flash 2s infinite;
}
@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* ====================
   導覽列 Navbar
==================== */
.navbar {
    background-color: #ffffff;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--accent-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}
.nav-logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}
.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
}
.nav-links li a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: bold;
    transition: 0.2s;
}
.nav-links li a:hover { color: var(--primary-color); }
.btn-game-nav {
    background-color: var(--primary-color);
    color: white !important;
    padding: 8px 15px;
    border-radius: 20px;
}

/* ====================
   標頭區塊 Hero
==================== */
.hero {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    text-align: center;
    padding: 60px 20px;
}
.hero h1 { font-size: 2.8rem; color: var(--primary-color); margin: 0 0 10px 0; }
.hero p { font-size: 1.2rem; margin: 0; }
.subtitle { font-weight: bold; color: var(--danger-color) !important; margin-top: 15px; }

/* ====================
   內容區塊 共用設定
==================== */
.content-section { max-width: 900px; margin: 50px auto; padding: 0 20px; }
h2 {
    font-size: 2rem;
    color: var(--primary-color);
    border-left: 6px solid var(--accent-color);
    padding-left: 15px;
    margin-bottom: 30px;
}
.highlight { background-color: #fef08a; padding: 0 5px; font-weight: bold; }
.center-text { text-align: center; }

/* ====================
   點擊展開 UI (案例區)
==================== */
.tab-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}
.tab-btn {
    background-color: #f1f5f9;
    border: 2px solid #e2e8f0;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    color: var(--text-light);
    transition: all 0.3s ease;
}
.tab-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.tab-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(37,99,235,0.2);
}
.tab-content-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border-left: 5px solid var(--primary-color);
    min-height: 150px;
}
.tab-content { display: none; animation: fadeIn 0.5s; }
.tab-content.active { display: block; }
.tab-content h3 { color: var(--primary-color); margin-top: 0; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ====================
   五大絕招卡片排版
==================== */
.card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.step-card-new {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    position: relative;
    transition: transform 0.2s;
}
.step-card-new:hover { transform: translateY(-5px); box-shadow: 0 10px 15px rgba(0,0,0,0.1); }
.step-card-new .icon { font-size: 2.5rem; margin-bottom: 10px; }
.step-card-new h3 { color: var(--primary-color); margin: 0 0 10px 0; font-size: 1.2rem; }

.whoscall-box {
    background: linear-gradient(to right, #f0fdf4, #dcfce7);
    border: 2px solid #4ade80;
    padding: 25px;
    border-radius: 12px;
}
.whoscall-box h3 { color: #166534; margin-top: 0; }
.whoscall-box ul { list-style: none; padding: 0; }
.whoscall-box li { margin-bottom: 10px; }

/* ====================
   模擬 AI 對話框 UI
==================== */
.chat-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}
.chat-box {
    height: 350px;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.message { display: flex; gap: 10px; max-width: 80%; }
.message .avatar { font-size: 1.5rem; }
.message .text {
    padding: 12px 18px;
    border-radius: 15px;
    font-size: 1rem;
    line-height: 1.5;
}
.bot-message { align-self: flex-start; }
.bot-message .text { background-color: #e0f2fe; color: #0369a1; border-top-left-radius: 0; }
.user-message { align-self: flex-end; flex-direction: row-reverse; }
.user-message .text { background-color: var(--primary-color); color: white; border-top-right-radius: 0; }

.chat-input-area {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
}
.chat-input-area input {
    flex: 1;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    outline: none;
    font-size: 1rem;
}
.chat-input-area input:focus { border-color: var(--primary-color); }
.chat-input-area button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 20px;
    margin-left: 10px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
}

/* 打字特效 */
.typing-indicator span {
    animation: blink 1.4s infinite both;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* ====================
   按鈕與 Modal (遊戲區塊)
==================== */
.btn-primary {
    background-color: var(--primary-color);
    color: white; border: none; padding: 15px 30px; font-size: 1.2rem;
    border-radius: 8px; cursor: pointer; font-weight: bold; box-shadow: 0 4px 6px rgba(37,99,235,0.3);
}
.modal {
    display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(15,23,42,0.8); backdrop-filter: blur(5px);
    justify-content: center; align-items: center;
}
.modal-content {
    background-color: var(--card-bg); padding: 30px; border-radius: 16px;
    width: 90%; max-width: 600px; position: relative;
}
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 30px; cursor: pointer; }
.progress-bar { width: 100%; height: 8px; background: #e2e8f0; border-radius: 4px; margin-bottom: 20px; }
#progress-fill { height: 100%; width: 0%; background: var(--primary-color); transition: 0.3s; }
.game-btn { background: #f1f5f9; border: 2px solid #cbd5e1; padding: 15px; border-radius: 8px; cursor: pointer; width: 100%; text-align: left; margin-bottom: 10px; }
.next-btn { text-align: center; background: var(--primary-color); color: white; border: none; }
.feedback { margin-top: 20px; padding: 15px; border-radius: 8px; font-weight: bold; display: none; }
.feedback.success { display: block; background: #dcfce7; color: #166534; border-left: 4px solid #22c55e; }
.feedback.error { display: block; background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }

/* 頁尾 */
footer { background-color: #1e293b; color: #cbd5e1; text-align: center; padding: 30px 20px; margin-top: 50px; }

/* 響應式手機版 */
@media (max-width: 768px) {
    .card-grid { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .tab-container { flex-direction: column; }
    .tab-btn { text-align: center; }
}