:root {
  --bg: #181a20;
  --container-bg: #23272f;
  --text: #f3f3f3;
  --accent: #6cb4ff;
  --header-bg: #23272f;
  --button-bg: #282c34;
  --button-hover: #3a3f4b;
  --label: #fff;
  --subtitle: #aaa;
  --project-card-bg: #282c34;
  --project-card-hover: rgba(108,180,255,0.10);
  --contact-label: #e0e0e0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

header {
  background: var(--header-bg);
  padding: 24px 0 12px 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  position: relative;
}

.mode-toggle {
  position: absolute;
  top: 18px;
  right: 24px;
  background: var(--button-bg);
  color: var(--accent);
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.mode-toggle:hover {
  background: var(--button-hover);
  color: var(--label);
}

nav {
  margin-top: 12px;
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.06));
  border-radius: 18px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.22), inset 0 1px rgba(255,255,255,0.02);
}
nav a {
  color: var(--text);
  text-decoration: none;
  margin: 0;
  font-weight: 600;
  font-size: 1.02rem;
  transition: color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  display: inline-block;
  padding: 8px 16px;
  border-radius: 12px 12px 8px 8px;
  background: transparent;
  position: relative;
}
nav a:hover {
  color: var(--accent);
  transform: translateY(-3px);
}
nav a.active {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.08));
  color: var(--label);
  box-shadow: 0 8px 18px rgba(0,0,0,0.28);
  transform: translateY(-6px);
}
nav a::before {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 6px;
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.02));
  opacity: 0.06;
  pointer-events: none;
}
nav a.active::before { opacity: 0.03; }

body.light-mode header nav {
  background: linear-gradient(180deg, rgba(255,255,255,0.6), rgba(0,0,0,0.02));
  box-shadow: 0 6px 18px rgba(0,0,0,0.06), inset 0 1px rgba(255,255,255,0.6);
}
body.light-mode nav a {
  color: var(--subtitle);
}
body.light-mode nav a.active {
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(240,240,240,0.9));
  color: var(--label);
}

.container {
  max-width: 900px;
  margin: 32px auto 0 auto;
  background: var(--container-bg);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  padding: 40px 32px;
}

.about {
  text-align: center;
  margin-bottom: 40px;
}
h1.style1 {
  font-size: 1.1rem;
  color: var(--subtitle);
  margin: 0 0 8px 0;
  font-weight: 400;
}
h1.style3 {
  font-size: 2.2rem;
  color: var(--label);
  margin: 0 0 16px 0;
  font-weight: 700;
}
.style2 {
  font-size: 1.05rem;
  color: var(--contact-label);
  margin-bottom: 24px;
}

