/* CRAFT UI HANDCRAFT STYLE */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&family=Zhi+Mang+Xing&family=ZCOOL+KuaiLe&family=Nunito:wght@400;600;700&display=swap');

:root {
  --journal-paper: #FDF8F3;
  --journal-ink: #2C1810;
  --journal-accent-1: #D4A574;
  --journal-accent-2: #8B6F47;
  --journal-highlight: #FFE4B5;
  --craft-red: #E07A5F;
  --craft-orange: #F2A65A;
  --craft-yellow: #F4E285;
  --craft-green: #8FB996;
  --craft-blue: #81B5DB;
  --craft-purple: #B8A9C9;
  
  --font-heading: 'ZCOOL KuaiLe', cursive;
  --font-script: 'Zhi Mang Xing', 'Caveat', cursive;
  --font-body: 'Nunito', sans-serif;
  
  --nav-height: 70px;
  --max-width: 1000px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-height); }

body {
  font-family: var(--font-body);
  background-color: var(--journal-paper);
  color: var(--journal-ink);
  line-height: 1.6;
  overflow-x: hidden;
  background-image: radial-gradient(var(--journal-accent-1) 1px, transparent 1px);
  background-size: 24px 24px;
}

a { text-decoration: none; color: inherit; transition: all 0.2s ease; }
img { max-width: 100%; display: block; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; position: relative; }

/* Hand Draw Element Bases */
.craft-card {
  background: #ffffff;
  border: 2px solid var(--journal-ink);
  border-radius: 2px 255px 3px 25px / 255px 5px 225px 3px;
  box-shadow: 4px 4px 0px var(--journal-ink);
  padding: 32px;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.craft-card:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 8px 8px 0px var(--journal-ink); }

/* Sticky Tapes */
.tape {
  position: absolute;
  background-color: rgba(244, 226, 133, 0.7);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  height: 25px;
  width: 100px;
  border-radius: 2px;
  clip-path: polygon(0 5%, 100% 0%, 98% 95%, 2% 100%);
  z-index: 10;
}
.tape-top-center { top: -12px; left: 50%; transform: translateX(-50%) rotate(-3deg); }
.tape-top-left { top: -12px; left: -15px; transform: rotate(-45deg); width: 60px; }
.tape-top-right { top: -12px; right: -15px; transform: rotate(45deg); width: 60px; }
.tape-green { background-color: rgba(143, 185, 150, 0.7); }
.tape-red { background-color: rgba(224, 122, 95, 0.7); }
.tape-blue { background-color: rgba(129, 181, 219, 0.7); }

/* Paperclip */
.paperclip {
  position: absolute;
  top: -15px;
  right: 20px;
  width: 25px;
  height: 50px;
  border: 3px solid var(--journal-accent-2);
  border-radius: 12px;
  z-index: 10;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 60% 80%, 60% 20%, 40% 20%, 40% 100%, 0 100%);
  transform: rotate(15deg);
}

/* Nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; height: var(--nav-height);
  background: rgba(253, 248, 243, 0.9); backdrop-filter: blur(10px);
  border-bottom: 2px dashed var(--journal-accent-1); z-index: 100;
}
.nav-inner {
  max-width: var(--max-width); margin: 0 auto; height: 100%; padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
}
.nav-logo { font-family: var(--font-heading); font-size: 28px; font-weight: bold; color: var(--journal-ink); padding: 4px 8px; border: 2px solid transparent; transform: translateY(-2px); display: inline-block; }
.nav-logo:hover { border-color: var(--craft-red); border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; transform: translateY(-2px) rotate(-5deg); }
.nav-links { display: flex; gap: 32px; align-items: center; transform: translateY(-3px); }
.nav-link { font-family: var(--font-heading); font-size: 18px; color: var(--journal-accent-2); padding: 4px 8px; position: relative; }
.nav-link:hover, .nav-link.active { color: var(--journal-ink); }
.nav-link.active::after { content: ''; position: absolute; bottom: 0; left: 10%; width: 80%; height: 3px; background-color: var(--craft-orange); border-radius: 2px 255px 3px 25px / 255px 5px 225px 3px; transform: rotate(-2deg); }

/* Hero */
.hero { min-height: 100vh; display: flex; align-items: center; position: relative; padding-top: var(--nav-height); }
.hero-content {
  display: flex; align-items: center; justify-content: center; gap: 60px;
  max-width: var(--max-width); margin: 0 auto; padding: 0 24px; width: 100%; z-index: 1; position: relative;
}
.hero-avatar-wrapper { position: relative; transform: rotate(-3deg); transition: transform 0.3s; }
.hero-avatar-wrapper:hover { transform: rotate(2deg) scale(1.05); }
.hero-avatar { width: 220px; height: 220px; object-fit: cover; border: 4px solid white; background-color: white; padding: 8px; border-radius: 50%; box-shadow: 6px 6px 0px var(--journal-ink); }
.hero-badge {
  display: inline-flex; gap: 8px; padding: 8px 16px; background: var(--journal-paper); border: 2px solid var(--journal-ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; font-family: var(--font-heading); box-shadow: 3px 3px 0 var(--journal-accent-1); transform: rotate(-2deg); margin-bottom: 24px;
}
.badge-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--craft-red); border: 1.5px solid var(--journal-ink); }
.hero-name-zh { display: block; font-family: var(--font-script); font-size: 80px; text-shadow: 3px 3px 0px var(--craft-orange); }
.hero-name-en { display: block; font-family: var(--font-heading); font-size: 24px; color: var(--journal-accent-2); }
.hero-subtitle { font-size: 18px; font-weight: 600; padding: 4px 8px; background: rgba(255,255,255,0.6); border: 1.5px dashed var(--journal-accent-1); margin: 16px 0; display: inline-block;}
.hero-info { display: flex; gap: 16px; font-family: var(--font-heading); flex-wrap: wrap; margin-top: 24px; }
.hero-info-item { border-bottom: 2px dotted var(--journal-accent-1); }

