@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;650;720;760;800&display=swap');

:root {
  /* Light Mode Design Tokens */
  --bg-gradient: radial-gradient(circle at 10% 20%, rgba(240, 244, 255, 0.8) 0%, transparent 45rem),
                 radial-gradient(circle at 90% 80%, rgba(255, 244, 240, 0.8) 0%, transparent 45rem),
                 linear-gradient(180deg, #f8f9fa 0%, #f3f5f8 50%, #ebedf2 100%);
  --bg: #f3f5f8;
  --card: rgba(255, 255, 255, 0.82);
  --card-border: rgba(255, 255, 255, 0.6);
  --card-border-hover: rgba(0, 102, 204, 0.25);
  --text: #1c1c1e;
  --subtle: #3a3a3c;
  --muted: #636366;
  --line: #e5e5ea;
  --link: #0066cc;
  --link-hover: #0055b3;
  --link-bg: rgba(242, 248, 255, 0.7);
  --link-bg-hover: rgba(0, 102, 204, 0.08);
  --link-border: rgba(0, 102, 204, 0.15);
  --link-border-hover: rgba(0, 102, 204, 0.35);
  --chip: #f2f2f7;
  --chip-text: #48484a;
  --asset-bg: #f8fafc;
  --asset-line: #e2e8f0;
  --warm: #9f5e26;
  --green: #24684a;
  
  /* Shadows */
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 20px 40px -15px rgba(0, 102, 204, 0.12), 0 0 1px rgba(0, 102, 204, 0.2);
  --soft-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.05);
  --radius: 24px;

  /* Theme Toggle Button */
  --toggle-bg: rgba(255, 255, 255, 0.7);
  --toggle-border: rgba(0, 0, 0, 0.08);
  --toggle-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  --toggle-color: #48484a;

  /* Transitions */
  --ease-premium: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: all 0.5s var(--ease-premium);
  --transition-fast: all 0.2s ease;
}

[data-theme="dark"] {
  /* Dark Mode Design Tokens */
  --bg-gradient: radial-gradient(circle at 10% 20%, rgba(30, 41, 59, 0.25) 0%, transparent 50rem),
                 radial-gradient(circle at 90% 80%, rgba(15, 23, 42, 0.35) 0%, transparent 50rem),
                 linear-gradient(180deg, #090d16 0%, #0d131f 50%, #080a10 100%);
  --bg: #0d131f;
  --card: rgba(18, 25, 41, 0.7);
  --card-border: rgba(255, 255, 255, 0.05);
  --card-border-hover: rgba(56, 189, 248, 0.25);
  --text: #f1f5f9;
  --subtle: #cbd5e1;
  --muted: #94a3b8;
  --line: #1e293b;
  --link: #38bdf8;
  --link-hover: #7dd3fc;
  --link-bg: rgba(30, 41, 59, 0.6);
  --link-bg-hover: rgba(56, 189, 248, 0.12);
  --link-border: rgba(56, 189, 248, 0.2);
  --link-border-hover: rgba(56, 189, 248, 0.45);
  --chip: #1e293b;
  --chip-text: #94a3b8;
  --asset-bg: #1e293b;
  --asset-line: #334155;
  --warm: #fbbf24;
  --green: #34d399;
  
  /* Shadows */
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 20px 40px -15px rgba(56, 189, 248, 0.25), 0 0 1px rgba(56, 189, 248, 0.4);
  --soft-shadow: 0 4px 20px -8px rgba(0, 0, 0, 0.2);

  /* Theme Toggle Button */
  --toggle-bg: rgba(30, 41, 59, 0.7);
  --toggle-border: rgba(255, 255, 255, 0.08);
  --toggle-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  --toggle-color: #f1f5f9;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: light dark;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.62;
  color: var(--text);
  background: var(--bg-gradient);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.6s var(--ease-premium), color 0.4s ease;
}

/* Custom Scrollbars */
body {
  scrollbar-color: var(--link-border) transparent;
  scrollbar-width: thin;
}

@media (pointer: fine) {
  .nagato-cursor {
    cursor: url("assets/cursors/nagato/normal-32.png") 0 0,
            auto;
  }

  .nagato-cursor p,
  .nagato-cursor li,
  .nagato-cursor h1,
  .nagato-cursor h2,
  .nagato-cursor h3,
  .nagato-cursor .item-title,
  .nagato-cursor .timeline-title,
  .nagato-cursor .news-text,
  .nagato-cursor .muted,
  .nagato-cursor .authors,
  .nagato-cursor .section-note {
    cursor: url("assets/cursors/nagato/text-32.png") 4 8,
            text;
  }

  .nagato-cursor a,
  .nagato-cursor button,
  .nagato-cursor summary,
  .nagato-cursor [role="button"],
  .nagato-cursor .pill-link,
  .nagato-cursor .mini-link,
  .nagato-cursor .collab-card,
  .nagato-cursor .news-toggle,
  .nagato-cursor .bibtex-btn,
  .nagato-cursor .theme-toggle-btn,
  .nagato-cursor .lang-toggle-btn,
  .nagato-cursor .back-to-top-btn,
  .nagato-cursor .waifu-tool span {
    cursor: url("assets/cursors/nagato/pointer-32.png") 0 0,
            pointer;
  }
}

.nagato-trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1600;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}



