/* ============================================================
   心情小院 —— 青少年多模态心理状态采集 · 界面皮肤（Organic 设计系统）
   ------------------------------------------------------------
   这是原 public/css/style.css 的整体替换版本。
   选择器与原文件 **完全一致**，所以 app.js / ui.js / tasks/*.js
   一行都不用改，页面就会换成新的样子。
   颜色 / 字号 / 圆角 / 阴影全部取自 Organic 设计系统的 token。
   ============================================================ */

:root {
  /* —— Organic 设计系统 token —— */
  --color-bg: #f5ead8;
  --color-text: #201e1d;
  --color-surface: #fffdf9;

  --color-neutral-100: #f9f4ed;
  --color-neutral-200: #eee7db;
  --color-neutral-300: #dcd3c4;
  --color-neutral-400: #c0b6a5;
  --color-neutral-500: #a19786;
  --color-neutral-600: #82796a;
  --color-neutral-700: #645c50;
  --color-neutral-800: #474238;
  --color-neutral-900: #2e2b25;

  --color-accent-100: #fff2eb;
  --color-accent-200: #ffe1d0;
  --color-accent-300: #ffc6a5;
  --color-accent-400: #f6a06b;
  --color-accent-500: #d67f48;
  --color-accent-600: #b2622d;
  --color-accent-700: #8c491a;
  --color-accent-800: #643312;
  --color-accent-900: #402310;

  --color-accent-2-100: #f0fae1;
  --color-accent-2-200: #e1eecc;
  --color-accent-2-300: #ccdbb2;
  --color-accent-2-400: #aebf92;
  --color-accent-2-500: #8fa073;
  --color-accent-2-600: #728157;
  --color-accent-2-700: #56633f;
  --color-accent-2-800: #3d472b;
  --color-accent-2-900: #272e1b;

  --shadow-sm: 0 1px 2px rgba(46, 43, 37, .14);
  --shadow-md: 0 3px 10px rgba(46, 43, 37, .16);
  --shadow-lg: 0 12px 32px rgba(46, 43, 37, .22);

  --font-heading: "Caprasimo", "PingFang SC", "Microsoft YaHei", serif;
  --font-body: "Figtree", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;

  /* —— 兼容原变量名（老代码里若有引用不会失效）—— */
  --brand: var(--color-accent-500);
  --brand-dark: var(--color-accent-800);
  --bg: var(--color-bg);
  --card: var(--color-surface);
  --text: var(--color-text);
  --muted: var(--color-neutral-600);
  --green: var(--color-accent-2-600);
  --red: #c0563d;
  --yellow: var(--color-accent-500);
  --radius: 28px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 18px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh; display: flex; flex-direction: column;
  overscroll-behavior: none;   /* 关掉橡皮筋回弹 */
}
/* body 是 flex 容器：顶栏/站点地图/提示条不允许被压缩，否则站点地图会被挤扁看起来像被遮挡 */
#topbar, #journey-map, #banner { flex: none; }
:focus-visible { outline: 2px solid var(--color-accent-500); outline-offset: 2px; }
::selection { background: var(--color-accent-200); }

/* ===================== 顶栏 ===================== */
#topbar {
  min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; background: rgba(249, 244, 237, .94); color: var(--color-accent-800);
  border-bottom: 1px solid var(--color-neutral-300);
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 30;
}
#app-title {
  font-family: var(--font-heading); font-weight: 400; font-size: 19px; line-height: 1.15;
  color: var(--color-accent-800); position: relative; padding-left: 42px; white-space: nowrap;
}
/* 品牌小叶子（纯 CSS，不用图片） */
#app-title::before {
  content: ''; position: absolute; left: 0; top: 50%; width: 32px; height: 32px; margin-top: -16px;
  border-radius: 999px; background: var(--color-accent-2-300);
}
#app-title::after {
  content: ''; position: absolute; left: 10px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  border-radius: 999px 2px 999px 2px; background: var(--color-accent-2-700);
}
#progress { font-size: 13px; color: var(--color-neutral-700); text-align: right; }

/* ===================== 舞台 ===================== */
#stage {
  /* 填满剩余空间：内容少时正好铺满、不产生多余滚动；内容多时才滚动 */
  flex: 1 0 auto; min-height: 0;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
  display: flex; align-items: flex-start; justify-content: center;
}
.calib-screen { margin-top: 0; }

