:root {
    /* Fonts */
    --font-header: 'Newsreader', Georgia, serif;
    --font-main: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --line-height: 1.7;
    --nav-height: 64px;

    /* Editorial Warm-Minimalism Light Theme Default */
    --bg-body: #faf8f5;
    --bg-card: rgba(255, 255, 255, 0.65);
    --text-primary: #181816;
    --text-secondary: #575752;
    --accent-primary: #8c6239;    /* Editorial Bronze */
    --accent-secondary: #a87f54;  /* Soft Warm Accent */
    --border-color: rgba(24, 24, 22, 0.07);
    --highlight-bg: rgba(140, 98, 57, 0.08);
    
    --shadow-sm: 0 2px 4px rgba(24, 24, 22, 0.02);
    --shadow-md: 0 4px 12px rgba(24, 24, 22, 0.04);
    --shadow-lg: 0 16px 32px rgba(24, 24, 22, 0.06);

    /* Game Brand Badge Custom Variables */
    --badge-subway-bg: rgba(242, 114, 38, 0.07);
    --badge-subway-text: #a8470a;
    --badge-subway-border: rgba(242, 114, 38, 0.18);
    
    --badge-talking-bg: rgba(32, 156, 238, 0.07);
    --badge-talking-text: #0e64a3;
    --badge-talking-border: rgba(32, 156, 238, 0.18);
    
    --badge-farmville-bg: rgba(46, 125, 50, 0.07);
    --badge-farmville-text: #236327;
    --badge-farmville-border: rgba(46, 125, 50, 0.18);
    
    --badge-draw-bg: rgba(224, 153, 36, 0.07);
    --badge-draw-text: #965a00;
    --badge-draw-border: rgba(224, 153, 36, 0.18);
    
    --badge-parking-bg: rgba(211, 47, 47, 0.07);
    --badge-parking-text: #a61c1c;
    --badge-parking-border: rgba(211, 47, 47, 0.18);
}

/* Explicit Light Mode Override */
:root[data-theme="light"] {
    --bg-body: #faf8f5;
    --bg-card: rgba(255, 255, 255, 0.65);
    --text-primary: #181816;
    --text-secondary: #575752;
    --accent-primary: #8c6239;
    --accent-secondary: #a87f54;
    --border-color: rgba(24, 24, 22, 0.07);
    --highlight-bg: rgba(140, 98, 57, 0.08);
    
    --shadow-sm: 0 2px 4px rgba(24, 24, 22, 0.02);
    --shadow-md: 0 4px 12px rgba(24, 24, 22, 0.04);
    --shadow-lg: 0 16px 32px rgba(24, 24, 22, 0.06);

    /* Game Brand Badge Custom Variables */
    --badge-subway-bg: rgba(242, 114, 38, 0.07);
    --badge-subway-text: #a8470a;
    --badge-subway-border: rgba(242, 114, 38, 0.18);
    
    --badge-talking-bg: rgba(32, 156, 238, 0.07);
    --badge-talking-text: #0e64a3;
    --badge-talking-border: rgba(32, 156, 238, 0.18);
    
    --badge-farmville-bg: rgba(46, 125, 50, 0.07);
    --badge-farmville-text: #236327;
    --badge-farmville-border: rgba(46, 125, 50, 0.18);
    
    --badge-draw-bg: rgba(224, 153, 36, 0.07);
    --badge-draw-text: #965a00;
    --badge-draw-border: rgba(224, 153, 36, 0.18);
    
    --badge-parking-bg: rgba(211, 47, 47, 0.07);
    --badge-parking-text: #a61c1c;
    --badge-parking-border: rgba(211, 47, 47, 0.18);
}

/* Explicit Dark Mode Override */
:root[data-theme="dark"] {
    --bg-body: #111210;
    --bg-card: rgba(22, 23, 20, 0.65);
    --text-primary: #f4f3ef;
    --text-secondary: #a1a19b;
    --accent-primary: #d4b387;    /* Elegant Muted Gold */
    --accent-secondary: #b8976c;
    --border-color: rgba(244, 243, 239, 0.07);
    --highlight-bg: rgba(212, 179, 135, 0.12);
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.4);

    /* Game Brand Badge Custom Variables */
    --badge-subway-bg: rgba(242, 114, 38, 0.12);
    --badge-subway-text: #ffa266;
    --badge-subway-border: rgba(242, 114, 38, 0.28);
    
    --badge-talking-bg: rgba(32, 156, 238, 0.12);
    --badge-talking-text: #7cd0ff;
    --badge-talking-border: rgba(32, 156, 238, 0.28);
    
    --badge-farmville-bg: rgba(76, 175, 80, 0.12);
    --badge-farmville-text: #94e097;
    --badge-farmville-border: rgba(76, 175, 80, 0.28);
    
    --badge-draw-bg: rgba(224, 153, 36, 0.12);
    --badge-draw-text: #ffd07d;
    --badge-draw-border: rgba(224, 153, 36, 0.28);
    
    --badge-parking-bg: rgba(239, 83, 80, 0.12);
    --badge-parking-text: #ff9e9e;
    --badge-parking-border: rgba(239, 83, 80, 0.28);
}

