:root {
  --page: #edf1f6;
  --panel: rgba(250, 252, 255, 0.28);
  --panel-strong: rgba(255, 255, 255, 0.4);
  --panel-hover: rgba(255, 255, 255, 0.5);
  --border: rgba(31, 43, 57, 0.13);
  --border-strong: rgba(31, 43, 57, 0.23);
  --text: #1b2530;
  --muted: rgba(27, 37, 48, 0.64);
  --faint: rgba(27, 37, 48, 0.4);
  --accent: #d97842;
  --accent-soft: rgba(217, 120, 66, 0.13);
  --mint: #2d8e75;
  --blue: #4b84be;
  --cute-blue: #9db9d5;
  --cute-blue-soft: rgba(157, 185, 213, 0.2);
  --shadow: 0 20px 54px rgba(52, 64, 80, 0.16);
  --blur: blur(24px) saturate(150%);
  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page);
  font-family: "DM Sans", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.background {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("./assets/ornate-anime-background.jpg") center / cover no-repeat;
  background-image: -webkit-image-set(
    url("./assets/ornate-anime-background-1280.webp") 1x,
    url("./assets/ornate-anime-background-1920.webp") 2x
  );
  background-image: image-set(
    url("./assets/ornate-anime-background-1280.webp") type("image/webp") 1x,
    url("./assets/ornate-anime-background-1920.webp") type("image/webp") 2x
  );
  filter: blur(24px) brightness(0.94) saturate(0.9);
  transform: scale(1.06);
}

.background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(246, 249, 252, 0.1) 0%, rgba(246, 249, 252, 0.02) 42%, rgba(235, 240, 247, 0.14) 100%), linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(245, 248, 252, 0.01) 42%, rgba(226, 233, 242, 0.19) 100%);
}

.cursor-glow {
  position: fixed;
  z-index: 0;
  width: 280px;
  height: 280px;
  margin: -140px 0 0 -140px;
  pointer-events: none;
  opacity: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 181, 107, 0.17) 0%, rgba(124, 183, 232, 0.08) 30%, transparent 70%);
  filter: blur(10px);
  transform: translate3d(-1000px, -1000px, 0);
  transition: opacity 220ms ease;
  will-change: transform;
}

.app-shell { position: relative; z-index: 1; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  pointer-events: none;
}

.top-nav {
  width: min(420px, calc(100vw - 24px));
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  pointer-events: auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(250, 252, 255, 0.32);
  box-shadow: 0 14px 36px rgba(52, 64, 80, 0.15);
  backdrop-filter: blur(34px) saturate(150%);
  -webkit-backdrop-filter: blur(34px) saturate(150%);
}
.top-nav-link { position: relative; min-width: 0; height: 40px; flex: 1; display: grid; place-items: center; padding: 0 12px; color: var(--muted); border-radius: 999px; font-size: 14px; font-weight: 600; transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.top-nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.38); transform: translateY(-1px); }
.top-nav-link.is-active { color: var(--text); background: rgba(255, 255, 255, 0.72); box-shadow: 0 4px 14px rgba(52, 64, 80, 0.12); }
.top-nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.live-label i { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(115, 201, 173, 0.11); }

