/* ============================================================================
   单词小路 · 描写板（ours-trace.css）  v 20261015z119
   规则：所有孩子看得到的按钮都不含文字；风格沿用站内既有观感
        （奶油底 #FBF8F2 / 卡片 #FAF8F5、圆角 20px、描边 rgba 中性色、blue-600 强调色）。
   本文件只负责外观与状态，逻辑在 ours-trace.js。
   ========================================================================== */

:root {
  --ot-surface: #FFFDF8;
  --ot-surface-2: #FAF8F5;
  --ot-page: #FBF8F2;
  --ot-line: rgba(60, 52, 40, .16);
  --ot-line-soft: rgba(60, 52, 40, .09);
  --ot-ink: #2B2721;
  --ot-ink-soft: #8A8071;
  --ot-accent: #2563EB;
  --ot-accent-soft: #7FA8D9;
  --ot-dot: #F5B301;
  --ot-tap: 56px;          /* 孩子手指最小可点边长 */
  --ot-r-card: 20px;
  --ot-r-btn: 14px;
}

/* ---------- ① 词卡页的小角签（入口） ---------- */
.ot-tab {
  position: fixed;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--ot-tap);
  height: var(--ot-tap);
  padding: 0;
  border: 1px solid var(--ot-line);
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFFFF 0%, var(--ot-surface-2) 100%);
  box-shadow: 0 6px 16px rgba(74, 64, 48, .16), 0 1px 0 rgba(255, 255, 255, .9) inset;
  color: var(--ot-accent);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: opacity .25s ease, transform .18s ease, box-shadow .18s ease;
}
.ot-tab:active { transform: scale(.94); }
.ot-tab svg { width: 30px; height: 30px; pointer-events: none; }
/* 朗读播放中：淡到 35%，并且不可点（防误触） */
.ot-tab.is-muted { opacity: .35; pointer-events: none; }
.ot-tab.is-hidden { display: none; }
/* 已完成整词的角签：右下角一枚小勾 */
.ot-tab.is-done::after {
  content: "";
  position: absolute; right: -3px; bottom: -3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #34B27B url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>") center/12px 12px no-repeat;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
/* 电脑端：可点区加宽到 ≥190×48 */
@media (min-width: 900px) {
  .ot-tab { width: 190px; height: 48px; border-radius: var(--ot-r-btn); }
  .ot-tab svg { width: 26px; height: 26px; }
}

/* ---------- ② 整页描写板 ---------- */
.ot-veil {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--ot-page);
  display: flex;
  flex-direction: column;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--ot-ink);
  opacity: 0;
  transition: opacity .22s ease;
  /* 防误触：整层不许选、不许长按弹菜单、不许拖拽 */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  overscroll-behavior: contain;
}
.ot-veil.is-on { opacity: 1; }
.ot-veil[hidden] { display: none; }
html.ot-lock, html.ot-lock body { overflow: hidden !important; touch-action: none; }

.ot-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 14px 6px;
}
.ot-dots { display: flex; gap: 8px; align-items: center; }
/* 两种指示条：左边「看·描·写」三步用横条，中间「写 3 次」用圆点 —— 一眼能分开 */
.ot-dot {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid rgba(60, 52, 40, .22); background: rgba(60, 52, 40, .04);
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.ot-dot.is-on { background: var(--ot-accent); border-color: var(--ot-accent); transform: scale(1.08); }
.ot-dot.is-now { box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
.ot-steps { display: flex; gap: 6px; align-items: center; }
.ot-steps .ot-dot {
  width: 20px; height: 6px; border-radius: 3px; border: 0; background: rgba(60, 52, 40, .16);
  transform: none;
}
.ot-steps .ot-dot.is-on { background: var(--ot-accent); }
.ot-steps .ot-dot.is-now { box-shadow: none; transform: none; width: 26px; }

/* 板内所有图形按钮：无文字、够大、统一观感 */
.ot-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--ot-tap); height: var(--ot-tap);
  padding: 0; border: 1px solid var(--ot-line); border-radius: var(--ot-r-btn);
  background: var(--ot-surface);
  color: var(--ot-ink);
  box-shadow: 0 1px 3px rgba(74, 64, 48, .09);
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  transition: transform .15s ease, opacity .2s ease, color .2s ease;
}
.ot-btn:active { transform: scale(.93); }
.ot-btn svg { width: 26px; height: 26px; pointer-events: none; }
.ot-btn[disabled] { opacity: .35; pointer-events: none; }
.ot-btn.is-accent { color: #fff; background: var(--ot-accent); border-color: transparent;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .24); }
.ot-btn.is-accent:active { transform: scale(.93); }
.ot-top .ot-btn { width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--ot-line-soft);
  color: var(--ot-ink-soft); box-shadow: 0 1px 3px rgba(74, 64, 48, .07); }
.ot-top .ot-btn svg { width: 22px; height: 22px; }
.ot-top .ot-btn:active { color: var(--ot-ink); }
/* 板开着时把入口角签收起来，别压在板上 */
.ot-lock .ot-tab { display: none; }