::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--link-border);
  border-radius: 99px;
  transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--link-border-hover);
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  position: relative;
  z-index: 1;
}

.research-float-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.research-float-keyword {
  position: absolute;
  left: 0;
  top: 0;
  padding: 5px 11px;
  border: 1px solid rgba(0, 102, 204, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(0, 102, 204, 0.52);
  box-shadow: 0 8px 22px rgba(0, 102, 204, 0.06);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: var(--keyword-size, 13px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  opacity: 0;
  white-space: nowrap;
  transform: translate3d(var(--keyword-start-x, 0), var(--keyword-start-y, 0), 0) scale(0.96);
  animation: research-keyword-drift var(--keyword-duration, 14000ms) linear var(--keyword-delay, 0ms) forwards;
  will-change: transform, opacity;
}

[data-theme="dark"] .research-float-keyword {
  border-color: rgba(56, 189, 248, 0.18);
  background: rgba(15, 23, 42, 0.42);
  color: rgba(125, 211, 252, 0.58);
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.08);
}

@keyframes research-keyword-drift {
  0% {
    opacity: 0;
    transform: translate3d(var(--keyword-start-x, 0), var(--keyword-start-y, 0), 0) scale(0.96);
  }

  12%,
  78% {
    opacity: 0.5;
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--keyword-end-x, 0), var(--keyword-end-y, 0), 0) scale(1.04);
  }
}

@media (max-width: 720px), (prefers-reduced-motion: reduce) {
  .research-float-layer {
    display: none;
  }
}

/* Floating Theme Toggle */
.theme-toggle-btn {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  box-shadow: var(--toggle-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--toggle-color);
  transition: transform 0.3s var(--ease-premium), background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.theme-toggle-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

.theme-toggle-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s var(--ease-premium);
}

[data-theme="dark"] .theme-toggle-btn svg {
  transform: rotate(360deg);
}

/* Hide theme icon depending on theme */
.theme-toggle-btn .sun-icon {
  display: block;
}
.theme-toggle-btn .moon-icon {
  display: none;
}

[data-theme="dark"] .theme-toggle-btn .sun-icon {
  display: none;
}
[data-theme="dark"] .theme-toggle-btn .moon-icon {
  display: block;
}

/* Language Toggle Button */
.lang-toggle-btn {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  box-shadow: var(--toggle-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--toggle-color);
  transition: transform 0.3s var(--ease-premium), background 0.3s, border-color 0.3s, box-shadow 0.3s;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.lang-toggle-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.lang-toggle-btn:active {
  transform: scale(0.95);
}

/* Navigation */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14.5px;
  font-family: 'Outfit', sans-serif;
  padding: 12px 16px;
  border-radius: 16px;
  transition: background 0.3s, backdrop-filter 0.3s, box-shadow 0.3s, border-color 0.3s;
  border: 1px solid transparent;
}