/* Skills Section */
.section-header { margin-bottom: 48px; position: relative; display: inline-block; }
.section-tag { font-family: var(--font-heading); font-size: 32px; position: relative; z-index: 2;}
.section-tag::after { content: ''; position: absolute; bottom: 0; left: -10px; right: -10px; height: 16px; background: var(--journal-highlight); z-index: -1; transform: rotate(-2deg); border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;}
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px; margin-bottom: 48px; }
.skill-card-icon { font-size: 32px; background: var(--journal-highlight); width: 50px; height: 50px; text-align: center; line-height: 50px; border-radius: 50%; border: 2px solid var(--journal-ink); margin-bottom: 16px; display: inline-block;}
.skill-card-title { font-family: var(--font-heading); font-size: 22px; margin-bottom: 12px; }
.skills-tags { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.skill-tag {
  font-family: var(--font-heading); font-size: 14px; padding: 6px 16px; background: white;
  border: 2px solid var(--journal-ink); border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  box-shadow: 2px 2px 0 var(--journal-accent-1);
}
.skill-tag.highlight-tag { background: var(--craft-yellow); font-weight: bold; }
.skill-tag.highlight-tag:nth-child(even) { background: var(--craft-blue); color: white; }
.skill-tag.highlight-tag:nth-child(3n) { background: var(--craft-purple); color: white; }

/* Experience Section */
.experience-section .container { position: relative; z-index: 1; }
.experience-section .container::before {
  content: ''; position: absolute; top: 100px; bottom: 50px; left: 40px; width: 4px;
  background-image: repeating-linear-gradient(to bottom, var(--journal-ink) 0, var(--journal-ink) 10px, transparent 10px, transparent 20px);
}
.exp-card { margin-bottom: 48px; margin-left: 50px; position: relative; }
.exp-card::before { content: ''; position: absolute; left: -44px; top: 24px; width: 20px; height: 20px; background: var(--craft-red); border: 3px solid var(--journal-ink); border-radius: 50%; box-shadow: 2px 2px 0 var(--journal-ink); }
.exp-card-header { margin-bottom: 16px; border-bottom: 2px dashed var(--journal-accent-1); padding-bottom: 16px; }
.exp-company { font-family: var(--font-heading); font-size: 24px; color: var(--craft-red); }
.exp-meta { display: flex; justify-content: space-between; font-family: var(--font-heading); color: var(--journal-accent-2); }
.exp-role { font-weight: bold; color: var(--journal-ink); }
.exp-list { padding-left: 20px; }
.exp-list li { margin-bottom: 12px; position: relative; }
.exp-list li::before { content: '➤'; position: absolute; left: -20px; color: var(--craft-orange); font-family: var(--font-heading); }
.exp-list li strong { background: rgba(244, 226, 133, 0.4); padding: 0 4px; border-radius: 2px; }

/* Education Section */
.edu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.edu-card { text-align: center; }
.edu-icon { font-size: 40px; margin-bottom: 16px; }
.edu-school { font-family: var(--font-heading); font-size: 20px; color: var(--craft-purple); margin-bottom: 8px; }

/* About & Footer */
.about-content { font-size: 18px; text-align: center; }
.about-content p { margin-bottom: 24px; }
.about-content p:last-child { font-family: var(--font-script); font-size: 28px; color: var(--craft-red); }
.footer { text-align: center; padding: 40px 0; border-top: 2px dashed var(--journal-accent-1); margin-top: 40px; }
.footer-note { font-family: var(--font-script); font-size: 24px; margin-bottom: 16px; }

/* Works / TV Showcase */
.tv-showcase { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 40px; width: 100%; }
.tv-shell {
  background-color: #F5E6D3; border: 6px solid #8B6F47;
  border-radius: 20px 20px 25px 30px / 25px 23px 20px 25px;
  box-shadow: inset -4px -4px 0 rgba(0,0,0,0.1), 8px 8px 0 var(--journal-ink);
  padding: 30px; display: flex; gap: 30px; flex: 1.5; min-width: 0;
  transform: rotate(-0.5deg); transition: transform 0.1s;
}
.tv-shake { animation: tv-shake-anim 0.4s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes tv-shake-anim {
  10%, 90% { transform: translate3d(-1px, 0, 0) rotate(-1.5deg); }
  20%, 80% { transform: translate3d(2px, 0, 0) rotate(0.5deg); }
  30%, 50%, 70% { transform: translate3d(-3px, 2px, 0) rotate(-2.5deg); }
  40%, 60% { transform: translate3d(3px, -2px, 0) rotate(1.5deg); }
}
.tv-screen-container { flex: 1; background: #AFA292; border-radius: 16px; padding: 20px; border: 4px solid #8B6F47; }
.tv-brand { text-align: center; font-family: var(--font-heading); color: #8B6F47; margin-top: 15px; font-size: 18px; letter-spacing: 2px; }
.tv-screen {
  background: #111; border-radius: 12px; overflow: hidden; position: relative;
  aspect-ratio: 4/3; width: 100%; border: 6px solid #2C1810; box-shadow: inset 0 0 20px rgba(0,0,0,1);
}
.tv-screen video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-crt-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 5;
  background: linear-gradient(rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 20%), 
              repeating-linear-gradient(rgba(0,0,0,0.1) 0px, rgba(0,0,0,0.1) 2px, transparent 2px, transparent 4px);
}
.tv-static {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 6; pointer-events: none; opacity: 0;
  background-image: url('data:image/svg+xml,%3Csvg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"%3E%3Cfilter id="n"%3E%3CfeTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23n)"/%3E%3C/svg%3E');
}
.tv-static.active { opacity: 0.3; animation: tv-static-anim 0.2s infinite; }
@keyframes tv-static-anim { 0% { transform: translate(0,0); } 100% { transform: translate(-5%, 5%); } }
.tv-curtain { position: absolute; left: 0; right: 0; height: 0%; background: #111; z-index: 4; transition: height 0.3s ease-in-out; }
.tv-curtain-top { top: 0; }
.tv-curtain-bottom { bottom: 0; }
.tv-curtain.closed { height: 50.5%; }
.tv-power-mask {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #111; z-index: 10;
  transform-origin: center; transition: transform 0.4s cubic-bezier(0.8, 0, 0.2, 1); transform: scaleY(0);
}
.tv-power-mask.off { transform: scaleY(1); }
.tv-screen.filter-bw video { filter: grayscale(1); }
.tv-screen.filter-sepia video { filter: sepia(0.8) contrast(1.2); }
.tv-controls { width: 120px; display: flex; flex-direction: column; gap: 20px; }
.tv-knob {
  width: 60px; height: 60px; border-radius: 50%; background: #D4A574; border: 4px solid var(--journal-ink);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-heading); cursor: pointer;
  box-shadow: 2px 2px 0 var(--journal-ink); transition: all 0.2s; user-select: none;
}
.tv-knob:active { transform: scale(0.95); }
.tv-knob.off { background: #555; color: #999; }
.tv-channels, .tv-actions { display: flex; flex-direction: column; gap: 10px; }
.tv-btn {
  padding: 8px; background: #fff; border: 3px solid var(--journal-ink);
  border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px;
  font-family: var(--font-heading); cursor: pointer; box-shadow: 2px 2px 0 var(--journal-ink);
}
.tv-btn.active { background: var(--craft-orange); color: #fff; }
.tv-btn:hover { transform: translateY(-2px); }
.tv-btn-small {
  padding: 6px; background: #E07A5F; color: #fff; border: 2px solid var(--journal-ink);
  border-radius: 4px; font-family: var(--font-heading); cursor: pointer;
}
.tv-info-card { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.tv-info-title { font-family: var(--font-heading); color: var(--craft-blue); margin-bottom: 12px; font-size: 24px; }
.tv-info-desc { margin-bottom: 16px; font-size: 15px; }
.tv-info-tags { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .tv-showcase { flex-direction: column; }
  .tv-shell, .tv-info-card { width: 100%; flex: auto; max-width: 800px; }
  .tv-controls { flex-direction: row; width: 100%; justify-content: space-around; flex-wrap: wrap; }
}

/* Platformer Mini Game */
.platformer-section { padding-bottom: 40px; }
.platformer-container {
  width: 100vw; height: 220px; overflow: hidden; position: relative;
  left: 50%; transform: translateX(-50%);
  border-top: 2px dashed var(--journal-accent-1);
  border-bottom: 2px dashed var(--journal-accent-1);
}
#platformerCanvas { display: block; width: 100%; height: 100%; filter: url(#handdraw-jitter); cursor: crosshair; }

/* Animations & Responsive */
.reveal { opacity: 0; transform: translateY(30px); transition: all 0.6s; }
.reveal.active { opacity: 1; transform: translateY(0); }
@media (max-width: 768px) {
  .hero-content { flex-direction: column; text-align: center; }
  .nav-links { display: none; }
}
