/* ============================================================
   Joe 的产品设计稿 — 设计系统
   品牌靛蓝 #5B6CFC · Inter · 中性浅灰系 · 8px 圆角
   ============================================================ */

:root {
  /* 品牌色 */
  --brand: #5b6cfc;
  --brand-light: #7c8bfd;
  --brand-dark: #3d50fb;
  --brand-bg: #f0f1ff;
  --brand-border: #dde0fd;

  /* 为兼容引用 --purple 的旧写法，映射到品牌色 */
  --purple: var(--brand);
  --purple-light: var(--brand-light);
  --purple-dark: var(--brand-dark);
  --purple-bg: var(--brand-bg);
  --purple-border: var(--brand-border);

  /* 文字灰阶 */
  --t1: #0a0a06;
  --t2: #36383b;
  --t3: #57574a;
  --muted: #8c8c85;
  --subtle: #9d9d9d;

  /* 背景 / 边框 */
  --bg: #ffffff;
  --bg-subtle: #f7f7f7;
  --bg-muted: #f2f2f2;
  --bg-soft: #e6e6e6;
  --app-card: #f2f2f7;
  --border: #ececec;
  --border-strong: #d8d8d4;

  /* 功能色 */
  --success: #34c79a;
  --warning: #f2994a;
  --danger: #eb5757;
  --link: #7092fa;

  --radius: 8px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC',
    'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei', system-ui, sans-serif;
}

/* ---- 屏幕外壳：纯屏幕，无设备外壳 ---- */
.screen {
  width: 390px;
  height: 844px;
  background: var(--bg);
  font-family: var(--font);
  color: var(--t1);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.screen * { box-sizing: border-box; }
.screen.tinted { background: var(--bg-subtle); }

/* ---- iOS 状态栏 ---- */
.statusbar {
  height: 50px;
  flex: 0 0 50px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 26px 9px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--t1);
  z-index: 5;
}
.statusbar .sb-time { font-variant-numeric: tabular-nums; }
.statusbar .sb-right { display: flex; align-items: center; gap: 7px; }
.sb-icon { display: block; }

/* ---- Home indicator ---- */
.home-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 8px;
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: #0a0a06;
  opacity: 0.85;
  z-index: 6;
}

/* ---- 顶部栏 ---- */
.appbar {
  height: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}
.appbar .iconbtn { color: var(--t2); }
.appbar-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--t1);
  letter-spacing: -0.2px;
}
.appbar-sub { font-size: 12px; color: var(--muted); }
.appbar .spacer { flex: 1; }

.iconbtn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--t2);
  border-radius: 9px;
  cursor: pointer;
  flex: 0 0 auto;
}
.iconbtn:active { background: var(--bg-muted); }

/* ---- 内容区 ---- */
.body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.scroll { flex: 1; overflow: hidden; }
.pad { padding: 0 16px; }