.top-nav.scrolled {
  background: var(--card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-color: var(--card-border);
  box-shadow: var(--shadow);
}

.nav-name {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 16px;
  letter-spacing: -0.01em;
  transition: color var(--transition-fast);
}

.nav-name:hover {
  color: var(--link);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
  position: relative;
  padding: 4px 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--link);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s var(--ease-premium);
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-links a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* Glassmorphism Cards */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 38px 40px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: transform 0.4s var(--ease-premium), box-shadow 0.4s var(--ease-premium), border-color 0.4s;
  contain: layout style;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--card-border-hover);
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: center;
}

.profile-photo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: fit-content;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 4px solid var(--card-border);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08);
  transition: transform 0.4s var(--ease-premium), border-color 0.3s;
}

.profile-photo-wrap:hover {
  transform: scale(1.02) rotate(1deg);
  border-color: var(--link-border);
}

.profile-photo {
  width: 172px;
  height: 218px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

/* Typography */
h1, h2, h3 {
  font-family: 'Outfit', sans-serif;
  color: var(--text);
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text) 30%, var(--muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  margin: 0 0 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 760;
  position: relative;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--link);
  border-radius: 99px;
}

h3 {
  margin: 0 0 12px;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.005em;
}

p {
  margin: 8px 0;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.identity {
  font-size: 17.5px;
  color: var(--subtle);
  margin-bottom: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.about-line {
  max-width: 760px;
  margin-top: 14px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.68;
  text-wrap: pretty;
}

/* Focus List */
.focus-list {
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.focus-list li {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--chip-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.focus-list li:hover {
  border-color: var(--line);
  background: var(--card);
}

/* Links */
.links {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* CV Download Accent Pill */
.pill-link.pill-link-accent {
  border-color: var(--link);
  font-weight: 600;
}

.pill-link.pill-link-accent:hover,
.pill-link.pill-link-accent:focus-visible {
  border-color: var(--link-hover);
  background: var(--link-bg-hover);
}

.pill-link.pill-link-accent svg {
  stroke: currentColor;
}

.pill-link,
.mini-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.pill-link {
  padding: 6px 16px;
  border: 1px solid var(--link);
  background: var(--link-bg);
  color: var(--link);
  font-size: 14.5px;
  line-height: 1.5;
  box-shadow: var(--soft-shadow);
}

.pill-link:hover,
.pill-link:focus-visible {
  text-decoration: none;
  background: var(--link-bg-hover);
  border-color: var(--link-hover);
  transform: translateY(-2px);
}

.mini-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.mini-link {
  padding: 4px 12px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--link);
  font-size: 13.5px;
  line-height: 1.45;
}

.mini-link:hover,
.mini-link:focus-visible {
  text-decoration: none;
  background: var(--link-bg-hover);
  border-color: var(--link-border);
  transform: translateY(-1px);
}

.item-title {
  font-weight: 700;
  font-size: 17.5px;
  line-height: 1.45;
  color: var(--text);
  font-family: 'Outfit', sans-serif;
}

.muted {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.authors {
  margin-top: 6px;
  color: var(--subtle);
  font-size: 14.5px;
  line-height: 1.48;
}

.me {
  color: var(--text);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--link-border);
}

.highlight {
  margin: 10px 0 8px;
  color: var(--subtle);
  font-size: 14.8px;
  line-height: 1.55;
  background: rgba(0, 102, 204, 0.03);
  border-left: 3px solid var(--link);
  padding: 6px 12px;
  border-radius: 0 8px 8px 0;
}

[data-theme="dark"] .highlight {
  background: rgba(56, 189, 248, 0.03);
}

.highlight-label {
  color: var(--text);
  font-weight: 700;
}

.tag {
  display: inline-block;
  margin: 8px 8px 0 0;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--chip-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

.tag:hover {
  border-color: var(--line);
  background: var(--card);
}

/* Publication Card */
.publication-card {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 26px;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.publication-card:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.publication-card:first-of-type {
  padding-top: 0;
}

.publication-cover-wrap {
  width: 250px;
  height: 150px;
  border-radius: 16px;
  background: var(--asset-bg);
  border: 1px solid var(--asset-line);
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  transition: transform 0.3s var(--ease-premium), box-shadow 0.3s;
}

.publication-cover-wrap:hover {
  transform: scale(1.03);
  box-shadow: 0 12px 24px rgba(0,0,0,0.06);
}

.publication-cover {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  background: transparent;
}

.publication-cover.logo-cover {
  padding: 22px;
  background: var(--asset-bg);
}

.publication-cover.image-cover {
  object-fit: cover;
}

.publication-cover-text {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: #ffffff;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: 'Outfit', sans-serif;
}

/* Projects Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.project-card,
.note-card,
.info-panel {
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--soft-shadow);
  transition: transform 0.3s var(--ease-premium), border-color 0.3s, background-color 0.3s;
}

[data-theme="dark"] .project-card,
[data-theme="dark"] .note-card,
[data-theme="dark"] .info-panel {
  background: rgba(18, 25, 41, 0.3);
}

.project-card:hover,
.note-card:hover,
.info-panel:hover {
  transform: translateY(-2px);
  border-color: var(--link-border);
  background: var(--card);
}

.project-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.project-title {
  font-size: 17.5px;
  font-weight: 750;
  margin-bottom: 8px;
  font-family: 'Outfit', sans-serif;
}

.project-desc {
  color: var(--subtle);
  font-size: 14.5px;
  line-height: 1.58;
}

/* Experience & Awards Grid */
.experience-awards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.timeline {
  position: relative;
  display: grid;
  gap: 20px;
  margin-top: 10px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 16px;
  align-items: start;
}

.school-logo {
  width: 52px;
  height: 38px;
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--asset-line);
  padding: 5px;
  display: block;
}

.school-logo.logo-hkust {
  padding: 4px 8px;
}

.school-logo.logo-epfl {
  padding: 6px;
}

.school-logo.logo-sjtu {
  padding: 6px;
}

.timeline-time {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.timeline-title {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  font-weight: 600;
}

.award-list {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
}

.award-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
  color: var(--chip-text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 500;
  transition: var(--transition-fast);
}

.award-chip:hover {
  background: var(--link-bg);
  border-color: var(--link-border);
  color: var(--link);
}

/* Details & Expandables */
details {
  margin-top: 10px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 600;
  user-select: none;
  transition: color 0.12s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

summary:hover {
  color: var(--link);
}

details[open] summary {
  margin-bottom: 12px;
  color: var(--link);
}

/* Notes Grid */
.note-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.note-card {
  min-height: 214px;
}

.section-note {
  color: var(--muted);
  font-size: 14.5px;
  margin: 0 0 10px;
  font-style: italic;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list li {
  position: relative;
  margin-bottom: 8px;
  padding-left: 18px;
  font-size: 14.8px;
  line-height: 1.55;
  color: var(--subtle);
}

.post-list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--link);
}

/* Footer */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  padding: 16px 0 32px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--link);
}

.footer-updated {
  display: block;
  padding: 0 16px;
}

.site-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  line-height: 1.2;
}

.site-counter-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-counter img {
  display: block;
  max-width: min(260px, calc(100vw - 48px));
  height: auto;
}

/* News Section */
.news-list {
  display: grid;
  gap: 0;
}

.news-item {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.55;
  transition: background 0.2s;
}

.news-item:first-child {
  padding-top: 0;
}

.news-item:last-child {
  border-bottom: none;
}

.news-hidden {
  display: none;
}

.news-date {
  flex-shrink: 0;
  min-width: 80px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--link);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.news-text {
  color: var(--subtle);
}

.news-text a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--link-border);
}

.news-text a:hover {
  text-decoration-color: var(--link);
}

.news-toggle {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--link);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.news-toggle:hover {
  background: var(--link-bg-hover);
  border-color: var(--link-border);
}

/* BibTeX Copy Button */
.bibtex-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--link);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.45;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.bibtex-btn:hover {
  background: var(--link-bg-hover);
  border-color: var(--link-border);
  transform: translateY(-1px);
}

