/* ========== 基础变量 ========== */
:root {
  --bg: #fafaf7;
  --panel: #ffffff;
  --ink: #1b1b1b;
  --muted: #6b7280;
  --accent: #204d8d;
  --accent-2: #2e7d6f;
  --shadow: 0 0 30px rgba(0, 0, 0, 0.1);
  --radius: 18px;
  --easing-soft: cubic-bezier(0.22, 1, 0.36, 1);

  /* 背景飘字可调 */
  --ticker-font-size: clamp(16px, 2.2vw, 24px);
  --ticker-line-height: 1.65;
  --ticker-opacity-badge: 0.16;
  --ticker-opacity-paper: 0.12;

  /* 无缝滚动的节奏与间距 */
  --ticker-gap: 40px; /* 邻近两项的水平间隔 */
  --ticker-speed: 90; /* px/s：越大越快（可被每行覆盖） */

  --ticker-ink-rgb: 27, 27, 27; /* 文字基色（和 --ink 对齐） */
  --ticker-idle: 0.22; /* 常态透明度 */
  --ticker-hover: 0.7; /* 悬停时透明度 */
}

/* 字体 */
body {
  font-family: "Inter", "Noto Sans SC", system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol";
  /* font-family: 'Montserrat', sans-serif; */
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0 0 0.4em 0;
  line-height: 1.2;
}
p {
  line-height: 1.75;
  color: #2b2b2b;
}
.u-em {
  font-family: "Noto Serif SC", "Noto Serif", serif;
}

/* 跳转链接 */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 8px 12px;
  background: #000;
  color: #fff;
  z-index: 10000;
  border-radius: 8px;
}

/* 页面布局 */
.page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

.hero {
  position: relative;
  z-index: 2;
  max-width: 960px;
  width: 100%;
  padding: 8vh 20px 40px;
  text-align: center;
}

.hero-head {
  margin-bottom: 28px;
}
.hero-title {
  font-size: clamp(24px, 3.2vw, 42px);
  font-weight: 700;
  letter-spacing: 0.2px;
}
.hero-subtitle {
  color: var(--muted);
  font-size: clamp(14px, 1.6vw, 18px);
}

/* 主操作按钮 */
.hero-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 28px auto 22px;
  max-width: 560px;
}
@media (min-width: 720px) {
  .hero-actions {
    grid-template-columns: 1fr 1fr;
  }
}

.btn {
  --btn-bg: var(--panel);
  --btn-ink: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-ink);
  text-decoration: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow);
  transition: transform 0.35s var(--easing-soft),
    box-shadow 0.35s var(--easing-soft), background 0.35s var(--easing-soft);
  will-change: transform;
  cursor: pointer;

}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}
.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow);
}
.btn .btn-icon {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.btn.primary {
  --btn-bg: #ffffff;
  border-color: rgb(255, 255, 255);
}
.btn.secondary {
  --btn-bg: #ffffff;
  border-color: rgb(255, 255, 255);
}
.btn.ghost {
  background: transparent;
  border: 1px dashed rgba(0, 0, 0, 0.2);
  padding: 10px 20px;
  box-shadow: none;
}
.btn.subtle {
  background: #f4f5f7;
}
.btn .btn-label {
  font-weight: 600;
}

.hero-footer {
  margin-top: 8px;
}
.letter-link {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline dotted;
  cursor: pointer;
}

/* ===== 背景飘动（无缝循环） ===== */
.bg-floating {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.8;
  pointer-events: auto;
  mix-blend-mode: normal;
  display: grid;
  grid-template-rows: 1fr;
}

.ticker-column {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-rows: min-content;
  align-content: space-between;
  gap: 10px;
  padding: 0vh 0;
}

.ticker-row {
  font-family: "Noto Serif SC", "Noto Serif", serif;
  font-size: var(--ticker-font-size);
  line-height: var(--ticker-line-height);
  letter-spacing: 0.2px;
  /* opacity: .10; */
  opacity: 1 !important;
}

.ticker-line {
  position: relative;
  display: inline-flex;
  will-change: transform;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  white-space: nowrap;
}

.ticker-track {
  display: inline-flex;
  gap: var(--ticker-gap);
  padding-inline: 8px;
  align-items: baseline;
  white-space: nowrap;
}

.ticker-item {
  cursor: default;
  display: inline-flex;
  align-items: baseline;
  padding: 0 0.2em;
  pointer-events: auto; /* 让文字本身可 hover */
  color: rgba(var(--ticker-ink-rgb), var(--ticker-idle));
  transition: color 0.28s var(--easing-soft),
    text-shadow 0.28s var(--easing-soft);
}
.ticker-item::before {
  content: "「";
}
.ticker-item::after {
  content: "」";
}
.ticker-item:hover {
  color: rgba(var(--ticker-ink-rgb), var(--ticker-hover));
  /* 需要一点点质感可以开微弱高光（可删） */
  text-shadow: 0 0 0.5px rgba(255, 255, 255, 0.35);
}

@keyframes tickerScroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-1 * var(--scroll-distance, 1000px)));
  }
}

/* 无障碍：减少动效时静止 */
@media (prefers-reduced-motion: reduce) {
  .ticker-line {
    animation: none !important;
  }
  .btn {
    transition: none !important;
  }
}

