/* ========================================
   CSS Variables & Reset - Professional Academic Theme
   ======================================== */
:root {
    /* Colors - Inspired by swkang73.github.io */
    --color-primary: #F06000;
    --color-primary-dark: #c85000;
    --color-primary-light: #ff7a1a;
    --color-secondary: #11ABB0;

    --color-bg-dark: #0f0f0f;
    --color-bg-darker: #090909;
    --color-bg-light: #ffffff;
    --color-bg-gray: #f8f8f8;
    --color-bg-section: #1a1a1a;

    --color-text-light: #ffffff;
    --color-text-gray: #9a9a9a;
    --color-text-dark: #333333;
    --color-text-muted: #666666;

    --color-border: rgba(255, 255, 255, 0.1);
    --color-border-dark: rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-primary: 'Open Sans', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 5rem;
    --spacing-3xl: 8rem;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 30px rgba(240, 96, 0, 0.3);
}

@media (max-width: 768px) {
    :root {
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
        --spacing-2xl: 3rem;
        --spacing-3xl: 4rem;
    }
}

/* Reset */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font-primary);
    background-color: var(--color-bg-dark);
    color: var(--color-text-light);
    line-height: 1.7;
    overflow-x: hidden;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ========================================
   Navigation
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-md) 0;
    background: transparent;
    transition: var(--transition-normal);
}

.navbar.scrolled {
    padding: var(--spacing-sm) 0;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-light);
    letter-spacing: 0.1em;
    transition: var(--transition-fast);
}

.nav-logo:hover {
    color: var(--color-primary);
}

.nav-menu {
    display: flex;
    gap: var(--spacing-xs);
}

.nav-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-light);
    padding: var(--spacing-xs) var(--spacing-sm);
    letter-spacing: 0.1em;
    position: relative;
    transition: var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: var(--transition-normal);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

/* Mobile Nav Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background: var(--color-text-light);
    transition: var(--transition-fast);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background:
        url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?ixlib=rb-4.0.3&auto=format&fit=crop&w=2072&q=80') center/cover no-repeat fixed;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(0, 0, 0, 0.6) 0%,
            rgba(0, 0, 0, 0.7) 50%,
            rgba(0, 0, 0, 0.8) 100%);
}

.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: var(--spacing-lg);
    animation: fadeInUp 1s ease 0.3s both;
}

.hero-avatar {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto var(--spacing-lg);
}

.hero-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition-normal);
}

.hero-avatar:hover img {
    transform: scale(1.05);
    border-color: var(--color-primary);
}

.avatar-ring {
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    opacity: 0.5;
    animation: pulse-ring 2s ease-in-out infinite;
}

.hero-name {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.02em;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

.name-text {
    display: inline-block;
    background: linear-gradient(135deg, #fff 0%, #ccc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-roles {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: 1.1rem;
    color: var(--color-text-gray);
    margin-bottom: var(--spacing-md);
}

.hero-roles .separator {
    color: var(--color-primary);
    font-weight: 300;
}

.hero-tagline {
    font-size: 1rem;
    color: var(--color-primary);
    font-weight: 500;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-xl);
    text-transform: uppercase;
}

.hero-social {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.social-link {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: var(--transition-normal);
}

.social-link svg {
    width: 24px;
    height: 24px;
    fill: var(--color-text-light);
    transition: var(--transition-fast);
}

.social-link:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.social-link:hover svg {
    fill: white;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: var(--spacing-xl);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--color-text-gray);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: bounce 2s ease-in-out infinite;
}

.mouse {
    width: 26px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    position: relative;
}

.wheel {
    width: 4px;
    height: 8px;
    background: var(--color-primary);
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll-wheel 1.5s ease-in-out infinite;
}

/* ========================================
   Section Headers
   ======================================== */
.section-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--color-primary);
}

.section-header.light h2 {
    color: var(--color-text-light);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-top: var(--spacing-md);
}

.section-header.light .section-subtitle {
    color: var(--color-text-gray);
}

/* ========================================
   About Section
   ======================================== */
.about {
    padding: var(--spacing-3xl) 0;
    background: var(--color-bg-light);
    color: var(--color-text-dark);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--spacing-2xl);
    align-items: center;
}

.about-image {
    position: relative;
}

.image-frame {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.image-frame img {
    width: 100%;
    height: auto;
    transition: var(--transition-slow);
}

.image-frame:hover img {
    transform: scale(1.05);
}

.image-decoration {
    position: absolute;
    bottom: -20px;
    right: -20px;
    width: 100%;
    height: 100%;
    border: 4px solid var(--color-primary);
    border-radius: 8px;
    z-index: -1;
}

.about-text h3 {
    font-size: 1.75rem;
    margin-bottom: var(--spacing-md);
    color: var(--color-text-dark);
}

.about-text h3 .highlight {
    color: var(--color-primary);
}

.about-intro {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
    line-height: 1.8;
}

.about-text p {
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
}

.about-info {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: var(--color-bg-gray);
    border-radius: 8px;
    border-left: 4px solid var(--color-primary);
}

.info-item {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.info-item:last-child {
    margin-bottom: 0;
}

.info-label {
    font-weight: 600;
    color: var(--color-text-dark);
}

.info-value {
    color: var(--color-text-muted);
}

/* Buttons */
.about-buttons {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 14px 32px;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    border-color: var(--color-primary);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-slow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(240, 96, 0, 0.4);
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover svg {
    transform: translateX(5px);
}

.btn-outline {
    background: transparent;
    color: var(--color-text-dark);
    border-color: var(--color-text-dark);
}

.btn-outline:hover {
    background: var(--color-text-dark);
    color: white;
    transform: translateY(-3px);
}

/* ========================================
   Skills Section
   ======================================== */
.skills {
    padding: var(--spacing-3xl) 0;
    background: var(--color-bg-section);
}

.skills-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2xl);
}

.skills-bars {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.skill-item {
    margin-bottom: var(--spacing-md);
}

.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-xs);
}

