:root {
    --primary-color: #1a202c; /* 深藍灰 */
    --secondary-color: #2d3748; /* 次深藍灰 */
    --accent-color: #4299e1; /* 藍色 */
    --highlight-color: #e53e3e; /* 紅色 */
    --text-color: #4a5568; /* 文字灰 */
    --bg-color: #f7fafc; /* 背景淺灰 */
    --header-bg: #ffffff;
    --transition-speed: 0.3s;
    --hover-scale: 1.02;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* 添加平滑滾動效果 */
html {
    scroll-behavior: smooth;
}

/* 導航欄樣式優化 */
header {
    transition: all var(--transition-speed);
    backdrop-filter: blur(8px);
    background-color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

header:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.98);
}

nav a {
    position: relative;
    transition: all var(--transition-speed);
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-weight: 500;
}

nav a:hover {
    color: var(--accent-color) !important;
    background-color: rgba(66, 153, 225, 0.1);
    transform: translateY(-1px);
}

nav a.active {
    color: var(--highlight-color) !important;
    font-weight: 600;
    background-color: rgba(229, 62, 62, 0.1);
    box-shadow: 0 2px 4px rgba(229, 62, 62, 0.1);
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, var(--highlight-color), var(--accent-color));
    transform: scaleX(1);
    transition: transform var(--transition-speed);
    box-shadow: 0 2px 4px rgba(229, 62, 62, 0.2);
}

nav a.active:hover::after {
    transform: scaleX(1.1);
}

/* 內容區域優化 */
.prose {
    max-width: 65ch;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.prose:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.prose h1 {
    font-size: 2.5em;
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
    font-weight: 700;
    position: relative;
    transition: color var(--transition-speed);
}

.prose h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--accent-color);
    margin: 1rem auto;
    border-radius: 2px;
    transition: width var(--transition-speed);
}

.prose h1:hover {
    color: var(--accent-color);
}

.prose h1:hover::after {
    width: 100px;
}

.prose h2 {
    font-size: 1.75em;
    color: var(--primary-color);
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1.5rem;
    transition: all var(--transition-speed);
}

.prose h2:hover {
    color: var(--accent-color);
    transform: translateX(5px);
}

.prose h3 {
    font-size: 1.5em;
    color: var(--secondary-color);
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.4rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.prose h4 {
    font-size: 1.25em;
    color: var(--accent-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.prose p {
    margin-bottom: 1.5rem;
    text-align: justify;
    line-height: 1.8;
    transition: color var(--transition-speed);
}

.prose p:hover {
    color: var(--primary-color);
}

.prose ul, .prose ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.75rem;
    line-height: 1.8;
}

.prose ul li, .prose ol li {
    transition: transform var(--transition-speed);
    padding-left: 0.5rem;
}

.prose ul li:hover, .prose ol li:hover {
    transform: translateX(5px);
    color: var(--accent-color);
}

.prose code {
    background-color: #edf2f7;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    transition: all var(--transition-speed);
    cursor: pointer;
}

.prose code:hover {
    background-color: #e2e8f0;
    transform: scale(1.05);
}

.prose blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin: 2rem 0;
    background-color: #f8fafc;
    border-radius: 0 0.5rem 0.5rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-speed);
    cursor: pointer;
}

.prose blockquote:hover {
    transform: translateX(10px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: #f0f4f8;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all var(--transition-speed);
}

.prose table:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.prose th, .prose td {
    border: 1px solid #cbd5e0;
    padding: 1rem;
    text-align: left;
}

.prose th {
    background-color: #edf2f7;
    font-weight: 600;
    color: var(--primary-color);
    transition: background-color var(--transition-speed);
}

.prose th:hover {
    background-color: #e2e8f0;
}

.prose tr:nth-child(even) {
    background-color: #f8fafc;
}

.prose tr {
    transition: all var(--transition-speed);
}

.prose tr:hover {
    background-color: #edf2f7;
    transform: scale(1.01);
}

.prose img {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
    max-width: 100%;
    height: auto;
    transition: all var(--transition-speed);
    cursor: pointer;
}

.prose img:hover {
    transform: scale(var(--hover-scale));
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* 添加返回頂部按鈕樣式 */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--accent-color);
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-speed);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background-color: var(--highlight-color);
}

