/* ============================================================
   键盘星球 KeyboardPlanet 宣传页样式
   设计 token 与应用内 Theme.swift 的 v6「Zen 纸墨 · 实体键帽」
   设计系统一一对应：暖纸白画布 + 1px 发丝线（零阴影）、低饱和莫兰迪
   语义色（叶绿 = 行动/成功，金 = 星星/奖励，陶土 = 警示）、
   按钮 = 实体键帽（渐变受光面 + 唇边侧壁 + 极近接触影，按下 = 敲键）。
   游戏场景插画保留 SpriteKit 场景的贴纸物件色（纸上的实物）。
   ============================================================ */

:root {
  /* 纸墨令牌（与 DSTheme.paper 一致） */
  --paper: #F7F5F1;        /* canvas 暖纸白画布 */
  --surface: #FFFFFF;      /* 白纸卡面 */
  --line: #E8E5DD;         /* 发丝线 */
  --divider: #F0EEE7;
  --hover: #F2F0E9;
  --ink: #2B2A26;          /* 墨色正文/标题 */
  --muted: #767268;
  --faint: #A9A498;
  /* 语义色（低饱和陶土系） */
  --accent: #33774A;       /* 叶绿：品牌 + 主 CTA + 成功 */
  --accent-deep: #2A603D;
  --accent-soft: #EAF1EA;
  --danger: #AE4A40;       /* 陶土红：错误警示 */
  --danger-soft: #F7E9E6;
  --warning: #8F6400;
  --warning-soft: #F6EFDC;
  --gold: #B08A2E;         /* 奖励专属金：星星/等级 */
  --gold-deep: #967426;
  --gold-ink: #6E5518;
  --steel: #5E7E9E;        /* 信息冷灰蓝 */
  --steel-deep: #4D6B87;
  --purple: #8A67A3;
  --orange: #BC7A38;
  --night: #26251F;        /* 深色时刻：暖炭黑（不用蓝紫夜空） */
  --night-deep: #1C1B17;
  --night-high: #2E2D27;
  --keycap-lip: #DCD8CB;   /* 键帽唇边侧壁 */
  /* 世界主题色（莫兰迪配对，同 Duo.worldPalette 的饱和度区间） */
  --w1: #7FA065;  --w1-deep: #628049;   /* 起步草原 */
  --w2: #BC7A38;  --w2-deep: #A0662B;   /* 上排山丘 */
  --w3: #5E7E9E;  --w3-deep: #4D6B87;   /* 下排海岸 */
  --w4: #8A67A3;  --w4-deep: #74568B;   /* 词语之城 */
  --w5: #5E8E9E;  --w5-deep: #48737F;   /* 数字群岛 */
  --w6: #B0735F;  --w6-deep: #93584A;   /* 标点海湾 */
  --w7: #A98F4A;  --w7-deep: #8A7139;   /* 拼音大陆 */
  --radius-card: 14px;
  --radius-btn: 9px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
b { font-weight: 650; }

.container { max-width: 1120px; margin-inline: auto; padding-inline: 24px; }
.container-narrow { max-width: 820px; }

h1, h2, h3 { font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; color: var(--ink); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); text-align: center; }
.section-sub {
  text-align: center;
  color: var(--muted);
  font-weight: 400;
  max-width: 560px;
  margin: 14px auto 0;
}
.section-sub.left { text-align: left; margin-inline: 0; }
.section { padding-block: 96px; scroll-margin-top: 76px; }
.eyebrow {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--muted);
  margin-bottom: 12px;
}

.ic { width: 1.15em; height: 1.15em; fill: currentColor; flex: none; }

/* ---------- 焦点与跳转链接 ---------- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip-link {
  position: fixed; top: -48px; left: 16px; z-index: 100;
  background: var(--accent); color: #fff; font-weight: 600;
  padding: 10px 16px; border-radius: 0 0 10px 10px;
  transition: top .2s;
}
.skip-link:focus { top: 0; }

/* ---------- 实体键帽按钮（复刻 KeycapChrome：渐变受光面 + 唇边 + 接触影） ---------- */
.btn3d {
  --face: var(--accent);
  --edge: var(--accent-deep);
  --lip: var(--accent-deep);
  --face-label: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font);
  font-weight: 600;
  border: 1px solid var(--edge);
  cursor: pointer; text-decoration: none;
  border-radius: var(--radius-btn);
  padding: 12px 26px;
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--face-label);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--face) 90%, #fff) 0%, var(--face) 100%);
  box-shadow: 0 3px 0 var(--lip), 0 5px 10px rgba(43, 42, 38, 0.10);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn3d:hover { filter: brightness(1.05); }
