/* ==========================================================================
   个人主页 · 设计系统
   概念：编辑感 / 个人品牌 —— 暖纸色纸面、墨黑排版、电光靛蓝 + 酸柠檬高光
   所有视觉由下方 design token 驱动，深浅色是两套独立调色，不是简单反色
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* 色板 */
  --bg: #f4f1e9;
  --surface: #fffdf8;
  --surface-2: #ece7db;
  --text: #16140f;
  --muted: #6c675c;
  --border: #ded7c6;
  --line-strong: #c6bdab;
  --accent: #3f2ae0;
  --accent-2: #0f8f86;
  --accent-ink: #2b19b8;
  --accent-soft: rgba(63, 42, 224, 0.08);
  --lime: #cbf26c;
  --success: #0d8a5f;
  --danger: #c33a30;
  --warn: #a06f14;

  /* 氛围光 */
  --glow-1: rgba(63, 42, 224, 0.14);
  --glow-2: rgba(203, 242, 108, 0.42);
  --grid-line: rgba(22, 20, 15, 0.05);
  --topbar-bg: rgba(244, 241, 233, 0.76);

  /* 阴影 */
  --shadow: 0 30px 60px -28px rgba(38, 31, 12, 0.4);
  --shadow-soft: 0 14px 34px -22px rgba(38, 31, 12, 0.35);

  /* 字号阶梯 */
  --text-xs: 0.72rem;
  --text-sm: 0.8125rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.25rem, 2vw, 1.5rem);
  --text-2xl: clamp(1.6rem, 3.2vw, 2.4rem);
  --text-hero: clamp(2.9rem, 7.2vw, 5rem);

  /* 间距 / 圆角 / 版心 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;
  --max: 1120px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Source Han Serif SC",
    "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.65, 0.3, 1);
  --dur: 0.32s;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #07080b;
  --surface: #0e1015;
  --surface-2: #151821;
  --text: #f2f0e9;
  --muted: #94929c;
  --border: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #8b7dff;
  --accent-2: #4cd6c8;
  --accent-ink: #b3a9ff;
  --accent-soft: rgba(139, 125, 255, 0.14);
  --lime: #d8ff77;
  --success: #40d99f;
  --danger: #ff7b71;
  --warn: #f5c76a;

  --glow-1: rgba(108, 86, 255, 0.3);
  --glow-2: rgba(216, 255, 119, 0.09);
  --grid-line: rgba(255, 255, 255, 0.045);
  --topbar-bg: rgba(7, 8, 11, 0.72);

  --shadow: 0 40px 80px -34px rgba(0, 0, 0, 0.85);
  --shadow-soft: 0 18px 40px -26px rgba(0, 0, 0, 0.8);
}

/* --------------------------------------------------------------------------
   2. Reset / 基础
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 620px at 6% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 520px at 102% -6%, var(--glow-2), transparent 58%),
    repeating-linear-gradient(to right, var(--grid-line) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(to bottom, var(--grid-line) 0 1px, transparent 1px 72px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

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

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

p {
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] code {
  background: rgba(255, 255, 255, 0.08);
}

::selection {
  background: var(--lime);
  color: #14120e;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.shell {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 clamp(18px, 3vw, 32px);
}

.muted {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  background: var(--text);
  color: var(--bg);
  font-size: var(--text-sm);
  transition: top 0.2s var(--ease);
}

.skip-link:focus-visible {
  top: 16px;
}

/* file:// 兜底提示 */
.file-notice {
  position: relative;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  padding: 11px clamp(16px, 4vw, 32px);
  background: var(--lime);
  color: #14120e;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.file-notice-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #14120e;
  flex: none;
}

.file-notice a {
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
}

.file-notice code {
  background: rgba(20, 18, 14, 0.12);
  color: inherit;
}

/* --------------------------------------------------------------------------
   3. 按钮 / 标签
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
}

.btn.primary {
  background: var(--text);
  color: var(--bg);
  box-shadow: 4px 4px 0 var(--lime);
}

/* 悬停效果只在支持悬停的指针设备生效，触屏不残留 */
@media (hover: hover) {
  .btn.primary:hover:not(:disabled) {
    transform: translate(-2px, -2px);
    box-shadow: 7px 7px 0 var(--lime);
  }
}

.btn.primary:active:not(:disabled) {
  transform: translate(0, 0);
  box-shadow: 2px 2px 0 var(--lime);
}

.btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

