/* ============================================================
   L 的工作台 — 功能组件样式（无框架，自包含，可离线）
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--lw-font-sans);
  color: var(--lw-text);
  background: var(--lw-bg-deep);
  font-size: 14px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

button { font-family: inherit; }
img { display: block; }

#app {
  position: relative;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--lw-bg);
  box-shadow: 0 0 40px rgba(46, 37, 25, 0.08);
}

/* ---------- 页头 ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 16px 10px;
}
.app-header h1 {
  margin: 0;
  font-family: var(--lw-font-serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: .01em;
}
.app-header p { margin: 2px 0 0; font-size: 12px; color: var(--lw-text-2); }
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--lw-radius-full);
  background: var(--lw-primary-100);
  color: var(--lw-primary-700);
  font-size: 15px; font-weight: 600;
}

main.view { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--lw-surface);
  border: 1px solid var(--lw-border);
  border-radius: var(--lw-radius-lg);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--lw-shadow-card);
}
.card.tight { padding: 12px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.section-title {
  font-family: var(--lw-font-serif);
  font-size: 18px; font-weight: 700;
  margin: 14px 2px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.section-title span:last-child { font-family: var(--lw-font-sans); font-size: 13px; font-weight: 400; color: var(--lw-text-2); }

/* ---------- 积分横幅 ---------- */
.points-hero {
  background: linear-gradient(135deg, var(--lw-primary-500), var(--lw-primary-600));
  color: var(--lw-text-inverse);
  border: none;
}
.points-hero .ph-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.points-hero .ph-label { font-size: 12px; opacity: .75; }
.points-num {
  margin: 6px 0 0;
  font-family: var(--lw-font-serif);
  font-size: 34px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.points-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 248, 239, .16);
  border-radius: var(--lw-radius-full);
  padding: 5px 10px; font-size: 11px; white-space: nowrap;
}
.points-hero hr { border: none; height: 1px; margin: 14px 0; background: rgba(255, 248, 239, .22); }
.ph-cols { display: flex; gap: 12px; }
.ph-col { flex: 1; min-width: 0; }
.ph-col b { font-size: 14px; font-weight: 600; }
.ph-col p { margin: 4px 0 0; font-size: 11px; opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-divider { width: 1px; background: rgba(255, 248, 239, .22); }

.reward-track { margin-top: 12px; }
.reward-track .rt-labels { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; opacity: .9; }
.track { margin-top: 6px; height: 4px; border-radius: var(--lw-radius-full); background: rgba(255,248,239,.22); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: var(--lw-radius-full); background: var(--lw-text-inverse); }
.points-rules { margin: 12px 0 0; font-size: 11px; line-height: 1.6; opacity: .72; }

/* 浅色进度条 */
.track.light { background: var(--lw-surface-3); }
.track.light > i { background: var(--lw-primary-500); }
.track.light > i.success { background: var(--lw-success); }

/* ---------- 任务行 ---------- */
.task-row { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 8px; }
.task-check {
  width: 26px; height: 26px; flex: none;
  border-radius: var(--lw-radius-full);
  border: 1.5px solid var(--lw-border-strong);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
}
.task-check.done { background: var(--lw-success-bg); border-color: var(--lw-success); color: var(--lw-success); }
.task-main { flex: 1; min-width: 0; }
.task-main b { display: block; font-size: 14px; font-weight: 500; }
.task-main p { margin: 2px 0 0; font-size: 11px; color: var(--lw-text-2); }
.task-row.done .task-main b { color: var(--lw-text-2); text-decoration: line-through; }
.task-thumb { width: 52px; height: 52px; border-radius: var(--lw-radius-md); object-fit: cover; flex: none; position: relative; }
.thumb-dot {
  position: absolute; right: -4px; bottom: -4px;
  width: 20px; height: 20px; border-radius: var(--lw-radius-full);
  background: var(--lw-success); color: var(--lw-text-inverse);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--lw-surface);
}
.checked-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--lw-success); font-size: 12px; white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid transparent; border-radius: var(--lw-radius-md);
  font-size: 13px; font-weight: 500; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--lw-primary-500); color: var(--lw-text-inverse); }
