/* ==========================================================================
   Mathsight 站点设计系统
   与 iOS App 视觉对齐：iOS 分组底色 + 大圆角卡片 + SF 字体栈 + 品牌紫金
   ========================================================================== */

:root {
  /* 底色与文字（对齐 App 的 iOS 系统色） */
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --ink: #1c1c1e;
  --ink-2: rgba(60, 60, 67, 0.6);
  --ink-3: rgba(60, 60, 67, 0.38);
  --line: rgba(60, 60, 67, 0.12);

  /* 交互色（与 App 内蓝色按钮一致） */
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff4ff;

  /* 品牌色（App 图标渐变 + 金点） */
  --brand-1: #2a2f7a;
  --brand-2: #5b49b8;
  --brand-3: #8a7be0;
  --gold: #f2c14e;

  /* 年级色（沿用 Web 端既有规范） */
  --g1: #2563eb;
  --g2: #059669;
  --g3: #d97706;
  --g4: #7c3aed;
  --g5: #db2777;
  --g6: #dc2626;

  --r-card: 20px;
  --r-btn: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.04), 0 14px 40px rgba(15, 23, 42, 0.08);
  --maxw: 1120px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------------------------------------------------------------- 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(242, 242, 247, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--ink); }
.brand img { width: 26px; height: 26px; }
.brand:hover { text-decoration: none; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--ink-2); font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav .btn { padding: 9px 16px; font-size: 15px; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: var(--r-btn);
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.24); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet { padding: 10px 4px; color: var(--blue); font-weight: 500; }
.btn-block { width: 100%; }
.btn svg { flex: 0 0 auto; }

