:root {
  color-scheme: dark;
  --bg: #020604;
  --panel: rgba(3, 18, 13, 0.76);
  --panel-strong: rgba(7, 34, 24, 0.9);
  --line: rgba(79, 255, 176, 0.24);
  --line-strong: rgba(79, 255, 176, 0.54);
  --green: #41ff9b;
  --green-strong: #9effcf;
  --cyan: #4ee7ff;
  --amber: #e7ff7a;
  --text: #e7fff3;
  --muted: #9fb8ac;
  --shadow: rgba(65, 255, 155, 0.26);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 16%, rgba(78, 231, 255, 0.12), transparent 28%),
    radial-gradient(circle at 80% 4%, rgba(65, 255, 155, 0.14), transparent 34%),
    radial-gradient(circle at 72% 78%, rgba(231, 255, 122, 0.07), transparent 24%),
    linear-gradient(180deg, #020604 0%, #03100b 44%, #020604 100%);
  color: var(--text);
  overflow-x: hidden;
  isolation: isolate;
}

header,
main {
  position: relative;
  z-index: 2;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.75;
}

#matrix-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.64;
}

.ambient-grid,
.scan-beam {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient-grid {
  z-index: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65, 255, 155, 0.04) 1px, transparent 1px);
  background-size: 100% 5px, 84px 84px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.25));
}

.scan-beam {
  z-index: 0;
  background: linear-gradient(
    110deg,
    transparent 0%,
    transparent 42%,
    rgba(65, 255, 155, 0.05) 48%,
    rgba(78, 231, 255, 0.08) 50%,
    rgba(65, 255, 155, 0.05) 52%,
    transparent 58%,
    transparent 100%
  );
  background-size: 240% 100%;
  animation: beamSweep 12s linear infinite;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0;
}

.brand {
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-weight: 900;
  text-shadow: 0 0 18px var(--shadow);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.nav-links a {
  min-width: 56px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  transition: 180ms ease;
}

.nav-links a:hover {
  border-color: var(--line);
  color: var(--green-strong);
  background: rgba(65, 255, 155, 0.08);
}

.lang-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(3, 18, 13, 0.72);
  box-shadow: 0 0 18px rgba(65, 255, 155, 0.08) inset;
}

.lang-toggle button {
  min-width: 46px;
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 800;
  transition:
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.lang-toggle button.is-active {
  background: rgba(65, 255, 155, 0.16);
  color: var(--green-strong);
  box-shadow: 0 0 18px rgba(65, 255, 155, 0.16);
}

.hero {
  min-height: calc(100vh - 88px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.7fr);
  align-items: center;
  gap: 44px;
  padding: 36px 0 78px;
}

.hero-copy {
  animation: rise 700ms ease both;
}

.eyebrow,
.section-heading p,
.tag {
  margin: 0 0 12px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(4.5rem, 12vw, 10rem);
  line-height: 0.88;
  font-weight: 950;
  color: #f4fff8;
  text-shadow:
    0 0 24px rgba(65, 255, 155, 0.56),
    0 0 84px rgba(65, 255, 155, 0.18);
}

.role {
  color: var(--green-strong);
  font-size: clamp(1.3rem, 2.4vw, 2.05rem);
  font-weight: 800;
}

.summary {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.9;
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 850;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  background: var(--green);
  color: #00170d;
  box-shadow: 0 0 34px var(--shadow);
}

.button.ghost {
  background: rgba(3, 18, 13, 0.62);
  color: var(--green-strong);
}

.terminal-card,
.profile-panel,
.signal-grid article,
.project-grid article,
.timeline article,
.skill-board > div,
.metric-grid article,
.contact {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(3, 18, 13, 0.94), rgba(3, 31, 22, 0.84));
  backdrop-filter: blur(14px);
  box-shadow:
    0 0 0 1px rgba(65, 255, 155, 0.045) inset,
    0 20px 70px rgba(0, 0, 0, 0.24);
}

.terminal-card {
  position: relative;
  z-index: 5;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(1, 8, 5, 0.99), rgba(3, 28, 20, 0.97)),
    radial-gradient(circle at 20% 0%, rgba(65, 255, 155, 0.16), transparent 36%);
  border-color: rgba(65, 255, 155, 0.48);
  animation: terminalPulse 4s ease-in-out infinite;
  opacity: 1;
}

.terminal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(rgba(65, 255, 155, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65, 255, 155, 0.032) 1px, transparent 1px);
  background-size: 100% 28px, 28px 100%;
}

