@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400;1,8..60,600&family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Light Theme (Warm Academic Paper) */
  --bg-color: #faf9f6;
  --bg-card: #ffffff;
  --bg-subtle: #f2efe9;
  --bg-hover: #ece8e0;

  --text-main: #181c20;
  --text-body: #2c3238;
  --text-muted: #565e68;
  --text-dim: #7a828e;

  --border-color: #e2ded5;
  --border-subtle: #ece8e1;
  --border-focus: #1a56db;

  --link-color: #1a56db;
  --link-hover: #0d3da5;

  --accent: #92400e;
  --accent-light: #fef3c7;

  --badge-bg: #eef2ff;
  --badge-text: #3730a3;
  --badge-border: #c7d2fe;

  --news-tag-bg: #fbf2f4;
  --news-tag-text: #861f41;
  --news-tag-border: #f0d5dd;

  --theorem-bg: #f8fafc;
  --theorem-border: #2563eb;
  --theorem-title: #1e3a8a;

  --lemma-bg: #faf5ff;
  --lemma-border: #7c3aed;
  --lemma-title: #581c87;

  --definition-bg: #fffbeb;
  --definition-border: #d97706;
  --definition-title: #78350f;

  --proof-bg: #fcfcfd;
  --proof-border: #94a3b8;

  --code-bg: #f1f3f5;
  --code-border: #e2e8f0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);

  --font-serif: 'Charter', 'Bitstream Charter', 'Source Serif 4', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  /* Dark Theme (Midnight Slate) */
  --bg-color: #0d1117;
  --bg-card: #161b22;
  --bg-subtle: #1f242c;
  --bg-hover: #262c36;

  --text-main: #f0f6fc;
  --text-body: #c9d1d9;
  --text-muted: #8b949e;
  --text-dim: #6e7681;

  --border-color: #30363d;
  --border-subtle: #21262d;
  --border-focus: #58a6ff;

  --link-color: #58a6ff;
  --link-hover: #79c0ff;

  --accent: #f59e0b;
  --accent-light: #451a03;

  --badge-bg: #1e293b;
  --badge-text: #93c5fd;
  --badge-border: #334155;

  --news-tag-bg: rgba(186, 68, 100, 0.16);
  --news-tag-text: #f4a2b6;
  --news-tag-border: rgba(186, 68, 100, 0.3);

  --theorem-bg: #0f172a;
  --theorem-border: #3b82f6;
  --theorem-title: #93c5fd;

  --lemma-bg: #1e1b4b;
  --lemma-border: #8b5cf6;
  --lemma-title: #c4b5fd;

  --definition-bg: #291e0a;
  --definition-border: #f59e0b;
  --definition-title: #fde68a;

  --proof-bg: #161b22;
  --proof-border: #475569;

  --code-bg: #161b22;
  --code-border: #30363d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   RESET & BASE STYLES
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 17px;
  line-height: 1.68;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

body {
  font-family: var(--font-serif);
  background-color: var(--bg-color);
  color: var(--text-body);
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
  position: relative;
}

/* Container & Layout Containment */
main,
article,
.container {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* --------------------------------------------------------------------------
   TYPOGRAPHY
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-main);
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 2.2rem;
}

