:root {
  --bg: #0b0e14;
  --surface: #121721;
  --surface-hover: #171d2a;
  --border: #232a38;
  --border-subtle: #1b212d;
  --text: #e6edf3;
  --text-cn: #c9d5e3;
  --text-secondary: #9ba3b0;
  --text-muted: #6e7785;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.12);
  --btn-solid-bg: #238636;
  --btn-solid-hover: #2ea043;

  /* Systematic spacing tokens */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 36px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 52px;
}

/* Header & Identity */
.identity {
  padding-bottom: 24px;
}

.identity-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.identity-profile {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.identity-titles h1 {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 6px 0;
  line-height: 1.15;
}

.role {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.social-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pill:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
  text-decoration: none;
}

.pill-primary {
  background: var(--accent-soft);
  border-color: rgba(88, 166, 255, 0.38);
  color: #79c0ff;
}

.pill-primary:hover {
  background: rgba(88, 166, 255, 0.22);
  border-color: var(--accent);
}

.pill-lg {
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
}

.intro-copy {
  width: 100%;
}

.manifesto {
  margin: 0 0 14px 0;
  font-size: 1.18rem;
  line-height: 1.72;
  color: var(--text);
  font-weight: 400;
  letter-spacing: -0.005em;
}

.manifesto strong,
.manifesto-cn strong {
  color: #ffffff;
  font-weight: 600;
}

.manifesto-cn {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.82;
  letter-spacing: 0.015em;
  color: var(--text-cn);
  padding-left: 14px;
  border-left: 2px solid rgba(88, 166, 255, 0.42);
}

/* Unified Section Grammar — Every Section Uses Identical Spacing, Divider, Header & Surface Cards */
.page-section {
  padding-top: 28px;
  margin-top: 28px;
  border-top: 1px solid var(--border);
}

.identity + .page-section {
  margin-top: 4px;
}

/*
  APPENDIX SECTION: Recent on X
  Must stay at the very bottom after Contact Me, with extra vertical separation
  so it reads clearly as an appendix.
*/
.appendix-section {
  margin-top: 56px;
  padding-top: 40px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.section-meta {
  font-size: 0.84rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.section-meta a {
  color: var(--text-secondary);
}

.section-meta a:hover {
  color: var(--accent);
}

/* Unified 2-Column Card Grid & Surface Card Component */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.surface-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease;
}

.surface-card:hover {
  border-color: #364156;
}

.card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.app-icon {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  flex-shrink: 0;
  object-fit: cover;
}

.app-icon-round {
  border-radius: 50%;
  border: 1px solid var(--border);
}

.card-title-group {
  flex: 1;
  min-width: 0;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.card-title-row h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
}

.card-title-row h3 a {
  color: var(--text);
}

.card-title-row h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.badge {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.73rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-tagline {
  margin: 3px 0 0 0;
  font-size: 0.84rem;
  color: var(--text);
  line-height: 1.35;
}

.card-tagline-cn {
  margin: 1px 0 0 0;
  font-size: 0.8rem;
  color: var(--text-cn);
  line-height: 1.35;
}

.preview-frame {
  display: block;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #07090d;
  margin-bottom: var(--sp-3);
  aspect-ratio: 16 / 9.6;
}

/* X Appendix Media Frame: supports tall / square images up to 1:1 without clipping comics */
.preview-frame-x {
  aspect-ratio: auto;
  max-height: 490px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #07090d;
}

.preview-frame-x img {
  width: 100%;
  height: auto;
  max-height: 490px;
  object-fit: contain;
  object-position: center;
}

.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.card-summary {
  margin: 0 0 var(--sp-2) 0;
  font-size: 0.89rem;
  color: var(--text);
}

.card-highlights {
  margin: 0 0 var(--sp-4) 0;
  padding-left: 18px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  flex: 1;
}

.card-highlights li {
  margin-bottom: 5px;
}

.card-highlights strong {
  color: var(--text);
  font-weight: 600;
}

/* Native X Post Body — Same Font Scale & Contrast as Project Cards */
.tweet-body {
  margin: 0 0 var(--sp-4) 0;
  font-size: 0.89rem;
  line-height: 1.62;
  color: var(--text-cn);
  flex: 1;
}

.tweet-body p {
  margin: 0 0 8px 0;
}

.tweet-body p:last-child {
  margin-bottom: 0;
}

.tweet-body strong {
  color: var(--text);
  font-weight: 600;
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.84em;
  background: rgba(255, 255, 255, 0.07);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.83rem;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-solid {
  background: var(--btn-solid-bg);
  color: #ffffff;
  border: 1px solid rgba(240, 246, 252, 0.1);
}

.btn-solid:hover {
  background: var(--btn-solid-hover);
}

.btn-primary-x {
  background: var(--accent-soft);
  border: 1px solid rgba(88, 166, 255, 0.38);
  color: #79c0ff;
  padding: 8px 16px;
  font-size: 0.88rem;
}

.btn-primary-x:hover {
  background: rgba(88, 166, 255, 0.22);
  border-color: var(--accent);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--text-muted);
}

.btn-ghost {
  color: var(--accent);
  margin-left: auto;
  padding-right: 4px;
}

.btn-ghost:hover {
  color: #79c0ff;
}

/* Contact Me Section — Full-width open editorial flow (matches Intro rhythm, no inner card) */
.contact-block {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.contact-copy {
  width: 100%;
}

.contact-en {
  margin: 0 0 12px 0;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--text);
}

.contact-cn {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.78;
  letter-spacing: 0.015em;
  color: var(--text-cn);
  padding-left: 14px;
  border-left: 2px solid rgba(88, 166, 255, 0.42);
}

.contact-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

@media (max-width: 820px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .shell {
    padding: 24px 16px 36px;
  }
  .identity-titles h1 {
    font-size: 1.75rem;
  }
  .manifesto {
    font-size: 1.06rem;
  }
  .surface-card {
    padding: var(--sp-4);
  }
}
