:root {
  --primary: #0891b2;
  --primary-dark: #0e7490;
  --accent: #10b981;
  --gradient: linear-gradient(135deg, #0891b2 0%, #10b981 100%);
  --gradient-subtle: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
  --text: #1e293b;
  --text-secondary: #475569;
  --text-light: #94a3b8;
  --bg: #fff;
  --bg-alt: #f8fafc;
  --border: #e2e8f0;
  --radius: 10px;
  --transition: 0.25s ease;
  --max-w: 1000px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
  background: var(--bg); color: var(--text); line-height: 1.7;
  -webkit-font-smoothing: antialiased; text-align: justify;
}
:lang(zh), :lang(zh-CN) {
  font-weight: 600;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== NAV ===== */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  background: linear-gradient(135deg, #0e7490 0%, #059669 100%);
  border-bottom: none; transition: var(--transition);
}
.nav.scrolled { box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15); }
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 32px;
  display: flex; align-items: center; justify-content: space-between; height: 40px;
}
.nav-logo { 
  font-size: 1rem; font-weight: 700; text-decoration: none;
  color: #fff;
}
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.nav-links a {
  text-decoration: none; color: rgba(255,255,255,0.85); font-size: 0.85rem; font-weight: 500;
  padding: 6px 12px; border-radius: 8px; transition: var(--transition);
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.15); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,0.2); font-weight: 600; }
.lang-toggle {
  background: rgba(255,255,255,0.2); color: #fff; border: 1px solid rgba(255,255,255,0.3);
  padding: 4px 12px; border-radius: 4px; cursor: pointer;
  font-size: 0.75rem; font-weight: 600; transition: var(--transition); font-family: inherit;
}
.lang-toggle:hover { background: rgba(255,255,255,0.3); }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: #fff; }
.mobile-menu-btn svg { width: 22px; height: 22px; }

