/* =========================================
   1. 全局变量与基础设置
   ========================================= */
:root {
    --bg-paper: #e8ecef;       
    --text-ink: #1a1a2e;       
    --accent-blue: #34495e;    
    --accent-orange: #d35400;  
    --border-hard: 3px solid var(--text-ink); 
    --shadow-hard: 8px 8px 0px var(--text-ink);
    --bento-gap: 32px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-paper);
    color: var(--text-ink);
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    background-image: linear-gradient(rgba(26, 26, 46, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(26, 26, 46, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="%23ffffff" stroke="%231a1a2e" stroke-width="2" d="M5.5 3.5l11 11.4-4.8.4 3.2 7.2-2.7 1.2-3.1-7-4.6 4.6z"/></svg>'), auto;
}

body.lang-en .zh { display: none; }
body.lang-zh .en { display: none; }

/* =========================================
   2. 导航栏 
   ========================================= */
.mac-topbar {
    position: fixed; top: 0; left: 0; width: 100%; padding: 16px 32px;
    display: flex; justify-content: space-between; align-items: center;
    background-color: rgba(232, 236, 239, 0.9); backdrop-filter: blur(10px);
    border-bottom: var(--border-hard); z-index: 1000;
}
.topbar-center { list-style: none; display: flex; gap: 48px; }
.topbar-center a { text-decoration: none; color: var(--text-ink); font-weight: 800; font-size: 1rem; text-transform: uppercase; cursor: inherit; }
.topbar-center a:hover { color: var(--accent-orange); text-decoration: underline; text-decoration-thickness: 3px; }
.lang-toggle-simple { background: var(--text-ink); color: var(--bg-paper); border: none; padding: 6px 16px; border-radius: 2px; font-family: inherit; font-weight: 800; cursor: inherit; box-shadow: 2px 2px 0 rgba(0,0,0,0.2); }

/* =========================================
   3. 🌟 修复后的 Hero Section (弹性居中) 🌟
   ========================================= */
/* 改用 flex 弹性布局，确保内容永远居中不溢出 */
.mac-desktop { 
    width: 100vw; height: 100vh; position: relative; overflow: hidden; 
    display: flex; justify-content: center; align-items: center; flex-direction: column;
}

/* 移除导致溢出的绝对定位，改为相对定位 */
.center-title-group { 
    position: relative; z-index: 10; pointer-events: none; width: 100%; 
    display: flex; flex-direction: column; align-items: center; 
    margin-top: -60px; /* 稍微往上提一点，避开底部的 scroll down 提示 */
}

.script-text { font-family: 'Instrument Serif', serif; font-style: italic; font-size: clamp(3rem, 5vw, 4.5rem); color: #1a1a2e; line-height: 1; margin-bottom: -20px; margin-left: -25%; display: block; transform: rotate(-5deg); text-shadow: 2px 2px 0px rgba(0,0,0,0.1); }
.mega-title { font-family: 'Archivo Black', sans-serif; font-weight: 900; font-size: clamp(4rem, 11vw, 9rem); line-height: 0.85; text-transform: uppercase; display: flex; justify-content: center; align-items: baseline; flex-wrap: wrap; letter-spacing: -0.03em; }
.mega-title span { display: inline-block; transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.mega-title:hover span { transform: scale(1.05) translate(-2px, -4px); } 

.t-p { color: #0056b3; font-size: 1.2em; transform: rotate(-4deg) translateY(8px); text-shadow: 4px 4px 0px rgba(0, 86, 179, 0.2); }
.t-o1 { color: #ff6b00; font-family: 'Instrument Serif', serif; font-style: italic; font-size: 0.9em; transform: translateY(-5px); text-shadow: 3px 3px 0px rgba(255, 107, 0, 0.2); }
.t-rt { color: transparent; -webkit-text-stroke: 3px #2c3e50; transform: rotate(3deg); text-shadow: 4px 4px 0px rgba(44, 62, 80, 0.15); }
.t-f { color: #d32f2f; font-family: 'Instrument Serif', serif; font-weight: 400; font-size: 1.3em; transform: translateY(12px); text-shadow: 4px 4px 0px rgba(211, 47, 47, 0.2); }
.t-o2 { color: #00897b; font-size: 0.9em; transform: rotate(-5deg); text-shadow: 3px 3px 0px rgba(0, 137, 123, 0.2); }
.t-lio { color: #37474f; font-size: 1.1em; transform: rotate(2deg) translateY(-5px); letter-spacing: -0.05em; text-shadow: 4px 4px 0px rgba(55, 71, 79, 0.2); }

.year-text { font-family: 'Space Mono', monospace; font-weight: 700; font-size: 1.2rem; color: #fff; background: var(--text-ink); display: inline-block; padding: 4px 16px; transform: rotate(2deg); border: 2px solid var(--text-ink); box-shadow: 4px 4px 0px rgba(0,0,0,0.1); }

.scroll-hint { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); font-weight: 800; font-family: 'Space Mono', monospace; text-transform: uppercase; animation: bounce 2s infinite; color: var(--text-ink); background: var(--bg-paper); padding: 4px 12px; border: 2px solid var(--text-ink);}

@keyframes bounce { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 10px); } }

/* =========================================
   4. Bento Grid & Retro Window 核心布局
   ========================================= */
.bento-section { padding: 100px 5vw; max-width: 1400px; margin: 0 auto; }
.section-title { font-family: 'Archivo Black', sans-serif; font-size: 3.5rem; margin-bottom: 60px; text-transform: uppercase; text-align: left; border-bottom: 4px solid var(--text-ink); padding-bottom: 16px; color: var(--text-ink); text-shadow: 3px 3px 0px var(--bg-paper), 6px 6px 0px var(--text-ink); }
.bento-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(350px, auto); gap: 40px; }

.retro-window { background-color: #fff; border: var(--border-hard); box-shadow: var(--shadow-hard); display: flex; flex-direction: column; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; transform: rotate(var(--rot, 0deg)); position: relative; }
a.retro-window { cursor: pointer; text-decoration: none; color: inherit; }
a.link-card:hover { transform: translate(-4px, -4px) rotate(0deg) !important; box-shadow: 12px 12px 0px var(--text-ink); }

.window-header { background-color: #fff; border-bottom: var(--border-hard); padding: 10px 16px; display: flex; align-items: center; color: var(--text-ink); }
.window-btns { display: flex; gap: 6px; margin-right: 16px; }
.window-btns i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--text-ink); } 
.window-btns i:nth-child(1) { background-color: #ff5f56; }
.window-btns i:nth-child(2) { background-color: #ffbd2e; }
.window-btns i:nth-child(3) { background-color: #27c93f; }

.window-title { font-weight: 700; font-size: 0.85rem; font-family: 'Space Mono', monospace; letter-spacing: 1px;}
.window-content { display: flex; flex-direction: column; height: 100%; }
.window-img { width: 100%; height: 200px; object-fit: cover; border-bottom: var(--border-hard); filter: grayscale(20%) contrast(1.2) sepia(10%); }
.window-text { padding: 24px; flex-grow: 1; background-color: #fff; display: flex; flex-direction: column;}
.window-text h3 { font-family: 'Archivo Black', sans-serif; font-size: 1.8rem; margin-bottom: 4px; text-transform: uppercase; line-height: 1;}
.project-subtitle { font-weight: 800; font-size: 0.95rem; color: #555; margin-bottom: 12px; text-transform: uppercase;}
.project-desc { font-family: 'Space Mono', monospace; font-size: 0.9rem; line-height: 1.5; color: #333; flex-grow: 1; }

.tags-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tech-tag { font-family: 'Space Mono', monospace; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; padding: 6px 12px; border: 2px solid var(--text-ink); box-shadow: 3px 3px 0px var(--text-ink); color: var(--text-ink); background: #fff;}

.card-large { grid-column: span 2; grid-row: span 2; }
.card-large .window-img { height: 350px; }
.card-medium { grid-column: span 1; grid-row: span 2; }
.card-wide { grid-column: span 2; grid-row: span 1; }
.flex-row { flex-direction: row; }

/* =========================================
   5. About Section
   ========================================= */
.about-layout { display: grid; grid-template-columns: 1fr 2fr; gap: 60px; padding: 48px; background: #fff;}
.about-left { display: flex; flex-direction: column; }
.about-portrait { width: 100%; max-width: 280px; aspect-ratio: 1; object-fit: cover; border: var(--border-hard); box-shadow: 8px 8px 0px var(--text-ink); margin-bottom: 32px; transform: rotate(-2deg); }
.about-name { font-family: 'Archivo Black', sans-serif; font-size: 3rem; margin-bottom: 16px; color: var(--text-ink); line-height: 1; text-transform: uppercase;}
.about-bio { font-family: 'Space Mono', monospace; font-size: 1rem; color: var(--text-ink); line-height: 1.7; }
.about-right { display: flex; flex-direction: column; gap: 24px; }
.info-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.info-label { font-family: 'Archivo Black', sans-serif; font-size: 1.5rem; width: 140px; flex-shrink: 0; text-transform: uppercase; color: var(--text-ink);}
.info-content { flex-grow: 1; font-family: 'Space Mono', monospace; font-size: 1.1rem; font-weight: 700; line-height: 1.6; text-align: right;}
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px 40px; text-align: left;}
.skill-item span { display: block; margin-bottom: 8px; font-family: 'Archivo Black', sans-serif; font-size: 1rem; text-transform: uppercase; }
.skill-bar { width: 100%; height: 18px; border: 3px solid var(--text-ink); background: #fff; box-shadow: 4px 4px 0px var(--text-ink);}
.skill-fill { height: 100%; background: var(--text-ink); width: 0; }
.reveal.active .skill-fill { animation: fillProgress 1.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; animation-delay: 0.5s; }
@keyframes fillProgress { 0% { width: 0; } 100% { width: var(--target-width); border-right: 3px solid var(--text-ink); } }
.divider { width: 100%; height: 4px; background-color: var(--text-ink); margin: 30px 0; border-bottom: 2px solid var(--bg-paper); }

/* 徽章与社交图标 */
.interest-tags { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: #f8f9fa; border: 2px solid var(--text-ink); padding: 6px 14px; font-family: 'Space Mono', monospace; font-size: 0.9rem; font-weight: bold; border-radius: 20px; box-shadow: 2px 2px 0px var(--text-ink); transition: transform 0.2s; }
.badge:hover { transform: translateY(-3px); }
.social-links { display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }
.social-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; background: #fff; border: 3px solid var(--text-ink); box-shadow: 4px 4px 0px var(--text-ink); color: var(--text-ink); text-decoration: none; cursor: pointer !important; transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, background-color 0.2s, color 0.2s; }
.xhs-btn { width: auto; padding: 0 16px; }
.social-btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0px var(--text-ink); }
.social-btn:active { transform: translate(2px, 2px); box-shadow: 0px 0px 0px var(--text-ink); }

/* 漂浮装饰 */
.float-shape { position: absolute; font-size: 2rem; z-index: 5; pointer-events: none; animation: float-around 4s ease-in-out infinite; filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.5)); }
.shape-1 { top: -20px; left: -20px; animation-delay: 0s; }
.shape-2 { bottom: -20px; right: -20px; animation-delay: 1.5s; }
.shape-3 { top: 50%; right: -30px; font-size: 2.5rem; animation-delay: 0.7s; }
@keyframes float-around { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-15px) rotate(15deg); } }

/* 跑马灯 */
.tech-section { padding: 80px 0 120px 0; overflow: hidden; }
.marquee-container { width: 100%; overflow: hidden; display: flex; border-top: 4px solid var(--text-ink); border-bottom: 4px solid var(--text-ink); background: #fff; color: var(--text-ink);}
.marquee-track { display: flex; width: max-content; animation: marquee-scroll 20s linear infinite; }
.marquee-item { font-family: 'Archivo Black', monospace; font-size: 2rem; font-weight: 900; padding: 30px 50px; border-right: 4px solid var(--text-ink); text-transform: uppercase; -webkit-text-stroke: 2px var(--text-ink); color: transparent; }
.marquee-item:hover { color: var(--text-ink); -webkit-text-stroke: 0px;}
@keyframes marquee-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.reveal { opacity: 0; transform: translateY(60px) rotate(var(--rot, 0deg)); transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.active { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)); }

/* =========================================
   3D 精灵球与自由宝可梦系统
   ========================================= */
.free-sprite { background: transparent !important; border: none !important; box-shadow: none !important; width: 150px; cursor: grab; position: absolute; display: flex; flex-direction: column; align-items: center; z-index: 5; }
.free-sprite:active { cursor: grabbing; }
.poke-sprite { width: 130px; height: 130px; image-rendering: pixelated; filter: drop-shadow(5px 5px 0px rgba(0,0,0,0.3)); animation: poke-bounce 2.5s ease-in-out infinite; transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.free-sprite:hover .poke-sprite { transform: scale(1.15); animation: none; filter: drop-shadow(8px 8px 0px rgba(0,0,0,0.4)); }
@keyframes poke-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.icon-label { margin-top: 8px; font-size: 0.9rem; font-family: 'Space Mono', monospace; font-weight: 700; color: #fff; background: rgba(26, 26, 46, 0.85); backdrop-filter: blur(4px); border: 2px solid var(--text-ink); padding: 4px 10px; border-radius: 6px; box-shadow: 3px 3px 0px rgba(0,0,0,0.5); pointer-events: none; }

.pokeball-container { position: relative; width: 220px; height: 220px; margin: 40px auto 0; z-index: 10; }
.pokeball { width: 100%; height: 100%; border-radius: 50%; position: relative; overflow: visible; box-shadow: inset -20px -20px 30px rgba(0,0,0,0.4), inset 15px 15px 25px rgba(255,255,255,0.6), 15px 15px 25px rgba(0,0,0,0.2); border: 8px solid var(--text-ink); background: #fff; transition: transform 0.3s; }
.pokeball-top { position: absolute; top: 0; left: 0; width: 100%; height: 50%; background: #ff5f56; border-radius: 220px 220px 0 0; border-bottom: 10px solid var(--text-ink); box-shadow: inset 15px 15px 25px rgba(255,255,255,0.5); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform-origin: top center; z-index: 2; }
.pokeball-bottom { position: absolute; bottom: 0; left: 0; width: 100%; height: 50%; background: #fff; border-radius: 0 0 220px 220px; box-shadow: inset -20px -20px 30px rgba(0,0,0,0.2); transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); transform-origin: bottom center; z-index: 1; }
.pokeball-center-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 60px; height: 60px; background: #fff; border: 10px solid var(--text-ink); border-radius: 50%; z-index: 3; display: flex; justify-content: center; align-items: center; box-shadow: inset -3px -3px 6px rgba(0,0,0,0.3); transition: all 0.2s;}
.pokeball-button { width: 20px; height: 20px; background: var(--text-ink); border-radius: 50%; border: 3px solid #fff; transition: background 0.3s; }

.drag-hint { position: absolute; bottom: -80px; left: 50%; transform: translateX(-50%); text-align: center; width: 300px; pointer-events: none; font-family: 'Space Mono', monospace; font-weight: bold; color: var(--text-ink); }
.drag-hint span { display: block; font-size: 1rem; text-shadow: 1px 1px 0px #fff;}
.bounce-arrow { font-size: 2rem !important; animation: arrow-bounce 1s infinite; color: #ff5f56; }
.pokeball-container.active-drop .pokeball { box-shadow: 0 0 40px #ff5f56, inset -20px -20px 30px rgba(0,0,0,0.4), inset 15px 15px 25px rgba(255,255,255,0.6); transform: scale(1.05); }
.pokeball-container.active-drop .pokeball-button { background: #ff5f56; box-shadow: 0 0 15px #ff5f56; }
.pokeball-container.open .pokeball-top { transform: translateY(-40px); }
.pokeball-container.open .pokeball-bottom { transform: translateY(40px); }
.pokeball-container.open .pokeball-center-ring { transform: translate(-50%, -50%) scale(0); opacity: 0;}
.poke-caught { transition: all 0.6s cubic-bezier(0.5, 0, 0.5, 1) !important; transform: scale(0) rotate(720deg) !important; opacity: 0; pointer-events: none; }

/* 卡比兽睡眠 */
@keyframes sleep-breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1.02); } }
@keyframes zzz-float { 0% { opacity: 0; transform: translateY(0) scale(0.8) rotate(-10deg); } 50% { opacity: 1; transform: translateY(-10px) scale(1.1) rotate(0deg); } 100% { opacity: 0; transform: translateY(-25px) scale(1.2) rotate(10deg); } }
.snorlax-sprite { width: 90px; image-rendering: pixelated; animation: sleep-breathe 4s ease-in-out infinite; filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.15)); }
.zzz-mark { position: absolute; font-family: 'Archivo Black', sans-serif; color: #5d4037; opacity: 0; pointer-events: none; }
.zzz-1 { top: -10px; right: 40px; font-size: 1rem; animation: zzz-float 3s infinite 0s; }
.zzz-2 { top: -25px; right: 10px; font-size: 1.4rem; animation: zzz-float 3s infinite 1.5s; }

/* 全局图片放大 */
.zoom-img { cursor: zoom-in !important; transition: transform 0.2s, box-shadow 0.2s; position: relative; z-index: 10; }
.zoom-img:hover { transform: scale(1.02); box-shadow: 6px 6px 0px rgba(0,0,0,0.3); }
.retro-lightbox { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(26, 26, 46, 0.85); backdrop-filter: blur(5px); z-index: 99999; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; cursor: zoom-out !important; }
.retro-lightbox.active { opacity: 1; pointer-events: auto; }
.lightbox-window { background: var(--bg-paper); border: 4px solid var(--text-ink); box-shadow: 16px 16px 0px rgba(0,0,0,0.6); max-width: 90vw; max-height: 90vh; display: flex; flex-direction: column; cursor: default; transform: scale(0.95); transition: transform 0.3s; }
.retro-lightbox.active .lightbox-window { transform: scale(1); }
.lightbox-header { background: var(--text-ink); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; }
.lightbox-close { background: #d32f2f; color: #fff; border: 2px solid #fff; font-family: 'Space Mono', monospace; font-weight: 700; cursor: pointer; padding: 2px 12px; transition: background 0.2s; font-size: 1rem; }
.lightbox-close:hover { background: #ff5f56; }
.lightbox-content { overflow: auto; padding: 20px; display: flex; justify-content: center; align-items: flex-start; }
.lightbox-content img { max-width: 100%; height: auto; border: 2px solid var(--text-ink); box-shadow: 4px 4px 0px var(--text-ink); }

/* 移动端 */
@media (max-width: 1024px) {
    .bento-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 30px;}
    .card-large, .card-wide, .retro-window[style*="grid-column: span"] { grid-column: span 2 !important; }
    .card-medium { grid-column: span 1 !important; }
    .about-layout { grid-template-columns: 1fr; padding: 30px; gap: 40px; }
    .info-row { flex-direction: column; gap: 16px; }
    .info-content { text-align: left !important; }
    .interest-tags { justify-content: flex-start; }
    .pokeball-container { width: 150px; height: 150px;}
}
@media (max-width: 768px) {
    .topbar-center { display: none; }
    .bento-grid { grid-template-columns: 1fr !important; }
    .card-large, .card-wide, .card-medium, .retro-window { grid-column: span 1 !important; }
    .desktop-icon { display: none; }
}