.contact-strip {
  width: min(1540px, calc(100% - 32px));
  min-height: 68px;
  margin: 10px auto 0;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  scrollbar-width: none;
}
.contact-strip::-webkit-scrollbar { display: none; }
.contact-label { flex: 0 0 auto; padding: 0 16px 0 8px; color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; }
.contact-strip a { min-width: 180px; flex: 1 0 180px; display: grid; grid-template-columns: 32px auto 1fr 16px; grid-template-rows: 20px 16px; align-items: center; column-gap: 9px; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; transition: background 160ms ease, border-color 160ms ease; }
.contact-strip a:hover { background: rgba(255, 255, 255, 0.56); border-color: var(--border); }
.contact-icon { grid-row: 1 / span 2; width: 32px; height: 32px; display: grid; place-items: center; color: #fff; border-radius: 8px; font-size: 15px; font-weight: 700; }
.contact-icon img { display: block; width: 15px; height: 15px; object-fit: contain; }
.bilibili-icon img { width: 17px; height: 17px; }
.csdn-icon img { width: 18px; height: 18px; }
.github-icon { background: #242a32; }
.bilibili-icon { background: #f080a6; }
.csdn-icon { background: #c93a35; }
.x-icon { background: #17191c; }
.contact-strip a > span:not(.contact-icon) { font-size: 15px; font-weight: 600; }
.contact-strip small { overflow: hidden; color: var(--faint); text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.contact-strip b { grid-column: 4; grid-row: 1 / span 2; color: var(--muted); font-size: 15px; font-weight: 400; }
.info-rail .contact-strip a { min-width: 0; flex: 1 1 0; grid-template-columns: 30px auto 1fr 14px; column-gap: 8px; padding-right: 8px; padding-left: 8px; }
.info-rail .contact-strip .contact-icon { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }

.personal-layout {
  width: min(1000px, 100%);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 18px clamp(14px, 2.5vw, 32px) 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: start;
}

.identity-stage {
  position: relative;
  min-height: 620px;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  background: rgba(250, 252, 255, 0.32);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  animation: card-enter 720ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.stage-signal { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stage-line { width: 56px; height: 1px; background: var(--border-strong); }
.cute-assets { --cute-scale: 1; position: absolute; top: 38px; right: clamp(32px, 5vw, 62px); width: 124px; height: 92px; pointer-events: none; animation: cute-float 4.8s ease-in-out infinite alternate; }
.cute-asset { position: absolute; display: block; object-fit: contain; opacity: 0.82; filter: drop-shadow(0 7px 10px rgba(119, 133, 163, 0.13)); }
.cute-asset-sparkles { top: 0; right: 0; width: 44px; height: 44px; }
.cute-asset-heart { top: 10px; left: 38px; width: 39px; height: 39px; transform: rotate(-9deg); }
.cute-asset-blossom { bottom: 0; left: 0; width: 36px; height: 36px; filter: grayscale(1) sepia(0.45) hue-rotate(270deg) saturate(0.75) brightness(1.12) drop-shadow(0 7px 10px rgba(119, 133, 163, 0.13)); transform: rotate(9deg); }

.identity-content { width: min(900px, 100%); display: grid; grid-template-columns: 168px minmax(0, 1fr); align-items: start; column-gap: 28px; padding: 48px 0 54px; }
.avatar-wrap { position: relative; width: 168px; height: 168px; margin: 0; }
.avatar-sticker { position: absolute; left: -18px; bottom: -6px; z-index: 4; width: 46px; height: 46px; object-fit: contain; opacity: 0.84; filter: drop-shadow(0 8px 12px rgba(119, 133, 163, 0.15)); transform: rotate(-10deg); }
.identity-details { min-width: 0; padding-top: 2px; }
.profile-avatar { position: relative; z-index: 2; width: 100%; height: 100%; border: 2px solid rgba(255, 255, 255, 0.94); border-radius: 50%; object-fit: cover; outline: 1px solid rgba(0, 0, 0, 0.08); outline-offset: -1px; background: #e7edf3; box-shadow: 0 16px 34px rgba(52, 64, 80, 0.2); }
.profile-marker { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; }
.profile-marker i { width: 7px; height: 7px; border-radius: 50%; background: var(--cute-blue); box-shadow: 0 0 0 4px var(--cute-blue-soft); }
.profile-marker b { padding-left: 9px; border-left: 1px solid var(--border-strong); color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.identity-content h1 { margin: 0; max-width: 100%; font-size: 42px; line-height: 1.16; font-weight: 700; letter-spacing: 0; }
.identity-content h1 .name-cn { color: var(--text); }
.identity-content h1 .name-latin { display: inline; margin-left: 10px; color: var(--text); font-size: 42px; font-weight: 700; transform: none; }
.identity-handle { margin: 16px 0 28px; color: var(--muted); font-size: 18px; }
.identity-summary { max-width: 540px; min-height: 24px; margin: 0; padding-left: 14px; border-left: 2px solid rgba(157, 185, 213, 0.62); color: var(--muted); font-size: 15px; line-height: 1.7; text-wrap: pretty; }

.profile-numbers { grid-column: 1 / -1; display: flex; gap: clamp(28px, 4vw, 56px); margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--border); }
.profile-numbers div { display: flex; flex-direction: column; gap: 2px; }
.profile-numbers strong { font-size: 26px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.profile-numbers span { color: var(--muted); font-size: 14px; }

.stage-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.social-links { display: flex; flex-wrap: wrap; gap: 18px; }
.social-links a { color: var(--muted); font-size: 14px; transition: color 160ms ease; }
.social-links a:hover { color: var(--text); }
.scroll-cue { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.scroll-cue i { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; font-style: normal; }

.info-rail { width: 100%; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.info-rail .github-panel, .info-rail .projects-panel { min-width: 0; }
.info-rail .contact-strip, .info-rail .info-footer { width: 100%; margin: 0; }
.info-panel { scroll-margin-top: 80px; padding: clamp(26px, 3vw, 36px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.info-panel:not([hidden]) { animation: card-enter 680ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.projects-panel:not([hidden]) { animation-delay: 90ms; }
.info-rail .contact-strip { animation: card-enter 680ms 150ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.panel-heading h2 { margin: 0; font-size: 22px; line-height: 1.25; text-wrap: balance; }
.panel-index { color: var(--accent); font-size: 13px; font-weight: 700; }
.panel-tag, .live-label { color: var(--faint); font-size: 13px; font-weight: 700; }
.live-label { display: flex; align-items: center; gap: 8px; color: var(--mint); }
.live-label i { width: 6px; height: 6px; }
.panel-heading > a { color: var(--muted); font-size: 14px; transition: color 160ms ease; }
.panel-heading > a:hover { color: var(--text); }

.github-summary { display: grid; grid-template-columns: minmax(70px, 0.7fr) minmax(0, 1.3fr); gap: 18px; margin-bottom: 28px; }
.contribution-total { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 0 6px; padding-right: 8px; border-right: 1px solid var(--border); }
.contribution-total strong { grid-row: span 2; font-size: 42px; line-height: 0.9; font-variant-numeric: tabular-nums; }
.contribution-total span { font-size: 16px; font-weight: 600; white-space: nowrap; }
.contribution-total small { align-self: start; color: var(--faint); font-size: 13px; }
.github-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.github-facts div { display: flex; flex-direction: column; gap: 7px; }
.github-facts span { color: var(--faint); font-size: 13px; }
.github-facts strong { overflow-wrap: anywhere; font-size: 16px; }

.contribution-wrap { width: 100%; overflow: hidden; padding: 20px 0 6px; border-top: 1px solid var(--border); }
.month-labels { width: 100%; display: flex; justify-content: space-between; padding-left: 1px; margin-bottom: 8px; color: var(--faint); font-size: 13px; }
.contribution-grid { width: 100%; display: grid; grid-template-rows: repeat(7, 7px); grid-auto-flow: column; grid-auto-columns: minmax(4px, 1fr); gap: 3px; }
.contribution-cell, .contribution-legend i { min-width: 4px; height: 7px; border-radius: 1px; background: rgba(31, 43, 57, 0.09); }
.contribution-cell[data-level="1"], .contribution-legend i[data-level="1"] { background: rgba(115, 201, 173, 0.32); }
.contribution-cell[data-level="2"], .contribution-legend i[data-level="2"] { background: rgba(115, 201, 173, 0.52); }
.contribution-cell[data-level="3"], .contribution-legend i[data-level="3"] { background: rgba(115, 201, 173, 0.74); }
.contribution-cell[data-level="4"], .contribution-legend i[data-level="4"] { background: var(--mint); }
.contribution-legend { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; color: var(--faint); font-size: 13px; }
.contribution-legend > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contribution-legend > div { display: flex; align-items: center; gap: 4px; }
.contribution-legend i { display: block; width: 7px; min-width: 7px; }
.contribution-legend small { font-size: 13px; }

.project-list { display: flex; flex-direction: column; gap: 12px; }
.project-card { display: grid; grid-template-columns: 30px minmax(0, 1fr) 32px; gap: 14px; align-items: start; padding: 20px 16px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255, 255, 255, 0.24); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 8px 24px rgba(52, 64, 80, 0.08); backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%); transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.project-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.4); border-color: var(--border-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46), 0 12px 28px rgba(52, 64, 80, 0.12); }
.project-number { color: var(--faint); font-size: 13px; padding-top: 4px; }
.project-main { min-width: 0; }
.project-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.project-main p { margin: 6px 0 12px; color: var(--muted); font-size: 15px; line-height: 1.65; text-wrap: pretty; }
.project-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--faint); font-size: 13px; }
.project-meta span { display: flex; align-items: center; gap: 5px; }
.language-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.language-dot.cpp { background: #f19f8f; }
.language-dot.qml { background: #8ac7ad; }
.language-dot.css { background: #8daee8; }
.project-arrow { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--border); border-radius: 50%; font-size: 14px; transition: color 160ms ease, border-color 160ms ease; }
.project-card:hover .project-arrow { color: var(--accent); border-color: var(--border-strong); }

.info-footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 2px 6px; color: var(--faint); font-size: 13px; }
.info-footer a:hover { color: var(--text); }

@keyframes card-enter {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cute-float {
  from { transform: translate3d(0, 0, 0) rotate(-1deg) scale(var(--cute-scale)); }
  to { transform: translate3d(0, -7px, 0) rotate(2deg) scale(var(--cute-scale)); }
}

@media (hover: hover) {
  .identity-stage:hover, .info-panel:hover, .contact-strip:hover { border-color: rgba(31, 43, 57, 0.22); }
}

@media (max-width: 1080px) {
  .identity-stage { padding: 36px; }
  .identity-content h1 { font-size: 40px; }
  .identity-content h1 .name-latin { font-size: 40px; }
}

@media (max-width: 860px) {
  .background { background-position: 72% center; }
  .topbar { height: 70px; padding: 8px 10px; }
  .personal-layout { display: block; padding: 12px 12px 24px; }
  .contact-strip { width: calc(100% - 24px); margin-top: 10px; }
  .identity-stage { position: relative; top: auto; min-height: 600px; margin-bottom: 12px; }
  .identity-content { display: block; padding: 40px 0 46px; }
  .avatar-wrap { margin-bottom: 28px; }
  .info-rail { gap: 16px; }
  .info-panel { scroll-margin-top: 76px; }
}

@media (max-width: 560px) {
  .top-nav { width: calc(100vw - 20px); }
  .top-nav-link { padding: 0 8px; font-size: 13px; }
  .contact-strip { min-height: 64px; padding: 7px; }
  .contact-label { padding-right: 8px; }
  .contact-strip a, .info-rail .contact-strip a { min-width: 176px; flex-basis: 176px; }
  .identity-stage { min-height: 0; padding: 26px 22px; }
  .stage-signal { gap: 10px; }
  .stage-line { width: 38px; }
  .cute-assets { --cute-scale: 0.78; top: 27px; right: 22px; transform-origin: top right; }
  .identity-content { padding: 34px 0 42px; }
  .avatar-wrap { width: 136px; height: 136px; margin-bottom: 30px; }
  .identity-content h1 { font-size: 32px; }
  .identity-content h1 .name-latin { display: block; margin: 8px 0 0; color: var(--text); font-size: 32px; transform: none; }
  .profile-marker { margin-bottom: 14px; font-size: 11px; }
  .identity-summary { padding-left: 12px; font-size: 14px; }
  .profile-numbers { gap: 20px; }
  .profile-numbers strong { font-size: 24px; }
  .stage-footer { align-items: flex-start; flex-direction: column; }
  .scroll-cue { display: none; }
  .info-panel { padding: 26px 20px; }
  .panel-heading { margin-bottom: 28px; }
  .panel-heading h2 { font-size: 20px; }
  .github-summary { grid-template-columns: 1fr; }
  .contribution-total { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--border); }
  .contribution-grid { grid-template-rows: repeat(7, 6px); gap: 2px; }
  .contribution-cell { height: 6px; }
  .contribution-legend > span { max-width: 120px; }
  .project-card { grid-template-columns: 26px minmax(0, 1fr) 32px; padding: 18px 12px; }
  .project-meta span:last-child { display: none; }
  .info-footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