.btn-primary:active { background: var(--lw-primary-600); }
.btn-ghost { background: var(--lw-primary-50); color: var(--lw-primary-700); }
.btn-outline { background: var(--lw-surface); border-color: var(--lw-border-strong); color: var(--lw-text); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-block { width: 100%; height: 40px; }
.btn:disabled { opacity: .5; pointer-events: none; }
.text-btn { background: none; border: none; color: var(--lw-primary-600); font-size: 12px; cursor: pointer; padding: 2px; }

/* ---------- 标签 / 胶囊 ---------- */
.tag {
  display: inline-block;
  background: var(--lw-surface-2);
  color: var(--lw-text-2);
  border-radius: var(--lw-radius-sm);
  padding: 2px 8px;
  font-family: var(--lw-font-mono);
  font-size: 11px;
  white-space: nowrap;
}
.pill {
  display: inline-flex; align-items: center;
  border-radius: var(--lw-radius-full);
  padding: 3px 10px; font-size: 11px; white-space: nowrap;
}
.pill-primary { background: var(--lw-primary-50); color: var(--lw-primary-700); }
.pill-error { background: var(--lw-error-bg); color: var(--lw-error); }
.pill-success { background: var(--lw-success-bg); color: var(--lw-success); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 30px; padding: 0 14px;
  display: inline-flex; align-items: center;
  border-radius: var(--lw-radius-full);
  border: 1px solid var(--lw-border);
  background: var(--lw-surface);
  color: var(--lw-text-2); font-size: 12px; cursor: pointer;
}
.chip.active { background: var(--lw-primary-500); border-color: var(--lw-primary-500); color: var(--lw-text-inverse); }

/* ---------- 搜索框 ---------- */
.searchbar {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px;
  background: var(--lw-surface);
  border: 1px solid var(--lw-border);
  border-radius: var(--lw-radius-md);
  color: var(--lw-text-3); font-size: 13px;
}

/* ---------- 列表行（资讯/文章/视频） ---------- */
.feed-card { display: block; padding: 12px; margin-bottom: 8px; }
.feed-card h3 { margin: 6px 0 0; font-size: 15px; font-weight: 600; }
.feed-card p { margin: 6px 0 0; font-size: 13px; color: var(--lw-text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed-meta { margin-top: 8px; font-size: 11px; color: var(--lw-text-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.feed-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--lw-text-3); font-size: 12px; padding: 2px;
}
.icon-btn.on { color: var(--lw-primary-600); }
.summary-box {
  margin-top: 10px; padding: 10px 12px;
  background: var(--lw-primary-50);
  border-radius: var(--lw-radius-md);
  font-size: 12px; color: var(--lw-text-2); line-height: 1.65;
}
.summary-box b { color: var(--lw-primary-700); }
.article-row { display: flex; align-items: center; gap: 10px; padding: 12px; margin-bottom: 8px; }
.article-row .ar-main { flex: 1; min-width: 0; }
.article-row .ar-main b { display: block; font-size: 14px; font-weight: 500; }
.article-row .ar-main p { margin: 3px 0 0; font-size: 11px; color: var(--lw-text-3); }

/* ---------- 统计网格 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid.two { grid-template-columns: repeat(2, 1fr); }
.stat {
  background: var(--lw-surface);
  border: 1px solid var(--lw-border);
  border-radius: var(--lw-radius-lg);
  padding: 12px; text-align: center;
}
.stat p { margin: 0; font-size: 11px; color: var(--lw-text-2); }
.stat b { display: block; margin-top: 6px; font-family: var(--lw-font-serif); font-size: 20px; color: var(--lw-primary-700); font-variant-numeric: tabular-nums; }
.stat b small { font-family: var(--lw-font-sans); font-size: 11px; font-weight: 400; color: var(--lw-text-2); margin-left: 2px; }

/* ---------- 目标进度 ---------- */
.goal-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.goal-row:last-child { margin-bottom: 0; }
.goal-row > span { width: 64px; flex: none; font-size: 13px; }
.goal-row .track { flex: 1; margin-top: 0; }
.goal-row em { width: 42px; flex: none; text-align: right; font-size: 12px; font-style: normal; color: var(--lw-text-2); font-variant-numeric: tabular-nums; }

/* ---------- 软考题 ---------- */
.q-meta { font-size: 12px; color: var(--lw-text-2); }
.option {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  border: 1px solid var(--lw-border);
  background: var(--lw-surface);
  border-radius: var(--lw-radius-md);
  padding: 10px 12px; margin-top: 8px;
  font-size: 13px; cursor: pointer;
}
.radio {
  width: 18px; height: 18px; flex: none;
  border-radius: var(--lw-radius-full);
  border: 1.5px solid var(--lw-border-strong);
  position: relative;
}
.option.selected { border-color: var(--lw-primary-500); background: var(--lw-primary-50); }
.option.selected .radio { border-color: var(--lw-primary-500); }
.option.selected .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--lw-primary-500); }
.option.correct { border-color: var(--lw-success); background: var(--lw-success-bg); color: var(--lw-success); }
.option.correct .radio { border-color: var(--lw-success); }
.option.correct .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--lw-success); }
.option.wrong { border-color: var(--lw-error); background: var(--lw-error-bg); color: var(--lw-error); }
.option.wrong .radio { border-color: var(--lw-error); }
.option.wrong .radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--lw-error); }
.q-actions { display: flex; gap: 10px; margin-top: 14px; }
.explain-box { margin-top: 12px; padding: 10px 12px; border-radius: var(--lw-radius-md); background: var(--lw-surface-2); font-size: 12px; color: var(--lw-text-2); line-height: 1.65; }
.explain-box b { color: var(--lw-text); }