/* ---------------------------------------------------------------- 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
}
.pad { padding: 22px; }
.section { padding: 58px 0; }
.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 22px; }
.section-head p { color: var(--ink-2); font-size: 15px; }
.section-head .more { margin-left: auto; font-size: 15px; font-weight: 500; }

/* ---------------------------------------------------------------- Hero */
.hero { padding: 54px 0 46px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.hero h1 { margin: 18px 0 16px; }
.hero .lede { font-size: 18px; color: var(--ink-2); max-width: 33ch; }
.hero-actions { display: flex; align-items: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-note { margin-top: 14px; font-size: 13.5px; color: var(--ink-3); }
.hero-visual { position: relative; display: flex; justify-content: center; }
.hero-visual::before {
  content: ""; position: absolute; inset: -8% -14% 12%;
  background: radial-gradient(60% 60% at 50% 40%, rgba(138, 123, 224, 0.28), transparent 70%);
  z-index: 0; filter: blur(6px);
}

/* 手机外框 */
.phone {
  position: relative; z-index: 1;
  width: 268px; padding: 10px;
  background: linear-gradient(160deg, #2a2f7a, #5b49b8 55%, #8a7be0);
  border-radius: 44px;
  box-shadow: 0 24px 60px rgba(42, 47, 122, 0.28);
}
.phone img { border-radius: 35px; }

/* ---------------------------------------------------------------- 年级卡 */
.grade-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grade-card { display: block; padding: 20px; color: var(--ink); position: relative; overflow: hidden; }
.grade-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.grade-card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.grade-card .num {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 19px; color: #fff;
  margin-bottom: 14px;
}
.grade-card h3 { margin-bottom: 4px; }
.grade-card .meta { font-size: 14px; color: var(--ink-2); }
.grade-card .tags { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.tag {
  font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue-dark);
}
.tag.free { background: #eefaf1; color: #067647; }

/* ---------------------------------------------------------------- 资源卡 */
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.res-card { display: flex; gap: 16px; align-items: flex-start; padding: 22px; }
.res-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.res-card, .res-card * { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.res-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue-soft); color: var(--blue-dark);
}
.res-card p { font-size: 14.5px; color: var(--ink-2); margin-top: 4px; }

/* ---------------------------------------------------------------- 课程页 */
.player-shell { background: #000; border-radius: var(--r-card); overflow: hidden; position: relative; box-shadow: var(--shadow-md); }
.player-shell video { width: 100%; display: block; background: #000; }
.player-frame { max-width: 900px; margin: 0 auto; }
.lesson-head { max-width: 900px; margin: 26px auto 0; }
.crumbs { font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.crumbs a { color: var(--ink-2); }
.lesson-title { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.lesson-title h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.lesson-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* 播放结束浮层 */
.cta-overlay {
  position: absolute; inset: 0; z-index: 5;
  background: linear-gradient(180deg, rgba(10, 10, 20, 0.55), rgba(10, 10, 20, 0.92));
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; padding: 26px;
}
.cta-overlay.show { display: flex; }
.cta-card {
  background: var(--surface); border-radius: 18px; padding: 26px 26px 22px;
  max-width: 430px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.cta-card .mark { width: 44px; height: 44px; margin: 0 auto 12px; }
.cta-card h3 { font-size: 1.25rem; margin-bottom: 8px; }
.cta-card p { font-size: 15px; color: var(--ink-2); margin-bottom: 18px; }
.cta-card .btn { width: 100%; }
.cta-card .alt { display: block; margin-top: 12px; font-size: 14px; }

/* 转录稿 */
.transcript { margin-top: 14px; }
.transcript p { color: var(--ink-2); font-size: 15.5px; margin-bottom: 10px; }
.transcript p:last-child { margin-bottom: 0; }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; max-width: 900px; margin: 26px auto 0; }

/* 底部 CTA 大卡 */
.cta-band {
  margin: 54px auto 0; max-width: 900px;
  background: linear-gradient(150deg, #2a2f7a, #5b49b8 58%, #8a7be0);
  border-radius: 24px; padding: 34px; color: #fff;
  display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.cta-band h2 { color: #fff; font-size: 1.6rem; }
.cta-band p { color: rgba(255, 255, 255, 0.78); font-size: 15.5px; margin-top: 6px; }
.cta-band .spacer { margin-left: auto; }
.cta-band .btn { background: #fff; color: var(--brand-1); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18); }
.cta-band .btn:hover { background: #fff; }
.cta-band .btn-w { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.3); }

/* ---------------------------------------------------------------- 列表页 */
.lesson-list { display: grid; gap: 12px; }
.lesson-row { display: flex; align-items: center; gap: 16px; padding: 12px; }
.lesson-row:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.lesson-row { transition: transform 0.16s ease, box-shadow 0.16s ease; }
.thumb {
  position: relative; width: 118px; height: 66px; border-radius: 12px; overflow: hidden;
  background: #0a0a12; flex: 0 0 auto;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge {
  position: absolute; left: 6px; bottom: 6px;
  background: rgba(255, 255, 255, 0.92); color: #111;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px;
}
.lesson-row .info { min-width: 0; }
.lesson-row h3 { font-size: 16px; margin-bottom: 3px; }
.lesson-row .meta { font-size: 13.5px; color: var(--ink-2); }
.lesson-row .right { margin-left: auto; text-align: right; flex: 0 0 auto; }

/* ---------------------------------------------------------------- 页脚 */
.footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 36px 0 54px; }
.footer-grid { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.footer h4 { font-size: 13.5px; color: var(--ink-2); margin-bottom: 12px; font-weight: 600; }
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer a { color: var(--ink); font-size: 14.5px; }
.footer .copy { margin-top: 28px; font-size: 13px; color: var(--ink-3); }
.badge-slot {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px;
  font-size: 13px; color: var(--ink-3); background: var(--surface);
}

/* ---------------------------------------------------------------- 工具类 */
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.center { text-align: center; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .hero-visual { order: -1; }
  .grade-grid { grid-template-columns: 1fr 1fr; }
  .res-grid, .two-col { grid-template-columns: 1fr; }
  .nav .navlink { display: none; }
  .section { padding: 42px 0; }
  .cta-band { padding: 26px; }
}
@media (max-width: 560px) {
  .grade-grid { grid-template-columns: 1fr; }
  .phone { width: 232px; }
  .thumb { width: 96px; height: 54px; }
}

.band-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 课程网格（列表页/年级页） */
.grade-section { margin-bottom: 44px; }
.grade-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.grade-head h2 { display: flex; align-items: center; gap: 12px; font-size: 1.4rem; }
.gnum {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; font-weight: 700;
}
.gcount { font-size: 14px; color: var(--ink-2); }
.grade-head .more { margin-left: auto; font-size: 14.5px; font-weight: 500; }

.lesson-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.lcard { display: block; overflow: hidden; padding: 0; color: var(--ink); }
.lcard { transition: transform 0.16s ease, box-shadow 0.16s ease; }
.lcard:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.lthumb { position: relative; aspect-ratio: 16 / 9; background: #0a0a12; }
.lthumb img { width: 100%; height: 100%; object-fit: cover; }
.lnum {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(255, 255, 255, 0.92); color: #111;
  font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 7px;
}
.lbody { padding: 12px 14px 14px; }
.lbody h3 {
  font-size: 14.5px; font-weight: 600; line-height: 1.32; letter-spacing: -0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.64em;
}
.lmeta { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

/* ---------------------------------------------------------------- 资源列表（工作册） */
.res-list { display: grid; gap: 12px; max-width: 720px; }
.dl-row-item { display: flex; align-items: center; gap: 16px; padding: 18px 20px; color: var(--ink); }
.dl-row-item:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.dl-row-item { transition: transform 0.16s ease, box-shadow 0.16s ease; }
.dl-row-item .txt h4 { font-size: 16px; }
.dl-row-item .txt p { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.dl-row-item .get { margin-left: auto; font-size: 15px; font-weight: 600; color: var(--blue); }

@media (max-width: 1024px) { .lesson-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .lesson-grid { grid-template-columns: repeat(2, 1fr); }
  .grade-head { flex-wrap: wrap; }
  .grade-head .more { margin-left: 0; flex-basis: 100%; }
}

/* ---------------------------------------------------------------- 课程页（生成页用） */
.soft-cta {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
  padding: 12px 16px; font-size: 14.5px; color: var(--ink-2);
  border-radius: 14px;
}
.soft-cta strong { color: var(--ink); font-weight: 600; }
.soft-cta a { margin-left: auto; font-weight: 600; white-space: nowrap; }

.cta-overlay { opacity: 0; transition: opacity .35s ease; }
.cta-overlay.show { display: flex; opacity: 1; }
.cta-card { transform: translateY(8px); transition: transform .35s ease; }
.cta-overlay.show .cta-card { transform: none; }

.side-list { display: grid; gap: 10px; margin-top: 14px; }
.side-item { display: flex; gap: 10px; font-size: 14.5px; color: var(--ink-2); }
.side-item .tick { color: #067647; flex: 0 0 auto; font-weight: 700; }
.sticky { position: sticky; top: 82px; }

.dl-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); }
.dl-row .ico {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  background: var(--blue-soft); color: var(--blue-dark);
  display: flex; align-items: center; justify-content: center;
}
.dl-row .txt { min-width: 0; }
.dl-row .txt h4 { font-size: 15px; }
.dl-row .txt p { font-size: 13px; color: var(--ink-2); }
.dl-row .get { margin-left: auto; font-size: 15px; font-weight: 600; }

/* ---------------------------------------------------------------- 下载页（生成页用） */
.dl-hero { max-width: 720px; margin: 0 auto; text-align: center; padding: 64px 0 20px; }
.dl-hero .app-icon { width: 92px; height: 92px; border-radius: 22px; margin: 0 auto 22px; box-shadow: var(--shadow-md); }
.dl-hero .lede { margin: 14px auto 0; max-width: 46ch; color: var(--ink-2); }
.dl-actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.dl-note { margin-top: 16px; font-size: 13.5px; color: var(--ink-3); }
.qr-card { display: flex; gap: 20px; align-items: center; max-width: 460px; margin: 34px auto 0; text-align: left; }
.qr-box { width: 116px; height: 116px; border-radius: 12px; background: #fff; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.qr-box img { width: 96px; height: 96px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 720px; margin: 44px auto 0; }
.fact { text-align: center; padding: 20px 12px; }
.fact .n { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.fact .l { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
@media (max-width: 700px) { .facts { grid-template-columns: 1fr; } }