@media (hover: hover) {
  .btn.ghost:hover:not(:disabled) {
    background: var(--surface);
    border-color: var(--text);
    transform: translateY(-2px);
  }
}

.btn.danger {
  background: transparent;
  border-color: rgba(195, 58, 48, 0.4);
  color: var(--danger);
}

@media (hover: hover) {
  .btn.danger:hover:not(:disabled) {
    background: rgba(195, 58, 48, 0.08);
    border-color: var(--danger);
  }
}

.btn.small {
  padding: 8px 13px;
  font-size: var(--text-xs);
  border-radius: var(--r-sm);
  box-shadow: none;
}

.btn.small.primary {
  box-shadow: 2px 2px 0 var(--lime);
}

@media (hover: hover) {
  .btn.small.primary:hover:not(:disabled) {
    box-shadow: 3px 3px 0 var(--lime);
  }
}

.btn.full {
  width: 100%;
}

.btn-arrow {
  font-family: var(--font-mono);
  font-size: 1.05em;
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .btn:hover .btn-arrow {
    transform: translateX(3px);
  }
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

@media (hover: hover) {
  .chip:hover {
    color: var(--text);
    border-color: var(--line-strong);
    transform: translateY(-2px);
  }
}

/* --------------------------------------------------------------------------
   4. 顶栏
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  height: 70px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent);
  box-shadow: 4px 4px 0 var(--lime);
  flex: none;
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .brand:hover .brand-mark {
    transform: rotate(-8deg);
  }
}

.brand-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* 窄屏隐藏品牌后的模块名，避免「凡客创造 · Content manager」被省略号截断 */
@media (max-width: 620px) {
  .brand-sub {
    display: none;
  }
}

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 26px);
  font-size: var(--text-sm);
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  padding: 6px 0;
  white-space: nowrap;
  transition: color var(--dur) var(--ease);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .nav-link:hover {
    color: var(--text);
  }

  .nav-link:hover::after {
    transform: scaleX(1);
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .icon-btn:hover {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    transform: rotate(12deg);
  }
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-sun {
  display: block;
}

html[data-theme="dark"] .icon-moon {
  display: none;
}

/* --------------------------------------------------------------------------
   5. Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(48px, 8vw, 96px) 0 0;
  overflow: hidden;
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

.hero-glow {
  position: absolute;
  z-index: 0;
  top: -34%;
  left: -12%;
  width: min(760px, 92vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow-1), transparent 64%);
  filter: blur(18px);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
}

.hero-copy {
  min-width: 0;
  padding-bottom: clamp(16px, 3vw, 36px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  flex: none;
}

.hero-title {
  margin-top: 20px;
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
  word-break: break-word;
  text-wrap: balance;
}

.hero-title .name {
  position: relative;
  z-index: 0;
  display: inline-block;
}

.hero-title .name::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -0.04em;
  right: -0.04em;
  bottom: -0.06em;
  height: 0.13em;
  border-radius: 0.07em;
  background: var(--lime);
  transform: rotate(-1.2deg);
  transform-origin: left center;
}

.hero-tagline {
  margin-top: 22px;
  max-width: 44ch;
  font-size: var(--text-lg);
  line-height: 1.7;
  color: var(--muted);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: clamp(24px, 3.4vw, 36px);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: clamp(24px, 3.4vw, 34px);
}

/* 首屏次级入口：插件集市（不抢主 CTA 的视觉） */
.market-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 4px;
  padding: 6px 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.market-link-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
  transition: background-color var(--dur) var(--ease);
}

.market-link-arrow {
  font-size: 0.95em;
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .market-link:hover {
    color: var(--text);
  }

  .market-link:hover .market-link-dot {
    background: var(--accent-2);
  }

  .market-link:hover .market-link-arrow {
    transform: translate(2px, -2px);
  }
}

/* 头像 / 视觉装饰 */
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(300px, 34vw, 420px);
}

.orbit {
  position: absolute;
  width: min(430px, 92%);
  aspect-ratio: 1;
  border: 1px dashed var(--line-strong);
  border-radius: 50%;
  animation: orbit-spin 46s linear infinite;
}

