/* ==========================================================================
   🏫 澳門特教學校校本教材：共用設計樣式庫 (shared_style.css)
   ========================================================================== */

:root {
    /* 核心色系：預設為 PowerPoint 暖橘，可由各科目主頁面覆寫 */
    --primary: #FF7A00; 
    --primary-light: #FFF0E0;
    --secondary: #0085FF; 
    --secondary-light: #E6F3FF;
    --success: #00C853;
    --success-light: #E8F9EE;
    --warning: #FFD600;
    --bg-body: #F4F7FC;
    --bg-card: #FFFFFF;
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    --border-radius-sm: 12px;
    --border-radius-md: 20px;
    --border-radius-lg: 32px;
    --padding-card: 30px;
    --border-radius: var(--border-radius-md); /* 保持向後相容 */
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 20px rgba(44, 62, 80, 0.08);
    --shadow-lg: 0 20px 40px rgba(44, 62, 80, 0.12);
    --font-friendly: 'Fredoka', 'Noto Sans TC', sans-serif;
    
    /* 特教無障礙字體縮放變數 */
    --text-scale: 1.0;

    /* Mascot Identity Colors */
    --color-xiao-ao: #0085ff;      /* Sky Blue */
    --color-xiao-lian: #ff66a3;    /* Lotus Pink */
    --color-bibi: #ffb700;         /* Tech Amber */
    
    /* 預設非學科主視覺灰色，降低視覺疲勞 */
    --subject-primary: #64748b;
}

[data-theme="dark"] {
    --subject-primary: #94a3b8;
}

/* ==========================================================================
   各學科主題配套變數 (Subject Specific Color Themes)
   ========================================================================== */

/* 1. 中文科 (Chinese) */
body.theme-chinese {
    --primary: #ef4444; 
    --primary-light: #fef2f2;
    --subject-primary: #ef4444;
    --subject-bg-grad: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}