.btn3d:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--lip), 0 2px 4px rgba(43, 42, 38, 0.08);
}
.btn3d-sm { padding: 8px 18px; font-size: 0.85rem; }
.btn3d-lg { padding: 14px 32px; font-size: 1.05rem; }
.btn3d-xl { padding: 18px 46px; font-size: 1.2rem; }
.btn3d-white {
  --face: var(--surface);
  --edge: var(--line);
  --lip: var(--keycap-lip);
  --face-label: var(--accent);
}

/* ---------- 顶部导航 ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 245, 241, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; gap: 28px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; }
.brand-name {
  font-weight: 700; font-size: 1.05rem; color: var(--ink);
  letter-spacing: 0.02em;
}
.nav-links { display: flex; gap: 4px; margin-inline: auto; }
.nav-links a {
  text-decoration: none; font-weight: 500; font-size: 0.92rem;
  color: var(--muted); padding: 8px 13px; border-radius: 9px;
  transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--hover); color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding-block: 64px 88px; scroll-margin-top: 76px; text-align: center; }
.hero-kicker {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.3em;
  color: var(--muted);
}
.hero h1 {
  margin-top: 14px;
  font-size: clamp(2.2rem, 4.4vw, 3.3rem);
  font-weight: 700; line-height: 1.18;
}
.hero-sub {
  margin: 18px auto 0; font-size: 1.02rem; color: var(--muted); font-weight: 400;
  max-width: 36em;
}
.hero-cta { display: flex; gap: 14px; margin-top: 28px; flex-wrap: wrap; justify-content: center; }
.hero-meta { margin-top: 14px; font-size: 0.8rem; color: var(--faint); font-weight: 400; }
.hero-shot { max-width: 980px; margin: 44px auto 0; }
/* Mac 窗口卡：柔和投影 + 发丝线，替代裸贴截图 */
.mac-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(43, 42, 38, 0.25),
              0 12px 24px -18px rgba(43, 42, 38, 0.12);
}
.mac-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  background: #FBFAF6;
  border-bottom: 1px solid var(--divider);
}
.mac-bar i { width: 11px; height: 11px; border-radius: 50%; }
.mac-bar i:nth-child(1) { background: #DFA096; }
.mac-bar i:nth-child(2) { background: #E2CB92; }
.mac-bar i:nth-child(3) { background: #A9C2A0; }
.mac-bar span {
  margin-inline: auto; padding-right: 44px;
  font-size: 0.78rem; font-weight: 500; color: var(--faint);
}
.mac-card img { display: block; width: 100%; height: auto; }

/* ---------- 卡片（纸面 + 1px 发丝线，零阴影——层次靠留白） ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

/* ---------- 为什么不一样(对垒卡 + 次要项 + 佐证) ---------- */
.vs-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 18px; max-width: 980px; margin: 44px auto 0;
}
.vs-card { padding: 24px 26px 26px; }
.vs-them { font-size: 0.8rem; font-weight: 400; color: var(--faint); }
.vs-card h3 { margin-top: 12px; font-size: 1.15rem; }
.vs-card h3::before {
  content: "✓";
  color: var(--accent); font-weight: 700;
  margin-right: 8px;
}
.vs-note {
  margin-top: 8px;
  font-size: 0.85rem; font-weight: 400; color: var(--muted); line-height: 1.65;
}
.vs-science {
  max-width: 760px; margin: 32px auto 0; text-align: center;
  font-size: 0.8rem; font-weight: 400; color: var(--muted); line-height: 1.8;
}
.vs-chips {
  margin-top: 22px; text-align: center;
  font-size: 0.82rem; font-weight: 400; color: var(--muted);
}
.vs-chips span {
  display: inline-block; margin: 4px 3px; padding: 5px 13px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
  font-weight: 500;
}
.vs-tag {
  display: inline-block;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 11px; border-radius: 999px;
}

/* ---------- 课程世界：一排七卡 ---------- */
.world-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px;
  margin-top: 44px;
}
.world-card {
  padding: 18px 10px 16px; text-align: center;
}
.world-disc {
  width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 50%;
  background: var(--wc, var(--accent));
  display: grid; place-items: center;
}
.world-disc svg { width: 22px; height: 22px; }
.world-card h3 { font-size: 0.98rem; }
.world-sub { font-size: 0.74rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.world-note { font-size: 0.74rem; font-weight: 400; color: var(--muted); line-height: 1.5; margin-top: 8px; }

.num-strip {
  display: flex; justify-content: center; gap: 52px; flex-wrap: wrap;
  margin-top: 44px; padding: 22px 28px;
  border-block: 1px solid var(--line);
}
.num-item { text-align: center; }
.num-item b {
  display: block; font-size: 2rem; color: var(--ink);
  font-variant-numeric: tabular-nums; line-height: 1.1; font-weight: 650;
}
.num-item span { font-size: 0.82rem; font-weight: 500; color: var(--muted); }

/* ---------- 星乐场横向长卷（全屏拉通） ---------- */
.arcade-head {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  padding-inline: 32px;
}
.arcade-head h2 { text-align: center; }
.arcade-sub { max-width: 640px; }
.game-progress {
  margin: 16px 0 0;
  font-size: 0.9rem; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.game-progress b { color: var(--ink); }

.game-strip { position: relative; }
.game-scroller {
  display: flex; gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 44px 32px 12px;
  scroll-padding-inline: 32px;
  scrollbar-width: none; /* 进度由箭头与计数表达 */
  /* 两端渐隐，提示横向还有内容 */
  mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}
.game-scroller::-webkit-scrollbar { display: none; }
.game-card {
  flex: 0 0 330px; scroll-snap-align: start;
  padding: 14px 14px 20px;
  transition: border-color .15s ease;
}
.game-card:hover { border-color: var(--accent); }
.game-cover { display: block; width: 100%; height: auto; border-radius: 10px; }
.game-card h3 { font-size: 1.05rem; margin: 14px 6px 0; }
.game-card p { font-size: 0.85rem; font-weight: 400; color: var(--muted); margin: 6px 6px 0; }

/* 横卷导航：键帽圆钮，浮在留白带上 */
.game-nav {
  position: absolute; z-index: 2; top: 40%;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  padding: 0; border-radius: 50%;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 3px 0 var(--keycap-lip);
  cursor: pointer;
  transition: opacity .2s ease, transform .12s ease, box-shadow .12s ease;
}
.game-nav svg { width: 18px; height: 18px; }
.game-nav:hover { border-color: var(--faint); }
.game-nav:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--keycap-lip); }
.game-nav.prev { left: 10px; }
.game-nav.next { right: 10px; }
.game-nav.is-off { opacity: 0; pointer-events: none; }

/* ---------- 书房三馆 ---------- */
.shelf-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 20px; margin-top: 44px;
}
.shelf-card { padding: 26px 24px; }
.shelf-card .world-disc { margin-bottom: 14px; }
.shelf-card h3 { font-size: 1.2rem; }
.shelf-sub { font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-top: 3px; }
.shelf-list { list-style: none; margin-top: 16px; display: grid; gap: 10px; }
.shelf-list li {
  position: relative; padding-left: 20px;
  font-size: 0.88rem; font-weight: 400; color: var(--ink); line-height: 1.5;
}
.shelf-list li::before {
  content: ""; position: absolute; left: 2px; top: 0.52em;
  width: 8px; height: 8px; border-radius: 3px;
  background: var(--wc, var(--accent));
  opacity: 0.75;
}