/* ===== HERO ===== */
.hero {
  padding: 52px 24px 16px;
  border-bottom: none;
  background: var(--bg-alt);
  overflow: hidden;
}
.hero-inner {
  max-width: var(--max-w); margin: 0 auto; padding: 0 16px;
  display: flex; gap: 32px; align-items: flex-start;
}
.hero-profile { flex-shrink: 0; }
.hero-photo {
  width: 140px; height: 140px; border-radius: 50%;
  object-fit: cover; object-position: center 25%;
  border: none;
  box-shadow: none;
  margin-left: 16px;
}
.hero-text { flex: 1; min-width: 0; overflow: hidden; }
.hero-text h1 {
  font-size: 1.5rem; font-weight: 600; margin-bottom: 2px; line-height: 1.4;
  letter-spacing: 0.1em; color: var(--primary-dark);
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-tagline {
  font-size: 1rem; color: var(--primary-dark); margin-bottom: 6px; font-weight: 500;
}
.hero-bio {
  max-width: 760px; text-align: justify;
}
.hero-bio p {
  font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.65;
}
.hero-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.badge {
  background: var(--gradient-subtle); border: 1px solid rgba(8, 145, 178, 0.15);
  padding: 4px 10px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 500; color: var(--primary-dark);
}
.hero-links {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.hero-links a {
  font-size: 0.72rem; font-weight: 500; color: var(--primary-dark);
  text-decoration: none; padding: 4px 10px; border-radius: 4px;
  background: var(--gradient-subtle); border: 1px solid rgba(8, 145, 178, 0.15);
  transition: var(--transition); display: inline-flex; align-items: center;
}
.hero-links a:hover { color: #fff; background: var(--gradient); border-color: transparent; text-decoration: none; }
.hero-links a svg { opacity: 0.7; }
.hero-links a:hover svg { opacity: 1; }
.hero-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; align-items: center; }
.hero-skill {
  background: var(--gradient-subtle); border: 1px solid rgba(8, 145, 178, 0.15);
  padding: 4px 10px; border-radius: 4px;
  font-size: 0.72rem; font-weight: 500; color: var(--primary-dark);
}
/* ===== PROJECT SKILLS ===== */
.project-skills {
  display: flex; flex-wrap: wrap; gap: 3px;
  padding: 0 8px 6px;
}
.project-skill {
  background: var(--gradient-subtle); border: 1px solid rgba(8, 145, 178, 0.2);
  padding: 2px 5px; border-radius: 2px;
  font-size: 0.55rem; font-weight: 500; color: var(--primary-dark);
  transition: var(--transition); white-space: nowrap;
}
.photo-card:hover .project-skill {
  border-color: var(--primary); background: rgba(8, 145, 178, 0.12);
}
.project-skill.talk-type {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.photo-card:hover .project-skill.talk-type {
  background: var(--accent); border-color: var(--accent);
}

/* ===== CAROUSEL (grid) ===== */
.carousel-section {
  background: var(--bg-alt);
  padding: 4px 24px 20px;
  border: none;
}
.carousel-wrapper {
  max-width: var(--max-w); margin: 0 auto; position: relative; 
  display: flex; align-items: center; gap: 8px;
}
.carousel-viewport {
  flex: 1; overflow: hidden;
}
.carousel-track {
  display: flex; gap: 12px; transition: transform 0.3s ease;
}
.carousel-card {
  flex: 0 0 calc((100% - 24px) / 3); min-width: 0;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg);
  text-decoration: none; transition: var(--transition);
}
.carousel-arrow {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border);
  background: #fff; color: var(--text-secondary); font-size: 1.2rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); flex-shrink: 0;
}
.carousel-arrow:hover { color: var(--primary); border-color: var(--primary); }
.carousel-card:hover { 
  box-shadow: 0 6px 16px rgba(8, 145, 178, 0.15); 
  transform: translateY(-2px); text-decoration: none;
  border-color: rgba(8, 145, 178, 0.3);
}
.carousel-card img { width: 100%; aspect-ratio: 2/1; object-fit: cover; display: block; background: var(--bg-alt); }
.carousel-label {
  padding: 5px 10px;
}
.carousel-label strong { display: block; font-size: 0.75rem; color: var(--text); margin-bottom: 1px; }
.carousel-label span { font-size: 0.65rem; color: var(--text-light); }
.carousel-nav {
  display: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text); z-index: 2;
  transition: var(--transition); box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.carousel-nav:hover { background: var(--bg-alt); }
.carousel-prev { left: 4px; }
.carousel-next { right: 4px; }

/* ===== SECTIONS ===== */
.section { padding: 24px 24px; }
.section + .section { border-top: 1px solid var(--border); }
.section-inner { max-width: var(--max-w); margin: 0 auto; }
.section-title { 
  font-size: 1.3rem; font-weight: 700; margin-bottom: 4px;
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.section-subtitle { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 24px; }
.subsection-title {
  font-size: 1.1rem; font-weight: 700; margin: 24px 0 16px;
  padding-top: 16px; border-top: 1px solid var(--border);
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.section-inner > .subsection-title:first-child {
  margin-top: 0; padding-top: 0; border-top: none;
}

/* ===== SKILLS (Card Groups) ===== */
.skills-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.skill-card {
  background: var(--bg); border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--border); position: relative; overflow: hidden;
  transition: var(--transition);
}
.skill-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient);
}
.skill-card:hover {
  border-color: rgba(8, 145, 178, 0.3);
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.1);
}
.skill-card-title {
  font-size: 0.85rem; font-weight: 700; color: var(--primary-dark);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.skill-card-title::before {
  content: attr(data-icon); font-size: 1rem;
}
.skill-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-card-tag {
  background: var(--gradient-subtle); border: 1px solid rgba(8, 145, 178, 0.12);
  padding: 3px 10px; border-radius: 4px;
  font-size: 0.73rem; font-weight: 500; color: var(--text);
  transition: var(--transition);
}
.skill-card-tag:hover {
  border-color: var(--primary); background: rgba(8, 145, 178, 0.08);
}

/* Legacy skills-inline (keep for compatibility) */
.skills-inline { display: flex; flex-direction: column; gap: 12px; }
.skill-group { display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: 6px; row-gap: 6px; padding-left: 106px; }
.skill-group-label {
  font-size: 0.8rem; font-weight: 700; color: var(--text-secondary);
  width: 100px; margin-left: -106px; flex-shrink: 0;
}
.skill-tag {
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 4px;
  font-size: 0.75rem; font-weight: 500; color: var(--text);
}
.skill-break { display: block; flex-basis: 100%; width: 100%; height: 0; }

/* ===== PHOTO GRID (unified: projects, blog, talks) ===== */
.photo-grid {
  display: grid; gap: 16px;
}
.photo-grid-4 { grid-template-columns: repeat(4, 1fr); }
.photo-grid-3 { grid-template-columns: repeat(3, 1fr); }
.photo-grid-6 { grid-template-columns: repeat(6, 1fr); }

.photo-card {
  display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg);
  transition: var(--transition); height: 100%;
}
.photo-card:hover {
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.15);
  transform: translateY(-2px); text-decoration: none;
  border-color: rgba(8, 145, 178, 0.3);
}
.photo-card img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--bg-alt);
  flex-shrink: 0;
}
.photo-card-label {
  padding: 10px 12px; font-size: 0.82rem; font-weight: 600;
  line-height: 1.4; color: var(--text); flex-grow: 1;
}
.project-skills { margin-top: auto; }

