/* xue.qingya.ai 试用版样式。沿用 DESIGN.md 亮区「纸感晨光」令牌；单主题（亮色）。
   布局：手机单列 600px 专注流，上舞台下卡片，底部浮条回目录 / 看数据；
   竖屏 iPad 单列加宽到 760px；电脑和 iPad 横屏的知识点页左右两栏（见文件末尾）。 */
:root {
  --cyan:#22d3ee; --cyan-deep:#0891b2;
  --violet:#818cf8; --violet-soft:rgba(129,140,248,.10);
  --ink:#1e293b; --ink-strong:#0f172a; --muted:#64748b;
  --bg-1:#eef2fb; --bg-2:#f5f7fc; --panel:#ffffff; --line:#e6eaf2; --field:#fbfcfe;
  --ok:#10b981; --ok-soft:rgba(16,185,129,.09); --ok-line:#34d399;
  --neon:linear-gradient(90deg,#22d3ee,#818cf8,#f472b6);
  --font:system-ui,-apple-system,"PingFang SC","HarmonyOS Sans SC","MiSans","Noto Sans SC","Microsoft YaHei",sans-serif;
  --r-card:18px; --r-ctrl:12px; --r-chip:8px;
  --shadow:0 6px 24px rgba(30,41,59,.07),0 1px 3px rgba(30,41,59,.05);
  --shadow-sm:0 1px 3px rgba(30,41,59,.08);
  --ring:0 0 0 3px rgba(34,211,238,.45);
  color-scheme: light;
}
html { background: var(--bg-2); }
body {
  background: linear-gradient(180deg,var(--bg-1),var(--bg-2) 320px) var(--bg-2);
  color: var(--ink); font: 15px/1.6 var(--font); margin: 0;
}
* { box-sizing: border-box; }
.app {
  max-width: 600px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 104px;
  display: flex; flex-direction: column; gap: 12px;
}
.top { display: flex; align-items: center; gap: 12px; }
.top h1 { font-size: 20px; line-height: 1.3; margin: 0; color: var(--ink-strong); text-wrap: balance; }
.top .sub { font-size: 13px; color: var(--muted); }
.ctx { font-size: 13px; color: var(--muted); margin: -4px 0 0; }   /* 英文课页标题下的背景说明 */
.top .grow { flex: 1; min-width: 0; }
.chip-btn {
  min-height: 44px; padding: 0 14px; border-radius: var(--r-chip);
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font: inherit; font-size: 13px; cursor: pointer;
}
.dots { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--cyan-deep); }
.dots i.done { background: var(--cyan); }