.terminal-card > * {
  position: relative;
  z-index: 1;
}

.avatar-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(65, 255, 155, 0.055);
}

.avatar-frame {
  display: grid;
  place-items: center;
  width: 82px;
  aspect-ratio: 1;
  border: 1px solid rgba(65, 255, 155, 0.62);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(65, 255, 155, 0.14), rgba(78, 231, 255, 0.08)),
    linear-gradient(rgba(65, 255, 155, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(65, 255, 155, 0.08) 1px, transparent 1px);
  background-size: auto, 12px 12px, 12px 12px;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 0 24px rgba(65, 255, 155, 0.16) inset;
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.terminal-body .phone-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.reveal-phone {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--cyan);
  font: inherit;
  font-family: "SFMono-Regular", Consolas, monospace;
  cursor: pointer;
  text-align: left;
  text-shadow: 0 0 12px rgba(65, 255, 155, 0.24);
  text-decoration: underline;
  text-decoration-color: rgba(78, 231, 255, 0.45);
  text-underline-offset: 3px;
  transition:
    color 180ms ease,
    text-decoration-color 180ms ease;
}

.reveal-phone:hover,
.reveal-phone:focus-visible {
  color: var(--green-strong);
  text-decoration-color: rgba(65, 255, 155, 0.7);
  outline: none;
}

.reveal-phone.is-revealed {
  text-decoration: none;
  cursor: default;
}

a.reveal-phone.is-revealed {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(65, 255, 155, 0.45);
}

.button.reveal-phone {
  text-decoration: none;
  text-shadow: none;
  color: #00170d;
  font-family: inherit;
  font-weight: 850;
}

.button.reveal-phone:hover,
.button.reveal-phone:focus-visible {
  color: #00170d;
  text-decoration: none;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(65, 255, 155, 0.08);
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.terminal-header span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 14px var(--green);
}

.terminal-header span:nth-child(2) {
  background: var(--cyan);
  box-shadow: 0 0 14px var(--cyan);
}

.terminal-header span:nth-child(3) {
  background: var(--amber);
  box-shadow: 0 0 14px rgba(231, 255, 122, 0.75);
}

.terminal-header strong {
  margin-left: auto;
  font-size: 0.8rem;
}

.terminal-body {
  padding: 24px;
  font-family: "SFMono-Regular", Consolas, monospace;
  color: #c6ffe0;
}

.terminal-body p {
  margin-bottom: 16px;
  line-height: 1.45;
  word-break: break-word;
  text-shadow: 0 0 12px rgba(65, 255, 155, 0.24);
}

.terminal-body span {
  color: var(--cyan);
}

.agent-console {
  border-top: 1px solid var(--line);
  padding: 14px 20px 18px;
  background: rgba(0, 0, 0, 0.18);
}

.console-title {
  margin-bottom: 10px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 800;
}

.console-lines {
  height: 96px;
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, monospace;
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 100%);
  scroll-behavior: auto;
}

.console-line {
  margin: 0 0 8px;
  color: rgba(198, 255, 224, 0.68);
  font-size: 0.78rem;
  line-height: 1.45;
  text-shadow: 0 0 10px rgba(65, 255, 155, 0.18);
  white-space: nowrap;
  animation: logIn 280ms ease both;
}

.console-line.is-active::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -0.14em;
  background: var(--green);
  animation: cursorBlink 820ms steps(1) infinite;
}