/* ===== CARD THEME ACCENTS ===== */
.project-card, .talk-card, .blog-card {
  border-bottom: 3px solid var(--primary);
}
.project-card:hover, .talk-card:hover, .blog-card:hover {
  border-bottom-color: var(--accent);
}
.project-card .photo-card-label,
.talk-card .photo-card-label,
.blog-card .photo-card-label {
  border-top: 2px solid rgba(8, 145, 178, 0.4);
}
.project-card:hover .photo-card-label,
.talk-card:hover .photo-card-label,
.blog-card:hover .photo-card-label {
  border-top-color: rgba(5, 150, 105, 0.6);
}
.blog-card .photo-card-label {
  font-size: 0.72rem; padding: 8px 10px;
}

/* ===== CREATIVE ===== */
.creative-card {
  display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
}
.creative-text { flex: 1; min-width: 240px; }
.creative-text h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.creative-text p { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 12px; }
.creative-links { display: flex; gap: 14px; flex-wrap: wrap; }
.creative-links a { font-size: 0.85rem; font-weight: 600; }
.music-player { margin-top: 12px; }
.music-player iframe { border-radius: 8px; max-width: 100%; }
.creative-video { width: 380px; max-width: 100%; flex-shrink: 0; }
.video-switch {
  display: flex; gap: 2px; margin-bottom: 6px;
  background: var(--bg-alt); border-radius: 5px; padding: 2px; border: 1px solid var(--border);
}
.video-switch-btn {
  flex: 1; padding: 4px 12px; border: none; border-radius: 4px;
  background: transparent; color: var(--text-secondary);
  font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: var(--transition); font-family: inherit;
}
.video-switch-btn.active { background: var(--text); color: #fff; }
.video-switch-btn:not(.active):hover { color: var(--primary); }
.video-container { aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: #000; }
.video-container iframe { width: 100%; height: 100%; border: none; }
.video-fallback {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: #888; font-size: 0.9rem;
}
.video-fallback a {
  margin-top: 12px; padding: 10px 20px; background: #c00; color: #fff;
  border-radius: 4px; text-decoration: none; font-weight: 600;
}
.video-fallback a:hover { background: #a00; }

/* ===== EXPERIENCE (Timeline Cards) ===== */
.exp-list {
  display: flex; flex-direction: column; gap: 4px;
  position: relative; padding-left: 120px;
}
.exp-list::before {
  content: ''; position: absolute; left: 106px; top: 8px; bottom: 8px; width: 3px;
  background: var(--gradient); border-radius: 2px; opacity: 0.3;
}
.exp-item {
  display: block; position: relative;
  background: transparent; border-radius: var(--radius);
  padding: 6px 18px; border: none;
  transition: var(--transition); max-width: 810px;
}
.exp-item::before {
  content: ''; position: absolute; left: -18px; top: 22px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gradient); box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}
.exp-item:hover {
  background: rgba(8, 145, 178, 0.03);
}
.exp-period {
  position: absolute; left: -118px; top: 18px; width: 90px;
  font-size: 0.78rem; font-weight: 700; text-align: right;
  background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.exp-body { flex: 1; }
.exp-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.exp-body h3 a, .exp-body h3 span { color: var(--text); }
.exp-body h3 a:hover { color: var(--primary); text-decoration: none; }
.company-logo { 
  width: 36px; height: 36px; object-fit: contain; border-radius: 8px; flex-shrink: 0;
  background: var(--bg); padding: 4px; border: 1px solid var(--border);
}
.exp-role { font-size: 0.85rem; color: var(--primary); font-weight: 600; margin-bottom: 8px; }
.exp-status { 
  font-size: 0.88rem; color: var(--primary); font-weight: 600; margin-bottom: 8px;
}
.exp-body ul { list-style: disc; padding-left: 18px; margin: 8px 0; }
.exp-body li {
  margin-bottom: 6px;
  font-size: 0.82rem; color: var(--text-secondary); line-height: 1.7;
  text-align: justify;
}
.exp-body li::marker { color: var(--primary); }
.exp-note { 
  font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px;
  padding: 4px 10px; background: var(--gradient-subtle); border-radius: 4px; display: inline-block;
}

/* ===== EDUCATION (Compact Cards) ===== */
.edu-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.edu-card {
  background: var(--bg); border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--border); transition: var(--transition);
  display: flex; gap: 12px; align-items: flex-start;
}
.edu-card:hover {
  border-color: rgba(8, 145, 178, 0.4);
  box-shadow: 0 4px 16px rgba(8, 145, 178, 0.1);
}
.edu-logo {
  width: 44px; height: 44px; object-fit: contain; border-radius: 8px; flex-shrink: 0;
  background: var(--bg-alt); padding: 6px;
}
.edu-info { flex: 1; }
.edu-info h4 { font-size: 0.92rem; font-weight: 700; margin-bottom: 2px; }
.edu-info h4 a { color: var(--text); }
.edu-info h4 a:hover { color: var(--primary); text-decoration: none; }
.edu-degree { font-size: 0.8rem; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.edu-period { font-size: 0.72rem; color: var(--text-light); margin-bottom: 4px; }
.edu-honor {
  font-size: 0.72rem; color: var(--accent); font-weight: 600;
  background: rgba(16, 185, 129, 0.1); padding: 2px 8px; border-radius: 3px; display: inline-block;
}

/* ===== CERTIFICATIONS (Grouped Cards) ===== */
.cert-section { display: flex; flex-direction: column; gap: 16px; }
.cert-group {
  background: var(--bg); border-radius: var(--radius); padding: 16px;
  border: 1px solid var(--border);
}
.cert-group-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.cert-group-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--gradient); display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}
.cert-group-title { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.cert-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.cert-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 6px;
  background: var(--gradient-subtle); border: 1px solid rgba(8, 145, 178, 0.15);
  font-size: 0.78rem; color: var(--text); text-decoration: none; transition: var(--transition);
}
.cert-tag:hover { 
  border-color: var(--primary); background: rgba(8, 145, 178, 0.08); 
  text-decoration: none; transform: translateY(-1px);
}
.cert-tag strong { font-weight: 700; color: var(--primary); }
.cert-tag .cert-issuer { color: var(--text-light); font-size: 0.72rem; }

/* Compact certifications */
.cert-compact {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.cert-compact a {
  display: inline-block; padding: 4px 12px; border-radius: 4px;
  background: var(--gradient-subtle); border: 1px solid rgba(8, 145, 178, 0.15);
  font-size: 0.78rem; font-weight: 500; color: var(--text);
  text-decoration: none; transition: var(--transition);
}
.cert-compact a:hover { 
  border-color: var(--primary); background: rgba(8, 145, 178, 0.08); 
  text-decoration: none; 
}

/* Compact skills */
.skills-compact {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.skills-compact .skill-tag {
  background: var(--bg-alt); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 4px;
  font-size: 0.75rem; font-weight: 500; color: var(--text);
}

/* ===== PUBLICATIONS ===== */
.pub-list { display: flex; flex-direction: column; gap: 16px; }
.pub-item { display: flex; flex-direction: column; gap: 2px; }
.pub-title-row { display: flex; align-items: center; gap: 6px; }
.pub-type {
  display: inline-block; background: var(--bg-alt); border: 1px solid var(--border);
  padding: 1px 8px; border-radius: 3px; font-size: 0.68rem; font-weight: 700;
  color: var(--primary); width: fit-content;
}
.pub-item a { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.pub-item a:hover { color: var(--primary); }
.pub-meta { font-size: 0.78rem; color: var(--text-light); }
.pub-download {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; margin-left: 6px;
  background: var(--gradient); color: #fff !important;
  border-radius: 4px; text-decoration: none;
}
.pub-download:hover { opacity: 0.85; color: #fff !important; text-decoration: none; }
.pub-download svg { flex-shrink: 0; }

/* ===== CONTACT ===== */
.contact-section {
  background: linear-gradient(135deg, #0e7490 0%, #059669 100%); color: #fff; padding: 16px 24px;
}
.contact-inner { max-width: var(--max-w); margin: 0 auto; text-align: center; }
.contact-inner h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 2px; color: #fff; }
.contact-inner > p { font-size: 0.92rem; opacity: 0.7; margin-bottom: 10px; }
.contact-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.contact-links a { color: rgba(255,255,255,0.9); font-size: 0.85rem; font-weight: 500; text-decoration: none; padding: 6px 12px; border-radius: 4px; background: rgba(255,255,255,0.15); display: inline-flex; align-items: center; transition: var(--transition); }
.contact-links a:hover { background: rgba(255,255,255,0.25); color: #fff; text-decoration: none; }

.qrcode-section { display: flex; justify-content: center; gap: 40px; flex-wrap: wrap; }
.qrcode-card { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qrcode-card img {
  width: 160px; height: 160px; object-fit: contain; border-radius: 8px;
  background: #fff; padding: 8px;
}
.qrcode-card span { font-size: 0.85rem; opacity: 0.7; }

.footer {
  background: var(--text); color: rgba(255,255,255,0.4);
  text-align: center; padding: 12px 24px; font-size: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Back to Top Button */
.back-to-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient); color: #fff; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 12px rgba(8, 145, 178, 0.25);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: var(--transition);
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-2px); box-shadow: 0 5px 16px rgba(8, 145, 178, 0.35); }

/* ===== ANIMATE ===== */
.fade-in { opacity: 0; transform: translateY(12px); transition: opacity 0.5s ease, transform 0.5s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .nav-links {
    display: none; position: absolute; top: 40px; left: 0; right: 0;
    background: linear-gradient(135deg, #0e7490 0%, #059669 100%);
    flex-direction: column; padding: 12px 20px;
    border-bottom: none; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  }
  .nav-links.open { display: flex; }
  .mobile-menu-btn { display: block; }

  .hero-inner { flex-direction: column; gap: 20px; align-items: center; text-align: center; }
  .hero-links, .hero-badges, .hero-skills { justify-content: center; }
  .hero { padding: 68px 16px 32px; }

  .carousel-track { grid-template-columns: 1fr; gap: 12px; }

  .section { padding: 36px 16px; }
  .section-title { font-size: 1.25rem; }

  .photo-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .photo-grid-3 { grid-template-columns: 1fr; }
  .photo-grid-6 { grid-template-columns: repeat(3, 1fr); }

  .creative-card { flex-direction: column; }
  .creative-video { width: 100%; }

  .exp-list { padding-left: 20px; }
  .exp-list::before { left: 6px; }
  .exp-item { padding: 14px 16px; }
  .exp-item::before { left: -18px; top: 18px; width: 8px; height: 8px; }
  .exp-period { 
    position: static; width: auto; text-align: left; 
    margin-bottom: 8px; display: block;
  }
  
  .edu-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .cert-group { padding: 14px; }
}

/* ===== AI CHAT WIDGET ===== */
.ai-chat-widget {
  position: fixed;
  bottom: 72px;
  right: 24px;
  z-index: 1001;
  font-family: inherit;
}

.ai-chat-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 12px rgba(8, 145, 178, 0.25);
  transition: all 0.3s ease;
  position: relative;
}

.ai-chat-toggle::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--gradient);
  opacity: 0;
  z-index: -1;
  animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
  0%, 100% { transform: scale(1); opacity: 0; }
  50% { transform: scale(1.15); opacity: 0.3; }
}

.ai-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(8, 145, 178, 0.5);
}

.ai-chat-toggle:hover::before {
  animation: none;
  opacity: 0;
}

.ai-chat-toggle .ai-icon-close {
  display: none;
}

.ai-chat-widget.open .ai-chat-toggle .ai-icon-open {
  display: none;
}

.ai-chat-widget.open .ai-chat-toggle .ai-icon-close {
  display: block;
}

.ai-chat-widget.open .ai-chat-toggle::before {
  animation: none;
}

.ai-chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 400px;
  height: 560px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s ease;
}

.ai-chat-widget.open .ai-chat-window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.ai-chat-header {
  background: var(--gradient);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.ai-chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: background 0.2s ease;
}

.ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-chat-body {
  flex: 1;
  overflow: hidden;
  position: relative;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ai-chat-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.ai-chat-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.ai-chat-loading {
  text-align: center;
  color: var(--text-secondary);
}

.ai-loading-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
}

.ai-loading-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: ai-dot-bounce 1.4s infinite ease-in-out both;
}

.ai-loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.ai-loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes ai-dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-chat-loading p {
  font-size: 0.88rem;
  margin: 0;
}

.ai-chat-error {
  text-align: center;
  padding: 40px 24px;
  color: var(--text-secondary);
}

.ai-chat-error svg {
  margin-bottom: 16px;
  color: var(--text-light);
}

.ai-chat-error p {
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.ai-chat-error a {
  display: inline-block;
  padding: 10px 20px;
  background: var(--gradient);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s ease;
}

.ai-chat-error a:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
  text-decoration: none;
}

/* 自定义聊天消息 (proxy 模式) */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
  min-height: 0;
}