/* ===================== 卡片 / 排版 ===================== */
.center-box {
  width: 100%; max-width: 860px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
/* 卡片内文字左对齐 —— Organic 的方向是齐左、右侧留白；按钮仍由 .center-box 居中 */
.card {
  background: var(--color-surface); border-radius: 28px; padding: 28px 26px;
  box-shadow: var(--shadow-sm); width: 100%; text-align: left;
}
.card > h1, .card > h2, .card > .lead, .card > .prompt-text { align-self: stretch; }
.card > h1, .card > h2 { max-width: 20em; }
.card > .lead, .card > .prompt-text { max-width: 36em; }
.card.wide { max-width: 780px; }
h1 { font-family: var(--font-heading); font-weight: 400; font-size: 32px; line-height: 1.2; margin: 6px 0 4px; color: var(--color-accent-800); }
h2 { font-family: var(--font-heading); font-weight: 400; font-size: 25px; line-height: 1.2; margin: 4px 0 8px; color: var(--color-accent-800); }
.lead { font-size: 18px; line-height: 1.75; color: var(--color-text); text-wrap: pretty; }
.small { color: var(--color-neutral-700); font-size: 14px; }
.prompt-text { font-size: 18px; line-height: 1.85; text-align: left; color: var(--color-neutral-900); text-wrap: pretty; }

/* 通知块 */
.notice {
  text-align: left; background: var(--color-accent-100); border: 1px solid var(--color-accent-200);
  border-radius: 24px; padding: 18px 22px; width: 100%;
}
.notice strong { color: var(--color-accent-800); }
.notice ul { margin: 10px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.notice li { margin: 0; padding-left: 30px; position: relative; line-height: 1.65; }
.notice li::before {
  content: ''; position: absolute; left: 0; top: .5em; width: 18px; height: 18px;
  border-radius: 999px; background: var(--color-accent-200);
}

/* ===================== 按钮 ===================== */
.btn {
  border: 1px solid transparent; border-radius: 999px; padding: 13px 26px; font-size: 17px; font-weight: 600;
  min-height: 48px; cursor: pointer; font-family: inherit;
  transition: transform .06s, background .15s, border-color .15s;
  background: var(--color-neutral-200); color: var(--color-neutral-800);
}
.btn:hover { background: var(--color-neutral-300); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.loading { opacity: .92; cursor: default; }
.btn-spin {
  display: inline-block; width: 15px; height: 15px; margin-right: 8px; vertical-align: -2px;
  border: 3px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite;
}
.btn-primary { background: var(--color-accent-500); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); }
.btn-secondary { background: var(--color-accent-2-200); color: var(--color-accent-2-800); }
.btn-secondary:hover { background: var(--color-accent-2-300); }
.btn-outline { background: var(--color-surface); color: var(--color-accent-700); border-color: var(--color-accent-400); }
.btn-outline:hover { background: var(--color-accent-100); }
.btn-lg { padding: 16px 38px; font-size: 19px; min-height: 56px; }
.btn.chosen { background: var(--color-accent-2-500); color: #fff; border-color: var(--color-accent-2-600); }
.spk-status { margin-top: 10px; font-size: 15px; color: var(--color-neutral-600); }
.spk-status.ok { color: var(--color-accent-2-700); font-weight: 700; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hidden { display: none !important; }

/* ===================== 提示条 = 小苗的话 ===================== */
/* #banner 变成伙伴「小苗」的对话条：左侧是它的头，右侧是指导语。 */
/* 提示文字条 = 小苗的对话条。放在文档流里（#journey-map 之后），
   不再 fixed —— 否则会被顶部的站点地图盖住。 */
#banner {
  display: none; text-align: center;
  font-size: 21px; font-weight: 600; line-height: 1.6;
  background: var(--color-accent-2-100); color: var(--color-accent-2-900);
  border-bottom: 1px solid var(--color-accent-2-300);
  position: relative; z-index: 15;
  padding: 16px 84px; min-height: 68px;   /* 左右对称留白：小苗头在左、听一遍在右，文字居中 */
}
#banner::before, #banner::after { display: none; } /* 已去掉横幅里的小苗头 */
#banner.banner-countdown { padding-top: 12px; padding-bottom: 12px; }
#banner .cd-tip { font-size: 17px; margin-right: 12px; opacity: .8; }
#banner .cd-num {
  display: inline-block; min-width: 46px; text-align: center;
  font-family: var(--font-heading); font-size: 26px; vertical-align: middle;
  background: #fff; border-radius: 999px; padding: 2px 14px; color: var(--color-accent-2-800);
}
#banner .cd-go { font-size: 26px; font-weight: 800; letter-spacing: 1px; color: var(--color-accent-700); }
/* journey.js 注入的「听一遍」按钮 */
#banner .sprout-say {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  min-height: 40px; padding: 8px 16px; white-space: nowrap; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700;
  background: #fff; color: var(--color-accent-2-700);
  border: 1px solid var(--color-accent-2-500); border-radius: 999px;
}
#banner .sprout-say:hover { background: var(--color-accent-2-200); }

/* ===================== 录制页顶部横幅 ===================== */
.rec-headbar {
  align-self: stretch; display: flex; align-items: center; gap: 16px;
  background: var(--color-surface); border: 1px solid var(--color-neutral-200); border-radius: 999px;
  padding: 12px 24px; min-height: 60px; box-shadow: var(--shadow-sm);
}
.rhb-title {
  flex: 1 1 auto; min-width: 0; text-align: left; font-size: 18px; font-weight: 700;
  color: var(--color-accent-800); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rhb-status { flex: 0 1 auto; text-align: right; font-size: 18px; font-weight: 700; color: var(--color-accent-2-800); white-space: nowrap; }
.rhb-status.rhb-go { font-size: 20px; color: var(--color-accent-700); }
.rhb-timerbox { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.rhb-live { display: flex; align-items: center; gap: 7px; color: var(--color-accent-600); font-weight: 700; font-size: 14px; white-space: nowrap; }
.rhb-timerbox .rec-timer { font-size: 20px; font-weight: 800; color: var(--color-accent-800); font-variant-numeric: tabular-nums; }

/* ===================== 摄像头 ===================== */
.cam-wrap {
  position: relative; width: 480px; max-width: 90vw; aspect-ratio: 4/3;
  background: #14171a; border-radius: 28px; overflow: hidden; box-shadow: var(--shadow-md);
}
.cam { display: block; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #14171a; }
.cam-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cam-mini { width: 260px; border-radius: 22px; }
.rec-cam-corner {
  /* 悬浮预览：层级高于顶栏(30)/站点地图(29)，任何时候都不被压住；
     top 由 ui.js 按顶栏实际高度动态设置，这里只是兜底初值 */
  position: fixed; top: 172px; right: 18px; width: 200px; z-index: 34;
  box-shadow: var(--shadow-lg); border-radius: 20px;
  cursor: move; touch-action: none; user-select: none; -webkit-user-select: none;
}
.cam-drag-tag {
  position: absolute; top: 8px; left: 8px; z-index: 4; pointer-events: none;
  background: rgba(32,30,29,.55); color: #fff; font-size: 11px; letter-spacing: 1px;
  padding: 3px 10px; border-radius: 999px;
}
@media (max-width: 1180px) { .rec-cam-corner { width: 168px; right: 12px; } }

/* ===================== 校准 ===================== */
.calib-title { font-family: var(--font-heading); font-weight: 400; font-size: 22px; color: var(--color-accent-800); }
.calib-status {
  font-size: 16px; font-weight: 600; padding: 12px 20px; border-radius: 999px;
  background: var(--color-neutral-200); color: var(--color-neutral-800);
}
.calib-status.green { color: var(--color-accent-2-800); background: var(--color-accent-2-200); }
.calib-status.red { color: #8c3a25; background: #fbe3dc; }
.calib-status.yellow { color: var(--color-accent-800); background: var(--color-accent-200); }
.ok-line { color: var(--color-accent-2-700); font-weight: 700; margin-bottom: 8px; }
.error { color: #8c3a25; background: #fbe3dc; padding: 18px 20px; border-radius: 24px; text-align: left; }
.error strong { display: block; font-size: 19px; margin-bottom: 4px; }

/* ===================== 表单 / 设备检查 ===================== */
.field { text-align: left; width: 100%; margin-top: 6px; }
.field-label { font-weight: 700; margin-bottom: 8px; font-size: 15px; color: var(--color-neutral-800); }
.login-field {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px;
  width: 100%; max-width: 460px; margin: 6px auto; text-align: left;
}
.login-label { font-weight: 700; font-size: 14px; color: var(--color-neutral-800); }
.login-input {
  width: 100%; min-height: 50px; padding: 12px 18px; font-size: 16px; font-family: inherit;
  border: 1px solid var(--color-neutral-300); border-radius: 999px;
  background: var(--color-neutral-100); color: var(--color-text);
}
.login-input:hover { border-color: var(--color-neutral-400); }
.login-input:focus { outline: none; border-color: var(--color-accent-500); background: #fff; }
.login-err { color: #8c3a25; background: #fbe3dc; padding: 12px 18px; border-radius: 999px; margin: 10px auto; max-width: 460px; font-size: 16px; }

.dc-cam-block { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.dev-select {
  width: 100%; min-height: 48px; padding: 12px 18px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--color-neutral-300); border-radius: 999px;
  background: var(--color-neutral-100); color: var(--color-text); cursor: pointer;
}
.dev-select:focus { outline: none; border-color: var(--color-accent-500); }
.dev-select:disabled { opacity: .45; }
.mic-bar { width: 100%; height: 18px; background: var(--color-neutral-200); border-radius: 999px; overflow: hidden; }
.mic-level { width: 0%; height: 100%; background: var(--color-accent-2-500); border-radius: 999px; transition: width .08s; }
.check {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  font-size: 16px; margin: 2px 0; cursor: pointer; min-height: 48px;
  background: var(--color-accent-100); border-radius: 999px; padding: 6px 20px;
}
.check input { width: 22px; height: 22px; accent-color: var(--color-accent-500); }

/* ===================== 倒计时 ===================== */
.countdown-num { font-family: var(--font-heading); font-size: 112px; font-weight: 400; color: var(--color-accent-500); line-height: 1; }
.countdown-tip { font-size: 18px; color: var(--color-neutral-700); margin-bottom: 8px; }

/* ===================== 过渡灰屏（改为温和的米色）===================== */
.gray-space {
  width: 100%; height: 60vh; background: var(--color-neutral-200); border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
}
.pic-gray {
  width: min(90vw, 720px); aspect-ratio: 4 / 3; background: var(--color-neutral-200); border-radius: 28px;
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
}
.pic-gray-text { font-family: var(--font-heading); color: var(--color-neutral-700); font-size: 28px; letter-spacing: 3px; }
.gray-label { color: var(--color-neutral-700); font-size: 18px; }

/* ===================== 朗读 / 问答 / 看图 ===================== */
.reading-block, .qa-block, .pic-block, .tell-block { width: 100%; }
.reading-block, .qa-block { text-align: center; }
.pic-block, .tell-block { display: flex; flex-direction: column; align-items: center; }
.reading-title, .qa-index { font-size: 15px; color: var(--color-accent-700); font-weight: 700; margin-bottom: 12px; }
.reading-text {
  text-align: left; font-size: 21px; line-height: 2.05; white-space: pre-wrap;
  max-width: 34em; margin: 0 auto; color: var(--color-neutral-900);
  background: var(--color-surface); border-radius: 28px; padding: 26px 24px; box-shadow: var(--shadow-sm);
}
.qa-text {
  font-size: 23px; line-height: 1.75; font-weight: 600; max-width: 26em; margin: 0 auto;
  color: var(--color-neutral-900); background: var(--color-surface);
  border-radius: 28px; padding: 28px 26px; box-shadow: var(--shadow-sm); text-wrap: pretty;
}
.pic-block .qa-text, .tell-block .qa-text {
  font-size: 18px; font-weight: 600; color: var(--color-accent-800);
  background: var(--color-accent-100); box-shadow: none; padding: 16px 20px; border-radius: 24px; margin-bottom: 14px;
}
.scene-img {
  display: block; margin: 0 auto; max-width: 100%; max-height: 52vh;
  border-radius: 24px; box-shadow: var(--shadow-md); filter: saturate(.88) contrast(.96);
}
.drawing-in-tell { max-height: 44vh; margin-bottom: 12px; }
.rec-hint { color: var(--color-neutral-700); font-size: 14px; text-align: center; margin-top: 2px; }
.rec-overlay .go-label { font-size: 28px; letter-spacing: 2px; }

/* ===================== 录制屏 ===================== */
.rec-screen { width: 100%; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 16px; position: relative; }
/* 吸顶：顶栏 58px + 站点地图 70px = 128px */
.rec-topfixed {
  position: sticky; top: 128px; z-index: 20; align-self: stretch;
  display: flex; flex-direction: column; gap: 10px; background: var(--color-bg); padding: 8px 0;
}
.rec-topbar { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.rec-live { display: flex; align-items: center; gap: 8px; color: var(--color-accent-600); font-weight: 700; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent-500); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.rec-timer { font-size: 22px; font-weight: 800; color: var(--color-accent-800); font-variant-numeric: tabular-nums; }
.rec-body { width: 100%; display: flex; justify-content: center; }
.rec-controls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.more-controls { display: flex; gap: 12px; }
.rec-overlay {
  position: fixed; top: 84px; left: 50%; transform: translateX(-50%); z-index: 26;
  background: var(--color-accent-2-700); color: #fff; padding: 12px 26px; border-radius: 999px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-lg);
}
.rec-overlay .countdown-tip { font-size: 16px; color: var(--color-accent-2-100); margin: 0; }
.rec-overlay .countdown-num { font-size: 40px; color: #fff; line-height: 1; }
.face-warn {
  align-self: stretch; background: var(--color-accent-100); color: var(--color-accent-800);
  border: 1px solid var(--color-accent-300);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; text-align: center;
}

/* ===================== 弹窗 ===================== */
.modal-mask {
  position: fixed; inset: 0; z-index: 40; background: rgba(46, 43, 37, .5);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-box {
  background: var(--color-surface); border-radius: 32px; padding: 28px 26px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg); text-align: center;
}
.modal-text { font-size: 18px; line-height: 1.75; margin-bottom: 20px; color: var(--color-neutral-900); text-wrap: pretty; }
.modal-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.pic-prompt {
  max-width: 720px; margin: 0 auto 14px; font-size: 17px; line-height: 1.7; font-weight: 600;
  color: var(--color-accent-800); background: var(--color-accent-100); border: none;
  padding: 14px 20px; border-radius: 24px; text-align: left;
}

/* ===================== 绘画 ===================== */
/* journey.js 会把剩余时间写进 --p，做成一圈慢慢走完的环 */
.draw-timer-wrap {
  position: relative; width: 236px; height: 236px; margin: 14px auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--color-accent-2-700);
  border-radius: 999px; background: var(--color-accent-2-200);
  background-image: conic-gradient(var(--color-accent-2-500) var(--p, 0%), transparent 0);
}
.draw-timer-wrap::before {
  content: ''; position: absolute; inset: 16px; border-radius: 999px; background: var(--color-bg);
}
.draw-timer-wrap > * { position: relative; }
.draw-timer { font-family: var(--font-heading); font-size: 44px; font-weight: 400; color: var(--color-accent-800); font-variant-numeric: tabular-nums; letter-spacing: 0; }

.qr-box {
  width: 232px; height: 232px; background: #fff; padding: 12px; border-radius: 24px;
  display: flex; align-items: center; justify-content: center; margin: 8px auto;
  border: 1px solid var(--color-neutral-300);
}
.qr-box img, .qr-box canvas { display: block; }
.qr-fallback { color: var(--color-neutral-700); font-size: 14px; text-align: center; }
.qr-hint { color: var(--color-neutral-700); font-size: 14px; }
.qr-url { font-family: ui-monospace, monospace; font-size: 14px; background: var(--color-neutral-100); padding: 12px 16px; border-radius: 18px; word-break: break-all; }
.wait-line {
  margin-top: 12px; color: var(--color-accent-800); background: var(--color-accent-100);
  border-radius: 999px; padding: 10px 18px; font-size: 15px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
}
.spinner { width: 15px; height: 15px; border: 3px solid var(--color-accent-200); border-top-color: var(--color-accent-500); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.drawing-frame { max-width: 420px; margin: 10px auto; }
.drawing-preview { max-width: 100%; max-height: 52vh; border-radius: 24px; box-shadow: var(--shadow-md); transition: transform .2s; }

/* ===================== 休息（呼吸圆圈）===================== */
/* 休息屏用 flex order 把倒计时叠回呼吸圆圈中央（不改 rest.js 的 DOM 顺序） */
.rest-screen { gap: 14px; }
.rest-screen .rest-emoji { order: 1; }
.rest-screen .rest-timer-wrap { order: 2; position: relative; z-index: 2; margin: -148px 0 62px; background: transparent; box-shadow: none; padding: 0; flex-direction: column; gap: 0; color: var(--color-accent-2-800); }
.rest-screen .rest-title { order: 3; }
.rest-screen .rest-text { order: 4; }
.rest-screen .btn-row { order: 5; }
/* 原本这里是 🌿 一个 emoji —— 改成跟着呼吸缩放的两层圆 */
.rest-emoji {
  position: relative; width: 230px; height: 230px; margin: 6px auto 0; font-size: 0;
}
.rest-emoji::before, .rest-emoji::after {
  content: ''; position: absolute; border-radius: 999px;
  animation: breathe 8s ease-in-out infinite;
}
.rest-emoji::before { inset: 0; background: var(--color-accent-2-200); }
.rest-emoji::after { inset: 30px; background: var(--color-accent-2-300); animation-delay: .4s; }
@keyframes breathe { 0%, 100% { transform: scale(.72); } 45% { transform: scale(1); } }
.rest-title { font-family: var(--font-heading); font-weight: 400; font-size: 30px; color: var(--color-accent-800); }
.rest-text { max-width: 26em; color: var(--color-text); font-size: 17px; line-height: 1.8; text-wrap: pretty; }
.rest-timer-wrap {
  display: inline-flex; align-items: center; gap: 12px; font-size: 15px; color: var(--color-neutral-700);
  background: var(--color-surface); border-radius: 999px; padding: 10px 22px; box-shadow: var(--shadow-sm);
}
.rest-timer { font-family: var(--font-heading); font-size: 38px; font-weight: 400; color: var(--color-accent-2-900); font-variant-numeric: tabular-nums; }

/* ===================== 量表 ===================== */
.scale-page { width: 100%; max-width: 880px; margin: 0 auto; }
.scale-head { text-align: left; margin-bottom: 16px; background: var(--color-accent-100); border-radius: 28px; padding: 20px 22px; }
.scale-progress { color: var(--color-accent-700); font-weight: 700; margin-bottom: 6px; font-size: 15px; }
.scale-instruction { font-size: 16px; line-height: 1.75; color: var(--color-accent-900); margin: 0 0 10px; text-wrap: pretty; }
.scale-hint { font-size: 14px; line-height: 1.6; color: var(--color-neutral-700); background: #fff; padding: 10px 14px; border-radius: 18px; margin-top: 6px; }
.scale-leadin {
  font-size: 18px; font-weight: 700; margin: 14px 0 4px; color: var(--color-accent-2-900);
  background: var(--color-accent-2-100); border-radius: 24px; padding: 14px 20px; text-align: left;
}
.scale-list { display: flex; flex-direction: column; gap: 12px; }
.q-row {
  background: var(--color-surface); border-radius: 24px; padding: 18px 20px;
  box-shadow: var(--shadow-sm); text-align: left; border-left: 6px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.q-row.answered { border-left-color: var(--color-accent-2-400); }
.q-row.missing { box-shadow: 0 0 0 2px #c0563d; }
.q-text { font-size: 17px; line-height: 1.65; margin-bottom: 14px; text-wrap: pretty; }
.q-no {
  display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 8px;
  vertical-align: -6px; border-radius: 999px;
  background: var(--color-accent-200); color: var(--color-accent-800);
  font-size: 13px; font-weight: 800;
}
/* CDI 的题号是「第 9 组」这样的短语，不能塞进 26px 圆点里 —— 改成胶囊标签 */
.cdi-row .q-no {
  display: inline-block; width: auto; height: auto; margin-right: 0;
  vertical-align: baseline; padding: 4px 14px; white-space: nowrap;
  border-radius: 999px; background: var(--color-accent-200); color: var(--color-accent-800);
  font-size: 13px; font-weight: 800; line-height: 1.5;
}
.cdi-row .q-text { margin-bottom: 12px; }

.opt-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 6px; }
.opt-btn {
  min-width: 0; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 8px 4px; border: 2px solid var(--color-neutral-300); background: #fff; border-radius: 18px;
  cursor: pointer; font-family: inherit; transition: border-color .12s, background .12s, transform .06s;
}
.opt-btn:hover { border-color: var(--color-accent-400); }
.opt-btn:active { transform: scale(.97); }
.opt-btn .opt-val { font-size: 16px; font-weight: 800; color: var(--color-neutral-700); }
.opt-btn .opt-label { font-size: 11px; line-height: 1.25; text-align: center; color: var(--color-neutral-700); }
.opt-btn.selected { border-color: var(--color-accent-500); background: var(--color-accent-100); }
.opt-btn.selected .opt-val { color: var(--color-accent-700); }
.opt-btn.selected .opt-label { color: var(--color-accent-800); }
.cdi-opts { display: flex; flex-direction: column; gap: 8px; }
.cdi-opt {
  display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 12px 18px;
  border: 2px solid var(--color-neutral-300); background: #fff; border-radius: 22px;
  cursor: pointer; font-family: inherit; font-size: 16px; line-height: 1.6; text-align: left;
  transition: border-color .12s, background .12s;
}
.cdi-opt:hover { border-color: var(--color-accent-400); }
.cdi-box { width: 22px; height: 22px; border: 2px solid var(--color-neutral-400); border-radius: 999px; flex: none; }
.cdi-opt.selected { border-color: var(--color-accent-500); background: var(--color-accent-100); }
.cdi-opt.selected .cdi-box { background: var(--color-accent-500); border-color: var(--color-accent-500); box-shadow: inset 0 0 0 4px #fff; }
.scale-warn { color: #8c3a25; background: #fbe3dc; padding: 12px 18px; border-radius: 999px; margin: 14px 0; }
.skip-all { display: block; width: 100%; margin: 0 0 16px; border-style: dashed; color: var(--color-accent-800); border-color: var(--color-accent-300); background: var(--color-accent-100); }
.skip-task-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  padding: 8px 16px; font-size: 13px; font-family: inherit; cursor: pointer;
  background: var(--color-accent-100); color: var(--color-accent-800);
  border: 1px dashed var(--color-accent-300); border-radius: 999px;
  box-shadow: var(--shadow-sm); opacity: .85;
}
.skip-task-btn:hover { opacity: 1; }
.scale-page .btn-lg { display: block; margin: 20px auto 0; }

/* ===================== 结束 ===================== */
.progress-bar { width: 100%; max-width: 420px; height: 12px; background: var(--color-neutral-200); border-radius: 999px; overflow: hidden; margin: 8px auto; }
.progress-fill { width: 8%; height: 100%; background: var(--color-accent-2-500); border-radius: 999px; transition: width .5s; }
.big-check {
  width: 76px; height: 76px; margin: 0 auto; border-radius: 999px;
  background: var(--color-accent-2-500); color: #fff;
  font-size: 38px; line-height: 76px; text-align: center;
}
.done { color: var(--color-accent-2-800); }
.fail { color: #8c3a25; }

/* ===================== 引导页（app.js welcome）===================== */
.onb-screen { gap: 16px; max-width: 900px; }
.hero {
  position: relative; overflow: hidden; width: 100%;
  background: var(--color-accent-100); border: 1px solid var(--color-accent-200);
  border-radius: 32px; padding: 30px 26px;
}
.hero-blob { position: absolute; border-radius: 999px; }
.hero-blob-a { right: -56px; top: -56px; width: 200px; height: 200px; background: var(--color-accent-200); }
.hero-blob-b { right: 44px; bottom: -80px; width: 140px; height: 140px; background: var(--color-accent-2-200); }
.hero-inner { position: relative; text-align: left; }
.hero-tag {
  display: inline-block; background: #fff; color: var(--color-accent-700);
  font-size: 13px; font-weight: 700; padding: 6px 14px; border-radius: 999px; margin-bottom: 14px;
}
.hero h1 { font-size: 34px; margin: 0 0 12px; max-width: 15em; }
.hero .lead { margin: 0 0 8px; max-width: 34em; }
.hero .lead:last-child { margin-bottom: 0; }

.onb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; width: 100%; }
.onb-card {
  background: var(--color-surface); border-radius: 28px; padding: 20px 22px;
  box-shadow: var(--shadow-sm); text-align: left;
}
.onb-card-2 { background: var(--color-accent-2-100); box-shadow: none; }
.onb-title { font-size: 14px; font-weight: 700; color: var(--color-accent-700); margin-bottom: 12px; }
.onb-card-2 .onb-title { color: var(--color-accent-2-700); }

.req-list { display: flex; flex-direction: column; gap: 10px; }
.req { display: flex; gap: 12px; align-items: flex-start; }
.req-n {
  flex: none; width: 26px; height: 26px; border-radius: 999px; margin-top: 2px;
  background: var(--color-accent-200); color: var(--color-accent-800);
  font-size: 13px; font-weight: 800; display: grid; place-items: center;
}
.req-t { font-size: 16px; line-height: 1.6; text-wrap: pretty; }

.route { display: flex; flex-direction: column; gap: 7px; }
.route-row { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.route-n {
  flex: none; width: 24px; height: 24px; border-radius: 999px; background: #fff;
  color: var(--color-accent-2-700); font-size: 12px; font-weight: 800; display: grid; place-items: center;
}
.route-l { flex: 1 1 auto; min-width: 0; }
.route-m { flex: none; font-size: 13px; color: var(--color-neutral-700); white-space: nowrap; }

/* ===================== journey.js 注入的部件 ===================== */
/* 站点地图（顶栏下方一条） */
#journey-map { padding: 8px 16px 12px; overflow-x: auto; overflow-y: visible; background: rgba(249, 244, 237, .94); border-bottom: 1px solid var(--color-neutral-300); position: sticky; top: 58px; z-index: 29; }
#journey-map.hidden { display: none !important; }
.jm-row { display: flex; align-items: flex-start; gap: 0; min-width: 520px; max-width: 900px; margin: 0 auto; }
.jm-stop { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; }
.jm-line { position: absolute; top: 15px; left: 0; right: 0; height: 3px; border-radius: 999px; background: var(--color-neutral-300); }
.jm-stop:first-child .jm-line { background: transparent; }
.jm-stop.done .jm-line, .jm-stop.here .jm-line { background: var(--color-accent-2-400); }
.jm-mark {
  position: relative; width: 32px; height: 32px; border-radius: 999px; display: grid; place-items: center;
  font-size: 13px; font-weight: 800; background: #fff; color: var(--color-neutral-700);
  border: 2px solid var(--color-neutral-300);
}
.jm-stop.done .jm-mark { background: var(--color-accent-2-400); border-color: var(--color-accent-2-400); color: #fff; }
.jm-stop.here .jm-mark { background: var(--color-accent-500); border-color: var(--color-accent-700); color: #fff; box-shadow: 0 0 0 5px rgba(214, 127, 72, .22); }
.jm-label { font-size: 11px; line-height: 1.3; text-align: center; color: var(--color-neutral-700); }
.jm-stop.here .jm-label { color: var(--color-accent-800); font-weight: 700; }
/* 顶栏里的种子计数 */
#seed-count { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-neutral-700); white-space: nowrap; }
#seed-count b { font-size: 15px; color: var(--color-accent-2-700); }

/* 拿到种子的中间页 */
.award-emblem { position: relative; width: 150px; height: 150px; margin: 8px auto 0; animation: award-pop .6s cubic-bezier(.34,1.56,.64,1) both; }
.award-emblem::before { content: ''; position: absolute; inset: 0; border-radius: 999px; background: var(--color-accent-2-200); }
.award-emblem::after { content: ''; position: absolute; inset: 26px; border-radius: 999px; background: var(--color-accent-2-400); }
.award-seed { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 999px 6px 999px 6px; background: var(--color-accent-2-800); z-index: 2; }
@keyframes award-pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.award-shelf { display: inline-flex; gap: 10px; background: var(--color-surface); border-radius: 999px; padding: 10px 14px; box-shadow: var(--shadow-sm); }
.award-slot { width: 38px; height: 38px; border-radius: 999px; background: var(--color-neutral-200); display: grid; place-items: center; }
.award-slot i { width: 14px; height: 14px; border-radius: 999px 3px 999px 3px; background: var(--color-neutral-300); display: block; }
.award-slot.got { background: var(--color-accent-2-300); }
.award-slot.got i { background: var(--color-accent-2-700); }

/* 结束页徽章 */
/* —— 结束页奖章：花边奖章 + 缎带 + 收集陈列架 —— */
.badge-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; }
.badge-emblem { position: relative; width: 236px; height: 236px; margin: 6px auto 0; }
/* 外圈锯齿花边（纯 CSS 奖章齿轮） */
.badge-emblem .be-rim {
  position: absolute; inset: -10px; border-radius: 999px;
  background: repeating-conic-gradient(var(--color-accent-300) 0 9deg, var(--color-accent-200) 9deg 18deg);
  animation: be-rim-spin 44s linear infinite;
}
@keyframes be-rim-spin { to { transform: rotate(360deg); } }
/* 内盘 */
.badge-emblem .be-ring {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--color-neutral-100); border: 3px solid var(--color-accent-400);
  box-shadow: inset 0 3px 12px rgba(46,43,37,.10);
}
.badge-emblem .be-dash { position: absolute; inset: 26px; border-radius: 999px; border: 2px dashed var(--color-accent-2-300); }
/* 中心 */
.badge-emblem .be-core {
  position: absolute; inset: 66px; border-radius: 999px; background: var(--color-accent-2-500);
  display: grid; place-items: center; gap: 1px; color: #fff; text-align: center;
  box-shadow: inset 0 -7px 16px rgba(39, 46, 27, .34), 0 3px 10px rgba(46,43,37,.18);
}
.badge-emblem .be-core b { font-family: var(--font-heading); font-size: 42px; font-weight: 400; line-height: 1; display: block; }
.badge-emblem .be-core span { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--color-accent-2-100); }
/* 六片种子叶：逐颗弹出 */
.badge-emblem .be-dot { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.badge-emblem .be-dot i {
  display: block; border-radius: 999px 3px 999px 3px;   /* 叶子形状 */
  box-shadow: 0 0 0 4px var(--color-neutral-100), var(--shadow-sm);
  transform: scale(0); animation: seed-pop .5s cubic-bezier(.2,1.2,.3,1) forwards;
}
@keyframes seed-pop { from { transform: scale(0); } to { transform: scale(1); } }
/* 缎带 */
.badge-ribbon { position: relative; margin-top: -6px; display: flex; justify-content: center; }
.badge-ribbon span {
  position: relative; z-index: 2; display: inline-block;
  background: var(--color-accent-500); color: #fff;
  font-family: var(--font-heading); font-weight: 400; font-size: 21px; letter-spacing: 1px;
  padding: 9px 32px; border-radius: 8px; box-shadow: var(--shadow-md);
}
.badge-ribbon span::before, .badge-ribbon span::after {
  content: ''; position: absolute; top: 8px; width: 22px; height: 22px;
  background: var(--color-accent-700); border-radius: 4px; z-index: -1;
}
.badge-ribbon span::before { left: -9px; transform: rotate(45deg); }
.badge-ribbon span::after { right: -9px; transform: rotate(45deg); }
.badge-date { font-size: 13px; color: var(--color-neutral-700); margin-top: 10px; }
/* 收集陈列架 */
.badge-shelf-title {
  margin-top: 20px; font-size: 13px; font-weight: 700; letter-spacing: .06em;
  color: var(--color-accent-800); background: var(--color-accent-100);
  padding: 6px 16px; border-radius: 999px;
}
.badge-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; margin-top: 12px; width: 100%; }
.badge-item {
  display: flex; align-items: center; gap: 10px; background: var(--color-neutral-100);
  border: 1px solid var(--color-accent-2-200); border-radius: 18px; padding: 10px 14px;
  opacity: 0; animation: seed-slide .4s ease forwards;
}
@keyframes seed-slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.badge-item u { flex: none; width: 20px; height: 20px; border-radius: 999px 3px 999px 3px; text-decoration: none; box-shadow: var(--shadow-sm); }
.badge-item b { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 600; color: var(--color-accent-2-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.badge-item span { flex: none; font-size: 11px; color: var(--color-accent-2-700); background: var(--color-accent-2-100); padding: 2px 9px; border-radius: 999px; }
.badge-meta { border-top: 1px dashed var(--color-accent-200); margin-top: 18px; padding-top: 16px; width: 100%; display: flex; gap: 14px; flex-wrap: wrap; text-align: left; }
.badge-meta div { flex: 1 1 180px; }
.badge-meta small { display: block; font-size: 12px; color: var(--color-neutral-700); }
.badge-meta b { font-size: 15px; font-variant-numeric: tabular-nums; word-break: break-all; }

/* ===================== 响应式：手机优先兼容 ===================== */
@media (max-width: 820px) {
  #stage { padding: 14px 12px 130px; }
  .rec-cam-corner { width: 34vw; max-width: 132px; top: auto; bottom: 100px; right: 8px; border-radius: 16px; }
  .cam-drag-tag { font-size: 10px; padding: 1px 7px; }
  /* 小苗的话在窄屏收紧一些 */
  #banner {
    font-size: 16px; padding: 12px 16px 12px 70px; min-height: 0;
  }
  #banner::before { left: 14px; width: 40px; height: 40px; margin-top: -20px; }
  #banner::after { left: 27px; width: 13px; height: 13px; margin-top: -27px; }
  #banner .sprout-say { position: static; transform: none; display: inline-block; margin-top: 8px; }
  #banner.banner-countdown { padding-left: 70px; }
  .calib-screen { margin-top: 0; }
  #journey-map { position: static; padding: 4px 10px 10px; }
  .jm-row { min-width: 440px; }
  .jm-label { font-size: 10px; }
  .rec-headbar { min-height: 0; flex-wrap: wrap; padding: 12px 18px; gap: 8px 12px; border-radius: 24px; }
  .rhb-title { flex: 1 1 100%; white-space: normal; overflow: visible; text-overflow: clip; font-size: 17px; line-height: 1.5; }
  .rhb-status { white-space: normal; font-size: 17px; text-align: left; }
  .rec-topfixed { top: 58px; }
  .card { padding: 22px 18px; border-radius: 24px; }
  .reading-text { font-size: 19px; line-height: 1.95; padding: 20px 18px; }
  .qa-text { font-size: 20px; padding: 22px 18px; }
  /* 5～6 个选项在手机上不再挤成一行；网格等宽，所以换行后每个按钮依然一样大，
     不会有哪个选项因为更大而形成引导性。inline style 由 task5.js 写死，故用 !important。 */
  .opt-row { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px; }
  .opt-btn { min-height: 72px; border-radius: 16px; }
  .opt-btn .opt-label { font-size: 11px; }
  .draw-timer-wrap { width: 200px; height: 200px; }
  .draw-timer { font-size: 38px; }
  .rest-emoji { width: 190px; height: 190px; }
  .qr-box { width: 200px; height: 200px; }
  /* 手机上整体缩放奖章（叶子的定位是内联的，整体缩放最稳） */
  .badge-emblem { transform: scale(.8); transform-origin: top center; margin-bottom: -44px; }
  .badge-ribbon span { font-size: 18px; padding: 8px 24px; }
  /* 主按钮在手机上贴底，永远够得着 */
  .rec-controls, .scale-page .btn-lg { position: sticky; bottom: 8px; z-index: 25; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 27px; }
  h2 { font-size: 22px; }
  .countdown-num { font-size: 84px; }
  #app-title { font-size: 17px; padding-left: 38px; }
  #app-title::before { width: 28px; height: 28px; margin-top: -14px; }
  #app-title::after { left: 8px; width: 11px; height: 11px; margin-top: -5px; }
  #progress { font-size: 11px; }
  #seed-count { font-size: 11px; }
  #seed-count b { font-size: 13px; }
}

/* ===================== 上传遮罩 ===================== */
.saving-overlay { position: fixed; inset: 0; background: rgba(46, 43, 37, .5); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.saving-box { background: var(--color-surface); padding: 28px 34px; border-radius: 32px; text-align: center; font-size: 17px; color: var(--color-neutral-900); box-shadow: var(--shadow-lg); }
.saving-spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 4px solid var(--color-accent-200); border-top-color: var(--color-accent-500); border-radius: 50%; animation: saving-spin .9s linear infinite; }
@keyframes saving-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ===== 徽章生成中 & 揭晓动画（结束页）===== */
.badge-forming {
  width: 74px; height: 74px; margin: 2px auto 6px; border-radius: 50%;
  border: 5px dashed var(--color-accent-400); border-top-color: var(--color-accent-2-500);
  animation: badge-spin 2.6s linear infinite;
}
@keyframes badge-spin { to { transform: rotate(360deg); } }
.badge-wrap { animation: badge-in .65s cubic-bezier(.2,.85,.25,1) both; }
@keyframes badge-in {
  from { opacity: 0; transform: scale(.82) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ===== 提示语更醒目 ===== */
/* 录制页横幅里的"请开始…"字更大更重 */
.rhb-status.rhb-go { font-size: 25px; font-weight: 700; color: var(--color-accent-600); letter-spacing: 1px; }
/* 关键"开始"提示：屏幕中央短暂弹出的大胶囊 */
.center-flash {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.8);
  z-index: 60; pointer-events: none; opacity: 0;
  background: var(--color-accent-500); color: #fff;
  font-family: var(--font-heading); font-size: 34px; font-weight: 400; letter-spacing: 2px;
  padding: 18px 46px; border-radius: 999px; box-shadow: var(--shadow-lg);
  transition: opacity .18s ease, transform .22s cubic-bezier(.2,.85,.25,1);
}
.center-flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
@media (max-width: 820px) {
  #banner { font-size: 18px !important; }
  .center-flash { font-size: 26px; padding: 14px 32px; }
  .rhb-status.rhb-go { font-size: 21px; }
}

/* 绿色横幅提示语居中：窄屏隐藏小苗头，让文字真正居中 */
@media (max-width: 820px) {
  #banner { padding: 12px 20px; }
  #banner::before, #banner::after { display: none; }
}