.reveal-line {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 620ms ease,
    transform 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

.reveal-line.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section {
  padding: 72px 0;
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading h2,
.contact h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
}

.profile-panel {
  padding: 26px;
}

.profile-panel p {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.9;
}

.profile-panel .profile-greeting {
  color: var(--text);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.6;
}

.profile-panel p:last-child {
  margin-bottom: 0;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.metric-grid article {
  min-height: 132px;
  padding: 20px;
}

.metric-grid strong {
  display: block;
  margin-bottom: 12px;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 1;
  text-shadow: 0 0 22px var(--shadow);
}

.metric-grid .metric-boost {
  display: flex;
  align-items: center;
  gap: 12px;
}

.boost-chart {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  overflow: visible;
  transform: translateY(1px);
}

.boost-chart marker path {
  fill: var(--amber);
}

.boost-area {
  fill: rgba(65, 255, 155, 0.075);
}

.boost-axis,
.boost-grid-line {
  fill: none;
  stroke: rgba(78, 231, 255, 0.26);
  stroke-linecap: round;
}

.boost-axis {
  stroke-width: 1.6;
}

.boost-grid-line {
  stroke-width: 1;
  stroke-dasharray: 2 5;
}

.boost-line {
  fill: none;
  stroke: url(#boost-gradient);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  marker-end: url(#boost-arrowhead);
  filter: drop-shadow(0 0 5px rgba(231, 255, 122, 0.68));
}

.metric-grid span {
  color: var(--muted);
  line-height: 1.6;
}

/* 4 cards → 2×2, avoid leftover empty cell from a 3-col layout */
.signal-grid,
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.signal-grid article,
.project-grid article {
  min-height: 0;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.signal-grid article:hover,
.project-grid article:hover,
.metric-grid article:hover {
  transform: translateY(-5px);
  border-color: var(--line-strong);
  box-shadow: 0 0 36px rgba(65, 255, 155, 0.14);
}

.signal-grid span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.signal-grid h3,
.project-grid h3,
.timeline h3 {
  margin-bottom: 10px;
  color: var(--green-strong);
}

.signal-grid p,
.project-grid p,
.timeline p,
.contact p {
  color: var(--muted);
  line-height: 1.75;
}

.signal-grid p,
.project-grid p:last-child {
  margin-bottom: 0;
}

.skill-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.skill-board > div {
  padding: 22px;
}

.skill-board strong {
  display: block;
  margin-bottom: 16px;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.skill-board span {
  display: inline-flex;
  margin: 0 8px 10px 0;
  padding: 8px 10px;
  border: 1px solid rgba(78, 231, 255, 0.22);
  border-radius: 6px;
  background: rgba(78, 231, 255, 0.07);
  color: #d8fff0;
  font-size: 0.92rem;
}

.timeline {
  position: relative;
  display: grid;
  gap: 18px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--green), rgba(65, 255, 155, 0.06));
  box-shadow: 0 0 18px var(--green);
}

.timeline article {
  position: relative;
  margin-left: 46px;
  padding: 22px;
}

.timeline article::before {
  content: "";
  position: absolute;
  left: -40px;
  top: 26px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 20px var(--green);
}

.timeline time {
  display: block;
  margin-bottom: 10px;
  color: var(--cyan);
  font-family: "SFMono-Regular", Consolas, monospace;
}

.project-grid .tag {
  margin-bottom: 10px;
}

.contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 72px;
  padding: 34px;
  background: var(--panel-strong);
}

.contact > div:first-child {
  max-width: 720px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes terminalPulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(65, 255, 155, 0.05) inset,
      0 24px 90px rgba(0, 0, 0, 0.42),
      0 0 30px rgba(65, 255, 155, 0.1);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(65, 255, 155, 0.1) inset,
      0 24px 90px rgba(0, 0, 0, 0.42),
      0 0 58px rgba(65, 255, 155, 0.2);
  }
}

@keyframes beamSweep {
  from {
    background-position: 140% 0;
  }
  to {
    background-position: -140% 0;
  }
}

@keyframes logIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cursorBlink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .hero,
  .skill-board {
    grid-template-columns: 1fr;
  }

  .signal-grid,
  .project-grid,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    min-height: auto;
    padding-top: 24px;
  }

  .terminal-card {
    max-width: 640px;
  }

  .contact {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 28px, 1180px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 18px;
  }

  .nav-links {
    justify-content: flex-start;
    width: 100%;
    gap: 4px;
  }

  .nav-links a {
    flex: 1 1 28%;
    min-width: 0;
  }

  .lang-toggle {
    align-self: flex-start;
  }

  #matrix-field {
    opacity: 0.38;
  }

  h1 {
    font-size: clamp(3rem, 15vw, 4.1rem);
  }

  .role {
    font-size: 1.18rem;
  }

  .summary {
    font-size: 0.98rem;
  }

  .terminal-header strong {
    max-width: 52%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .avatar-slot {
    padding: 16px;
  }

  .avatar-frame {
    width: 68px;
  }

  .console-lines {
    height: 82px;
  }

  .console-line {
    font-size: 0.72rem;
  }

  .signal-grid,
  .project-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 48px 0;
  }

  .profile-panel,
  .signal-grid article,
  .project-grid article,
  .timeline article,
  .skill-board > div,
  .metric-grid article,
  .contact {
    padding: 18px;
  }

  .hero-actions .button,
  .contact-actions .button {
    width: 100%;
  }
}

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