.highlight-role {
  color: #6cb4ff;
}
body.light-mode .highlight-role {
  color: #0056b3;
}
.buttons {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.button {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--button-bg);
  color: var(--label);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: background 0.2s;
  border: none;
}
.button:hover {
  background: var(--button-hover);
}
.label {
  vertical-align: middle;
}
section {
  margin-bottom: 48px;
}
.section-title {
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  text-align: left;
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.project-card {
  background: var(--project-card-bg);
  border-radius: 10px;
  padding: 24px 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: transform 0.15s;
  min-height: 180px;
}
.project-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 4px 18px var(--project-card-hover);
}
.project-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--label);
  margin-bottom: 8px;
}
.project-desc {
  font-size: 0.98rem;
  color: #c0c0c0;
  margin-bottom: 12px;
}
.project-link {
  margin-top: auto;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.97rem;
  font-weight: 500;
  transition: color 0.2s;
}
.project-link:hover {
  color: var(--label);
  text-decoration: underline;
}
.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.contact-list li {
  margin: 0;
}
.publications-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.pub-card {
  background: var(--project-card-bg);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-left: 3px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s, border-left-color 0.15s;
}
.pub-card:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px var(--project-card-hover);
  border-left-color: var(--accent);
}
.pub-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--label);
  margin-bottom: 6px;
}
.pub-authors {
  font-size: 0.95rem;
  color: var(--subtitle);
  margin-bottom: 6px;
}
.pub-authors .me {
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 2px;
}
.pub-venue {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--contact-label);
  opacity: 0.9;
  margin-bottom: 12px;
}
.pub-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.small-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}
.cv-container {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.cv-section {
  position: relative;
  padding-left: 20px;
}
.cv-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--button-bg);
  border-radius: 2px;
}
.cv-heading {
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.cv-item {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}
.cv-date {
  min-width: 160px;
  width: 160px;
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--subtitle);
  text-align: right;
  padding-top: 4px;
  font-feature-settings: "tnum";
}
.cv-content {
  flex: 1;
}
.cv-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--label);
  margin-bottom: 2px;
}
.cv-place {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 6px;
  font-weight: 500;
}
.cv-desc {
  font-size: 0.92rem;
  color: var(--contact-label);
  line-height: 1.5;
}
.skill-category {
  margin-bottom: 16px;
}
.skill-category h4 {
  font-size: 0.95rem;
  color: var(--subtitle);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-tag {
  background: var(--button-bg);
  color: var(--label);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.skill-tag:hover {
  background: var(--button-hover);
  border-color: var(--accent);
}

@media (max-width: 900px) {
  .container {
    max-width: 95%;
    margin-top: 24px;
    margin-bottom: 24px;
  }
}

@media (max-width: 700px) {
  .container {
    padding: 32px 20px;
  }
  .section-title {
    font-size: 1.25rem;
  }
  h1.style3 {
    font-size: 1.5rem;
  }
}

@media (max-width: 600px) {
  header {
    padding-bottom: 12px;
    overflow-x: hidden;
  }
  
  h1.style3 {
    font-size: 1.4rem;
    padding: 0 50px;
    line-height: 1.3;
  }

  .mode-toggle {
    width: 48px;
    height: 48px;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
  }
  .mode-toggle:hover, .mode-toggle:active {
    background: var(--button-hover);
  }

  nav {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    white-space: nowrap;
    justify-content: flex-start;
    padding: 12px 16px;
    gap: 12px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    margin-top: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  nav::-webkit-scrollbar {
    display: none;
  }
  
  nav a {
    flex: 0 0 auto;
    padding: 10px 20px;
    font-size: 0.95rem;
    background: var(--button-bg);
    color: var(--label);
    border-radius: 24px;
    min-height: 44px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  }
  
  nav a.active {
    background: var(--accent);
    color: #fff !important;
    transform: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }
  
  nav a::before {
    display: none;
  }
  
  .cv-item {
    flex-direction: column;
    gap: 6px;
    margin-bottom: 24px;
  }
  .cv-date {
    text-align: left;
    min-width: auto;
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 4px;
    font-weight: 600;
  }
  .cv-section {
    padding-left: 0;
    margin-left: 0;
  }
  .cv-section::before {
    display: none;
  }
  
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .project-card {
    min-height: auto;
  }
  
  .pub-actions {
    flex-wrap: wrap;
    margin-top: 12px;
  }
  .pub-actions .button {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }
  
  .button {
    min-height: 48px;
    padding: 10px 20px;
  }
  
  section > div[style*="text-align: center"] {
    padding: 0 8px;
  }
  
  section > div[style*="text-align: center"] .button {
    width: 80%;
    max-width: 80%;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    display: inline-flex;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 24px 16px;
    margin-top: 0;
    border-radius: 0;
    box-shadow: none;
  }
  
  h1.style3 {
    font-size: 1.25rem;
  }
  
  .buttons, .contact-list {
    flex-direction: column;
    width: 100%;
    align-items: center;
    justify-content: center;
  }
  
  .buttons li, .contact-list li {
    width: 80%;
    margin: 0;
    display: flex;
    justify-content: center;
  }
  
  .button {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.9rem;
    padding: 12px 16px;
  }
  
  .pub-card, .project-card {
    padding: 20px 16px;
  }
  
  section > div[style*="text-align: center"] .button {
    width: 80%;
    max-width: 80%;
  }
}

body.light-mode {
  --bg: #f6f8fa;
  --container-bg: #fff;
  --text: #181a20;
  --accent: #007bff;
  --header-bg: #e9ecef;
  --button-bg: #e9ecef;
  --button-hover: #d0d7de;
  --label: #181a20;
  --subtitle: #495057;
  --project-card-bg: #f3f6fa;
  --project-card-hover: rgba(0,123,255,0.08);
  --contact-label: #181a20;
}

#loader-overlay {
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s;
}
#loader-overlay.hide {
  opacity: 0;
  pointer-events: none;
}
.loader {
  width: 48px;
  height: 48px;
  border: 5px solid var(--accent);
  border-top: 5px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.fade-in-up {
  opacity: 0;
  transform: translateY(32px);
  animation: fadeInUp 0.8s cubic-bezier(.23,1.02,.58,.99) forwards;
}
header.fade-in-up { animation-delay: 0.1s; }
.container.fade-in-up { animation-delay: 0.2s; }
section.fade-in-up { animation-delay: 0.3s; }

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