.skill-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.skill-percent {
    font-size: 0.9rem;
    color: var(--color-primary);
    font-weight: 600;
}

.skill-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: 4px;
    width: 0;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-progress.animated {
    width: var(--progress);
}

.skills-icons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
}

.tech-icon {
    width: 70px;
    height: 70px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: var(--transition-normal);
    cursor: pointer;
}

.tech-icon:hover {
    transform: translateY(-10px);
    background: rgba(240, 96, 0, 0.1);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}

.tech-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ========================================
   Experience Timeline
   ======================================== */
.experience {
    padding: var(--spacing-3xl) 0;
    background: var(--color-bg-light);
    color: var(--color-text-dark);
}

.timeline {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom,
            var(--color-primary),
            var(--color-secondary),
            var(--color-primary));
}

.timeline-item {
    position: relative;
    width: 50%;
    padding: 0 40px var(--spacing-xl);
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
    padding-right: 60px;
}

.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
    padding-left: 60px;
}

.timeline-icon {
    position: absolute;
    top: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline-item:nth-child(odd) .timeline-icon {
    right: -25px;
}

.timeline-item:nth-child(even) .timeline-icon {
    left: -25px;
}

.timeline-icon.education {
    background: var(--color-primary);
}

.timeline-icon.work {
    background: var(--color-secondary);
}

.timeline-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.timeline-content {
    background: white;
    padding: var(--spacing-lg);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    position: relative;
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 15px;
    width: 0;
    height: 0;
    border: 10px solid transparent;
}

.timeline-item:nth-child(odd) .timeline-content::before {
    right: -20px;
    border-left-color: white;
}

.timeline-item:nth-child(even) .timeline-content::before {
    left: -20px;
    border-right-color: white;
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.timeline-date {
    display: inline-block;
    padding: 4px 12px;
    background: var(--color-primary);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: var(--spacing-sm);
}

.timeline-content h3 {
    font-size: 1.25rem;
    color: var(--color-text-dark);
    margin-bottom: var(--spacing-xs);
}

.timeline-content h4 {
    font-size: 1rem;
    color: var(--color-primary);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.timeline-content p {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* Experience Grid (Papers & Awards) */
.experience-unified {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.unified-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.unified-list li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.unified-list li:last-child {
    border-bottom: none;
}

.unified-list li a {
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
    gap: 4px var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-md);
    margin: 0 calc(-1 * var(--spacing-md));
    align-items: start;
    text-decoration: none;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.unified-list li a:hover {
    background: rgba(240, 96, 0, 0.05);
}

.unified-list li a:hover .title {
    color: var(--color-primary);
}

.unified-list .tag {
    grid-row: 1 / 3;
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    align-self: center;
    /* 顏色由 JavaScript 動態設定 */
}

.unified-list .year {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-text-muted);
    grid-column: 2;
    grid-row: 1;
}

.unified-list .title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text-dark);
    line-height: 1.4;
    grid-column: 3;
    grid-row: 1;
}

.unified-list .venue {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    grid-column: 2 / 4;
    grid-row: 2;
}

@media (max-width: 768px) {
    .unified-list li {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        gap: var(--spacing-xs);
    }

    .unified-list .tag {
        grid-row: auto;
        width: fit-content;
        margin-bottom: var(--spacing-xs);
    }

    .unified-list .year,
    .unified-list .title,
    .unified-list .venue {
        grid-column: 1;
        grid-row: auto;
    }
}

/* ========================================
   Stats Section
   ======================================== */
.stats {
    padding: var(--spacing-2xl) 0;
    position: relative;
    background:
        url('https://images.unsplash.com/photo-1517694712202-14dd9538aa97?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80') center/cover no-repeat fixed;
}

.stats-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}

.stats .container {
    position: relative;
    z-index: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
}

.stat-item {
    text-align: center;
    padding: var(--spacing-lg);
}

.stat-number {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: var(--spacing-xs);
    display: inline-block;
}

.stat-number::after {
    content: '+';
}

.stat-label {
    font-size: 0.9rem;
    color: var(--color-text-gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ========================================
   Contact Section / Footer
   ======================================== */
.contact {
    padding: var(--spacing-3xl) 0 var(--spacing-xl);
    background: var(--color-bg-darker);
}

.contact-content {
    margin-bottom: var(--spacing-2xl);
}

.contact-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.contact-card {
    text-align: center;
    padding: var(--spacing-xl);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: var(--transition-normal);
}

.contact-card:hover {
    background: rgba(240, 96, 0, 0.05);
    border-color: var(--color-primary);
    transform: translateY(-5px);
}

.contact-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(240, 96, 0, 0.1);
}

.contact-icon svg {
    width: 30px;
    height: 30px;
    fill: var(--color-primary);
}

.contact-card h3 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-light);
}