/* ---------- 成长激励 ---------- */
.tile-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 18px; margin-top: 44px;
}
.tile { padding: 22px 20px; }
.tile-ic { width: 30px; height: 30px; }
.tile-ic-blue { color: var(--steel); }
.tile-ic-purple { color: var(--purple); }
.tile-ic-orange { color: var(--orange); }
.tile-ic-yellow { color: var(--gold); }
.tile b { display: block; font-size: 1.7rem; margin-top: 10px; color: var(--ink); font-variant-numeric: tabular-nums; }
.tile h3 { font-size: 0.98rem; margin-top: 2px; }
.tile p { font-size: 0.85rem; font-weight: 400; color: var(--muted); margin-top: 8px; }

.marquee {
  margin-top: 40px; overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track {
  display: flex; gap: 12px; width: max-content;
  padding-block: 6px;
}
@media (prefers-reduced-motion: no-preference) {
  .marquee-track { animation: marquee 30s linear infinite; }
}
@keyframes marquee { to { transform: translateX(-50%); } }
.badge-pill {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface);
  padding: 9px 18px;
  font-weight: 500; font-size: 0.88rem; color: var(--ink);
  white-space: nowrap;
}
.badge-pill .ic { color: var(--gold); }

/* ---------- 家长与隐私 ---------- */