.bibtex-btn.copied {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.bibtex-btn svg {
  flex-shrink: 0;
}

.bibtex-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 2200;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 48px);
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  box-shadow: var(--toggle-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px) scale(0.98);
  transition: opacity 0.24s ease, transform 0.24s var(--ease-premium);
}

.bibtex-toast[hidden] {
  display: none;
}

.bibtex-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.bibtex-toast-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.bibtex-toast-text {
  white-space: nowrap;
}

/* Collaborators Section */
.collab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.collab-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid var(--card-border);
  box-shadow: var(--soft-shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.3s var(--ease-premium), border-color 0.3s, background-color 0.3s;
}

[data-theme="dark"] .collab-card {
  background: rgba(18, 25, 41, 0.3);
}

.collab-card:hover {
  transform: translateY(-3px);
  border-color: var(--link-border);
  background: var(--card);
  text-decoration: none;
  color: var(--text);
}

.collab-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--link), #8b5cf6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s var(--ease-premium);
  object-fit: cover;
}

.collab-card:hover .collab-avatar {
  transform: scale(1.08);
}

.collab-name {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 4px;
}

.collab-affil {
  font-size: 13px;
  color: var(--muted);
}

/* Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 32px;
  right: 24px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  box-shadow: var(--toggle-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--toggle-color);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s var(--ease-premium), background 0.3s, box-shadow 0.3s;
}

.back-to-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.back-to-top-btn:active {
  transform: scale(0.95);
}

.back-to-top-btn svg {
  stroke: currentColor;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Accessibility: prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
    transform: none !important;
  }
  
  .card:hover, 
  .theme-toggle-btn:hover,
  .pill-link:hover, 
  .mini-link:hover,
  .profile-photo-wrap:hover {
    transform: none !important;
  }
}

/* Responsive Media Queries */
@media (max-width: 960px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) {
  .project-grid,
  .note-grid,
  .experience-awards-grid {
    grid-template-columns: 1fr;
  }

  .note-card,
  .project-card {
    min-height: auto;
  }
}