.contact-card a {
    color: var(--color-text-gray);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.contact-card a:hover {
    color: var(--color-primary);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
    color: var(--color-text-gray);
    font-size: 0.9rem;
}

.footer-credit {
    color: var(--color-primary);
    margin-top: var(--spacing-xs);
    font-size: 0.8rem !important;
}

/* ========================================
   Back to Top Button
   ======================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--color-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition-normal);
    z-index: 999;
    box-shadow: var(--shadow-glow);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--color-primary-dark);
    transform: translateY(-5px);
}

.back-to-top svg {
    width: 24px;
    height: 24px;
    fill: white;
}

/* ========================================
   Reveal Animations
   ======================================== */
.reveal-left,
.reveal-right,
.reveal-up {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-left {
    transform: translateX(-50px);
}

.reveal-right {
    transform: translateX(50px);
}

.reveal-up {
    transform: translateY(50px);
}

.reveal-left.revealed,
.reveal-right.revealed,
.reveal-up.revealed {
    opacity: 1;
    transform: translate(0);
}

/* ========================================
   Keyframe Animations
   ======================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse-ring {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(10px);
    }
}

@keyframes scroll-wheel {
    0% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(15px);
    }
}

/* ========================================
   Page Header (Projects)
   ======================================== */
.page-header {
    padding: calc(100px + var(--spacing-2xl)) 0 var(--spacing-2xl);
    background:
        linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
        url('https://images.unsplash.com/photo-1555066931-4365d14bab8c?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80') center/cover no-repeat;
    text-align: center;
}

.page-header h1 {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.page-header p {
    font-size: 1.1rem;
    color: var(--color-text-gray);
}

/* ========================================
   Projects Grid
   ======================================== */
.projects {
    padding: var(--spacing-3xl) 0;
    background: var(--color-bg-light);
}

/* Ensure projects section matches dark theme */
.projects {
    background-color: var(--color-bg-dark);
    min-height: 50vh;
    /* Ensure it takes space even if empty */
    position: relative;
    z-index: 1;
}

.error-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: #ff4444;
    font-size: 1.2rem;
    padding: 40px;
    background: rgba(255, 68, 68, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--spacing-lg);
}

.project-card {
    background: var(--color-bg-section);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-glow);
    border-color: var(--color-primary);
}

.project-image {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.project-card:hover .project-image img {
    transform: scale(1.1);
}

.project-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(0, 0, 0, 0.8) 100%);
    display: flex;
    align-items: flex-end;
    padding: var(--spacing-md);
    opacity: 0;
    transition: var(--transition-normal);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-links {
    display: flex;
    gap: var(--spacing-sm);
}

.project-links a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border-radius: 50%;
    transition: var(--transition-fast);
}

.project-links a:hover {
    background: white;
}

.project-links a svg {
    width: 20px;
    height: 20px;
    fill: white;
    transition: var(--transition-fast);
}

.project-links a:hover svg {
    fill: var(--color-primary);
}

.project-info {
    padding: var(--spacing-lg);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    /* Reduced top padding since title is gone */
    padding-top: var(--spacing-md);
}

/* New Marquee Title Styles */
.thumb-title-wrapper {
    position: absolute;
    inset: 0;
    /* Cover full thumb area */
    display: flex;
    align-items: center;
    justify-content: center;
    /* Default center for short titles */
    padding: 0 20px;
    background: transparent;
    overflow: hidden;
    z-index: 5;
    pointer-events: none;
    /* Let clicks pass through to card */
}