.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

.ai-message {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: ai-msg-in 0.3s ease;
}

@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-message-bot {
  align-self: flex-start;
}

.ai-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.ai-message-content {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  word-break: break-word;
}

.ai-message-bot .ai-message-content {
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px;
}

.ai-message-user .ai-message-content {
  background: var(--gradient);
  color: #fff;
  border-radius: 16px 4px 16px 16px;
}

.ai-message-content a {
  color: var(--primary);
  text-decoration: underline;
}

.ai-message-user .ai-message-content a {
  color: #fff;
}

.ai-message-content code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

.ai-typing-dots {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.ai-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: ai-typing 1.4s infinite ease-in-out both;
}

.ai-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes ai-typing {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.ai-chat-input-wrapper {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid var(--border);
}

.ai-chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
}

.ai-chat-send {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.ai-chat-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(8, 145, 178, 0.3);
}

.ai-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 流式输出光标 */
.ai-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: ai-blink 0.8s infinite;
}

@keyframes ai-blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* 思考中状态 */
.ai-thinking-box {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(8, 145, 178, 0.15);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}

.ai-thinking-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 8px;
}

.ai-thinking-icon {
  font-size: 1rem;
}

.ai-thinking-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 8px 10px;
  background: rgba(255,255,255,0.6);
  border-radius: 8px;
}