/* 分段控件 */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--lw-surface-2); border-radius: var(--lw-radius-md); padding: 3px; font-size: 13px; }
.segmented button {
  border: none; background: none; padding: 7px; border-radius: 6px;
  color: var(--lw-text-3); cursor: pointer;
}
.segmented button.on { background: var(--lw-surface); color: var(--lw-text); box-shadow: var(--lw-shadow-card); }

/* ---------- 踩坑记录 ---------- */
.pitfall-item { padding: 12px; margin-bottom: 8px; }
.pitfall-item b { font-size: 14px; font-weight: 500; display: block; }
.pf-lines { margin-top: 8px; }
.pf-line { display: flex; gap: 8px; font-size: 12px; margin-top: 5px; line-height: 1.6; }
.pf-line em { flex: none; font-style: normal; font-weight: 600; color: var(--lw-primary-700); width: 30px; }
.pf-line span { color: var(--lw-text-2); }
.pf-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }

/* 面试技巧 */
.tip-line { display: flex; gap: 8px; font-size: 13px; margin-top: 8px; line-height: 1.6; }
.tip-dot { width: 6px; height: 6px; margin-top: 8px; flex: none; border-radius: 50%; background: var(--lw-primary-500); }

/* 项目卡 */
.project-card { padding: 14px; margin-bottom: 10px; }
.project-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.project-card p { margin: 4px 0 0; font-size: 12px; color: var(--lw-text-2); }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.project-progress { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.project-progress .track { flex: 1; margin: 0; }
.project-progress em { font-size: 11px; font-style: normal; color: var(--lw-text-2); width: 38px; text-align: right; }
.project-foot { margin-top: 8px; font-size: 11px; color: var(--lw-text-3); }
.project-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.dashed-add {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; height: 44px;
  border: 1.5px dashed var(--lw-border-strong);
  border-radius: var(--lw-radius-lg);
  background: none; color: var(--lw-primary-600);
  font-size: 13px; cursor: pointer;
}

/* 时间线 */
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--lw-border-strong); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item:last-child { margin-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 5px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--lw-primary-500);
  box-shadow: 0 0 0 4px var(--lw-primary-50);
}
.tl-item time { font-size: 11px; color: var(--lw-text-3); }
.tl-item b { display: block; margin-top: 2px; font-size: 14px; font-weight: 500; }
.tl-item p { margin: 3px 0 0; font-size: 12px; color: var(--lw-text-2); line-height: 1.6; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 430px; margin: 0 auto;
  display: flex;
  height: calc(72px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--lw-border);
  background: var(--lw-surface);
  z-index: 20;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--lw-text-3); background: none; border: none; cursor: pointer; font-size: 11px;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--lw-primary-500); }