@media (max-width: 820px) {
  .container {
    padding: 24px 16px 48px;
  }

  .top-nav {
    display: none;
  }

  .card {
    padding: 30px 24px;
    border-radius: 20px;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .profile-photo-wrap {
    justify-self: center;
    width: fit-content;
  }

  .profile-photo {
    width: 158px;
    height: 200px;
  }

  .publication-card {
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
  }

  .publication-cover-wrap {
    width: 100%;
    height: 210px;
  }
  
  .theme-toggle-btn {
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
  }

  .lang-toggle-btn {
    top: 64px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 13px;
  }

  .news-item {
    flex-direction: column;
    gap: 4px;
  }

  .news-date {
    min-width: auto;
  }

  .back-to-top-btn {
    bottom: 24px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 560px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
  
  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 22px;
  }

  .identity,
  .about-line {
    font-size: 15.5px;
  }

  .links {
    gap: 8px;
  }

  .pill-link {
    font-size: 14px;
    padding: 5px 12px;
  }

  .site-counter {
    flex-direction: column;
    gap: 6px;
  }

  .site-counter img {
    max-width: min(260px, calc(100vw - 96px));
  }

  .publication-cover-wrap {
    height: 180px;
  }
}

/* Scroll-Driven Animations (SDA) for premium card entrance reveals */
@keyframes card-reveal {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@supports (animation-timeline: view()) {
  .card {
    animation: card-reveal var(--ease-premium) both;
    animation-timeline: view();
    animation-range: entry 10% cover 25%;
  }
}

/* Custom Text Selection Highlight */
::selection {
  background: rgba(0, 102, 204, 0.22);
  color: var(--text);
}

[data-theme="dark"] ::selection {
  background: rgba(56, 189, 248, 0.35);
  color: #ffffff;
}

/* Reading Progress Bar (Pure CSS Scroll-driven) */
#scroll-indicator {
  display: none;
}

@supports (animation-timeline: scroll()) {
  #scroll-indicator {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--link);
    z-index: 2000;
    width: 100%;
    transform-origin: 0 50%;
    animation: scroll-progress linear;
    animation-timeline: scroll();
  }
}