/* ---------- 下载 ---------- */
.section-download {
  background: var(--accent-soft);
  border-block: 1px solid var(--line);
}
.download-inner { text-align: center; }
.download-inner .btn3d-xl { margin-top: 30px; }
.download-meta { margin-top: 16px; font-size: 0.85rem; font-weight: 400; color: var(--muted); }
.download-pricing {
  margin: 10px auto 0; max-width: 560px;
  font-size: 0.85rem; font-weight: 400; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 20px;
}

/* ---------- FAQ ---------- */
.faq-list { margin-top: 36px; display: grid; gap: 12px; }
.faq-list details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 4px 22px;
}
.faq-list summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 600; font-size: 1rem; color: var(--ink);
  padding-block: 15px;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list .caret { color: var(--muted); transition: transform .2s; }
.faq-list details[open] .caret { transform: rotate(180deg); }
.faq-list details p {
  color: var(--muted); font-weight: 400; font-size: 0.93rem;
  padding-bottom: 16px; max-width: 60ch;
}

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 40px 32px; }
.footer-inner {
  display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.footer-brand .brand-mark { border-radius: 8px; }
.footer-brand span { font-weight: 700; color: var(--ink); }
.footer-brand small { color: var(--muted); font-weight: 400; }
.footer-links { display: flex; gap: 20px; margin-inline: auto; }
.footer-links a {
  text-decoration: none; font-weight: 500; font-size: 0.88rem; color: var(--muted);
}
.footer-links a:hover { color: var(--accent); }
.footer-note {
  width: 100%; font-size: 0.78rem; color: var(--muted); font-weight: 400;
}
.footer-note a { color: var(--muted); }

/* ---------- 入场浮现 ----------
   CSS 滚动驱动动画（渐进增强）：支持 animation-timeline 的浏览器在元素
   进入视口时浮现；不支持的浏览器（旧 Safari/Firefox）直接静态可见，
   不依赖 JS，搜索引擎渲染与打印永远能拿到完整内容。 */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    [data-reveal] {
      animation: reveal-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
    /* 卡片不参与横向 view(inline) 入场：scroll-padding 使吸附口内
       边缘卡恒定只露 ~22px，透明度动画会永远停在半透明态。 */
  }
}
@keyframes reveal-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1023px) {
  .shelf-grid { grid-template-columns: 1fr; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  /* 一排七卡保持到 768px：窄桌面整排收紧一号 */
  .world-card { padding: 14px 6px 12px; }
  .world-disc { width: 36px; height: 36px; margin-bottom: 8px; }
  .world-disc svg { width: 18px; height: 18px; }
  .world-card h3 { font-size: 0.88rem; }
  .world-sub, .world-note { font-size: 0.68rem; }
}
@media (max-width: 767px) {
  .section { padding-block: 64px; }
  .vs-grid { grid-template-columns: 1fr; }
  .arcade-sub { max-width: none; }
  .game-nav { width: 40px; height: 40px; top: 34%; }
  .hero { padding-block: 44px 56px; }
  .nav-links { display: none; }
  .nav-inner { justify-content: space-between; }
  .world-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { flex-direction: column; }
  .footer-links { margin-inline: 0; }
}
@media (max-width: 479px) {
  .tile-grid { grid-template-columns: 1fr; }
  .hero-cta .btn3d { width: 100%; }
  .num-strip { gap: 28px; }
  .game-card { flex-basis: 280px; }
}

/* ---------- 无障碍：减少动态 ---------- */
@media (prefers-reduced-motion: reduce) {
  .btn3d { transition: none; }
}