[data-theme="dark"] body.theme-chinese {
    --bg-body: #180c0c;
    --primary-light: #2a1212;
    --subject-bg-grad: linear-gradient(135deg, #180c0c 0%, #2a1212 100%);
}

/* 2. 數學科 (Mathematics) */
body.theme-math {
    --primary: #f59e0b; 
    --primary-light: #fffbeb;
    --subject-primary: #f59e0b;
    --subject-bg-grad: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
[data-theme="dark"] body.theme-math {
    --bg-body: #1c1505;
    --primary-light: #2e2207;
    --subject-bg-grad: linear-gradient(135deg, #1c1505 0%, #2e2207 100%);
}

/* 3. 英文科 (English) */
body.theme-english {
    --primary: #3b82f6; 
    --primary-light: #eff6ff;
    --subject-primary: #3b82f6;
    --subject-bg-grad: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}
[data-theme="dark"] body.theme-english {
    --bg-body: #091325;
    --primary-light: #112240;
    --subject-bg-grad: linear-gradient(135deg, #091325 0%, #112240 100%);
}

/* 4. 科學與常識科 (Science & GK) */
body.theme-science {
    --primary: #10b981; 
    --primary-light: #ecfdf5;
    --subject-primary: #10b981;
    --subject-bg-grad: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}
[data-theme="dark"] body.theme-science {
    --bg-body: #061f14;
    --primary-light: #0d3822;
    --subject-bg-grad: linear-gradient(135deg, #061f14 0%, #0d3822 100%);
}

/* 5. 地理與歷史科 (Geography & History) */
body.theme-geography {
    --primary: #8b5cf6; 
    --primary-light: #f5f3ff;
    --subject-primary: #8b5cf6;
    --subject-bg-grad: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
}
[data-theme="dark"] body.theme-geography {
    --bg-body: #110925;
    --primary-light: #1e113a;
    --subject-bg-grad: linear-gradient(135deg, #110925 0%, #1e113a 100%);
}

/* 6. 美勞與工藝科 (Arts & Crafts) */
body.theme-arts {
    --primary: #ec4899; 
    --primary-light: #fdf2f8;
    --subject-primary: #ec4899;
    --subject-bg-grad: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
}
[data-theme="dark"] body.theme-arts {
    --bg-body: #220516;
    --primary-light: #3b0724;
    --subject-bg-grad: linear-gradient(135deg, #220516 0%, #3b0724 100%);
}

/* 7. 宗教科 (Religion) */
body.theme-religion {
    --primary: #eab308; 
    --primary-light: #fefce8;
    --subject-primary: #eab308;
    --subject-bg-grad: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
}
[data-theme="dark"] body.theme-religion {
    --bg-body: #201a03;
    --primary-light: #302604;
    --subject-bg-grad: linear-gradient(135deg, #201a03 0%, #302604 100%);
}

/* 8. 語言與手語科 (Sign Language) */
body.theme-sign {
    --primary: #14b8a6; 
    --primary-light: #f0fdfa;
    --subject-primary: #14b8a6;
    --subject-bg-grad: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
}
[data-theme="dark"] body.theme-sign {
    --bg-body: #041d19;
    --primary-light: #0c3830;
    --subject-bg-grad: linear-gradient(135deg, #041d19 0%, #0c3830 100%);
}

/* 9. 其他與生活自理科 (Others & Life) */
body.theme-others {
    --primary: #6366f1; 
    --primary-light: #eef2ff;
    --subject-primary: #6366f1;
    --subject-bg-grad: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}
[data-theme="dark"] body.theme-others {
    --bg-body: #0b0d23;
    --primary-light: #15183f;
    --subject-bg-grad: linear-gradient(135deg, #0b0d23 0%, #15183f 100%);
}


* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-friendly);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    padding-bottom: 80px;
    font-size: calc(18px * var(--text-scale));
}

/* ==========================================================================
   12. 全新右下角學習輔助懸浮工具欄 (Expandable Floating Accessibility Widget)
   ========================================================================== */
.floating-accessibility-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 50px;
    padding: 6px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    z-index: 1200;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overflow: hidden;
    width: 330px;
    height: 48px;
}

/* 當收折狀態時的樣式 (極致精美圓形懸浮鈕 - 靜態 75% 透明灰色低干擾，Hover 100% 分科主題色激活) */
.floating-accessibility-widget.collapsed {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(241, 245, 249, 0.25) !important; /* 75% 高透明淺灰，極致低干擾 */
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
[data-theme="dark"] .floating-accessibility-widget.collapsed {
    background: rgba(30, 41, 59, 0.25) !important; /* 暗色模式 75% 高透明深灰 */
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.floating-accessibility-widget.collapsed:hover {
    transform: scale(1.08) rotate(8deg);
    background: var(--subject-primary, var(--color-xiao-ao)) !important; /* 懸浮時激活為 100% 飽和分科主題色 */
    border-color: transparent !important;
    box-shadow: 0 6px 20px color-mix(in srgb, var(--subject-primary, var(--color-xiao-ao)) 45%, transparent);
}

/* 改以透明度及寬度過渡來防止排版閃跳 */
.acc-widget-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 8px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    width: auto;
}

.floating-accessibility-widget.collapsed .acc-widget-content {
    display: flex !important;
    opacity: 0;
    visibility: hidden;
    width: 0;
    overflow: hidden;
    padding: 0;
    margin: 0;
    gap: 0;
    pointer-events: none;
}

.floating-accessibility-widget.collapsed .acc-toggle-trigger {
    background: transparent !important;
    color: #64748b !important; /* 預設低干擾灰色圖標 */
    box-shadow: none !important;
    width: 100% !important;
    height: 100% !important;
    font-size: 36px !important; /* 放大圖標至 36px，保證特教大視能友善度 */
    margin: 0 !important;
    transition: var(--transition-smooth);
}
[data-theme="dark"] .floating-accessibility-widget.collapsed .acc-toggle-trigger {
    color: #94a3b8 !important;
}

.floating-accessibility-widget.collapsed:hover .acc-toggle-trigger {
    color: white !important; /* Hover 時變為 100% 純白 */
}

.acc-widget-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.acc-widget-btn {
    background: var(--bg-primary);
    border: none;
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.acc-widget-btn:hover {
    background: var(--subject-primary, var(--color-xiao-ao));
    color: var(--white);
    transform: scale(1.1);
}

.acc-toggle-trigger {
    background: var(--bg-primary);
    border: none;
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.acc-toggle-trigger:hover {
    background: var(--subject-primary, var(--color-xiao-ao));
    color: var(--white);
}

@media print {
    .floating-accessibility-widget {
        display: none !important;
    }
}

/* 列印專用頁首與頁尾預設在螢幕隱藏 */
.print-only-header,
.print-only-footer {
    display: none;
}

/* 課本主容器 */
.container {
    max-width: 1280px;
    margin: 30px auto;
    padding: 0 20px;
}

/* 課本大標題卡片 */
.textbook-header {
    background: linear-gradient(135deg, var(--primary) 0%, #FF9E43 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.textbook-header::after {
    content: "";
    position: absolute;
    width: 250px;
    height: 250px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    bottom: -50px;
    right: -50px;
}

.badge-lesson {
    background-color: rgba(255, 255, 255, 0.25);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.textbook-header h2 {
    font-size: calc(2.2rem * var(--text-scale));
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.scenario-box {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    padding: 20px;
    margin-top: 15px;
    font-size: calc(1.05rem * var(--text-scale));
    border-left: 5px solid var(--warning);
}

/* 學習夥伴導引區 */
.mascots-section {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.section-title {
    font-size: calc(1.4rem * var(--text-scale));
    color: var(--text-main);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 3px solid var(--primary-light);
    padding-bottom: 10px;
}

.mascots-container {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.mascot-card {
    flex: 1;
    min-width: 280px;
    background: var(--bg-body);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
    border: 2px solid transparent;
}

.mascot-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

/* 角色 Avatar 設計 */
.mascot-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.xiao-ao-bg {
    background-color: #FFFFFF;
    border: 4px solid var(--color-xiao-ao);
}
.xiao-ao-face {
    width: 50px;
    height: 50px;
    background: #FFF;
    border-radius: 50%;
    position: relative;
}
.xiao-ao-eye {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #2C3E50;
    border-radius: 50%;
    top: 15px;
    left: 25px;
    animation: eye-blink 3.2s infinite ease-in-out;
}
.xiao-ao-beak {
    position: absolute;
    width: 25px;
    height: 15px;
    background: #FFAD00;
    border-radius: 0 50% 50% 0;
    top: 18px;
    left: 35px;
}
.xiao-ao-badge {
    position: absolute;
    bottom: -5px;
    background: var(--color-xiao-ao);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* 角色 B: 小蓮 (Dolphin) V8-2 */
.xiao-lian-bg {
    background-color: #FFFFFF;
    border: 4px solid var(--color-xiao-lian);
}
.xiao-lian-face {
    width: 50px;
    height: 50px;
    background: #FFFFFF;
    border-radius: 50%;
    position: relative;
}
.xiao-lian-eye {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #2C3E50;
    border-radius: 50%;
    top: 15px;
    left: 25px;
    animation: eye-blink 3.5s infinite ease-in-out 1.2s;
}
.xiao-lian-smile-line {
    position: absolute;
    width: 14px;
    height: 8px;
    border: 2px solid var(--color-xiao-lian);
    border-radius: 0 0 10px 10px;
    border-top: 0;
    top: 28px;
    left: 30px;
    display: block; /* Smile curve V8-2 mouth */
}
.xiao-lian-clip {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #e6cc80; 
    border-radius: 50%;
    top: 3px;
    left: 12px;
    border: 1.5px dashed #b48a38; 
    box-shadow: inset 0 0 2px rgba(0,0,0,0.1);
}
.xiao-lian-clip::after {
    content: "杏";
    position: absolute;
    font-size: 5.5px;
    font-weight: 900;
    color: #b48a38;
    top: 0.5px;
    left: 1.5px;
    line-height: 1;
    font-family: 'Noto Sans TC', sans-serif;
}
.tail-fin-swim {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-xiao-lian);
    border-radius: 50% 50% 0 0;
    bottom: 6px;
    left: -8px;
    transform: rotate(-45deg);
    display: block;
}
.tail-fin-swim::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--color-xiao-lian);
    border-radius: 50% 50% 0 0;
    bottom: 0px;
    left: -6px;
    transform: rotate(90deg);
}
.xiao-lian-badge {
    position: absolute;
    bottom: -5px;
    background: var(--color-xiao-lian);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

.bibi-bg {
    background-color: #2C3E50;
    border: 4px solid var(--color-bibi);
}
.bibi-face {
    width: 50px;
    height: 40px;
    background: #00E5FF;
    border-radius: 10px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.bibi-eye {
    width: 14px;
    height: 14px;
    background: #2C3E50;
    border-radius: 50%;
    animation: eye-blink 2.8s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 7.5px;
    font-weight: bold;
    font-family: 'Outfit', 'Inter', 'sans-serif';
    overflow: hidden;
    user-select: none;
    line-height: 1;
}
.bibi-antenna {
    position: absolute;
    width: 4px;
    height: 12px;
    background: var(--warning);
    top: -12px;
    border-radius: 2px;
}
.bibi-antenna::after {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--warning);
    border-radius: 50%;
    top: -6px;
    left: -3px;
}

/* Organic Eye Blinking Animations (desynchronized) */
@keyframes eye-blink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.05); }
}

.mascot-info h3 {
    font-size: calc(1.2rem * var(--text-scale));
    margin-bottom: 5px;
    color: var(--text-main);
}

.mascot-info p {
    font-size: calc(0.95rem * var(--text-scale));
    color: var(--text-muted);
}

/* 課本對話故事區 */
.story-section {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
}

.chat-bubble-container {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.chat-bubble-container.reverse {
    flex-direction: row-reverse;
}

.chat-bubble {
    background-color: var(--bg-body);
    border-radius: 20px;
    padding: 20px;
    position: relative;
    flex-grow: 1;
    box-shadow: var(--shadow-sm);
    border: 2px solid #E2E8F0;
}

.chat-bubble-container.reverse .chat-bubble {
    background-color: var(--primary-light);
    border-color: #FFE0C2;
}

.chat-speaker {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.chat-bubble-container.reverse .chat-speaker {
    color: var(--secondary);
}

/* 分軌實作區 */
.track-tabs-container {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--primary);
}

.track-intro {
    text-align: center;
    margin-bottom: 25px;
}

.track-intro h3 {
    font-size: calc(1.5rem * var(--text-scale));
    color: var(--primary);
    margin-bottom: 8px;
}

.tabs-header {
    display: flex;
    background: var(--bg-body);
    padding: 8px;
    border-radius: 50px;
    margin-bottom: 30px;
    gap: 5px;
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 15px 10px;
    border-radius: 40px;
    font-weight: 700;
    font-size: calc(1.1rem * var(--text-scale));
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.tab-btn:nth-child(2).active {
    background: var(--secondary);
}

.tab-btn:nth-child(3).active {
    background: var(--success);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

/* Mascot Speaking Visual Pulsing Animation */
.speaking-avatar-pulse {
    animation: speaking-pulse-animation 1s infinite ease-in-out;
    border-width: 5px !important;
}

.xiao-ao-bg.speaking-avatar-pulse {
    border-color: var(--color-xiao-ao) !important;
    box-shadow: 0 0 20px rgba(0, 133, 255, 0.6) !important;
}

.xiao-lian-bg.speaking-avatar-pulse {
    border-color: var(--color-xiao-lian) !important;
    box-shadow: 0 0 20px rgba(255, 102, 163, 0.6) !important;
}

.bibi-bg.speaking-avatar-pulse {
    border-color: var(--color-bibi) !important;
    box-shadow: 0 0 20px rgba(255, 183, 0, 0.6) !important;
}

@keyframes speaking-pulse-animation {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   11. 特教無障礙標準規格：吉祥物頭像階梯尺寸、Sticky 毛玻璃導航、螢幕端工作紙隱藏
   ========================================================================== */

/* 11.1 螢幕端紙本工作紙全面強制隱藏，杜絕主畫面雜訊 */
.worksheet-print-area {
    display: none !important;
}

/* 11.2 吉祥物三級尺寸標準規格與完美幾何縮放比例 */
.avatar-lg {
    width: 120px !important;
    height: 120px !important;
}
.avatar-lg .xiao-ao-face, .avatar-lg .xiao-lian-face {
    width: 75px !important;
    height: 75px !important;
}
.avatar-lg .xiao-ao-eye, .avatar-lg .xiao-lian-eye {
    width: 12px !important;
    height: 12px !important;
    top: 22px !important;
    left: 37px !important;
}
.avatar-lg .xiao-ao-beak {
    width: 37px !important;
    height: 22px !important;
    top: 27px !important;
    left: 52px !important;
}
.avatar-lg .xiao-lian-smile-line {
    width: 21px !important;
    height: 12px !important;
    top: 42px !important;
    left: 45px !important;
}
.avatar-lg .xiao-lian-clip {
    width: 18px !important;
    height: 18px !important;
    top: 4px !important;
    left: 18px !important;
}
.avatar-lg .tail-fin-swim {
    width: 18px !important;
    height: 18px !important;
    bottom: 9px !important;
    left: -12px !important;
}
.avatar-lg .bibi-face {
    width: 75px !important;
    height: 60px !important;
    border-radius: 15px !important;
}
.avatar-lg .bibi-eye {
    width: 21px !important;
    height: 21px !important;
    font-size: 11px !important;
}
.avatar-lg .bibi-antenna {
    width: 6px !important;
    height: 18px !important;
    top: -18px !important;
}

.avatar-md {
    width: 80px !important;
    height: 80px !important;
}

.avatar-sm {
    width: 65px !important;
    height: 65px !important;
}
.avatar-sm .xiao-ao-face, .avatar-sm .xiao-lian-face {
    width: 42px !important;
    height: 42px !important;
}
.avatar-sm .xiao-ao-eye, .avatar-sm .xiao-lian-eye {
    width: 6px !important;
    height: 6px !important;
    top: 13px !important;
    left: 21px !important;
}
.avatar-sm .xiao-ao-beak {
    width: 21px !important;
    height: 12px !important;
    top: 15px !important;
    left: 29px !important;
}
.avatar-sm .xiao-lian-smile-line {
    width: 12px !important;
    height: 7px !important;
    top: 24px !important;
    left: 25px !important;
}
.avatar-sm .xiao-lian-clip {
    width: 10px !important;
    height: 10px !important;
    top: 3px !important;
    left: 10px !important;
}
.avatar-sm .tail-fin-swim {
    width: 10px !important;
    height: 10px !important;
    bottom: 5px !important;
    left: -6px !important;
}
.avatar-sm .bibi-face {
    width: 42px !important;
    height: 34px !important;
    border-radius: 8px !important;
}
.avatar-sm .bibi-eye {
    width: 11px !important;
    height: 11px !important;
    font-size: 6.5px !important;
}
.avatar-sm .bibi-antenna {
    width: 3.5px !important;
    height: 10px !important;
    top: -10px !important;
}

/* 11.3 Sticky 頂部毛玻璃無障礙導航欄 */
.sticky-glass-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 32px;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}
[data-theme="dark"] .sticky-glass-header {
    background: rgba(15, 23, 42, 0.75);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-logo-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--white);
    box-shadow: var(--shadow-sm);
}

.header-brand-title {
    font-size: 1.15rem;
    font-weight: 900;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
[data-theme="dark"] .header-brand-title {
    color: var(--text-main);
}

.header-highlight-span {
    color: inherit !important;
    font-weight: 900;
    text-decoration: none !important;
    transition: var(--transition-smooth);
}

.header-highlight-span:hover {
    color: var(--subject-primary, var(--color-xiao-ao)) !important;
    text-decoration: none !important;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.header-logo-link:hover {
    transform: scale(1.08);
}

.header-actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-acc-btn {
    background: var(--bg-primary);
    border: 2px solid transparent;
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}
.nav-acc-btn:hover {
    background: var(--subject-primary, var(--color-xiao-ao));
    color: var(--white);
    transform: scale(1.05);
}

.nav-circle-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}
.nav-circle-btn:hover {
    transform: scale(1.1) rotate(15deg);
    background: var(--subject-primary, var(--color-xiao-ao));
    color: var(--white);
}

@page {
    size: A4 portrait;
    margin: 8mm 12mm 15mm 12mm;
    @bottom-right {
        content: "第 " counter(page) " 頁 / 共 " counter(pages) " 頁";
        font-family: 'Fredoka', 'Noto Sans TC', sans-serif;
        font-size: 10pt;
        font-weight: 700;
        color: #475569;
        vertical-align: bottom;
        padding-bottom: 8mm;
    }
}

@media print {
    /* 1. 隱藏所有網頁交互與控制元素，以及工作紙下載卡片與實體工作紙 */
    .accessibility-bar, 
    .floating-accessibility-widget,
    .sticky-glass-header,
    .tabs-header, 
    .session-tabs-header, 
    .btn-submit, 
    .btn-group, 
    .teacher-evaluation-card,
    footer,
    .btn-acc,
    button,
    input,
    select,
    textarea,
    .discussion-box-premium,
    .discussion-box,
    .track-intro,
    .track-tabs-container,
    .worksheet-section-card,
    .worksheet-print-area {
        display: none !important;
    }

    /* 2. 基礎字體與版面轉為實體列印高對比黑白排版 */
    body {
        background: white !important;
        color: black !important;
        font-size: 12pt !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .container {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 列印專用頁首，靠右上排版，並有精美下邊框 */
    .print-only-header {
        display: block !important;
        text-align: right;
        font-size: 10.5pt;
        font-weight: 700;
        line-height: 1.4;
        color: #475569 !important;
        margin-bottom: 20px;
        border-bottom: 1.5px solid #cbd5e1;
        padding-bottom: 8px;
        font-family: var(--font-friendly);
    }

    /* 隱藏舊版 HTML 固定定位頁尾，避免重複顯示 */
    .print-only-footer {
        display: none !important;
    }

    /* 確保課本內容在列印時有乾淨邊框，但不強制白色背景與黑色文字，以便瀏覽器「背景圖形」核取方塊正常作用 */
    .story-section {
        border-color: #ccc !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
        padding: 15px !important;
        page-break-inside: avoid;
    }

    .mascot-card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }

    /* 學生姓名學號與評量欄位 */
    .print-student-info {
        display: flex;
        justify-content: space-between;
        margin-bottom: 25px;
        font-size: 12pt;
        border: 2px solid black;
        padding: 12px;
        border-radius: 8px;
    }

    /* 清除所有陰影以保證列印清晰，且在未勾選背景圖形時由瀏覽器預設省墨 */
    *:not(.mascot-avatar):not(.mascot-avatar *) {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* 啟用瀏覽器強制列印背景色與外觀設定，保留吉祥物插圖 */
    .mascot-avatar,
    .mascot-avatar * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ==========================================================================
   10. 吉祥物科教科堂 Cosplay 裝飾套裝 (Mascot Subject Cosplays)
   ========================================================================== */

/* Cosplay 道具基準樣式 */
.cosplay-hat {
    position: absolute;
    z-index: 10;
    transition: var(--transition-smooth);
    pointer-events: none;
    display: none;
}

/* A. 中文科：書生小帽與絲帶髮夾 */
.xiao-ao-face.cosplay-chinese::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 12px;
    background: #1e293b;
    top: -10px;
    left: 13px;
    border-radius: 4px 4px 0 0;
    border-bottom: 2px solid #ef4444;
    box-shadow: 0 -2px 0 #ef4444;
    z-index: 5;
}
.xiao-lian-face.cosplay-chinese::before {
    content: "";
    position: absolute;
    width: 22px;
    height: 8px;
    background: #ef4444;
    top: -3px;
    left: 14px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 5;
}

/* B. 數學科：廚師主廚帽與店員遮陽帽 */
.xiao-ao-face.cosplay-math::before {
    content: "";
    position: absolute;
    width: 28px;
    height: 20px;
    background: #ffffff;
    border: 2px solid #94a3b8;
    border-radius: 15px 15px 8px 8px;
    top: -18px;
    left: 11px;
    z-index: 5;
    box-shadow: inset 0 -4px 0 #cbd5e1;
}
.xiao-lian-face.cosplay-math::before {
    content: "";
    position: absolute;
    width: 32px;
    height: 6px;
    background: #f59e0b;
    border-radius: 0 10px 0 0;
    top: -2px;
    left: 15px;
    z-index: 5;
    transform: rotate(-10deg);
}

/* C. 英文科：海藍水手帽與海灘帽 */
.xiao-ao-face.cosplay-english::before {
    content: "";
    position: absolute;
    width: 34px;
    height: 12px;
    background: #e2e8f0;
    border-bottom: 3px solid #3b82f6;
    border-radius: 20px 20px 0 0;
    top: -8px;
    left: 8px;
    z-index: 5;
}
.xiao-lian-face.cosplay-english::before {
    content: "";
    position: absolute;
    width: 24px;
    height: 10px;
    background: #3b82f6;
    border-radius: 4px 10px 0 0;
    top: -6px;
    left: 13px;
    z-index: 5;
    transform: rotate(-5deg);
}

/* D. 科學與常識科：翠綠護目鏡與葉子髮夾 */
.xiao-ao-face.cosplay-science::after {
    content: "";
    position: absolute;
    width: 36px;
    height: 12px;
    background: rgba(16, 185, 129, 0.4);
    border: 2px solid #10b981;
    border-radius: 6px;
    top: 13px;
    left: 10px;
    z-index: 5;
    box-shadow: 0 0 4px #10b981;
}
.xiao-lian-face.cosplay-science::before {
    content: "";
    position: absolute;
    width: 8px;
    height: 12px;
    background: #10b981;
    border-radius: 0 100% 0 100%;
    top: 2px;
    left: 14px;
    transform: rotate(45deg);
    z-index: 5;
}

/* E. 地理與歷史科：探險太陽帽與導遊帽子 */
.xiao-ao-face.cosplay-geography::before {
    content: "";
    position: absolute;
    width: 42px;
    height: 12px;
    background: #d97706;
    border-radius: 20px;
    top: -2px;
    left: 4px;
    z-index: 5;
}
.xiao-ao-face.cosplay-geography::after {
    content: "";
    position: absolute;
    width: 26px;
    height: 12px;
    background: #b45309;
    border-radius: 12px 12px 0 0;
    top: -12px;
    left: 12px;
    z-index: 4;
}
.xiao-lian-face.cosplay-geography::before {
    content: "";
    position: absolute;
    width: 36px;
    height: 10px;
    background: #8b5cf6;
    border-radius: 15px 15px 0 0;
    top: -7px;
    left: 10px;
    z-index: 5;
}

/* F. 美勞與工藝科：畫家貝雷帽 */
.xiao-ao-face.cosplay-arts::before {
    content: "";
    position: absolute;
    width: 32px;
    height: 14px;
    background: #ec4899;
    border-radius: 50%;
    top: -8px;
    left: 7px;
    z-index: 5;
    transform: rotate(-15deg);
}
.xiao-lian-face.cosplay-arts::before {
    content: "";
    position: absolute;
    width: 30px;
    height: 12px;
    background: #db2777;
    border-radius: 50%;
    top: -7px;
    left: 10px;
    z-index: 5;
    transform: rotate(15deg);
}

/* G. 宗教科：金色天使光圈 */
.xiao-ao-face.cosplay-religion::before {
    content: "";
    position: absolute;
    width: 30px;
    height: 8px;
    border: 2.5px solid #fbbf24;
    border-radius: 50%;
    top: -14px;
    left: 10px;
    z-index: 5;
    animation: float-slow 3s infinite ease-in-out;
    box-shadow: 0 0 8px #fbbf24;
}
.xiao-lian-face.cosplay-religion::before {
    content: "";
    position: absolute;
    width: 30px;
    height: 8px;
    border: 2.5px solid #fbbf24;
    border-radius: 50%;
    top: -14px;
    left: 10px;
    z-index: 5;
    animation: float-slow 3s infinite ease-in-out;
    box-shadow: 0 0 8px #fbbf24;
}

/* H. 語言與手語科：手勢標記與浮動 */
.xiao-ao-face.cosplay-sign::before {
    content: "🤟";
    position: absolute;
    font-size: 14px;
    top: -16px;
    left: 18px;
    z-index: 5;
    animation: float-slow 3s infinite ease-in-out;
}
.xiao-lian-face.cosplay-sign::before {
    content: "🤟";
    position: absolute;
    font-size: 14px;
    top: -16px;
    left: 18px;
    z-index: 5;
    animation: float-slow 3s infinite ease-in-out;
}

/* 隱藏裝飾品（當切換到 cosplay 主題時，小蓮自動隱藏經典杏仁餅夾） */
.xiao-lian-face[class*="cosplay-"] .xiao-lian-clip {
    display: none !important;
}

/* 浮動小動畫 */
@keyframes float-slow {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(1deg); }
}

