/* ===== 基础重置 ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #2E2E2E;
  background: #F4F1EC;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }
ul { list-style: none; padding: 0; margin: 0; }

/* ===== 设计变量 ===== */
:root {
  --green-900: #3F5A35;
  --green-700: #5C7F4F;
  --green-500: #7A9B6A;
  --green-100: #E5EDDE;
  --green-50:  #F1F5EC;
  --ink-900: #2A2A2A;
  --ink-700: #4A4A4A;
  --ink-500: #8A8A8A;
  --ink-300: #C8C5BF;
  --bg:       #F4F1EC;
  --card:     #FFFFFF;
  --line:     #ECE8E1;
  --danger:   #C9614F;
  --shadow:   0 1px 2px rgba(60,60,60,0.04), 0 6px 18px rgba(60,60,60,0.05);
  --radius:   16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

/* ===== 状态栏（已隐藏，App 内部不显示时间/灵动岛）===== */
.status-bar { display: none !important; }

/* ===== 侧边栏 ===== */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
  z-index: 200;
}
.drawer-mask.show { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 78%; max-width: 320px;
  background: var(--card);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
  box-shadow: 4px 0 20px rgba(0,0,0,0.08);
  padding-top: var(--safe-top);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 8px 22px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--green-700); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.user-name { font-size: 18px; font-weight: 700; color: var(--green-900); }
.user-sub  { font-size: 13px; color: var(--ink-500); margin-top: 2px; }

.drawer-nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 14px 14px; border-radius: 12px;
  font-size: 15px; color: var(--ink-700);
  transition: background .15s;
  text-align: left;
}
.nav-item .nav-emoji { font-size: 20px; width: 24px; text-align: center; }
.nav-item:hover { background: var(--green-50); }
.nav-item.active {
  background: var(--green-700); color: #fff;
  box-shadow: 0 4px 12px rgba(92,127,79,0.25);
}
.nav-item.active .nav-emoji { filter: brightness(1.2); }

.drawer-footer {
  padding: 12px 16px calc(20px + var(--safe-bot));
  border-top: 1px solid var(--line);
}
.footer-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border-radius: 12px;
  font-size: 14px; color: var(--danger);
  background: #FBEEEC;
}

/* ===== 主内容 ===== */
.main {
  min-height: 100vh;
  padding-top: var(--safe-top);
  padding-bottom: calc(20px + var(--safe-bot));
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
@media (display-mode: standalone) {
  .main { padding-top: var(--safe-top); }
  .topbar { position: sticky; top: var(--safe-top); }
  .drawer { padding-top: var(--safe-top); }
}
.main.shifted { transform: translateX(78%); }

.topbar {
  position: sticky; top: var(--safe-top);
  background: var(--bg);
  padding: 10px 16px 12px;
  display: flex; align-items: center; gap: 8px;
  z-index: 50;
}
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; color: var(--ink-900);
}
.icon-btn:active { background: rgba(0,0,0,0.05); }
.topbar-title { font-size: 18px; font-weight: 700; margin: 0; flex: 1; }
.topbar-date  { font-size: 13px; color: var(--ink-500); white-space: nowrap; }

.content { padding: 4px 16px 16px; }

/* ===== 卡片基础 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

/* ===== 概览卡 ===== */
.overview-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.overview-title { font-size: 17px; font-weight: 700; color: var(--ink-900); }
.overview-desc  { font-size: 13px; color: var(--ink-500); margin: 6px 0 0; line-height: 1.55; max-width: 220px; }
.sync-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green-50); color: var(--green-700);
  padding: 8px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--green-100);
  flex-shrink: 0;
}
.sync-btn:active { transform: scale(0.97); }
.sync-icon { display: inline-block; transition: transform .6s; }
.sync-btn.spinning .sync-icon { transform: rotate(360deg); }

.stat-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.stat-card {
  background: var(--green-50);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card.highlight { background: var(--green-100); }
.stat-num { font-size: 28px; font-weight: 800; color: var(--green-900); letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--ink-500); }