/* Automatic System Preference Fallback */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-body: #111210;
        --bg-card: rgba(22, 23, 20, 0.65);
        --text-primary: #f4f3ef;
        --text-secondary: #a1a19b;
        --accent-primary: #d4b387;    /* Elegant Muted Gold */
        --accent-secondary: #b8976c;
        --border-color: rgba(244, 243, 239, 0.07);
        --highlight-bg: rgba(212, 179, 135, 0.12);
        
        --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.4);

        /* Game Brand Badge Custom Variables */
        --badge-subway-bg: rgba(242, 114, 38, 0.12);
        --badge-subway-text: #ffa266;
        --badge-subway-border: rgba(242, 114, 38, 0.28);
        
        --badge-talking-bg: rgba(32, 156, 238, 0.12);
        --badge-talking-text: #7cd0ff;
        --badge-talking-border: rgba(32, 156, 238, 0.28);
        
        --badge-farmville-bg: rgba(76, 175, 80, 0.12);
        --badge-farmville-text: #94e097;
        --badge-farmville-border: rgba(76, 175, 80, 0.28);
        
        --badge-draw-bg: rgba(224, 153, 36, 0.12);
        --badge-draw-text: #ffd07d;
        --badge-draw-border: rgba(224, 153, 36, 0.28);
        
        --badge-parking-bg: rgba(239, 83, 80, 0.12);
        --badge-parking-text: #ff9e9e;
        --badge-parking-border: rgba(239, 83, 80, 0.28);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-secondary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: var(--line-height);
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
    min-height: 100vh;
    position: relative;
}

/* Mesh Background */
.mesh-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-body);
}

.mesh-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.04;
    animation: move 30s infinite alternate ease-in-out;
}

:root[data-theme="dark"] .mesh-circle {
    opacity: 0.06;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .mesh-circle {
        opacity: 0.06;
    }
}

.c1 {
    width: 400px;
    height: 400px;
    background: var(--accent-primary);
    top: -100px;
    left: -100px;
}

.c2 {
    width: 350px;
    height: 350px;
    background: var(--accent-secondary);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.c3 {
    width: 300px;
    height: 300px;
    background: var(--accent-primary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.02;
    animation: pulse 15s infinite alternate;
}

@keyframes move {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        transform: translate(3vw, 5vh) rotate(5deg);
    }
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        transform: translate(-45%, -48%) scale(1.1);
    }
}

.container {
    max-width: 850px;
    margin: 0 auto;
    padding: 80px 24px 120px 24px;
}

/* Sticky Nav */
nav {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 6px 8px;
    border-radius: 40px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: calc(100vw - 32px);
    width: max-content;
}

nav.visible {
    opacity: 1;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 30px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.02em;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: var(--highlight-bg);
}

/* Theme Toggle Floating Button */
.theme-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 100;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-btn:hover {
    transform: scale(1.08);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
}

/* Sun/Moon Icon Show/Hide Rules based on theme */
:root[data-theme="dark"] .theme-btn .sun-icon {
    display: block;
}
:root[data-theme="dark"] .theme-btn .moon-icon {
    display: none;
}
:root[data-theme="light"] .theme-btn .sun-icon {
    display: none;
}
:root[data-theme="light"] .theme-btn .moon-icon {
    display: block;
}

/* Default System Preference Fallbacks for Icon display */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-btn .sun-icon {
        display: block;
    }
    :root:not([data-theme="light"]) .theme-btn .moon-icon {
        display: none;
    }
}
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) .theme-btn .sun-icon {
        display: none;
    }
    :root:not([data-theme="dark"]) .theme-btn .moon-icon {
        display: block;
    }
}

/* Download CV Floating Button */
.download-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    z-index: 100;
    color: var(--text-secondary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none; /* Avoid link underlining */
}

.download-btn:hover {
    transform: scale(1.08);
    color: var(--text-primary);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-lg);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate {
    animation: fadeInUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Header Section */
header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 80px;
    gap: 24px;
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin-bottom: 12px;
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-body);
    box-shadow: var(--shadow-lg);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-container::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.35;
}

.profile-container:hover .profile-img {
    transform: scale(1.03) rotate(1deg);
}

h1 {
    font-family: var(--font-header);
    font-size: clamp(2.5rem, 8vw, 3.6rem);
    font-weight: 600;
    font-style: italic;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    color: var(--text-primary);
    line-height: 1.1;
}

h3 {
    font-family: var(--font-main);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--accent-primary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    line-height: 1.3;
}

.tagline {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 20px;
    max-width: 600px;
    letter-spacing: 0.01em;
}

.contact-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.chip {
    background: var(--bg-card);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
}