@keyframes scroll-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Background canvas positioning */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.9;
  transition: opacity 0.5s;
}

/* Terminal Console Toggle Button */
.terminal-toggle-btn {
  position: fixed;
  top: 128px;
  right: 24px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  box-shadow: var(--toggle-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--toggle-color);
  transition: transform 0.3s var(--ease-premium), background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.terminal-toggle-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.terminal-toggle-btn:active {
  transform: scale(0.95);
}

/* Terminal Console Modal */
.terminal-modal {
  position: fixed;
  top: 15%;
  left: calc(50% - 290px);
  width: 580px;
  height: 380px;
  background: rgba(10, 15, 26, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 20px rgba(56, 189, 248, 0.1);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  font-family: 'Courier New', Courier, monospace;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(20px) scale(0.98);
  transition: opacity 0.3s var(--ease-premium), transform 0.3s var(--ease-premium);
}

.terminal-modal[hidden] {
  display: none !important;
}

[data-theme="light"] .terminal-modal {
  background: rgba(243, 245, 248, 0.95);
  border: 1px solid rgba(0, 102, 204, 0.22);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 20px rgba(0, 102, 204, 0.05);
}

.terminal-modal.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.terminal-header {
  background: rgba(30, 41, 59, 0.4);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  user-select: none;
}

[data-theme="light"] .terminal-header {
  background: rgba(229, 229, 234, 0.5);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.terminal-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-premium), filter 0.2s ease;
}

.terminal-dot:hover {
  transform: scale(1.15);
  filter: brightness(1.15);
}

.terminal-dot.close-btn { background: #ff5f56; }
.terminal-dot.minimize-btn { background: #ffbd2e; }
.terminal-dot.expand-btn { background: #27c93f; }

.terminal-title {
  color: #94a3b8;
  font-size: 13px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 600;
}

[data-theme="light"] .terminal-title {
  color: #48484a;
}

.terminal-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  color: #38bdf8;
  font-size: 13.5px;
  line-height: 1.45;
}

[data-theme="light"] .terminal-body {
  color: #0066cc;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 8px;
  padding-right: 4px;
}

.terminal-output div {
  margin-bottom: 4px;
  word-break: break-all;
  white-space: pre-wrap;
}

.terminal-input-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-prompt {
  color: #4ade80;
  font-weight: bold;
  white-space: nowrap;
}

[data-theme="light"] .terminal-prompt {
  color: #24684a;
}

.cmd-highlight {
  color: #a78bfa;
  font-weight: bold;
}

[data-theme="light"] .cmd-highlight {
  color: #8b5cf6;
}

#terminal-input {
  background: transparent;
  border: none;
  outline: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 13.5px;
  flex: 1;
  caret-color: #4ade80;
}

[data-theme="light"] #terminal-input {
  color: #1c1c1e;
  caret-color: #24684a;
}

/* NetEase BGM Player Card */
.music-card {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 990;
  width: 255px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.3s var(--ease-premium), box-shadow 0.3s, border-color 0.3s;
}

.music-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--card-border-hover);
}

.music-vinyl-wrap {
  position: relative;
  width: 58px;
  height: 58px;
  flex-shrink: 0;
}

.music-vinyl {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #1e293b;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

[data-theme="light"] .music-vinyl {
  border-color: #e5e5ea;
}

.music-vinyl.playing {
  animation: spin 8s linear infinite;
}

.music-vinyl-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: var(--bg);
  border: 2.5px solid #1e293b;
  border-radius: 50%;
}