.stage {
  position: relative; width: 100%; max-width: 100%; aspect-ratio: 4 / 3;
  background: var(--panel); border-radius: var(--r-card); box-shadow: var(--shadow);
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
}
.stage canvas, .stage svg { display: block; width: 100%; height: 100%; }
.stage .fps {
  position: absolute; top: 8px; right: 8px; font-size: 12px; color: var(--muted);
  background: rgba(255,255,255,.85); border-radius: 6px; padding: 2px 6px;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.stage .loading {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px;
}
.stage .tag {
  position: absolute; font-size: 13px; font-weight: 600; color: var(--ink-strong);
  background: rgba(255,255,255,.88); border-radius: 6px; padding: 0 6px;
  transform: translate(-50%,-50%); pointer-events: none; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.note { font-size: 13px; color: var(--ink); background: var(--violet-soft); border-radius: var(--r-ctrl); padding: 8px 12px; }
.readout {
  display: flex; gap: 16px; justify-content: center; font-size: 17px; color: var(--ink-strong);
  font-variant-numeric: tabular-nums;
}
.readout b { font-weight: 600; }
.readout .eq { color: var(--muted); }

.card {
  background: var(--panel); border-radius: var(--r-card); box-shadow: var(--shadow);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.card h2 { font-size: 17px; margin: 0; color: var(--ink-strong); }
.card p { margin: 0; line-height: 1.7; }
.card .cap { min-height: 3.4em; font-size: 17px; line-height: 1.7; }
.opts { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.opt {
  min-height: 48px; border-radius: var(--r-ctrl); border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font: inherit; font-size: 17px; cursor: pointer;
}
.opt[aria-pressed="true"] { border-color: var(--cyan-deep); background: rgba(34,211,238,.10); color: var(--ink-strong); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  min-height: 48px; padding: 0 18px; border-radius: var(--r-ctrl); border: 0;
  background: var(--cyan-deep); color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
}
.btn.ghost { background: var(--panel); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn.link { background: none; color: var(--muted); padding: 0 8px; font-weight: 400; }
.btn:focus-visible, .opt:focus-visible, .chip-btn:focus-visible, input:focus-visible, .bar a:focus-visible { outline: none; box-shadow: var(--ring); }
.slider { display: grid; grid-template-columns: 6.5em 1fr 3.2em; align-items: center; gap: 8px; font-size: 15px; }
.slider output { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.slider input { width: 100%; height: 44px; accent-color: var(--cyan-deep); }
.flap {
  border: 1px dashed var(--line); border-radius: var(--r-ctrl); padding: 12px 14px; background: var(--field);
}
.flap ol { margin: 0; padding-left: 1.3em; line-height: 1.8; }
.soft { background: var(--violet-soft); border-radius: var(--r-ctrl); padding: 10px 12px; }
.okline { background: var(--ok-soft); border-radius: var(--r-ctrl); padding: 10px 12px; color: var(--ink-strong); }
.hint { font-size: 13px; color: var(--muted); }

.bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 4px; padding: 4px; border-radius: 14px;
  background: rgba(15,23,42,.88); box-shadow: var(--shadow); z-index: 5;
}
.bar a, .bar button {
  min-height: 40px; min-width: 64px; display: grid; place-items: center; padding: 0 12px;
  border-radius: 10px; color: #cbd5e1; text-decoration: none; font: inherit; font-size: 13px;
  background: none; border: 0; cursor: pointer;
}
.bar .cur { background: #fff; color: var(--ink-strong); font-weight: 600; }
.bar .tagp { color: #94a3b8; font-size: 12px; padding: 0 8px; display: grid; place-items: center; white-space: nowrap; }
.data {
  font-size: 13px; color: var(--ink); background: var(--panel); border-radius: var(--r-ctrl);
  border: 1px solid var(--line); padding: 10px 12px; font-variant-numeric: tabular-nums;
}
.data table { width: 100%; border-collapse: collapse; }
.data td { padding: 2px 0; vertical-align: top; }
.data td:first-child { color: var(--muted); width: 8em; }
@media (min-width: 640px) {
  body { font-size: 16px; }
  .card .cap { font-size: 18px; }
}

/* ---- 顶部切层、滑块两端文字、规律层列表、标签变体 ---- */
.seg { display: flex; gap: 2px; padding: 2px; border-radius: var(--r-ctrl); background: var(--line); }
.seg button {
  min-height: 44px; min-width: 60px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink-strong); font-weight: 600; box-shadow: var(--shadow-sm); }
.seg button:focus-visible { outline: none; box-shadow: var(--ring); }
.slider.plain { grid-template-columns: 6.5em 1fr; }
.ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin: -8px 0 0 calc(6.5em + 8px); }
.card b { font-weight: 600; color: var(--ink-strong); }
.found { margin: 0; padding-left: 1.3em; line-height: 1.8; }
.laws { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 10px; }
.laws li { line-height: 1.7; }
.laws .back { display: block; font-size: 13px; color: var(--muted); }
.stage .tag.k { color: #b45309; }
.stage .tag.two { white-space: pre; text-align: center; line-height: 1.3; padding: 2px 6px; }
/* 英文站：英文词比中文宽，标签一律按 \n 换行，手机上字号 12px（QYL-22） */
.en .stage .tag { white-space: pre; text-align: center; line-height: 1.25; padding: 1px 5px; }
@media (max-width: 639px) { .en .stage .tag { font-size: 12px; } }
.bar a, .bar button { min-height: 44px; }

/* ---- 目录页 ---- */
.list { display: flex; flex-direction: column; gap: 10px; }
.unit {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px;
  background: var(--panel); border-radius: var(--r-card); box-shadow: var(--shadow);
  color: inherit; text-decoration: none;
}
.unit .no { width: 2em; color: var(--muted); font-variant-numeric: tabular-nums; }
.unit .t { flex: 1; min-width: 0; }
.unit .t b { display: block; font-size: 17px; color: var(--ink-strong); }
.unit .t span { font-size: 13px; color: var(--muted); }
.unit.soon { box-shadow: none; background: var(--field); border: 1px dashed var(--line); }
.unit.soon .t b { color: var(--muted); font-weight: 500; }
.unit:focus-visible { outline: none; box-shadow: var(--ring); }
.intro { font-size: 15px; color: var(--muted); margin: 0; }
/* 英文目录页的分组和页脚（QYL-22；中文目录页不用 group / foot） */
.group { margin: 8px 0 0; }
.group h2 { font-size: 15px; margin: 0; color: var(--ink-strong); }
.group p { font-size: 13px; color: var(--muted); margin: 2px 0 0; }
.group .list { margin-top: 8px; }
.foot { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.7; }
.foot a { color: var(--muted); }
/* 英文目录页在电脑和 iPad 横屏上：标题放大，课程排成三列卡片，上方是这一课的画面（thumbs/，tools/thumbs.js 截）；
   手机和竖屏不放图，编号在左边。用户 2026-10-28 看样稿后选定；中文目录页仍单列 */
.home .unit .th, .home .unit .n { display: none; }
@media (min-width: 900px) and (min-height: 600px) and (orientation: landscape) {
  .app.home { max-width: 1120px; padding-block: 32px 20px; }   /* 目录页没有底部浮条，不用留 104px */
  .home .top h1 { font-size: 28px; }
  .home .top .sub { font-size: 15px; margin-top: 4px; }
  .home .intro { max-width: 760px; }
  .home .group { margin-top: 16px; }
  .home .group h2 { font-size: 17px; }
  .home .group .list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
  .home .unit { flex-direction: column; align-items: stretch; gap: 0; padding: 0; min-height: 0; overflow: hidden; }
  .home .unit .no { display: none; }
  .home .unit .n { display: inline; }
  .home .unit .th { display: block; border-bottom: 1px solid var(--line); }
  .home .unit .th img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .home .unit .t { padding: 14px 18px 18px; }
  .home .unit .t > span { display: block; margin-top: 4px; }
  .home .foot { margin-top: 16px; }
}
/* 备案号：只在境内站（tools/dist.sh cn）的目录页和统计说明页底部 */
.icp { margin: 12px 0 0; text-align: center; font-size: 13px; }
.icp a { color: var(--muted); text-decoration: none; }

/* ---- 电脑和 iPad ----
   竖屏宽屏：单列加宽。横屏（电脑、iPad 横放）知识点页：画面在左、步骤在右，常见尺寸一屏放下（很矮的屏上长步骤卡整页滚，不做卡片内滚动）。
   各页镜头按 4:3 构图，画面比 4:3 窄会裁掉两边，所以舞台保持 4:3，宽度按屏幕高度封顶
   （204px = 上边距 + 标题行 + 步骤点 + 间距 + 底部浮条）。 */
@media (min-width: 700px) and (min-height: 600px) {   /* 手机横放（高不到 600）保持 600px */
  .app { max-width: 760px; }
}
@media (min-width: 900px) and (min-height: 600px) and (orientation: landscape) {
  .app.point {
    /* 整页宽度跟着舞台的高度上限走：矮屏上两栏一起收拢居中，不在舞台两边留空 */
    --side: clamp(340px, 30vw, 400px);
    max-width: min(1600px, calc((100vh - 204px) * 4 / 3 + 24px + var(--side) + 32px));
    padding-bottom: 96px;
    display: grid; grid-template-columns: minmax(0, 1fr) var(--side);
    column-gap: 24px; row-gap: 12px; align-items: start;
  }
  .point .top { grid-column: 1 / -1; }
  .point .dots { grid-column: 1; grid-row: 2; }
  .point .stage {
    grid-column: 1; grid-row: 3; justify-self: center;
    width: min(100%, calc((100vh - 204px) * 4 / 3));
    width: min(100%, calc((100dvh - 204px) * 4 / 3));
  }
  .point .card { grid-column: 2; grid-row: 3; }   /* 与舞台同一行起，两栏顶部对齐；步骤点只在左栏 */
  .point .data { grid-column: 2; grid-row: 4; }
  /* 英文课页多一行背景说明（.ctx，约 26px）：预留高度跟着加，画面和步骤卡仍同排顶边对齐、1440×900 不整页滚。
     只在 .point.en 下改，中文站的 204px 不动。 */
  .app.point.en { max-width: min(1600px, calc((100vh - 230px) * 4 / 3 + 24px + var(--side) + 32px)); }
  .point.en .ctx { grid-column: 1 / -1; grid-row: 2; }
  .point.en .dots { grid-row: 3; }
  .point.en .stage {
    grid-row: 4;
    width: min(100%, calc((100vh - 230px) * 4 / 3));
    width: min(100%, calc((100dvh - 230px) * 4 / 3));
  }
  .point.en .card { grid-row: 4; }
  .point.en .data { grid-row: 5; }
  /* 带 var() 的声明在不认 dvh 的浏览器里到计算时才失效、不会退回上面的 vh 写法，所以单独包一层 */
  @supports (height: 100dvh) {
    .app.point { max-width: min(1600px, calc((100dvh - 204px) * 4 / 3 + 24px + var(--side) + 32px)); }
    .app.point.en { max-width: min(1600px, calc((100dvh - 230px) * 4 / 3 + 24px + var(--side) + 32px)); }
  }
}