/* ===== 模态 ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.16);
  opacity: 0;
  transition: opacity 0.25s var(--easing-soft);
  pointer-events: none;
}
.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  border: none;
  width: min(720px, 92vw);
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
  padding: 0;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.28s var(--easing-soft),
    opacity 0.28s var(--easing-soft);
}
.modal[open] {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.modal::backdrop {
  background: transparent;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: #fff;
  border-bottom: 1px solid #ececec;
}
.modal-head h2 {
  font-family: "Noto Serif SC", "Noto Serif", serif;
  font-weight: 700;
  font-size: 20px;
}
.icon-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 8px;
}

.modal-body {
  padding: 18px 20px;
  background: #fff;
}
.modal-foot {
  padding: 14px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fff;
  border-top: 1px solid #ececec;
}

/* 聚焦态 */
:focus-visible {
  outline: 2px solid #2e7d6f;
  outline-offset: 2px;
}

/* 背景遮罩过渡（你已有 .modal-backdrop，可复用） */
.modal::backdrop {
  background: rgba(15, 18, 30, 0.45);
  backdrop-filter: blur(2px);
}

/* 对话框主体：尺寸、圆角、阴影、进场动效 */
.modal {
  padding: 0;              /* 由内部容器控制 */
  border: none;
  border-radius: 20px;
  overflow: hidden;        /* 圆角裁切 */
  max-width: min(720px, 92vw);
  width: auto;
  box-shadow:
    0 20px 50px rgba(0,0,0,0.25),
    0 2px 10px rgba(0,0,0,0.12);
  animation: modalIn 220ms ease-out;
}

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

/* 内部“面板”留白与分区 */
.modal-surface {
  display: grid;
  grid-template-rows: auto 1fr auto; /* 标题 / 正文(可滚) / 底部按钮 */
  row-gap: 0;
  background: #fff;
  color: #1a1a1a;
  min-width: min(640px, 92vw);
  max-width: 92vw;
  max-height: min(80vh, 760px);      /* 限高：触发正文滚动 */
}

/* 头部：无按钮，仅标题 */
.modal-head {
  padding: 20px 24px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.modal-title {
  margin: 0;
  font-family: "Noto Serif SC", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* 正文：滚动区域 + 舒适阅读宽度 */
.modal-body {
  padding: 18px 24px;
  overflow: auto;                       /* 关键：允许滚动 */
  line-height: 1.7;
  font-size: clamp(14px, 1.9vw, 16px);
  -webkit-overflow-scrolling: touch;
}

/* 让长内容更易读的宽度限制（可选） */
.modal-body > * {
  max-width: 64ch;
}

/* 底部：仅关闭按钮 */
.modal-foot {
  padding: 14px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid rgba(0,0,0,0.06);
  background: linear-gradient(#fff, #fff9);
}

/* 轻微的滚动条美化（可选） */
.modal-body::-webkit-scrollbar { width: 10px; }
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
}
.modal-body::-webkit-scrollbar-track { background: transparent; }

/* 暗色模式适配（若有） */
@media (prefers-color-scheme: dark) {
  .modal-surface { background: #16181d; color: #eaeef5; }
  .modal-head, .modal-foot { border-color: rgba(255,255,255,0.08); }
  .modal::backdrop { background: rgba(0,0,0,0.6); backdrop-filter: blur(2px); }
  .modal-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.22); }
}

/* Localization */
.lang-switch {
  position: absolute;
  top: 1rem; right: 1rem; z-index: 1000;
  font-size: 0.85rem;
}
.lang-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .32rem .6rem;
  background: rgba(255,255,255,.9); backdrop-filter: blur(4px);
  border: 0; border-radius: 999px; cursor: pointer; font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.lang-toggle::after {
  content: ""; width: 0; height: 0; margin-left: .2rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #333;
  transition: transform .18s ease;
}
.lang-switch.open .lang-toggle::after { transform: rotate(180deg); }

.lang-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 2.2rem;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(4px);
  list-style: none;
  margin: 0;
  padding: 0.3rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.lang-switch.open .lang-menu { display: block; }
.lang-menu a {
  display: block;
  padding: .45rem 1rem;
  text-decoration: none;
  text-align: center;
  color: #333;
  white-space: nowrap;
  border-radius: 4px;
}
.lang-menu a:hover { background: #f2f3f5; }

.lang-current {
  font-weight: 400;
}

@media (max-width:600px){
  .lang-switch { top: .5rem; right: .5rem; }
  .lang-toggle { font-size: .8rem; padding: .28rem .5rem; }
}

/* 页面等待翻译应用完毕前，先隐藏内容以避免语言闪烁 */
html.i18n-wait body {
  visibility: hidden; /* 或者用 opacity: 0; */
}

.ticker-row {
  overflow: hidden;
  contain: content;              /* 隔离影响，减少重排范围 */
  content-visibility: auto;      /* 不在视口内就不渲染 */
}
.ticker-line {
  position: relative;
  white-space: nowrap;
  will-change: transform;
}
.ticker-track {
  display: inline-block;
  white-space: nowrap;
}
@keyframes tickerScroll {
  from { transform: translate3d(0,0,0); }
  to   { transform: translate3d(calc(-1 * var(--scroll-distance)), 0, 0); }
}