.tab.on span { font-weight: 500; }

/* ---------- 底部弹层 ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(46, 37, 25, .4);
  display: block;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  max-width: 430px; margin: 0 auto;
  max-height: 92vh; max-height: 92dvh;
  overflow-y: auto;
  background: var(--lw-surface);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--lw-shadow-float);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet-grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--lw-border-strong); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { margin: 0; font-size: 18px; font-family: var(--lw-font-serif); }
.sheet-close {
  width: 32px; height: 32px; border: none; background: none;
  color: var(--lw-text-3); cursor: pointer; border-radius: var(--lw-radius-md);
  display: flex; align-items: center; justify-content: center;
}
.sheet-sub { margin: 6px 0 0; font-size: 12px; color: var(--lw-text-2); }

/* 表单 */
.field { margin-top: 12px; }
.field label { display: block; font-size: 12px; color: var(--lw-text-2); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--lw-border);
  border-radius: var(--lw-radius-md);
  padding: 10px 12px;
  font-family: inherit; font-size: 13px; color: var(--lw-text);
  background: var(--lw-surface);
}
.field textarea { resize: vertical; min-height: 72px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--lw-primary-300); border-color: var(--lw-primary-400); }

/* 拍照凭证 */
.photo-pick {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  height: 132px;
  border: 1.5px dashed var(--lw-border-strong);
  border-radius: var(--lw-radius-lg);
  color: var(--lw-text-3); font-size: 12px; cursor: pointer;
  background: var(--lw-surface-2);
}
.photo-preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--lw-radius-lg); margin-top: 10px; }

/* 空状态 */
.empty { text-align: center; padding: 26px 16px; color: var(--lw-text-3); font-size: 13px; }
.empty svg { margin: 0 auto 8px; opacity: .5; }

/* 成功浮层 */
.success-badge {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--lw-primary-50); color: var(--lw-primary-600);
  display: inline-flex; align-items: center; justify-content: center;
}
.success-plus { font-family: var(--lw-font-serif); font-size: 32px; font-weight: 700; color: var(--lw-primary-600); }

/* 积分明细 */
.ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--lw-border); font-size: 13px; }
.ledger-row:last-child { border-bottom: none; }
.ledger-row p { margin: 0; }
.ledger-row small { display: block; margin-top: 2px; font-size: 11px; color: var(--lw-text-3); }
.ledger-delta { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ledger-delta.pos { color: var(--lw-success); }
.ledger-delta.neg { color: var(--lw-error); }
.ledger-delta.zero { color: var(--lw-warning); }

/* Toast */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 24px; }
.toast {
  background: rgba(46, 37, 25, .92); color: var(--lw-text-inverse);
  border-radius: var(--lw-radius-full);
  padding: 9px 18px; font-size: 13px;
  max-width: 100%; text-align: center;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 启动加载 */
.boot { display: flex; align-items: center; justify-content: center; min-height: 100vh; color: var(--lw-text-3); font-size: 13px; }

.note-card { display: flex; align-items: center; gap: 8px; background: var(--lw-surface-2); border-radius: var(--lw-radius-lg); padding: 10px 12px; font-size: 12px; color: var(--lw-text-2); margin-bottom: 10px; }