.chip:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -8px var(--accent-primary);
    background: rgba(255, 255, 255, 0.25);
}

:root[data-theme="dark"] .chip:hover {
    background: rgba(22, 23, 20, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .chip:hover {
        background: rgba(22, 23, 20, 0.4);
    }
}

/* Section Styling */
section {
    margin-bottom: 90px;
    opacity: 0;
    transform: translateY(24px);
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

h2 {
    font-family: var(--font-header);
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 36px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, var(--border-color), transparent);
}

/* Timeline/Experience */
.timeline {
    position: relative;
    padding-left: 36px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 10px;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.experience-item {
    position: relative;
    margin-bottom: 48px;
}

.experience-item::before {
    content: '';
    position: absolute;
    left: -36px;
    top: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 3px solid var(--bg-body);
    z-index: 1;
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 16px;
}

.exp-title {
    font-family: var(--font-header);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-primary);
}

.exp-company {
    color: var(--accent-primary);
    text-decoration: none;
    position: relative;
    font-style: italic;
}

.exp-company::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -1px;
    left: 0;
    background-color: var(--accent-primary);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.exp-company:hover::after {
    width: 100%;
}

.exp-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0.8;
}

.exp-location {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exp-content li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 12px;
    color: var(--text-secondary);
    list-style: none;
}

/* Primary Bullet Symbol */
.exp-content>ul>li::before {
    content: '—'; /* Elegant long dash */
    position: absolute;
    left: 0;
    color: var(--accent-primary);
    opacity: 0.7;
    font-weight: 500;
}

/* Nested List Hierarchy */
.exp-content ul ul {
    margin-top: 8px;
    margin-bottom: 4px;
    padding-left: 18px;
}

.exp-content ul ul li {
    font-size: 0.95em;
    margin-bottom: 8px;
    opacity: 0.95;
}

/* Nested Bullet Symbol */
.exp-content ul ul li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--accent-secondary);
    opacity: 0.6;
    font-size: 1.1em;
}

mark {
    background: var(--highlight-bg);
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

/* Custom Game Brand Badges (Suggestion 2) */
.game-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.35;
    margin: 2px 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border-color);
}

.game-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.04);
}

.game-badge.badge-subway {
    background-color: var(--badge-subway-bg);
    color: var(--badge-subway-text);
    border-color: var(--badge-subway-border);
}

.game-badge.badge-talking {
    background-color: var(--badge-talking-bg);
    color: var(--badge-talking-text);
    border-color: var(--badge-talking-border);
}

.game-badge.badge-farmville {
    background-color: var(--badge-farmville-bg);
    color: var(--badge-farmville-text);
    border-color: var(--badge-farmville-border);
}

.game-badge.badge-draw {
    background-color: var(--badge-draw-bg);
    color: var(--badge-draw-text);
    border-color: var(--badge-draw-border);
}

.game-badge.badge-parking {
    background-color: var(--badge-parking-bg);
    color: var(--badge-parking-text);
    border-color: var(--badge-parking-border);
}

/* Side Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
}

.project-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), 0 10px 24px -10px rgba(140, 98, 57, 0.1);
    background: rgba(255, 255, 255, 0.8);
}

:root[data-theme="dark"] .project-card:hover {
    background: rgba(22, 23, 20, 0.85);
    box-shadow: var(--shadow-lg), 0 10px 24px -10px rgba(212, 179, 135, 0.15);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .project-card:hover {
        background: rgba(22, 23, 20, 0.85);
        box-shadow: var(--shadow-lg), 0 10px 24px -10px rgba(212, 179, 135, 0.15);
    }
}

.project-card h3 {
    font-family: var(--font-header);
    font-weight: 500;
    font-style: italic;
    margin-bottom: 12px;
    color: var(--accent-primary);
    font-size: 1.3rem;
    transition: color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover h3 {
    color: var(--accent-secondary);
}

.project-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

footer {
    border-top: 1px solid var(--border-color);
    padding-top: 40px;
    text-align: center;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-main);
}

/* Print Styles */
@media print {
    .mesh-bg,
    nav,
    .download-btn,
    .theme-btn,
    .profile-container::after {
        display: none !important;
    }

    body {
        background-color: #fff;
        color: #000;
    }

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

    section {
        opacity: 1 !important;
        transform: none !important;
        page-break-inside: avoid;
    }
}

@media (min-width: 768px) {
    header {
        display: grid;
        grid-template-columns: auto 1fr;
        text-align: left;
        align-items: center;
        gap: 36px;
    }

    .header-info {
        align-items: flex-start;
    }

    .profile-container {
        margin-bottom: 0;
    }

    .contact-chips {
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .container {
        padding: 48px 20px;
    }

    .exp-header {
        flex-direction: column;
        gap: 4px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.75rem;
    }

    h1 {
        font-size: 2.5rem;
    }

    .tagline {
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {
    nav {
        gap: 2px;
        padding: 4px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 0.65rem;
    }
}