:root {
  --bg: #0a0b14;
  --bg-card: #131524;
  --bg-elev: #1b1e33;
  --border: #2a2e4a;
  --text: #e8eaf6;
  --text-dim: #9aa0c4;
  --accent: #818cf8;   /* indigo-400 */
  --accent-2: #a855f7; /* violet-500 */
  --accent-soft: rgba(129, 140, 248, 0.12);
  --grad: linear-gradient(135deg, #6366f1, #a855f7);
  --radius: 16px;
  --maxw: 880px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(129, 140, 248, 0.18), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(168, 85, 247, 0.10), transparent 55%),
    var(--bg) fixed;
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-2); text-decoration: underline; }

/* ---------- Language switch ---------- */
.lang-toggle {
  position: fixed;
  top: 16px; right: 18px;
  z-index: 30;
  padding: 7px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: rgba(19, 21, 36, 0.75);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.lang-toggle:hover { border-color: var(--accent); transform: translateY(-1px); }

/* i18n visibility — hide every non-active language */
body.lang-zh .en,
body.lang-zh .ja { display: none; }
body.lang-en .zh,
body.lang-en .ja { display: none; }
body.lang-ja .zh,
body.lang-ja .en { display: none; }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus {
  left: 12px; top: 12px;
  background: var(--accent); color: #0a0b14;
  padding: 6px 12px; border-radius: 8px; z-index: 40;
}

/* ---------- Hero ---------- */
.hero {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(129, 140, 248, 0.08), transparent);
}
.hero-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 52px 24px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.avatar-ring {
  flex: 0 0 auto;
  width: 112px; height: 112px;
  border-radius: 50%;
  padding: 3px;
  background: var(--grad);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.15), var(--shadow);
}
.avatar-img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #0a0b14;
}
.hero-text h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0.5px;
}
.hero-text h1 .en-name {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 20px;
}
.role { margin: 6px 0 2px; font-size: 18px; font-weight: 600;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; }
.meta { margin: 0 0 12px; color: var(--text-dim); }

.contacts {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  font-size: 14px;
}
.contacts a { color: var(--text); }
.contacts a:hover { color: var(--accent-2); }

/* ---------- Layout ---------- */
.layout { max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 56px; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.card h2::before {
  content: "";
  position: absolute;
  left: -28px; top: 4px; bottom: 14px;
  width: 4px; border-radius: 4px;
  background: var(--grad);
}
.card p { margin: 0 0 12px; color: var(--text); }
.card p:last-child { margin-bottom: 0; }

/* ---------- Skills ---------- */
.skill-group { margin-bottom: 18px; }
.skill-group:last-child { margin-bottom: 0; }
.skill-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--accent);
  font-weight: 600;
}
.tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tags li:hover { transform: translateY(-2px); border-color: var(--accent); color: #fff; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 22px 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.20);
}
.t-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; }
.t-org { font-weight: 600; }
.t-date { color: var(--text-dim); font-size: 13px; }
.t-role { margin: 2px 0 6px; color: var(--accent); font-size: 14px; }
.timeline p { margin: 0; color: var(--text-dim); font-size: 14.5px; }

/* ---------- Projects ---------- */
.project { padding: 16px 0; border-bottom: 1px dashed var(--border); }
.project:first-of-type { padding-top: 0; }
.project:last-of-type { border-bottom: none; padding-bottom: 0; }
.p-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; }
.p-head h3 { margin: 0; font-size: 16px; }
.p-tag {
  font-size: 12.5px; color: var(--text-dim);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px;
}
.project p { margin: 0 0 10px; font-size: 14.5px; color: var(--text); }
.project .result {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
}

/* ---------- Education ---------- */
.edu { list-style: none; margin: 0; padding: 0; }
.edu li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.edu li:last-child { border-bottom: none; }
.e-org { font-weight: 600; }
.e-degree { color: var(--accent); }
.e-date { color: var(--text-dim); font-size: 13px; margin-left: auto; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 26px 24px 44px;
  color: var(--text-dim);
  font-size: 13px;
}
.footer-links { margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .hero-inner { flex-direction: column; text-align: center; padding: 40px 20px 32px; }
  .contacts { justify-content: center; }
  .card h2::before { display: none; }
  .e-date { margin-left: 0; width: 100%; }
}