/* 添加頁面載入動畫 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    opacity: 0;
}

.animate-fade-in:nth-child(1) { animation-delay: 0.1s; }
.animate-fade-in:nth-child(2) { animation-delay: 0.2s; }
.animate-fade-in:nth-child(3) { animation-delay: 0.3s; }
.animate-fade-in:nth-child(4) { animation-delay: 0.4s; }
.animate-fade-in:nth-child(5) { animation-delay: 0.5s; }
.animate-fade-in:nth-child(6) { animation-delay: 0.6s; }
.animate-fade-in:nth-child(7) { animation-delay: 0.7s; }
.animate-fade-in:nth-child(8) { animation-delay: 0.8s; }
.animate-fade-in:nth-child(9) { animation-delay: 0.9s; }
.animate-fade-in:nth-child(10) { animation-delay: 1s; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in {
    animation: slideIn 0.6s ease-out forwards;
    opacity: 0;
}

/* 響應式設計優化 */
@media (max-width: 768px) {
    .prose {
        padding: 1rem;
        margin: 1rem;
    }
    
    .prose h1 {
        font-size: 2em;
    }
    
    .prose h2 {
        font-size: 1.5em;
    }
    
    .prose h3 {
        font-size: 1.25em;
    }

    nav {
        padding: 0.5rem;
    }

    nav a {
        padding: 0.75rem;
        margin: 0.25rem;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* 列印樣式優化 */
@media print {
    .prose {
        max-width: none;
        box-shadow: none;
        padding: 0;
        animation: none;
        transform: none !important;
    }
    
    .prose h1, .prose h2, .prose h3 {
        page-break-after: avoid;
    }
    
    .prose img {
        max-width: 100% !important;
        page-break-inside: avoid;
        box-shadow: none;
    }

    .prose blockquote {
        box-shadow: none;
        border-left-width: 2px;
    }

    .back-to-top {
        display: none;
    }
    
    nav a:hover,
    .prose h1:hover,
    .prose h2:hover,
    .prose p:hover,
    .prose li:hover,
    .prose code:hover,
    .prose blockquote:hover,
    .prose tr:hover,
    .prose img:hover {
        transform: none !important;
        color: inherit !important;
        background-color: transparent !important;
    }
}

/* 首頁卡片樣式優化 */
.chapter-card {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-speed);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(66, 153, 225, 0.1), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.chapter-card:hover {
    transform: translateY(-5px) scale(var(--hover-scale));
    box-shadow: var(--card-shadow-hover);
}

.chapter-card:hover::before {
    transform: translateX(100%);
}

/* Hero Section 優化 */
.hero-section {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #2d3748, #1a202c);
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(66, 153, 225, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.5; }
}

/* 滾動進度條 */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--accent-color), var(--highlight-color));
    transform-origin: 0 50%;
    transform: scaleX(0);
    z-index: 1000;
    transition: transform 0.1s ease-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.scroll-progress::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3));
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 響應式設計優化 */
@media (max-width: 768px) {
    .prose {
        padding: 1rem;
        margin: 1rem;
    }
    
    nav a {
        padding: 0.75rem;
        margin: 0.25rem;
    }
    
    .chapter-card {
        margin: 0.5rem;
    }
}

/* 列印樣式優化 */
@media print {
    .prose {
        animation: none;
        transform: none !important;
        box-shadow: none;
        background: none;
    }
    
    .scroll-progress {
        display: none;
    }
    
    nav a:hover,
    .prose h1:hover,
    .prose h2:hover,
    .prose p:hover,
    .prose li:hover,
    .prose code:hover,
    .prose blockquote:hover,
    .prose tr:hover,
    .prose img:hover {
        transform: none !important;
        color: inherit !important;
        background-color: transparent !important;
    }
} 