/* ---- 顶部模式切换器 (segmented) ---- */
.switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-muted);
  border-radius: 11px;
  padding: 4px;
  margin: 4px 16px 0;
}
.switcher .seg {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--t3);
  white-space: nowrap;
  cursor: pointer;
}
.switcher .seg.active {
  background: #fff;
  color: var(--t1);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(10, 10, 6, 0.08);
}
.switcher .seg.add { flex: 0 0 auto; padding: 0 14px; color: var(--brand); font-weight: 600; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.dot.on { background: var(--success); }
.dot.off { background: var(--subtle); }

/* ---- 卡片 / 列表行 ---- */
.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.2px;
  padding: 0 4px;
}
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
}
.row + .row { border-top: 1px solid var(--border); }
.row .r-ic {
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--bg-muted); color: var(--t3);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.row .r-main { flex: 1; min-width: 0; }
.row .r-title { font-size: 14.5px; font-weight: 500; color: var(--t1); }
.row .r-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.row .chev { color: var(--subtle); flex: 0 0 auto; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 20px;
}
.badge.on { background: rgba(52, 199, 154, 0.12); color: #1f9b78; }
.badge.off { background: var(--bg-muted); color: var(--muted); }

/* 帮助色 */
.text-brand { color: var(--brand-dark); }
.text-purple { color: var(--brand-dark); }
.divider { height: 1px; background: var(--border); }

/* ---- 发起对话输入坞 ---- */
.dock-wrap {
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  flex: 0 0 auto;
}
.dock {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 0 8px 0 10px;
}
.dock .ph { flex: 1; font-size: 15px; color: var(--muted); }
.dock .mic {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.dock .scope-icon { color: var(--muted); flex: 0 0 auto; }
.dock.recording { border-color: var(--brand); background: var(--brand-bg); }
.wave { display: flex; align-items: center; gap: 3px; flex: 1; height: 28px; }
.wave i { width: 3px; border-radius: 2px; background: var(--brand); display: block; }
.dock.recording .ph { color: var(--brand-dark); font-weight: 500; flex: 0 0 auto; }
.chip-row { -ms-overflow-style: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row > * { flex-shrink: 0; white-space: nowrap; }
.dock.typing { background: #fff; border-color: var(--brand-light); }
.dock.typing .caret {
  display: inline-block; width: 1.5px; height: 18px; background: var(--brand);
  margin-left: 1px; vertical-align: -3px;
}
.dock .send {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}

/* ---- 快捷任务卡片 ---- */
.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 20px 16px 0;
}
.shortcut {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  min-height: 104px;
  justify-content: space-between;
}
.shortcut .sc-ic {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-bg); color: var(--brand-dark);
}
.shortcut .sc-name { font-size: 15px; font-weight: 600; color: var(--t1); }
.shortcut .sc-desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }

/* ============================================================
   通用 · Heading 规范与序号
   仅作用于交互稿的「描述/说明」prose 区域（.intro 或 .proto-doc）
   ============================================================ */
@counter-style proto-circled {
  system: fixed ①;
  symbols: ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳;
  suffix: " ";
}
.intro, .proto-doc { counter-reset: proto-h2; }
.intro h1, .proto-doc h1 {
  font-size: 28px; font-weight: 700; letter-spacing: -0.4px;
  color: var(--t1); line-height: 1.3; margin: 0 0 12px;
}
.intro h2, .proto-doc h2 {
  counter-increment: proto-h2;
  counter-reset: proto-h3;
  font-size: 20px; font-weight: 700; color: var(--t1);
  line-height: 1.35; margin: 28px 0 10px;
}
.intro h2::before, .proto-doc h2::before {
  content: "(" counter(proto-h2) ") ";
  color: var(--brand); font-weight: 700;
}
.intro h3, .proto-doc h3 {
  counter-increment: proto-h3;
  font-size: 16px; font-weight: 700; color: var(--t2);
  line-height: 1.4; margin: 20px 0 8px;
}
.intro h3::before, .proto-doc h3::before {
  content: counter(proto-h3, proto-circled);
  color: var(--brand); font-weight: 700;
}
.intro h4, .proto-doc h4,
.intro h5, .proto-doc h5,
.intro h6, .proto-doc h6 {
  font-size: 14px; font-weight: 700; color: var(--t2);
  margin: 16px 0 6px;
}

/* ============================================================
   通用 · 左下角自动目录（默认折叠，hover 展开）
   ============================================================ */
.proto-toc {
  position: fixed; top: 16px; left: 20px; z-index: 180;
  font-family: var(--font);
  user-select: none;
}
.proto-toc-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--t2);
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.proto-toc-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.10);
}
.proto-toc-trigger .proto-toc-ico {
  width: 14px; height: 14px; color: var(--brand);
}
.proto-toc-panel {
  position: absolute; left: 0; top: 100%;
  min-width: 260px; max-width: 340px;
  max-height: 60vh; overflow-y: auto;
  padding: 10px 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.12);
  opacity: 0; pointer-events: none;
  transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease;
}
.proto-toc:hover .proto-toc-panel,
.proto-toc:focus-within .proto-toc-panel {
  opacity: 1; pointer-events: auto; transform: translateY(0);
}
.proto-toc.is-dismissed:hover .proto-toc-panel,
.proto-toc.is-dismissed:focus-within .proto-toc-panel {
  opacity: 0; pointer-events: none; transform: translateY(-6px);
}
.proto-toc-item {
  display: block; width: 100%; text-align: left;
  padding: 6px 12px;
  background: transparent; border: 0; cursor: pointer;
  font-size: 13px; color: var(--t2); line-height: 1.45;
  border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.proto-toc-item:hover { background: var(--brand-bg); color: var(--brand-dark); }
.proto-toc-item.lv-1 { font-weight: 600; color: var(--t1); }
.proto-toc-item.lv-2 { padding-left: 26px; font-size: 12.5px; color: var(--t3); }
.proto-toc-item.lv-3 { padding-left: 42px; font-size: 12px; color: var(--muted); }
.proto-toc-item.lv-2::before { content: ""; }
.proto-toc-item.lv-3::before { content: ""; }
.proto-toc-empty {
  padding: 8px 12px; font-size: 12px; color: var(--muted);
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes caret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