.orbit::before,
.orbit::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.orbit::before {
  top: 8%;
  right: 17%;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.orbit::after {
  bottom: 12%;
  left: 12%;
  background: var(--lime);
}

.portrait {
  position: relative;
  width: clamp(200px, 26vw, 320px);
  aspect-ratio: 1;
  padding: 7px;
  border-radius: 50%;
  background: conic-gradient(from 205deg, var(--accent), var(--lime) 32%, var(--accent) 66%, var(--lime));
  box-shadow: var(--shadow);
  animation: portrait-in 0.9s var(--ease) both 0.12s;
}

.avatar-fallback {
  position: absolute;
  inset: 7px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4.4vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.avatar-img {
  position: absolute;
  inset: 7px;
  width: calc(100% - 14px);
  height: calc(100% - 14px);
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.float-card {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}

.float-card b {
  color: var(--accent-ink);
  font-weight: 700;
}

.float-card i {
  font-style: normal;
  color: var(--muted);
}

.float-a {
  top: 6%;
  left: 2%;
  transform: rotate(-6deg);
}

.float-b {
  bottom: 20%;
  right: -2%;
  transform: rotate(4deg);
}

.float-c {
  bottom: 3%;
  left: 10%;
  transform: rotate(-3deg);
  color: var(--muted);
}

/* 滚动跑马灯 */
.ticker {
  position: relative;
  z-index: 1;
  margin-top: clamp(36px, 6vw, 64px);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
  padding: 13px 0;
  animation: ticker 34s linear infinite;
}

.ticker-track span {
  padding-right: 34px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes portrait-in {
  from {
    opacity: 0;
    transform: scale(0.94) rotate(-4deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* --------------------------------------------------------------------------
   6. 区块骨架
   -------------------------------------------------------------------------- */
.section {
  padding: clamp(52px, 7.5vw, 92px) 0 0;
  scroll-margin-top: 92px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: clamp(24px, 3.6vw, 40px);
}

.section-index {
  flex: none;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.section-head h2 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.section-rule {
  flex: 1;
  height: 1px;
  min-width: 20px;
  background: var(--border);
}

.section-kicker {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
}

/* --------------------------------------------------------------------------
   7. 关于我
   -------------------------------------------------------------------------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.85fr);
  gap: var(--space-4);
  align-items: start;
}

.about-card {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 3.6vw, 44px);
}

.about-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -20%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 68%);
  pointer-events: none;
}

.about-text {
  position: relative;
  z-index: 1;
  font-size: clamp(0.95rem, 1.15vw, 1.05rem);
  line-height: 2;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.about-side {
  display: grid;
  gap: var(--space-3);
  padding: clamp(20px, 2.6vw, 28px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}

.side-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.skill {
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 550;
  letter-spacing: 0.01em;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease);
}

@media (hover: hover) {
  .skill:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    color: var(--accent-ink);
  }
}

/* --------------------------------------------------------------------------
   8. 作品
   -------------------------------------------------------------------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: var(--space-4);
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: clamp(20px, 2.6vw, 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

@media (hover: hover) {
  .project-card:hover {
    transform: translateY(-5px);
    border-color: var(--line-strong);
    box-shadow: var(--shadow);
  }

  .project-card:hover::before {
    transform: scaleX(1);
  }
}

.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.project-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  flex: none;
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .project-card:hover .project-mark {
    transform: rotate(-5deg) scale(1.04);
  }
}

.project-index {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.project-card h3 {
  font-size: var(--text-lg);
  font-weight: 650;
  line-height: 1.35;
  word-break: break-word;
}

.project-desc {
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.75;
  word-break: break-word;
}

.project-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: 8px;
}

.project-tag {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 650;
  color: var(--accent-ink);
}

.project-link .arrow {
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .project-link:hover .arrow {
    transform: translateX(3px);
  }
}

/* --------------------------------------------------------------------------
   9. 留言板
   -------------------------------------------------------------------------- */
.section-guestbook {
  padding-bottom: clamp(20px, 3vw, 36px);
}

.guestbook-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: var(--space-5);
  align-items: start;
}

.form-card {
  display: grid;
  gap: var(--space-3);
  padding: clamp(22px, 3vw, 32px);
}

.form-head {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.form-head h3 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.form-head p {
  margin-top: 4px;
  font-size: var(--text-xs);
  color: var(--muted);
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

.field input,
.field textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease),
    background-color 0.18s var(--ease);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.field textarea {
  min-height: 108px;
  line-height: 1.7;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.challenge-row {
  gap: 6px;
}

.challenge-question {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  font-weight: 700;
}

.challenge-row input {
  max-width: 150px;
  text-align: center;
  font-weight: 600;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.form-hint {
  color: var(--muted);
  font-size: 12px;
}

.form-msg {
  min-height: 20px;
  font-size: 12.5px;
  color: var(--muted);
}

.form-msg.error {
  color: var(--danger);
}

.form-msg.success {
  color: var(--success);
}

.messages-panel {
  padding-top: 4px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.panel-head h3 {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
}

.messages-list {
  display: grid;
  gap: var(--space-3);
  max-height: 620px;
  margin: 0;
  padding: 0 6px 0 0;
  list-style: none;
  overflow-y: auto;
  scrollbar-width: thin;
}

.message-item {
  display: flex;
  gap: var(--space-3);
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .message-item:hover {
    border-color: var(--line-strong);
    transform: translateX(2px);
  }
}

.msg-avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
}

.msg-body {
  min-width: 0;
}

.msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 4px;
}

.msg-name {
  font-size: var(--text-sm);
  font-weight: 650;
}

.msg-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.msg-content {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   10. 页脚
   -------------------------------------------------------------------------- */
.footer {
  margin-top: clamp(56px, 9vw, 104px);
  border-top: 1px solid var(--border);
  padding-top: clamp(20px, 3vw, 32px);
}

.footer-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  padding-bottom: clamp(20px, 3vw, 36px);
}

.footer-wordmark {
  font-family: var(--font-serif);
  font-size: clamp(2.3rem, 8vw, 5rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.05em;
  color: var(--text);
  opacity: 0.16;
  word-break: break-word;
}

html[data-theme="dark"] .footer-wordmark {
  opacity: 0.2;
}

.footer-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

@media (hover: hover) {
  .footer-cta:hover {
    color: var(--text);
    border-color: var(--line-strong);
  }
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0 clamp(32px, 5vw, 48px);
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--muted);
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.visit-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
}

.visit-pill strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-weight: 700;
}

.visit-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.quiet-link {
  color: var(--muted);
  transition: color var(--dur) var(--ease);
}

@media (hover: hover) {
  .quiet-link:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

.noscript {
  padding: 24px;
  color: var(--muted);
  font-size: var(--text-sm);
}

/* --------------------------------------------------------------------------
   11. 管理后台（与前台共用同一套 token）
   -------------------------------------------------------------------------- */
.admin-main {
  padding: clamp(32px, 5vw, 56px) 0 80px;
}

.login-view {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 260px);
  min-height: calc(100dvh - 260px);
  padding: 32px 0;
}

.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: var(--space-4);
  padding: clamp(26px, 4vw, 40px);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.login-card p {
  font-size: var(--text-sm);
}

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.admin-head h1 {
  margin-top: 10px;
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}

.tab {
  position: relative;
  padding: 11px 15px 13px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.tab::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease);
}

@media (hover: hover) {
  .tab:hover {
    color: var(--text);
  }
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  transform: scaleX(1);
}

.panel {
  display: none;
  gap: var(--space-4);
}

.panel.active {
  display: grid;
}

.admin-card {
  padding: clamp(20px, 3vw, 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
}

.admin-card h2 {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.admin-form {
  display: grid;
  gap: var(--space-3);
}

.admin-form .field input,
.admin-form .field textarea {
  background: var(--surface-2);
}

.row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.admin-list {
  display: grid;
  gap: var(--space-3);
}

.admin-item {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.add-card {
  padding: var(--space-5);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: transparent;
}

.add-card h3 {
  margin-bottom: var(--space-3);
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge.pending {
  background: rgba(160, 111, 20, 0.14);
  color: var(--warn);
}

.badge.approved {
  background: rgba(13, 138, 95, 0.14);
  color: var(--success);
}

.badge.hidden {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.admin-message .msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 4px;
  font-size: var(--text-sm);
}

.admin-message .msg-email {
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--font-mono);
}

.admin-message .msg-content {
  font-size: 13.5px;
}

.admin-empty {
  padding: var(--space-4);
  color: var(--muted);
  font-size: var(--text-sm);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  transform: translateX(-50%);
  padding: 11px 22px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: var(--bg);
  font-size: 13.5px;
  box-shadow: var(--shadow);
}

/* --------------------------------------------------------------------------
   12. 滚动渐显 / 动效
   -------------------------------------------------------------------------- */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  will-change: opacity, transform;
}

html.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

html.js .hero-copy[data-reveal] {
  transition-delay: 0.04s;
}

html.js .hero-art[data-reveal] {
  transition-delay: 0.16s;
}

/* --------------------------------------------------------------------------
   13. 响应式
   -------------------------------------------------------------------------- */
@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
  }

  .hero-art {
    order: -1;
    min-height: 0;
    padding: 8px 0 0;
  }

  .portrait {
    width: clamp(150px, 30vw, 220px);
  }

  .orbit {
    width: min(300px, 78vw);
  }

  .float-a {
    top: 0;
    left: max(6%, 12px);
  }

  .float-b {
    right: max(4%, 10px);
    bottom: 12%;
  }

  .float-c {
    display: none;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .about-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .guestbook-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  .messages-list {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    height: 62px;
  }

  .topnav {
    gap: 6px;
  }

  .nav-link {
    display: none;
  }

  /* ≥481px 页头仍放得下集市入口；更窄时交给首屏次级入口，避免页头换行挤爆 */
  .nav-link--market {
    display: inline-flex;
    font-size: 12.5px;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  html[lang="ja"] .nav-link--market {
    font-size: 12px;
    letter-spacing: 0;
  }

  .hero {
    padding-top: clamp(32px, 9vw, 52px);
  }

  .hero-title {
    font-size: clamp(2.4rem, 11vw, 3.4rem);
    margin-top: 16px;
  }

  .hero-tagline {
    font-size: 1rem;
    margin-top: 18px;
  }

  .hero-actions {
    margin-top: 24px;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.18em;
  }

  .ticker-track span {
    font-size: 9.5px;
    padding-right: 26px;
  }

  .section-head {
    gap: var(--space-3);
    flex-wrap: wrap;
  }

  .section-rule {
    display: none;
  }

  .section-kicker {
    margin-left: auto;
  }

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

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }

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

  .row-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .login-view {
    min-height: 0;
  }

  /* iOS 聚焦时避免自动放大 */
  .field input,
  .field textarea {
    font-size: 16px;
  }
}

@media (max-width: 520px) {
  .shell {
    padding: 0 18px;
  }

  .hero-art {
    padding-top: 0;
  }

  .portrait {
    width: 160px;
  }

  .orbit {
    width: min(230px, 74vw);
  }

  .float-card {
    font-size: 9px;
    padding: 6px 9px;
  }

  .float-a {
    top: -4px;
    left: 2px;
  }

  .float-b {
    right: 0;
    bottom: 4%;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .social-links {
    margin-top: 20px;
  }

  .challenge-row input {
    max-width: none;
  }

  .about-card {
    padding: 22px;
  }

  .form-card {
    padding: 20px;
  }

  .message-item {
    padding: 14px;
  }

  .footer-meta {
    flex-wrap: wrap;
    gap: var(--space-3);
  }
}

/* --------------------------------------------------------------------------
   14. 移动端适配（安全区 / 触控热区 / 表单 / 横屏 / 后台）
   -------------------------------------------------------------------------- */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

/* 刘海屏 / 底部手势条：内容不贴边 */
.shell {
  padding-left: max(clamp(18px, 3vw, 32px), calc(12px + var(--safe-left)));
  padding-right: max(clamp(18px, 3vw, 32px), calc(12px + var(--safe-right)));
}

.topbar-inner {
  padding-top: var(--safe-top);
  height: calc(70px + var(--safe-top));
}

.footer-inner {
  padding-bottom: calc(clamp(32px, 5vw, 48px) + var(--safe-bottom));
}

.toast {
  bottom: calc(26px + var(--safe-bottom));
}

/* 触屏输入的点击反馈与延迟 */
a,
button,
.btn,
.chip,
.tab,
.icon-btn {
  touch-action: manipulation;
}

html {
  scroll-padding-top: calc(70px + var(--safe-top));
}

/* 触控热区：移动端 / 触屏设备上交互元素至少 44×44 */
@media (max-width: 900px), (pointer: coarse) {
  .chip {
    min-height: 44px;
    padding: 10px 16px;
  }

  .skill {
    min-height: 40px;
    padding: 9px 13px;
    font-size: 12.5px;
  }

  .project-link {
    min-height: 44px;
    padding-block: 9px;
  }

  .footer-cta {
    min-height: 44px;
    padding: 10px 18px;
  }

  .quiet-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-inline: 10px;
    margin-inline: -10px;
  }

  .checkbox-label {
    min-height: 44px;
  }

  .btn.small {
    min-height: 44px;
    padding: 10px 14px;
  }
}

/* 触屏上所有输入控件 ≥16px，避免 iOS 聚焦时自动放大页面 */
@media (pointer: coarse) {
  input:not([type='hidden']),
  textarea,
  select {
    font-size: 16px;
  }
}

/* 长英文单词 / URL 不撑破容器 */
.about-text,
.project-card h3,
.project-desc,
.msg-content,
.msg-head,
.form-msg,
.form-head p,
.login-card p {
  overflow-wrap: anywhere;
}

/* 图片避免 CLS */
.avatar-img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* 键盘弹起时，聚焦到的表单项与提交按钮自动让出顶部栏高度 */
.field,
#guest-submit {
  scroll-margin-block: calc(90px + var(--safe-top));
}

@media (max-width: 980px) {
  .nav-link {
    min-height: 44px;
    padding-inline: 10px;
    margin-inline: -10px;
  }
}

/* 横屏手机：首屏改为左右布局，避免头像把标题挤出视口 */
@media (orientation: landscape) and (max-height: 560px) {
  .shell {
    padding-left: max(24px, calc(12px + var(--safe-left)));
    padding-right: max(24px, calc(12px + var(--safe-right)));
  }

  .hero {
    padding-top: 18px;
    padding-bottom: 24px;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr) 190px;
    align-items: center;
    gap: var(--space-4);
  }

  .hero-art {
    order: 0;
    justify-self: end;
    padding: 0;
  }

  .portrait {
    width: 150px;
  }

  .orbit {
    width: 196px;
  }

  .float-b,
  .float-c,
  .ticker {
    display: none;
  }

  .float-a {
    top: -12px;
    left: -8px;
  }

  .hero-title {
    font-size: clamp(2rem, 5.4vw, 3rem);
  }

  .hero-actions {
    margin-top: 16px;
  }

  .social-links {
    margin-top: 14px;
  }
}

@media (max-width: 720px) {
  .topbar-inner {
    height: calc(62px + var(--safe-top));
  }

  html {
    scroll-padding-top: calc(62px + var(--safe-top));
  }

  /* 手机排版：稍降字号阶梯、放宽行高，避免中文段落过挤 */
  .hero-tagline {
    font-size: 1.0625rem;
    line-height: 1.65;
  }

  .about-text {
    font-size: 15.5px;
    line-height: 1.85;
  }

  .project-desc {
    font-size: 14px;
    line-height: 1.8;
  }

  .msg-content {
    font-size: 14.5px;
    line-height: 1.7;
  }

  .side-label,
  .section-kicker {
    font-size: 11px;
    letter-spacing: 0.14em;
  }

  .float-card {
    font-size: 10px;
  }

  .ticker {
    font-size: 11.5px;
  }

  .footer-inner {
    font-size: 12.5px;
  }

  /* 留言表单：按钮始终可见，输入区不被挤压 */
  .form-card {
    gap: 14px;
  }

  .form-card textarea {
    min-height: 96px;
  }

  /* 后台：Tab 允许换行，避免最后一项被裁切 */
  .tabs {
    flex-wrap: wrap;
    row-gap: 0;
  }

  .tab {
    flex: 0 1 auto;
    min-height: 48px;
    padding: 13px 11px 15px;
    white-space: nowrap;
  }

  .admin-head .btn {
    width: 100%;
  }

  .admin-card {
    padding: 18px;
  }

  .admin-item {
    padding: 14px;
  }

  .row-actions {
    gap: 10px;
  }

  .row-actions .btn {
    flex: 1 1 auto;
  }

  .login-card {
    padding: 22px;
    gap: 14px;
  }

  .toast {
    left: 16px;
    right: 16px;
    transform: none;
    text-align: center;
  }
}

/* 手机竖屏：页头只保留品牌、语言与主题，集市入口由首屏次级链接承担 */
@media (max-width: 480px) {
  .nav-link--market {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   15. 尊重「减少动效」偏好
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html.js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }

  .orbit,
  .portrait,
  .ticker-track {
    animation: none !important;
  }

  .btn.primary:hover:not(:disabled),
  .project-card:hover,
  .message-item:hover,
  .chip:hover,
  .skill:hover,
  .icon-btn:hover {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   16. 多语言：语言切换器 / 中英日排版差异 / 后台翻译编辑
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
}

.lang-switch::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 40px;
  max-width: 132px;
  padding: 0 32px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.lang-select option {
  background: var(--surface);
  color: var(--text);
}

@media (hover: hover) {
  .lang-select:hover {
    border-color: var(--line-strong);
  }
}

.lang-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .lang-select {
    min-height: 44px;
    max-width: 116px;
    padding: 0 30px 0 12px;
    /* 与输入框一致 >=16px，避免 iOS 聚焦时自动放大页面 */
    font-size: 16px;
  }
}

/* 英文：放宽字距、避免中文式断行与紧凑行高 */
html[lang="en"] {
  --font-sans: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html[lang="en"] body {
  line-height: 1.7;
}

html[lang="en"] .hero-title {
  letter-spacing: -0.035em;
  line-height: 1.02;
  word-break: normal;
  overflow-wrap: break-word;
}

html[lang="en"] .hero-tagline {
  line-height: 1.55;
}

html[lang="en"] .about-text,
html[lang="en"] .project-desc,
html[lang="en"] .msg-content,
html[lang="en"] .form-head p,
html[lang="en"] .project-card h3 {
  line-height: 1.65;
  letter-spacing: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

html[lang="en"] .eyebrow,
html[lang="en"] .section-kicker,
html[lang="en"] .side-label,
html[lang="en"] .float-card {
  letter-spacing: 0.12em;
}

html[lang="en"] .ticker-track span {
  letter-spacing: 0.14em;
}

/* 日文：单独字体回退与更宽松行高 */
html[lang="ja"] {
  --font-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP",
    "Meiryo", system-ui, sans-serif;
  --font-serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", "Source Han Serif JP",
    "Songti SC", serif;
}

html[lang="ja"] body {
  line-height: 1.85;
}

html[lang="ja"] .hero-title {
  letter-spacing: 0;
  line-height: 1.16;
  word-break: normal;
  overflow-wrap: anywhere;
}

html[lang="ja"] .hero-tagline {
  line-height: 1.8;
}

html[lang="ja"] .about-text,
html[lang="ja"] .project-desc,
html[lang="ja"] .msg-content,
html[lang="ja"] .form-head p {
  line-height: 1.95;
  word-break: normal;
  overflow-wrap: anywhere;
}

html[lang="ja"] .btn,
html[lang="ja"] .nav-link,
html[lang="ja"] .tab {
  letter-spacing: 0.02em;
}

/* 语言切换后按钮文案变长时避免撑破 */
.btn,
.nav-link,
.tab,
.quiet-link,
.footer-cta {
  overflow-wrap: anywhere;
}

/* 后台：翻译编辑区 */
.i18n-editor {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}

.i18n-caption {
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.i18n-group {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.i18n-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 44px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}

.i18n-group summary::-webkit-details-marker {
  display: none;
}

.i18n-group summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1;
  color: var(--muted);
}

.i18n-group[open] summary::after {
  content: "–";
}

.i18n-group[open] summary {
  border-bottom: 1px solid var(--border);
}

.i18n-code {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.i18n-fields {
  display: grid;
  gap: var(--space-3);
  padding: 14px;
}

/* 技能：按语言自动分列，窄屏自动堆叠 */
.skill-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.skill-row .row-actions {
  margin-top: 10px;
}

/* 英文/日文长文案下的后台操作按钮不被压缩 */
.row-actions .btn {
  flex: 0 1 auto;
}

@media (max-width: 720px) {
  .i18n-fields {
    padding: 12px;
  }

  .i18n-group summary {
    font-size: 12.5px;
  }
}
/* --------------------------------------------------------------------------
   17. 内容板块：关于标题 / 服务列表 / 视频预留卡
   -------------------------------------------------------------------------- */

/* 关于我的主标题 */
.about-headline {
  position: relative;
  z-index: 1;
  margin-bottom: var(--space-4);
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 1.9vw, 1.55rem);
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* 后台按空行分段，正文按真实段落排版 */
.about-text p + p {
  margin-top: 1.05em;
}

.about-text p {
  overflow-wrap: break-word;
}

/* 服务：编号 + 细线分隔的可扫读列表 */
.services-title {
  margin-bottom: var(--space-4);
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 1.8vw, 1.5rem);
  line-height: 1.4;
  color: var(--text);
}

.service-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.service-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: var(--space-4);
  align-items: baseline;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--border);
}

.service-no {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--accent-ink);
}

.service-text {
  font-size: clamp(0.95rem, 1.1vw, 1.02rem);
  line-height: 1.7;
  color: var(--text);
  overflow-wrap: break-word;
}

.service-note {
  grid-column: 2;
  margin-top: 2px;
  font-size: var(--text-xs);
  line-height: 1.65;
  color: var(--muted);
}

/* 作品区：视频预留卡（占位封面用色块 + 网格 + 播放键，不是空盒子） */
/* 封面占左列，文案在右列；用独立容器避免跨行分配把标题挤到封面下方 */
.video-card {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: clamp(16px, 2.4vw, 28px);
  margin-bottom: var(--space-4);
  align-items: stretch;
}

.video-cover {
  grid-column: 1;
}

.video-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.video-body .project-foot {
  margin-top: auto;
}

.video-cover {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: calc(var(--r-lg) - 6px);
  background:
    radial-gradient(110% 90% at 18% 8%, var(--glow-2) 0%, transparent 58%),
    linear-gradient(135deg, #2b2193 0%, var(--accent) 52%, #171227 100%);
  overflow: hidden;
}

.video-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.55;
  mask-image: radial-gradient(120% 120% at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 120% at 50% 40%, #000 30%, transparent 78%);
}

.video-badge {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.video-play {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
}

.video-play::after {
  content: "";
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid var(--accent);
}

/* 点击行为位：后续替换为 B 站链接或 mp4 地址 */
.video-cta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 0;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}

@media (hover: hover) {
  .video-card:hover .video-cover {
    border-color: var(--line-strong);
  }
}

/* 配置了封面图时替换占位色块 */
.video-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 已配置链接：整卡点击热区，单个焦点、≥44px */
.video-hit {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: var(--r-lg);
}

.video-card.is-live {
  cursor: pointer;
}

.video-card.is-live:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-color: var(--accent);
}

.video-card.is-live .video-cta {
  justify-content: flex-end;
  min-width: 44px;
  color: var(--accent-ink);
  cursor: pointer;
}

.video-play,
.video-cta,
.video-cta .arrow {
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

@media (hover: hover) {
  .video-card.is-live:hover .video-cover {
    border-color: var(--accent);
  }

  .video-card.is-live:hover .video-play {
    transform: scale(1.06);
    background: #fff;
  }

  .video-card.is-live:hover .video-cta .arrow {
    transform: translateX(3px);
  }
}

/* 卡片下方风险提示：小字一行，不做成免责声明海报 */
.video-risk {
  margin: 0 0 var(--space-5);
  max-width: 68ch;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.7;
}

html[lang="ja"] .video-risk {
  line-height: 1.9;
}

/* 站内视频播放弹层：竖屏 9:16，浅深色共用 token */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  background: rgba(10, 8, 20, 0.78);
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .video-modal {
  background: rgba(0, 0, 0, 0.82);
}

.video-modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  width: min(100%, 520px);
  max-height: 92dvh;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.video-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

@media (hover: hover) {
  .video-modal-close:hover {
    background: var(--text);
    color: var(--bg);
  }
}

.video-modal-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 70dvh;
  border-radius: var(--r-md);
  background: #000;
  overflow: hidden;
}

.video-modal-frame video {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 70dvh;
  aspect-ratio: 9 / 16;
  background: #000;
}

.video-modal-meta {
  display: grid;
  gap: 6px;
}

.video-modal-meta h3 {
  font-size: var(--text-lg);
}

.video-modal-meta p {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.65;
}

body.video-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .video-modal-panel {
    padding: var(--space-3);
  }

  .video-modal-meta h3 {
    font-size: var(--text-base);
  }

  .video-modal-frame,
  .video-modal-frame video {
    max-height: 64dvh;
  }
}

/* 英文正文限制行宽，接近 60–70 字符 */
html[lang="en"] .about-text,
html[lang="en"] .service-text {
  max-width: 68ch;
}

/* 日文：正文行高单独放宽 */
html[lang="ja"] .about-text {
  line-height: 2.1;
}

html[lang="ja"] .about-text p + p {
  margin-top: 1.2em;
}

html[lang="ja"] .service-text {
  line-height: 1.95;
  letter-spacing: 0.01em;
}

@media (max-width: 720px) {
  .video-card {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
  }

  .video-card .video-cover,
  .video-card .project-top,
  .video-card h3,
  .video-card .project-desc,
  .video-card .project-foot {
    grid-column: 1;
  }

  .video-card .video-cover {
    grid-row: auto;
  }

  .service-item {
    grid-template-columns: 30px minmax(0, 1fr);
    column-gap: var(--space-3);
    padding: 14px 0 16px;
  }

  .service-text {
    font-size: 0.95rem;
    line-height: 1.7;
  }
}