/* 折叠的思考过程 */
.ai-thought-collapse {
  margin-bottom: 12px;
  font-size: 0.82rem;
  border: 1px solid rgba(8, 145, 178, 0.12);
  border-radius: 10px;
  overflow: hidden;
}

.ai-thought-collapse summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.06), rgba(6, 182, 212, 0.03));
  transition: background 0.2s;
  list-style: none;
  font-weight: 500;
}

.ai-thought-collapse summary::-webkit-details-marker {
  display: none;
}

.ai-thought-collapse summary::after {
  content: '▶';
  font-size: 0.6rem;
  margin-left: auto;
  transition: transform 0.2s;
  color: var(--text-light);
}

.ai-thought-collapse[open] summary::after {
  transform: rotate(90deg);
}

.ai-thought-collapse summary:hover {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.1), rgba(6, 182, 212, 0.06));
}

.ai-thought-body {
  padding: 12px 14px;
  background: #f8fafc;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.82rem;
  border-top: 1px solid rgba(8, 145, 178, 0.08);
  max-height: 200px;
  overflow-y: auto;
}

/* 回答内容 */
.ai-answer {
  line-height: 1.7;
}

.ai-chat-footer a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.ai-chat-footer a:hover {
  text-decoration: underline;
}

/* Disclaimer 说明栏 - 始终显示 */
.ai-chat-disclaimer {
  background: #f8fafc;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 6px 12px;
  font-size: 0.7rem;
  color: var(--text-secondary, #64748b);
  text-align: center;
  flex-shrink: 0;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* iframe 模式：紧凑 header（避免与 Dify 内置 header 重叠） */
.ai-chat-widget.iframe-mode .ai-chat-header {
  padding: 6px 12px;
  min-height: 0;
}

.ai-chat-widget.iframe-mode .ai-chat-title {
  display: none;
}

.ai-chat-widget.iframe-mode .ai-chat-close {
  width: 26px;
  height: 26px;
  margin-left: auto;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .ai-chat-widget {
    right: 16px;
    bottom: 64px;
  }

  .ai-chat-toggle {
    width: 36px;
    height: 36px;
  }

  .ai-chat-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    max-height: none;
    border-radius: 16px 16px 0 0;
  }

  .ai-chat-widget.open .ai-chat-toggle {
    position: fixed;
    bottom: calc(100vh - 52px);
    right: 16px;
  }
}