/* ===== 任务卡 ===== */
.task-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.task-title { font-size: 17px; font-weight: 700; margin: 0; color: var(--ink-900); }
.add-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green-700); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(92,127,79,0.3);
}
.add-btn:active { transform: scale(0.92); }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  background: var(--green-50);
  border-radius: 12px;
  position: relative;
  transition: opacity .2s, background .2s;
  animation: slideIn .25s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.task-item.done { background: #F4F1EC; opacity: 0.65; }
.task-item.done .task-text { text-decoration: line-through; color: var(--ink-500); }

.checkbox {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--green-500);
  display: grid; place-items: center;
  flex-shrink: 0; background: #fff;
  transition: background .2s, border-color .2s;
}
.checkbox.checked { background: var(--green-700); border-color: var(--green-700); }
.checkbox.checked::after {
  content: ''; width: 10px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px,-1px);
}
.task-body { flex: 1; min-width: 0; cursor: pointer; }
.task-text { font-size: 15px; color: var(--ink-900); font-weight: 500; }
.task-meta {
  font-size: 12px; color: var(--ink-500); margin-top: 3px;
  display: flex; align-items: center; gap: 4px;
}
.task-meta::before { content: '\23F1'; }
.task-actions { display: flex; gap: 6px; align-items: center; }
.act-btn {
  padding: 5px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--green-700); background: var(--green-50);
  white-space: nowrap;
}
.act-btn:active { background: var(--green-100); }
.act-btn.del { color: var(--danger); background: #FBEEEC; }
.act-btn.del:active { background: #F4D9D3; }

.empty-tip {
  text-align: center; padding: 28px 12px; color: var(--ink-500);
}
.empty-emoji { font-size: 36px; margin-bottom: 6px; }
.empty-tip p { margin: 0; font-size: 13px; }

.bottom-spacer { height: 24px; }

/* ===== 底部弹层（添加任务） ===== */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; transition: opacity .2s;
  z-index: 300;
}
.sheet-mask.show { opacity: 1; pointer-events: auto; }

.sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(20px + var(--safe-bot));
  z-index: 301;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 -8px 24px rgba(0,0,0,0.08);
}
.sheet.show { transform: translateY(0); }
.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--ink-300); margin: 0 auto 12px;
}
.sheet-title { margin: 4px 0 14px; font-size: 17px; font-weight: 700; text-align: center; }
.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; color: var(--ink-500); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #FAFAF8; outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus { border-color: var(--green-500); background: #fff; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.btn {
  flex: 1; padding: 13px; border-radius: 12px;
  font-size: 15px; font-weight: 600;
  transition: opacity .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn-ghost   { background: #F0EDE7; color: var(--ink-700); }
.btn-primary { background: var(--green-700); color: #fff; }

/* ===== 爆款热点卡片流 ===== */
.hot-content { padding-top: 8px; }
.hot-filter {
  display: flex; gap: 8px; padding: 0 16px 12px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.filter-chip {
  padding: 7px 16px; border-radius: 999px;
  background: #fff; color: var(--ink-700);
  border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.filter-chip.active {
  background: var(--green-700); color: #fff;
  border-color: var(--green-700);
  box-shadow: 0 4px 10px rgba(92,127,79,0.25);
}

.hot-list { display: flex; flex-direction: column; gap: 14px; }
.hot-card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  animation: slideIn .3s ease;
}
.hot-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.hot-card-title {
  font-size: 17px; font-weight: 700; color: var(--ink-900);
  line-height: 1.35; flex: 1;
}
.hot-tag {
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--green-100); color: var(--green-700);
  white-space: nowrap;
}
.hot-heat {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: #E67E22; font-weight: 600;
  margin-bottom: 12px;
}
.hot-section {
  margin-bottom: 10px;
}
.hot-section-title {
  font-size: 13px; font-weight: 700; color: var(--ink-700);
  margin-bottom: 4px;
}
.hot-section-text {
  font-size: 14px; color: var(--ink-700); line-height: 1.6;
}
.hot-source {
  font-size: 12px; color: var(--ink-500); margin: 10px 0 12px;
}
.hot-video-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px; border-radius: 10px;
  background: var(--green-700); color: #fff;
  font-size: 14px; font-weight: 600;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(92,127,79,0.25);
}
.hot-video-btn:active { transform: scale(0.98); }
.hot-video-desc {
  background: var(--green-50); border-radius: 10px;
  padding: 12px; font-size: 13px; color: var(--ink-700); line-height: 1.55;
  margin-bottom: 14px;
}
.hot-video-desc::before { content: '🎬 '; }
.hot-actions {
  display: flex; gap: 8px;
}
.hot-actions .act-pill {
  flex: 1; padding: 10px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-700);
}
.hot-actions .act-pill.primary {
  background: var(--green-700); color: #fff; border-color: var(--green-700);
}
.hot-actions .act-pill.saved {
  background: #FFF8E1; color: #E6A817; border-color: #FFE082;
}
.hot-actions .act-pill:active { transform: scale(0.98); }

.hot-fab {
  position: fixed; right: 16px; bottom: calc(24px + var(--safe-bot));
  padding: 12px 18px; border-radius: 999px;
  background: var(--green-700); color: #fff;
  font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 18px rgba(92,127,79,0.35);
  z-index: 60;
  display: flex; align-items: center; gap: 6px;
}
.hot-fab:active { transform: scale(0.96); }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: calc(40px + var(--safe-bot));
  transform: translateX(-50%) translateY(20px);
  background: rgba(40,40,40,0.92); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 400;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 平板/桌面：居中显示 ===== */
@media (min-width: 640px) {
  body { background: #EDE9E0; }
  .main, .status-bar, .drawer, .drawer-mask {
    max-width: 420px; margin: 0 auto;
  }
  .drawer { left: 50%; transform: translateX(calc(-50% - 320px)); margin-left: -210px; }
  .drawer.open { transform: translateX(-100%); }
  .main.shifted { transform: translateX(78%); }
  .drawer-mask { max-width: 420px; }
}
