/* 起飞打卡 — 深色主题，手机优先 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0b0e1a;
  --card: #141936;
  --line: #232a4d;
  --text: #e8ebf7;
  --muted: #8a91b4;
  --acc1: #6366f1;
  --acc2: #a855f7;
  --danger: #ef4444;
}

html { color-scheme: dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(99, 102, 241, .18), transparent 60%),
    radial-gradient(800px 400px at -10% 20%, rgba(168, 85, 247, .12), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app { max-width: 560px; margin: 0 auto; padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 2px 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 22px; background: #1a2040; border: 1px solid var(--line); border-radius: 12px; padding: 7px 9px; }
.topbar h1 { font-size: 18px; letter-spacing: .5px; }
.topbar .brand p { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ---------- 通用 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 15px; margin-bottom: 12px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 0; }
.hidden { display: none !important; }
.tab { display: none; }
.tab.active { display: block; }
a { color: var(--acc2); }

.ghost-btn {
  background: #1a2040; color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 14px; font-size: 13px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; font-family: inherit;
}
.ghost-btn:active { transform: scale(.97); }
.ghost-btn.round { width: 36px; height: 36px; padding: 0; font-size: 18px; line-height: 1; }
.ghost-btn.danger { color: #fca5a5; border-color: rgba(239, 68, 68, .4); }

.big-btn {
  width: 100%; border: none; border-radius: 16px; padding: 15px 12px;
  font-size: 17px; font-weight: 700; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--acc1), var(--acc2));
  box-shadow: 0 8px 24px rgba(124, 92, 246, .35);
  font-family: inherit;
}
.big-btn:active { transform: scale(.98); }
.big-btn.secondary { background: #1a2040; border: 1px solid var(--line); box-shadow: none; color: var(--text); }
.big-btn.small { padding: 11px; font-size: 15px; }

.action-row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; margin-bottom: 8px; }
.row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.row.right { justify-content: flex-end; margin-top: 16px; }
.row.wrap { flex-wrap: wrap; }

/* ---------- 今日概览 ---------- */
.today-grid { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; margin-bottom: 12px; }
.today-grid.four { grid-template-columns: repeat(4, 1fr); margin-bottom: 0; }
.stat b { display: block; font-size: 24px; background: linear-gradient(135deg, #c7d2fe, #e9d5ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat span { font-size: 12px; color: var(--muted); }
.progress { height: 8px; background: #1a2040; border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--acc1), var(--acc2)); transition: width .4s; }

/* ---------- 横幅 / 计时提示 ---------- */
.banner {
  background: rgba(127, 29, 29, .35); border: 1px solid rgba(239, 68, 68, .45);
  color: #fecaca; border-radius: 14px; padding: 11px 14px; font-size: 14px; margin-bottom: 12px;
}
#timerHint { text-align: center; margin: 10px 0 2px; }
#timerHint b { color: var(--acc2); font-variant-numeric: tabular-nums; }

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head h2 { margin: 0; font-size: 16px; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: #1a2040; font-size: 13px;
}
.cell.blank { background: transparent; }
.cell.future { opacity: .35; }
.cell.lv1 { background: #373a8a; }
.cell.lv2 { background: #5b5fd6; }
.cell.lv3 { background: #f97316; }
.cell.today { outline: 2px solid var(--acc2); outline-offset: 1px; }
.legend { font-size: 12px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.legend .d1 { background: #373a8a; } .legend .d2 { background: #5b5fd6; } .legend .d3 { background: #f97316; }

/* ---------- 30 天柱状图 ---------- */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.bars .bar { flex: 1; min-height: 4px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--acc2), var(--acc1)); }
.bars .bar.zero { background: #1f2547; }
.bar-labels { display: flex; gap: 3px; margin-top: 6px; }
.bar-labels span { flex: 1; font-size: 11px; color: var(--muted); text-align: center; overflow: hidden; white-space: nowrap; }

/* ---------- 记录列表 ---------- */
.list .item { padding: 10px 2px; border-bottom: 1px dashed var(--line); }
.list .item:last-child { border-bottom: none; }
.item-main { display: flex; align-items: baseline; gap: 8px; }
.item-main b { font-size: 15px; font-variant-numeric: tabular-nums; }
.item-date { font-size: 12px; color: var(--muted); }
.item-main .dur { margin-left: auto; font-size: 13px; color: #c7d2fe; }
.item .note { font-size: 13px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.item-ops { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.item-ops .op { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; font-size: 12px; padding: 3px 10px; cursor: pointer; }
.day-h { font-size: 13px; color: var(--muted); font-weight: 600; margin: 12px 0 2px; display: flex; justify-content: space-between; }
#recordList .item:first-of-type { border-top: none; }

/* ---------- 设置 ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; background: #1a2040; border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 15px; font-family: inherit;
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--acc1); }
.field .row input[type="time"] { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 4px 0 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--acc1); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.chip { background: #1a2040; border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.chip .rm { margin-left: 4px; color: var(--muted); cursor: pointer; }
.chip .rm:hover { color: var(--danger); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: min(100%, 560px); display: flex;
  background: rgba(13, 17, 34, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 6px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tabbar button {
  flex: 1; background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 20px; padding: 4px 0; font-family: inherit;
}
.tabbar button span { display: block; font-size: 11px; margin-top: 1px; }
.tabbar button.active { color: #c7d2fe; }
.tabbar button.active span { font-weight: 700; }

/* ---------- 弹窗 / 提示 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 7, 18, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 16px;
}
.modal-box {
  width: min(100%, 420px); background: #161b3a; border: 1px solid var(--line);
  border-radius: 20px; padding: 20px; animation: pop .18s ease-out;
}
.modal-box h2 { font-size: 16px; margin-bottom: 14px; }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #1f2749; border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 99px; font-size: 14px; z-index: 60;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45); max-width: 86vw; text-align: center;
}

/* 桌面端微调 */
@media (min-width: 720px) {
  #app { padding-top: 26px; }
  .big-btn { font-size: 18px; }
}