/* ---------- ③ 四线三格 + 字形 + 引导 + 墨迹 ---------- */
.ot-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 10px;
  border-radius: var(--ot-r-card);
  background: var(--ot-surface);
  border: 1px solid var(--ot-line-soft);
  box-shadow: 0 1px 2px rgba(74, 64, 48, .04);
  overflow: hidden;
  touch-action: none;                 /* 板内不允许滚动/缩放，避免打断笔迹 */
}
.ot-grid { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; }
.ot-grid i { position: absolute; left: 12px; right: 12px; height: 0; border-top: 1px solid var(--ot-line); }
.ot-grid i.is-mid { border-top-style: dashed; border-top-color: var(--ot-line-soft); }
.ot-grid i.is-base { border-top-color: rgba(60, 52, 40, .26); }
.ot-grid.is-off { display: none; }

.ot-rowswrap {
  position: absolute; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 32px);
  touch-action: none;
}
.ot-rowswrap .traceRow { position: relative; }
.ot-rowswrap .traceLine {
  position: relative;
  font-family: "Andika", "Comic Sans MS", cursive;   /* 与词卡同一个字重文件：单层 a、不倾斜 */
  font-weight: 400;
  color: transparent;
  -webkit-text-stroke: 2.6px rgba(60, 52, 40, .22);
  letter-spacing: 2px;
  white-space: nowrap;
}
.ot-rowswrap .traceLetter { position: relative; display: inline-block; }
.ot-rowswrap .baseline { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.ot-rowswrap .strokeGuide {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: visible;
  transition: opacity .3s ease;
}
.ot-rowswrap .sg-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ot-rowswrap .sg-flowDot { fill: var(--ot-accent); stroke: #fff; stroke-width: 2.2; }   /* 笔顺「会走的点」（第 1 遍） */
.ot-rowswrap .sg-startDot { stroke: #fff; stroke-width: 2.6; }
.ot-rowswrap.lv-heavy .strokeGuide { opacity: 1; }
.ot-rowswrap.lv-light .strokeGuide { opacity: .42; }
.ot-rowswrap.lv-empty .strokeGuide { opacity: 0; }      /* 第 3 遍：自己写 */

/* 淡字形（真正的描红底字）：只在有引导的那两遍显示 */
.ot-rowswrap .traceLine.is-ghost { -webkit-text-stroke: 2.6px rgba(60, 52, 40, .2); }
.ot-rowswrap.lv-empty .traceLine { -webkit-text-stroke-color: rgba(60, 52, 40, .10); }
/* z119（业主 2026-10-15 15:50「虚线里 也不要指引什么的了」）：导引虚点点整层不显形 →
   「第 1 遍浓 / 第 2 遍淡 / 第 3 遍自己写」的递进改由灰色字形本身承担，孩子照样有「越描越淡」的节奏感。 */
.ot-rowswrap.lv-light .traceLine { -webkit-text-stroke-color: rgba(60, 52, 40, .13); }

.ot-ink {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  touch-action: none; cursor: crosshair; z-index: 3;
}

/* 引导动画：看一遍时逐笔描出 */
.ot-anim .sg-stroke { stroke-dasharray: var(--ot-len) !important; }

/* 通过一刹那的吸附光晕 */
.ot-flash {
  position: absolute; inset: 0; pointer-events: none; z-index: 4;
  background: radial-gradient(60% 60% at 50% 55%, rgba(37, 99, 235, .18), transparent 70%);
  opacity: 0; transition: opacity .28s ease;
}
.ot-flash.is-on { opacity: 1; }

/* 一笔写偏：只淡出，不给红叉 */
.ot-hintFade { opacity: .0; transition: opacity .35s ease; }

/* ---------- ④ 底部工具条 ---------- */
.ot-tools {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
}
.ot-tools .ot-spacer { flex: 1 1 auto; }
.ot-tools .ot-btn:first-child { color: var(--ot-accent); border-color: rgba(37, 99, 235, .28); }
/* 电脑端工具条按钮加宽 */
@media (min-width: 900px) {
  .ot-tools .ot-btn { width: 190px; height: 48px; }
  .ot-tools .ot-btn svg { width: 24px; height: 24px; }
}

/* ---------- ⑤ 家长开关（长按角签 0.6 秒）2026-10-15 已按业主要求整个移除，样式一并删掉 ---------- */

/* ---------- ⑥ 手机端微调 ---------- */
@media (max-width: 899px) {
  .ot-top { padding: 8px 10px 4px; }
  .ot-stage { margin: 0 6px; }
  .ot-tools { gap: 10px; padding: 8px 10px calc(12px + env(safe-area-inset-bottom)); }
}

/* 手机端可点区 ≥64px（验收口径） */
@media (max-width: 899px) {
  .ot-tab { width: 64px; height: 64px; border-radius: 20px; }
  .ot-tab svg { width: 28px; height: 28px; }
}