/* Base title style */
.thumb-title {
    color: white;
    font-size: 1.6rem;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* Marquee modifier */
.thumb-title-wrapper.marquee-active {
    justify-content: flex-start;
    /* Align left for scrolling */
    mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}

.thumb-title-wrapper.marquee-active .thumb-title {
    padding-left: 100%;
    /* Start from far right */
    animation: scroll-text 12s linear infinite;
}

@keyframes scroll-text {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

.project-title {
    display: none;
}

.project-desc {
    color: var(--color-text-gray);
    margin-bottom: var(--spacing-md);
    font-size: 0.95rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    /* Increased to show more text */
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.tag {
    font-size: 0.75rem;
    padding: 5px 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: white;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1024px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .about-image {
        max-width: 400px;
        margin: 0 auto;
    }

    .timeline::before {
        left: 30px;
    }

    .timeline-item {
        width: 100%;
        left: 0 !important;
        text-align: left !important;
        padding-left: 80px !important;
        padding-right: 0 !important;
    }

    .timeline-icon {
        left: 5px !important;
        right: auto !important;
    }

    .timeline-content::before {
        left: -20px !important;
        right: auto !important;
        border-left-color: transparent !important;
        border-right-color: white !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-info {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    /* Ensure grid doesn't break on mid-size screens */
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    /* Mobile Interaction Fix: Always show overlay */
    .project-overlay {
        opacity: 1;
        background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.9) 100%);
    }

    .project-card:hover {
        transform: none;
        /* Disable lift effect on touch */
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background: var(--color-bg-darker);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--spacing-lg);
        transition: var(--transition-normal);
    }

    .nav-menu.active {
        right: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .hero-name {
        font-size: 2.5rem;
    }

    .hero-roles {
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .hero-roles .separator {
        display: none;
    }

    .about-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .section-header h2 {
        font-size: 2rem;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    /* Mobile Modal Fixes */
    .modal-content {
        width: 95%;
        height: 85vh;
        /* Fallback */
        height: 85dvh;
        max-height: none;
    }

    .modal-close-btn {
        top: 10px;
        right: 10px;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 50%;
        color: #333;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        width: 36px;
        height: 36px;
        line-height: 36px;
        font-size: 1.5rem;
    }

    .project-image {
        height: 160px;
    }

    .thumb-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .hero-avatar {
        width: 120px;
        height: 120px;
    }

    .hero-name {
        font-size: 2rem;
    }

    .timeline-item {
        padding-left: 60px !important;
    }

    .timeline::before {
        left: 20px;
    }

    .timeline-icon {
        width: 40px;
        height: 40px;
        left: 0 !important;
    }

    .timeline-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* ========================================
   Project Modal - Redesigned
   ======================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background: #ffffff;
    width: 92%;
    max-width: 1100px;
    height: 88vh;
    border-radius: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: #fafafa;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 50px);
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    background: none;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
}

.modal-close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
    border-color: #d1d5db;
}

/* Tab Bar - hidden on desktop, visible on mobile */
.modal-tabs {
    display: none;
    flex-shrink: 0;
}

/* Modal Body - Desktop: side-by-side (readme left, tree right) */
.modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    /* Fix flex overflow */
}

/* Readme Container - Main content */
.readme-container {
    flex: 1;
    padding: 32px 40px;
    overflow-y: auto;
    background: #ffffff;
    min-width: 0;
    /* Prevent flex overflow */
}

/* File Tree Sidebar - Right side on desktop */
.file-tree-container {
    width: 280px;
    background: #f9fafb;
    border-left: 1px solid #e5e7eb;
    padding: 0;
    overflow-y: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.file-tree-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.file-tree-header svg {
    color: var(--color-primary);
}

.file-tree {
    padding: 12px 16px;
    flex: 1;
    overflow-y: auto;
}

.file-tree ul {
    list-style: none;
    padding-left: 16px;
    margin: 0;
}

.file-tree>ul {
    padding-left: 0;
}

.file-tree li {
    margin: 3px 0;
    font-size: 0.82rem;
    white-space: nowrap;
    color: #4b5563;
    line-height: 1.6;
}

.file-tree .folder {
    font-weight: 600;
    color: #1f2937;
}

.file-tree .file {
    color: #6b7280;
}

.file-tree .folder::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: text-bottom;
    background: var(--color-primary);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z'/%3E%3C/svg%3E") no-repeat center;
}

.file-tree .file::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 6px;
    vertical-align: text-bottom;
    background: #9ca3af;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z'/%3E%3C/svg%3E") no-repeat center;
}

/* ========================================
   File Type Icons (VS Code Style)
   ======================================== */

/* Python - 藍色蛇形圖示 */
.file-tree .file-py::before,
.file-tree .file-pyw::before,
.file-tree .file-pyx::before {
    background: #3572A5;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.585 11.692h4.328s2.432.039 2.432-2.35V5.391S16.714 3 11.936 3C7.362 3 7.647 4.983 7.647 4.983l.006 2.055h4.363v.617H5.92s-2.927-.332-2.927 4.282 2.555 4.45 2.555 4.45h1.524v-2.141s-.083-2.554 2.513-2.554zm-.056-5.74a.784.784 0 110-1.57.784.784 0 010 1.57zM14.415 12.308h-4.328s-2.432-.04-2.432 2.35v3.951S7.286 21 12.064 21c4.574 0 4.289-1.983 4.289-1.983l-.006-2.055h-4.363v-.617h6.097s2.927.332 2.927-4.282-2.555-4.45-2.555-4.45h-1.524v2.141s.083 2.554-2.514 2.554zm.056 5.74a.784.784 0 110 1.57.784.784 0 010-1.57z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9.585 11.692h4.328s2.432.039 2.432-2.35V5.391S16.714 3 11.936 3C7.362 3 7.647 4.983 7.647 4.983l.006 2.055h4.363v.617H5.92s-2.927-.332-2.927 4.282 2.555 4.45 2.555 4.45h1.524v-2.141s-.083-2.554 2.513-2.554zm-.056-5.74a.784.784 0 110-1.57.784.784 0 010 1.57zM14.415 12.308h-4.328s-2.432-.04-2.432 2.35v3.951S7.286 21 12.064 21c4.574 0 4.289-1.983 4.289-1.983l-.006-2.055h-4.363v-.617h6.097s2.927.332 2.927-4.282-2.555-4.45-2.555-4.45h-1.524v2.141s.083 2.554-2.514 2.554zm.056 5.74a.784.784 0 110 1.57.784.784 0 010-1.57z'/%3E%3C/svg%3E") no-repeat center;
}

/* JavaScript - 黄色 JS 圖示 */
.file-tree .file-js::before,
.file-tree .file-mjs::before,
.file-tree .file-cjs::before {
    background: #F7DF1E;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h18v18H3V3zm4.73 15.04c.4.85 1.19 1.55 2.54 1.55 1.5 0 2.53-.79 2.53-2.55v-5.78h-1.7v5.74c0 .86-.35 1.08-.91 1.08-.58 0-.82-.4-1.09-.87l-1.37.83zm5.98-.18c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.78z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h18v18H3V3zm4.73 15.04c.4.85 1.19 1.55 2.54 1.55 1.5 0 2.53-.79 2.53-2.55v-5.78h-1.7v5.74c0 .86-.35 1.08-.91 1.08-.58 0-.82-.4-1.09-.87l-1.37.83zm5.98-.18c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.78z'/%3E%3C/svg%3E") no-repeat center;
}

/* TypeScript - 藍色 TS 圖示 */
.file-tree .file-ts::before,
.file-tree .file-tsx::before {
    background: #3178C6;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h18v18H3V3zm10.71 14.86c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.78zM4.17 11.26h5.6v1.23h-1.9v6.17h-1.8v-6.17H4.17v-1.23z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 3h18v18H3V3zm10.71 14.86c.5.98 1.51 1.73 3.09 1.73 1.6 0 2.8-.83 2.8-2.36 0-1.41-.81-2.04-2.25-2.66l-.42-.18c-.73-.31-1.04-.52-1.04-1.02 0-.41.31-.73.81-.73.48 0 .8.21 1.09.73l1.31-.87c-.55-.96-1.33-1.33-2.4-1.33-1.51 0-2.48.96-2.48 2.23 0 1.38.81 2.03 2.03 2.55l.42.18c.78.34 1.24.55 1.24 1.13 0 .48-.45.83-1.15.83-.83 0-1.31-.43-1.67-1.03l-1.38.78zM4.17 11.26h5.6v1.23h-1.9v6.17h-1.8v-6.17H4.17v-1.23z'/%3E%3C/svg%3E") no-repeat center;
}

/* HTML - 橘色標籤圖示 */
.file-tree .file-html::before,
.file-tree .file-htm::before {
    background: #E44D26;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1.5 0h21l-1.91 21.563L11.977 24l-8.564-2.438L1.5 0zm7.031 9.75l-.232-2.718 10.059.003.076-.914.203-2.129.033-.453H6.312l.046.6.691 7.672h7.834l-.33 3.468-2.59.703-2.552-.703-.162-1.824h-2.81l.32 3.592L12 18.84l4.89-1.356.68-7.634.083-.1H8.531z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1.5 0h21l-1.91 21.563L11.977 24l-8.564-2.438L1.5 0zm7.031 9.75l-.232-2.718 10.059.003.076-.914.203-2.129.033-.453H6.312l.046.6.691 7.672h7.834l-.33 3.468-2.59.703-2.552-.703-.162-1.824h-2.81l.32 3.592L12 18.84l4.89-1.356.68-7.634.083-.1H8.531z'/%3E%3C/svg%3E") no-repeat center;
}

/* CSS - 藍色樣式表圖示 */
.file-tree .file-css::before,
.file-tree .file-scss::before,
.file-tree .file-sass::before,
.file-tree .file-less::before {
    background: #1572B6;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1.5 0h21l-1.91 21.563L11.977 24l-8.565-2.438L1.5 0zm17.09 4.413L5.41 4.41l.213 2.622 10.125.002-.255 2.716h-6.64l.24 2.573h6.182l-.366 3.523-2.91.804-2.956-.81-.188-2.11h-2.61l.29 3.855L12 19.002l5.355-1.12.294-3.369.075-.985.66-8.585z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1.5 0h21l-1.91 21.563L11.977 24l-8.565-2.438L1.5 0zm17.09 4.413L5.41 4.41l.213 2.622 10.125.002-.255 2.716h-6.64l.24 2.573h6.182l-.366 3.523-2.91.804-2.956-.81-.188-2.11h-2.61l.29 3.855L12 19.002l5.355-1.12.294-3.369.075-.985.66-8.585z'/%3E%3C/svg%3E") no-repeat center;
}

/* JSON - 黄色大括號圖示 */
.file-tree .file-json::before {
    background: #F5C518;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.759 3.975h1.783V5.76H5.759V3.975zm4.493 0h1.783V5.76h-1.783V3.975zm-2.247 0h1.783V5.76H8.005V3.975zM5 7.5c0-.276.224-.5.5-.5h13c.276 0 .5.224.5.5v9c0 .276-.224.5-.5.5h-13c-.276 0-.5-.224-.5-.5v-9zm2 2v1.5h2V9.5H7zm0 3v1.5h2v-1.5H7zm4-3v1.5h2V9.5h-2zm0 3v1.5h2v-1.5h-2zm4-3v1.5h2V9.5h-2zm0 3v1.5h2v-1.5h-2zM5.759 18.24h1.783v1.785H5.759V18.24zm2.246 0h1.783v1.785H8.005V18.24zm2.247 0h1.783v1.785h-1.783V18.24z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5.759 3.975h1.783V5.76H5.759V3.975zm4.493 0h1.783V5.76h-1.783V3.975zm-2.247 0h1.783V5.76H8.005V3.975zM5 7.5c0-.276.224-.5.5-.5h13c.276 0 .5.224.5.5v9c0 .276-.224.5-.5.5h-13c-.276 0-.5-.224-.5-.5v-9zm2 2v1.5h2V9.5H7zm0 3v1.5h2v-1.5H7zm4-3v1.5h2V9.5h-2zm0 3v1.5h2v-1.5h-2zm4-3v1.5h2V9.5h-2zm0 3v1.5h2v-1.5h-2zM5.759 18.24h1.783v1.785H5.759V18.24zm2.246 0h1.783v1.785H8.005V18.24zm2.247 0h1.783v1.785h-1.783V18.24z'/%3E%3C/svg%3E") no-repeat center;
}

/* Markdown - 藍色 MD 圖示 */
.file-tree .file-md::before,
.file-tree .file-mdx::before {
    background: #519ABA;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 4h20v16H2V4zm2 2v12h16V6H4zm2 2h2l2 3 2-3h2v8h-2v-4.5L8.5 12.5 7 10.5V14H6V8zm10 0h3l-1.5 2.5L19 13h-2l-1-2-1 2h-2l1.5-2.5L13 8z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M2 4h20v16H2V4zm2 2v12h16V6H4zm2 2h2l2 3 2-3h2v8h-2v-4.5L8.5 12.5 7 10.5V14H6V8zm10 0h3l-1.5 2.5L19 13h-2l-1-2-1 2h-2l1.5-2.5L13 8z'/%3E%3C/svg%3E") no-repeat center;
}

/* Java - 紅色咖啡杯圖示 */
.file-tree .file-java::before,
.file-tree .file-jar::before {
    background: #B07219;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.851 18.56s-.917.534.653.714c1.902.218 2.874.187 4.969-.211 0 0 .552.346 1.321.646-4.699 2.013-10.633-.118-6.943-1.149zM8.276 15.933s-1.028.762.542.924c2.032.209 3.636.227 6.413-.308 0 0 .384.389.987.602-5.679 1.661-12.007.13-7.942-.218zM13.116 11.475c1.158 1.333-.304 2.533-.304 2.533s2.939-1.518 1.589-3.418c-1.261-1.772-2.228-2.652 3.007-5.688 0-.001-8.216 2.051-4.292 6.573zM19.33 20.504s.679.559-.747.991c-2.712.822-11.288 1.069-13.669.033-.856-.373.75-.89 1.254-.998.527-.114.828-.093.828-.093-.953-.671-6.156 1.317-2.643 1.887 9.58 1.553 17.462-.7 14.977-1.82zM9.292 13.21s-4.362 1.036-1.544 1.412c1.189.159 3.561.123 5.77-.062 1.806-.152 3.618-.477 3.618-.477s-.637.272-1.098.587c-4.429 1.165-12.986.623-10.522-.568 2.082-1.006 3.776-.892 3.776-.892zM17.116 17.584c4.503-2.34 2.421-4.589.968-4.285-.355.074-.515.138-.515.138s.132-.207.385-.297c2.875-1.011 5.086 2.981-.928 4.562 0 0 .07-.062.09-.118zM14.401 0s2.494 2.494-2.365 6.33c-3.896 3.077-.889 4.832 0 6.836-2.274-2.053-3.943-3.858-2.824-5.539 1.644-2.469 6.197-3.665 5.189-7.627z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8.851 18.56s-.917.534.653.714c1.902.218 2.874.187 4.969-.211 0 0 .552.346 1.321.646-4.699 2.013-10.633-.118-6.943-1.149zM8.276 15.933s-1.028.762.542.924c2.032.209 3.636.227 6.413-.308 0 0 .384.389.987.602-5.679 1.661-12.007.13-7.942-.218zM13.116 11.475c1.158 1.333-.304 2.533-.304 2.533s2.939-1.518 1.589-3.418c-1.261-1.772-2.228-2.652 3.007-5.688 0-.001-8.216 2.051-4.292 6.573zM19.33 20.504s.679.559-.747.991c-2.712.822-11.288 1.069-13.669.033-.856-.373.75-.89 1.254-.998.527-.114.828-.093.828-.093-.953-.671-6.156 1.317-2.643 1.887 9.58 1.553 17.462-.7 14.977-1.82zM9.292 13.21s-4.362 1.036-1.544 1.412c1.189.159 3.561.123 5.77-.062 1.806-.152 3.618-.477 3.618-.477s-.637.272-1.098.587c-4.429 1.165-12.986.623-10.522-.568 2.082-1.006 3.776-.892 3.776-.892zM17.116 17.584c4.503-2.34 2.421-4.589.968-4.285-.355.074-.515.138-.515.138s.132-.207.385-.297c2.875-1.011 5.086 2.981-.928 4.562 0 0 .07-.062.09-.118zM14.401 0s2.494 2.494-2.365 6.33c-3.896 3.077-.889 4.832 0 6.836-2.274-2.053-3.943-3.858-2.824-5.539 1.644-2.469 6.197-3.665 5.189-7.627z'/%3E%3C/svg%3E") no-repeat center;
}

/* C / C++ / C# - 紫色圖示 */
.file-tree .file-c::before,
.file-tree .file-h::before {
    background: #555555;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.45 15.97l1.12-1.93c1.1 1.03 2.42 1.55 3.95 1.55 1.26 0 2.28-.34 3.05-1.03.78-.69 1.17-1.56 1.17-2.61 0-1.08-.41-1.97-1.22-2.68-.81-.71-1.83-1.06-3.06-1.06-1.46 0-2.74.51-3.84 1.53L6.23 4.01l-2.89.5 1.84 12.23-2.89.5h0z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15.45 15.97l1.12-1.93c1.1 1.03 2.42 1.55 3.95 1.55 1.26 0 2.28-.34 3.05-1.03.78-.69 1.17-1.56 1.17-2.61 0-1.08-.41-1.97-1.22-2.68-.81-.71-1.83-1.06-3.06-1.06-1.46 0-2.74.51-3.84 1.53L6.23 4.01l-2.89.5 1.84 12.23-2.89.5h0z'/%3E%3C/svg%3E") no-repeat center;
}

.file-tree .file-cpp::before,
.file-tree .file-hpp::before,
.file-tree .file-cc::before {
    background: #9B4993;
}

.file-tree .file-cs::before {
    background: #178600;
}

/* Go - 青色圖示 */
.file-tree .file-go::before {
    background: #00ADD8;
}

/* Ruby - 紅色圖示 */
.file-tree .file-rb::before,
.file-tree .file-gemspec::before {
    background: #CC342D;
}

/* Rust - 棕色圖示 */
.file-tree .file-rs::before {
    background: #DEA584;
}

/* PHP - 紫色圖示 */
.file-tree .file-php::before {
    background: #4F5D95;
}

/* Shell / Bash - 綠色終端機圖示 */
.file-tree .file-sh::before,
.file-tree .file-bash::before,
.file-tree .file-zsh::before,
.file-tree .file-bat::before,
.file-tree .file-ps1::before {
    background: #4EAA25;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8h16v10zm-9-2h5v-1h-5v1zm-3.15-3.85L10 14.29l-2.15 2.15L7 15.59 8.59 14 7 12.41l.85-.85z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 14H4V8h16v10zm-9-2h5v-1h-5v1zm-3.15-3.85L10 14.29l-2.15 2.15L7 15.59 8.59 14 7 12.41l.85-.85z'/%3E%3C/svg%3E") no-repeat center;
}

/* Jupyter Notebook - 橘色圖示 */
.file-tree .file-ipynb::before {
    background: #DA5B0B;
}

/* YAML / TOML 設定檔 - 紫灰色齒輪圖示 */
.file-tree .file-yml::before,
.file-tree .file-yaml::before,
.file-tree .file-toml::before,
.file-tree .file-ini::before,
.file-tree .file-cfg::before,
.file-tree .file-conf::before,
.file-tree .file-env::before {
    background: #6D8086;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z'/%3E%3C/svg%3E") no-repeat center;
}

/* XML / SVG - 橘色圖示 */
.file-tree .file-xml::before,
.file-tree .file-svg::before {
    background: #E37933;
}

/* SQL / 資料庫 - 藍色資料庫圖示 */
.file-tree .file-sql::before,
.file-tree .file-db::before,
.file-tree .file-sqlite::before {
    background: #336791;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3C7.58 3 4 4.79 4 7v10c0 2.21 3.58 4 8 4s8-1.79 8-4V7c0-2.21-3.58-4-8-4zm0 2c3.87 0 6 1.5 6 2s-2.13 2-6 2-6-1.5-6-2 2.13-2 6-2zM6 17V14.77c1.61.77 3.72 1.23 6 1.23s4.39-.46 6-1.23V17c0 .5-2.13 2-6 2s-6-1.5-6-2zm0-5V9.77C7.61 10.54 9.72 11 12 11s4.39-.46 6-1.23V12c0 .5-2.13 2-6 2s-6-1.5-6-2z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3C7.58 3 4 4.79 4 7v10c0 2.21 3.58 4 8 4s8-1.79 8-4V7c0-2.21-3.58-4-8-4zm0 2c3.87 0 6 1.5 6 2s-2.13 2-6 2-6-1.5-6-2 2.13-2 6-2zM6 17V14.77c1.61.77 3.72 1.23 6 1.23s4.39-.46 6-1.23V17c0 .5-2.13 2-6 2s-6-1.5-6-2zm0-5V9.77C7.61 10.54 9.72 11 12 11s4.39-.46 6-1.23V12c0 .5-2.13 2-6 2s-6-1.5-6-2z'/%3E%3C/svg%3E") no-repeat center;
}

/* 圖片檔案 - 綠色圖片圖示 */
.file-tree .file-png::before,
.file-tree .file-jpg::before,
.file-tree .file-jpeg::before,
.file-tree .file-gif::before,
.file-tree .file-webp::before,
.file-tree .file-ico::before,
.file-tree .file-bmp::before {
    background: #4CAF50;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E") no-repeat center;
}

/* 影音檔案 - 紫色影片圖示 */
.file-tree .file-mp4::before,
.file-tree .file-avi::before,
.file-tree .file-mov::before,
.file-tree .file-mkv::before,
.file-tree .file-webm::before,
.file-tree .file-mp3::before,
.file-tree .file-wav::before,
.file-tree .file-flac::before {
    background: #9C27B0;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z'/%3E%3C/svg%3E") no-repeat center;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z'/%3E%3C/svg%3E") no-repeat center;
}

/* 壓縮檔 - 棕色壓縮圖示 */
.file-tree .file-zip::before,
.file-tree .file-tar::before,
.file-tree .file-gz::before,
.file-tree .file-rar::before,
.file-tree .file-7z::before {
    background: #795548;
}

/* Git 相關 - 橘紅色圖示 */
.file-tree .file-gitignore::before,
.file-tree .file-gitmodules::before,
.file-tree .file-gitattributes::before {
    background: #F05032;
}

/* Docker - 藍色鯨魚圖示 */
.file-tree .file-dockerfile::before {
    background: #2496ED;
}

/* 文字與文件檔 - 灰藍色圖示 */
.file-tree .file-txt::before,
.file-tree .file-log::before,
.file-tree .file-csv::before {
    background: #607D8B;
}

/* PDF - 紅色圖示 */
.file-tree .file-pdf::before {
    background: #D32F2F;
}

/* React JSX - 青色圖示 */
.file-tree .file-jsx::before {
    background: #61DAFB;
}

/* Vue - 綠色圖示 */
.file-tree .file-vue::before {
    background: #42B883;
}

/* Dockerfile / Makefile / requirements.txt 等特殊檔名 */
.file-tree .file-lock::before {
    background: #6D8086;
}

/* R 語言 - 藍色圖示 */
.file-tree .file-r::before,
.file-tree .file-rmd::before {
    background: #198CE7;
}

/* Kotlin - 紫橘色 */
.file-tree .file-kt::before,
.file-tree .file-kts::before {
    background: #A97BFF;
}

/* Swift - 橘色 */
.file-tree .file-swift::before {
    background: #FA7343;
}

/* Dart / Flutter - 藍色 */
.file-tree .file-dart::before {
    background: #00B4AB;
}

/* .env 環境變數 */
.file-tree .file-pyc::before {
    background: #8DB6CB;
}

.markdown-body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    line-height: 1.7;
    max-width: 800px;
    color: #24292f;
}

.markdown-body h1 {
    font-size: 1.8em;
    border-bottom: 1px solid #d8dee4;
    padding-bottom: 0.3em;
    margin-bottom: 16px;
    margin-top: 0;
}

.markdown-body h2 {
    font-size: 1.4em;
    border-bottom: 1px solid #d8dee4;
    padding-bottom: 0.3em;
    margin-top: 32px;
    margin-bottom: 16px;
}

.markdown-body h3 {
    font-size: 1.15em;
    margin-top: 24px;
    margin-bottom: 16px;
}

.markdown-body p {
    margin-bottom: 16px;
}

.markdown-body code {
    background-color: rgba(175, 184, 193, 0.2);
    padding: 0.2em 0.4em;
    border-radius: 6px;
    font-size: 85%;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.markdown-body pre {
    background-color: #f6f8fa;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid #d0d7de;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    font-size: 85%;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 2em;
    margin-bottom: 16px;
}

.markdown-body li {
    margin-bottom: 4px;
}

.markdown-body blockquote {
    border-left: 0.25em solid #d0d7de;
    color: #656d76;
    padding: 0 1em;
    margin: 0 0 16px 0;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
    border-radius: 6px;
    image-rendering: auto;
    object-fit: contain;
}

.markdown-body table {
    border-spacing: 0;
    border-collapse: collapse;
    margin-bottom: 16px;
    width: 100%;
    display: block;
    overflow-x: auto;
}

.markdown-body table th,
.markdown-body table td {
    padding: 6px 13px;
    border: 1px solid #d0d7de;
}

.markdown-body table th {
    background: #f6f8fa;
    font-weight: 600;
}

.markdown-body table tr:nth-child(2n) {
    background-color: #f6f8fa;
}

/* ========================================
   Responsive Modal (Mobile)
   ======================================== */
@media (max-width: 768px) {
    .modal-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-width: 100%;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-title {
        font-size: 1rem;
    }

    /* Show tabs on mobile */
    .modal-tabs {
        display: flex;
        border-bottom: 1px solid #e5e7eb;
        background: #fafafa;
        flex-shrink: 0;
    }

    .modal-tab {
        flex: 1;
        padding: 10px 16px;
        border: none;
        background: none;
        font-size: 0.85rem;
        font-weight: 600;
        color: #6b7280;
        cursor: pointer;
        position: relative;
        transition: color 0.2s;
    }

    .modal-tab.active {
        color: var(--color-primary);
    }

    .modal-tab.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 16px;
        right: 16px;
        height: 2px;
        background: var(--color-primary);
        border-radius: 2px 2px 0 0;
    }

    .modal-body {
        flex-direction: column;
        position: relative;
    }

    /* Tab panel logic */
    .modal-panel {
        position: absolute;
        inset: 0;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .modal-panel.active {
        position: relative;
        opacity: 1;
        pointer-events: auto;
        flex: 1;
        min-height: 0;
    }

    /* Readme */
    .readme-container {
        padding: 20px 16px;
    }

    /* File Tree */
    .file-tree-container {
        width: 100%;
        border-left: none;
    }

    .markdown-body h1 {
        font-size: 1.4em;
    }

    .markdown-body h2 {
        font-size: 1.2em;
    }

    .markdown-body pre {
        font-size: 0.8rem;
    }
}