[data-theme="light"] .music-vinyl-center {
  border-color: #e5e5ea;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.music-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.music-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.music-artist {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.music-btn {
  background: transparent;
  border: none;
  outline: none;
  color: var(--link);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, transform 0.1s;
}

.music-btn:hover {
  color: var(--link-hover);
  transform: scale(1.1);
}

.music-btn:active {
  transform: scale(0.95);
}

.music-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 99px;
  cursor: pointer;
  position: relative;
  padding: 6px 0;
  background-clip: content-box;
}

[data-theme="dark"] .music-progress-bar {
  background: rgba(255, 255, 255, 0.18);
}

.music-progress {
  height: 4px;
  background: var(--link);
  border-radius: 99px;
  width: 0%;
  transition: width 0.1s linear;
}

/* Music close and minimize button */
.music-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 13px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s var(--ease-premium), background 0.25s, transform 0.25s;
  padding: 0;
  line-height: 1;
}

[data-theme="light"] .music-close-btn {
  background: rgba(0, 0, 0, 0.08);
}

.music-card:hover .music-close-btn {
  opacity: 0.6;
}

.music-close-btn:hover {
  opacity: 1 !important;
  background: rgba(239, 68, 68, 0.95) !important;
  color: #ffffff !important;
  transform: scale(1.08);
}

/* Floating Music Toggle (when minimized) */
.music-toggle-btn {
  position: fixed;
  bottom: 96px;
  right: 24px;
  z-index: 990;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.3s var(--ease-premium), box-shadow 0.3s, border-color 0.3s;
}

.music-toggle-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-hover);
  border-color: var(--card-border-hover);
}

.music-toggle-btn:active {
  transform: scale(0.95);
}

/* Custom Selection in Terminal Input */
#terminal-input::selection {
  background: rgba(74, 222, 128, 0.3);
}

/* Responsiveness for new widgets */
@media (max-width: 820px) {
  .terminal-toggle-btn {
    top: 112px;
    right: 16px;
    width: 40px;
    height: 40px;
  }
  
  .terminal-modal {
    width: calc(100dvw - 32px);
    height: min(380px, calc(100dvh - 144px));
    max-height: calc(100dvh - 144px);
    left: 16px;
    right: 16px;
    bottom: 16px;
    top: auto;
    border-radius: 14px;
  }

  .terminal-header {
    padding: 10px 12px;
  }

  .terminal-title {
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .terminal-body {
    padding: 12px;
    font-size: 12.5px;
    line-height: 1.5;
  }

  .terminal-input-line {
    gap: 6px;
  }

  .terminal-prompt {
    font-size: 12px;
  }

  #terminal-input {
    min-width: 0;
    font-size: 16px;
  }
  
  .music-card {
    position: fixed;
    bottom: 16px;
    left: 16px !important;
    right: 16px;
    width: auto;
    margin: 0;
    top: auto !important;
    z-index: 1400;
    padding: 12px 44px 12px 12px;
    border-radius: 16px;
    gap: 10px;
  }

  .music-card:hover {
    transform: none;
  }

  .music-vinyl-wrap {
    width: 52px;
    height: 52px;
  }

  .music-controls {
    gap: 14px;
    margin-bottom: 4px;
  }

  .music-btn {
    width: 30px;
    height: 30px;
  }

  .music-progress-bar {
    padding: 8px 0;
  }

  .music-toggle-btn {
    bottom: 76px;
    right: 16px;
    width: 40px;
    height: 40px;
    z-index: 1601;
  }

  .music-close-btn {
    display: flex !important;
    width: 28px;
    height: 28px;
    opacity: 0.72;
    font-size: 18px;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.18);
  }

  [data-theme="light"] .music-close-btn {
    background: rgba(0, 0, 0, 0.08);
  }

  .terminal-modal.visible ~ .music-toggle-btn {
    display: none !important;
  }
}

/* Maximized terminal modal (macOS style Fullscreen) */
.terminal-modal.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  transform: none !important;
  border: none !important;
  box-shadow: none !important;
}