h2 {
  font-size: 1.6rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.35rem;
  margin-top: 2.25rem;
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

h4 {
  font-size: 1.1rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

strong {
  color: var(--text-main);
  font-weight: 600;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

code {
  background-color: var(--code-bg);
  color: var(--text-main);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--code-border);
}

pre {
  background-color: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1.25rem 0;
  line-height: 1.45;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

/* --------------------------------------------------------------------------
   NAVBAR & HEADER
   -------------------------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.85rem 0;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.site-nav .nav-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.site-logo {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  text-decoration: none;
  letter-spacing: -0.005em;
}

.site-logo:hover {
  color: var(--link-color);
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  list-style: none;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-toggle-btn svg {
  display: block;
}

.theme-toggle-btn:hover {
  background-color: var(--bg-subtle);
  border-color: var(--text-muted);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mobile-menu-btn:hover {
  background-color: var(--bg-subtle);
  border-color: var(--text-muted);
}

.mobile-menu-btn .menu-close-icon {
  display: none;
}

.mobile-menu-btn.is-active .menu-open-icon {
  display: none;
}

.mobile-menu-btn.is-active .menu-close-icon {
  display: block;
}

/* --------------------------------------------------------------------------
   HOMEPAGE: HERO & BIO
   -------------------------------------------------------------------------- */
.hero-section {
  padding: 2.5rem 0 1.5rem 0;
}

.profile-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2rem;
  align-items: start;
}

.profile-avatar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.profile-avatar {
  width: 165px;
  height: 165px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.profile-status-badge {
  display: inline-block;
  margin-top: 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border: 1px solid var(--badge-border);
  border-radius: 9999px;
}

.profile-content h1 {
  margin-bottom: 0.25rem;
  font-size: 2.3rem;
  letter-spacing: -0.01em;
}

.profile-tagline {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  font-style: italic;
  text-wrap: balance;
}

.affiliation-box {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.affiliation-line {
  text-wrap: balance;
}

.affiliation-box strong {
  color: var(--text-main);
}

.social-links {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  margin-top: 1.15rem;
}

.social-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

.social-icon-btn svg {
  width: 26px;
  height: 26px;
  display: block;
}

.social-icon-btn:hover {
  color: var(--text-main);
  transform: translateY(-2px);
}

.social-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.15s ease;
}

.social-pill svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.social-pill:hover {
  background-color: var(--bg-subtle);
  border-color: var(--text-muted);
  color: var(--link-color);
  text-decoration: none;
}

.social-pill.primary {
  background-color: var(--text-main);
  color: var(--bg-color);
  border-color: var(--text-main);
}

.social-pill.primary:hover {
  background-color: var(--link-hover);
  border-color: var(--link-hover);
  color: #ffffff;
}

.linkedin-pill svg {
  fill: #0a66c2;
}

[data-theme="dark"] .linkedin-pill svg {
  fill: #70b5f9;
}

/* --------------------------------------------------------------------------
   HOMEPAGE: RECENT NEWS (INITIAL LANDING VIEW)
   -------------------------------------------------------------------------- */
.news-section {
  margin: 1.5rem 0 2rem 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.news-header h2 {
  font-size: 1.35rem;
  margin: 0;
  padding: 0;
  border: none;
}

.news-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.news-item {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 1rem;
  align-items: baseline;
  font-size: 0.95rem;
}

.news-date {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--news-tag-text);
  background-color: var(--news-tag-bg);
  border: 1px solid var(--news-tag-border);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-align: center;
  display: inline-block;
}

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

/* --------------------------------------------------------------------------
   PUBLICATIONS & PAPERS LIST
   -------------------------------------------------------------------------- */
.publication-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.publication-card:hover {
  box-shadow: var(--shadow-md);
}

.publication-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.publication-title a {
  color: var(--text-main);
  text-decoration: none;
}

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

.publication-authors {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.publication-authors .author-me {
  font-weight: 600;
  color: var(--text-main);
  text-underline-offset: 2px;
}

.publication-venue {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.85rem;
}

.publication-venue em {
  font-style: normal;
  font-weight: 600;
}

.publication-summary {
  font-size: 0.95rem;
  color: var(--text-body);
  margin-bottom: 1rem;
}

.publication-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.pub-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.28rem 0.7rem;
  border-radius: 5px;
  text-decoration: none;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pub-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.pub-btn:hover {
  background-color: var(--border-color);
  color: var(--link-color);
  text-decoration: none;
}

.pub-btn.blog-btn {
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border-color: var(--badge-border);
  font-weight: 600;
}

.pub-btn.blog-btn:hover {
  background-color: var(--link-color);
  color: #ffffff;
  border-color: var(--link-color);
}

.collapsible-content {
  display: none;
  margin-top: 1rem;
  padding: 1rem;
  background-color: var(--bg-subtle);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
}

.collapsible-content.is-open {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

/* --------------------------------------------------------------------------
   INTERACTIVE GAME MODAL ("A QUICK GAME")
   -------------------------------------------------------------------------- */
.game-nav-btn {
  background: none;
  border: none;
  color: var(--text-main);
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.15s ease;
}

.game-nav-btn svg {
  width: 21px;
  height: 21px;
  display: block;
}

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

.game-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

.game-modal.is-open {
  display: flex;
  animation: fadeIn 0.18s ease-out;
}

.game-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.game-modal-dialog {
  position: relative;
  z-index: 10;
  max-width: 820px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
  animation: modalScale 0.18s ease-out;
}

@keyframes modalScale {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.game-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.game-modal-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.game-modal-subtitle {
  font-family: var(--font-serif);
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.game-modal-close-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.game-modal-close-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.game-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.15rem 0.25rem 0.65rem 0.25rem;
  font-family: var(--font-sans);
  font-size: 0.84rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.75rem;
}

.game-stat-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
}

.game-stat-item strong {
  color: var(--text-main);
  font-family: var(--font-mono);
}

.game-status-banner {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.game-status-banner.status-playing {
  background-color: var(--bg-subtle);
  color: var(--text-body);
  border: 1px solid var(--border-subtle);
}

.game-status-banner.status-won {
  background-color: rgba(16, 185, 129, 0.12);
  color: #065f46;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .game-status-banner.status-won {
  background-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.4);
}

.game-status-banner.status-trapped {
  background-color: rgba(245, 158, 11, 0.12);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

[data-theme="dark"] .game-status-banner.status-trapped {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

.game-canvas-wrapper {
  position: relative;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  margin-bottom: 0.75rem;
}

.game-canvas {
  display: block;
  width: 100%;
  height: 300px;
  cursor: default;
  touch-action: none;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.game-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.game-btn:hover {
  background-color: var(--bg-subtle);
  border-color: var(--text-muted);
}

.game-btn svg {
  width: 13px;
  height: 13px;
}

/* --------------------------------------------------------------------------
   ACADEMIC SERVICE & COMMUNITY
   -------------------------------------------------------------------------- */
.service-section {
  margin-top: 2rem;
}

.service-list {
  list-style: none;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.service-list li {
  position: relative;
  padding-left: 1.15rem;
  line-height: 1.6;
  color: var(--text-body);
}

.service-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-size: 1.1rem;
}

/* --------------------------------------------------------------------------
   EXPERIENCE & EDUCATION TIMELINE
   -------------------------------------------------------------------------- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 1rem;
}

.timeline-item {
  border-left: 2px solid var(--border-color);
  padding-left: 1.25rem;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--text-muted);
  border: 2px solid var(--bg-color);
}

.timeline-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.15rem;
}

.timeline-meta {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}

.timeline-desc {
  font-size: 0.92rem;
  color: var(--text-body);
}

.timeline-desc ul {
  padding-left: 1.25rem;
  margin-top: 0.35rem;
}

.timeline-desc li {
  margin-bottom: 0.25rem;
}

/* --------------------------------------------------------------------------
   PAPER PROJECT / BLOG PAGE
   -------------------------------------------------------------------------- */
.paper-page-header {
  padding: 2rem 0 1.5rem 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 2rem;
  max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
}

.paper-breadcrumbs {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  overflow-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
}

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

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

.paper-page-title {
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.paper-meta-authors {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.paper-venue-badge {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background-color: var(--accent-light);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 1.25rem;
}

.paper-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* Paper Figures & Captions */
.paper-figure {
  margin: 2rem 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.paper-figure-img-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 0.85rem;
  padding-bottom: 0.35rem;
}

.paper-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

/* KaTeX Display Equations Horizontal Scroll on Mobile */
.katex-scroll-container,
.katex-display {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.35rem 0;
}

.paper-figure figcaption {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 0.85rem;
  text-align: left;
  line-height: 1.5;
}

.paper-figure figcaption strong {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-main);
}

/* Academic Callout Boxes: Theorem, Lemma, Definition, Proof */
.math-callout {
  margin: 1.5rem 0;
  padding: 1.15rem 1.35rem;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.math-callout .callout-header {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.theorem-box {
  background-color: var(--theorem-bg);
  border-left: 4px solid var(--theorem-border);
  color: var(--text-body);
}

.theorem-box .callout-header {
  color: var(--theorem-title);
}

.lemma-box {
  background-color: var(--lemma-bg);
  border-left: 4px solid var(--lemma-border);
  color: var(--text-body);
}

.lemma-box .callout-header {
  color: var(--lemma-title);
}

.definition-box {
  background-color: var(--definition-bg);
  border-left: 4px solid var(--definition-border);
  color: var(--text-body);
}

.definition-box .callout-header {
  color: var(--definition-title);
}

.proof-box {
  background-color: var(--proof-bg);
  border-left: 3px solid var(--proof-border);
  font-style: normal;
  margin: 1rem 0 1.5rem 0;
}

.proof-box .callout-header {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 600;
}

.qed-symbol {
  float: right;
  font-size: 1.1rem;
  color: var(--text-main);
  margin-top: 0.5rem;
}

.clear-fix {
  clear: both;
}

/* Paper Blog Article Content */
.paper-blog-content {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.paper-blog-content p,
.paper-blog-content li,
.paper-blog-content h1,
.paper-blog-content h2,
.paper-blog-content h3,
.paper-blog-content blockquote {
  overflow-wrap: break-word;
  word-wrap: break-word;
  max-width: 100%;
}

/* Algorithm Block */
.algorithm-block {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: block;
}

.algorithm-header {
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-main);
  white-space: normal;
}

.algorithm-content {
  min-width: max-content;
  white-space: nowrap;
  line-height: 1.7;
}

.algorithm-footer {
  border-top: 1px solid var(--border-color);
  margin-top: 0.75rem;
  padding-top: 0.25rem;
}

/* Tables */
.academic-table-wrapper {
  margin: 1.5rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.academic-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

.academic-table th,
.academic-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.academic-table th {
  border-top: 2px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
  font-weight: 600;
  color: var(--text-main);
}

.academic-table tbody tr:last-child td {
  border-bottom: 2px solid var(--border-color);
}

/* BibTeX block */
.bibtex-wrapper {
  position: relative;
  margin: 1.5rem 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.copy-bibtex-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.copy-bibtex-btn:hover {
  background-color: var(--bg-hover);
  border-color: var(--text-muted);
}

/* KaTeX Overrides for harmony */
.katex {
  font-size: 1.05em !important;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  background-color: var(--bg-card);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}

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

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

/* --------------------------------------------------------------------------
   RESPONSIVE DESIGN
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  html {
    font-size: 16px;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    padding: 1.15rem 1.85rem;
    gap: 0.65rem;
    z-index: 100;
  }

  .nav-links.is-open {
    display: flex;
    animation: fadeIn 0.18s ease-out;
  }

  .nav-links li {
    width: 100%;
    text-align: right;
  }

  .nav-links a {
    display: inline-block;
    padding: 0.35rem 0.25rem;
    font-size: 1.02rem;
    font-weight: 500;
    color: var(--text-main);
    text-align: right;
  }

  .nav-links a:hover,
  .nav-links a.active {
    color: var(--link-color);
  }

  .profile-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1.25rem;
  }

  .profile-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .profile-content h1 {
    font-size: 2rem;
    text-wrap: balance;
  }

  .profile-tagline {
    font-size: 1.05rem;
    margin-bottom: 0.65rem;
    text-wrap: balance;
    max-width: 320px;
  }

  .affiliation-box {
    font-size: 0.88rem;
    line-height: 1.45;
    gap: 0.35rem;
    max-width: 340px;
    text-align: center;
  }

  .affiliation-line {
    text-wrap: balance;
  }

  .profile-avatar {
    width: 145px;
    height: 145px;
  }

  .social-links {
    justify-content: center;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .news-date {
    display: inline-block;
    align-self: flex-start;
  }

  /* Paper Figure on Mobile: naturally scaled to fit the card */
  .paper-figure {
    padding: 0.95rem;
    margin: 1.5rem 0;
  }

  .paper-figure-img-wrapper {
    text-align: center;
    margin-bottom: 0.65rem;
    padding-bottom: 0;
  }

  .paper-figure img {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
  }

  /* Game Modal on Mobile */
  .game-modal {
    padding: 0.4rem;
    align-items: center;
  }

  .game-modal-dialog {
    max-width: 100%;
    width: 100%;
    padding: 1rem 0.75rem;
    max-height: 96vh;
    border-radius: 10px;
  }

  .game-canvas-wrapper {
    width: 100%;
    margin-bottom: 0.65rem;
  }

  .game-canvas {
    width: 100%;
    display: block;
  }

  .game-hud {
    font-size: 0.8rem;
    gap: 0.4rem;
    padding-bottom: 0.5rem;
  }

  .game-btn {
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
  }

  .algorithm-block {
    padding: 0.85rem 0.65rem;
    font-size: 0.82rem;
  }

  .paper-page-title {
    font-size: 1.65rem;
  }

  .paper-actions-bar .pub-btn {
    font-size: 0.84rem;
    padding: 0.4rem 0.75rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}