﻿/* ==========================================================
   星火计划 FocusSpark — 样式
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #070b16;
  --bg-2: #0c1322;
  --text: #eaf0ff;
  --muted: #8d9ab6;
  --card: #111a2b;
  --card-2: #16213a;
  --glass: rgba(255, 255, 255, .055);
  --glass-2: rgba(255, 255, 255, .09);
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .18);
  --accent: #ffb454;
  --accent-2: #ff8a3c;
  --accent-soft: rgba(255, 180, 84, .14);
  --blue: #7c96ff;
  --green: #3ddc97;
  --red: #ff7285;
  --purple: #b98cff;
  --shadow: 0 20px 45px -22px rgba(0, 0, 0, .9);
  --track: rgba(255, 255, 255, .08);
  --toast-bg: #1b2740;
  --sheet: #101827;
  --radius: 20px;
}

[data-theme="light"] {
  --bg: #eef2f9;
  --bg-2: #f7f9fe;
  --text: #101a33;
  --muted: #5f6d8c;
  --card: #ffffff;
  --card-2: #f4f7fd;
  --glass: #ffffff;
  --glass-2: #f4f7fd;
  --line: rgba(16, 26, 51, .10);
  --line-strong: rgba(16, 26, 51, .20);
  --accent: #e8890c;
  --accent-2: #f29b1c;
  --accent-soft: rgba(232, 137, 12, .12);
  --blue: #3f66e0;
  --green: #0f9d63;
  --red: #e0455c;
  --purple: #7c4dff;
  --shadow: 0 18px 40px -26px rgba(20, 35, 70, .38);
  --track: rgba(16, 26, 51, .08);
  --toast-bg: #101a33;
  --sheet: #ffffff;
}

html { height: 100%; -webkit-text-size-adjust: 100%; color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 620px at 8% -10%, rgba(108, 140, 255, .20), transparent 62%),
    radial-gradient(760px 560px at 102% 2%, rgba(255, 180, 84, .16), transparent 58%),
    radial-gradient(600px 500px at 50% 110%, rgba(124, 150, 255, .12), transparent 65%),
    var(--bg);
}

[data-theme="light"] body::before {
  background:
    radial-gradient(900px 620px at 8% -10%, rgba(108, 140, 255, .22), transparent 62%),
    radial-gradient(760px 560px at 102% 2%, rgba(255, 170, 70, .22), transparent 58%),
    var(--bg);
}

svg { display: block; }
svg:not(.ring) { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 15px; height: 15px; }

button { font-family: inherit; }
[hidden] { display: none !important; }
input, select, textarea { font-family: inherit; }
::selection { background: rgba(255, 180, 84, .35); }

/* ---------- 布局 ---------- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 18px;
}

@media (min-width: 560px) {
  .app {
    border-inline: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .022), transparent 320px);
  }
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 0 12px;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 13px;
  background: linear-gradient(140deg, #ffd98a, #ff9a3c);
  box-shadow: 0 8px 20px -10px rgba(255, 154, 60, .9);
  color: #2b1700;
  flex: 0 0 auto;
}
.logo svg { width: 21px; height: 21px; fill: currentColor; stroke: none; }

.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 16.5px; letter-spacing: .6px; }
.brand-text span { font-size: 10.5px; color: var(--muted); letter-spacing: .4px; }

.top-actions { display: flex; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  transition: background .2s, transform .12s, border-color .2s;
}
.icon-btn:hover { background: var(--glass-2); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.lg { width: 46px; height: 46px; border-radius: 15px; }
.icon-btn.lg svg { width: 20px; height: 20px; }

main {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 0 132px;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
main::-webkit-scrollbar { display: none; }

.view { display: none; }
.view.is-active { display: block; animation: fadeUp .34s cubic-bezier(.2, .8, .3, 1); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 24px 2px 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 620;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.count { font-size: 11.5px; color: var(--muted); font-weight: 400; }

.hint { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.7; margin: 12px 6px 0; }

/* ---------- 通用按钮 ---------- */
.primary {
  border: 0;
  border-radius: 14px;
  height: 44px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #2b1700;
  background: linear-gradient(135deg, #ffd98a, #ff9a3c);
  box-shadow: 0 10px 24px -12px rgba(255, 154, 60, .95);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .14s, filter .2s, opacity .2s;
}
.primary:hover { filter: brightness(1.04); }
.primary:active { transform: scale(.97); }
.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.primary.sm { height: 32px; padding: 0 13px; font-size: 12.5px; border-radius: 10px; }
.primary.xl { height: 58px; flex: 1; font-size: 16px; border-radius: 18px; }

.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 40px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .12s;
}
.ghost:hover { background: var(--glass); border-color: var(--line-strong); }
.ghost:active { transform: scale(.97); }
.ghost.sm { height: 32px; padding: 0 11px; font-size: 12px; border-radius: 10px; }
.ghost.lg { height: 46px; padding: 0 16px; border-radius: 15px; font-size: 13px; }
.ghost.danger { color: var(--red); border-color: rgba(255, 114, 133, .35); }
.ghost:disabled { opacity: .38; cursor: not-allowed; }
.ghost:disabled:hover { background: transparent; border-color: var(--line); }
select option { background: var(--sheet); color: var(--text); }
.task:focus-visible, .tab:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- 卡片 ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 14px;
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 620; letter-spacing: .4px; }

/* ---------- 今日 · Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px 18px 16px;
  background:
    linear-gradient(150deg, rgba(255, 180, 84, .17), rgba(124, 150, 255, .12) 58%, rgba(255, 255, 255, .02));
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 190px; height: 190px;
  right: -78px; top: -96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 196, 110, .38), transparent 68%);
  pointer-events: none;
}
[data-theme="light"] .hero {
  background:
    linear-gradient(150deg, #fff6e6, #eef3ff 62%, #ffffff);
  border-color: rgba(226, 158, 70, .22);
}
[data-theme="light"] .hero::after { background: radial-gradient(circle, rgba(255, 190, 100, .26), transparent 68%); }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-date { font-size: 12px; color: var(--muted); letter-spacing: .6px; }
.streak-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  color: #ffd8a1;
  background: rgba(255, 138, 60, .16);
  border: 1px solid rgba(255, 170, 90, .25);
}
[data-theme="light"] .streak-pill { color: #b45500; background: rgba(255, 170, 80, .18); }
.streak-pill svg { width: 13px; height: 13px; fill: currentColor; stroke: none; }

.hero-greet { margin: 9px 0 16px; font-size: 17px; font-weight: 600; letter-spacing: .4px; }

.hero-main { display: flex; align-items: center; gap: 16px; }

.goal-ring { position: relative; width: 82px; height: 82px; flex: 0 0 auto; }
.goal-ring svg { width: 82px; height: 82px; }
.goal-ring .gr-track { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 7; }
.goal-ring .gr-fg {
  fill: none; stroke: #ffc46b; stroke-width: 7; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: center;
  transition: stroke-dashoffset .7s cubic-bezier(.2, .8, .3, 1);
}
[data-theme="light"] .goal-ring .gr-track { stroke: rgba(20, 30, 60, .1); }
[data-theme="light"] .goal-ring .gr-fg { stroke: #f08c0a; }
.goal-ring .gr-text {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.goal-ring .gr-text small { font-size: 8.5px; font-weight: 400; color: var(--muted); letter-spacing: .5px; }

.hero-num { flex: 1; min-width: 0; }
.hero-minutes { display: flex; align-items: baseline; gap: 6px; }
.hero-minutes b {
  font-size: 38px; font-weight: 300; line-height: 1;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}
.hero-minutes span { font-size: 11.5px; color: var(--muted); }
.hero-sub { margin-top: 7px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.hero-sub b { color: var(--text); font-weight: 600; }

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.hero-stats > div { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 1px solid var(--line); }
.hero-stats > div:first-child { padding-left: 0; border-left: 0; }
.hero-stats b { font-size: 16px; font-weight: 620; font-variant-numeric: tabular-nums; }
.hero-stats b i { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 400; }
.hero-stats span { font-size: 10.5px; color: var(--muted); letter-spacing: .3px; }

/* ---------- 今日 · 下一项 ---------- */
.next-card {
  margin-top: 14px;
  padding: 15px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 180, 84, .28);
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, .025));
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
}
.next-card::before {
  content: "";
  position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #ffd479, #ff8a3c);
}
.next-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.next-label { font-size: 11px; letter-spacing: .8px; color: var(--accent); font-weight: 600; }
.next-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.next-title { font-size: 16px; font-weight: 620; margin-top: 3px; }
.next-meta { font-size: 11.5px; color: var(--muted); }
.next-actions { display: flex; gap: 8px; margin-top: 10px; }
.next-card.is-empty { border-style: dashed; border-color: var(--line); background: var(--glass); }
.next-card.is-empty::before { display: none; }
.next-card.is-late {
  border-color: rgba(255, 114, 133, .42);
  background: linear-gradient(135deg, rgba(255, 114, 133, .13), rgba(255, 255, 255, .02));
}
.next-card.is-late::before { background: linear-gradient(180deg, #ff9aa8, #e0455c); }
.next-card.is-late .next-label { color: var(--red); }

/* ---------- 任务列表 ---------- */
.task-list { display: flex; flex-direction: column; gap: 10px; }

.task {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 12px 12px 15px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--glass);
  transition: background .2s, border-color .2s, opacity .2s, transform .15s;
  cursor: pointer;
}
.task:hover { background: var(--glass-2); border-color: var(--line-strong); }
.task::before {
  content: "";
  position: absolute; left: 0; top: 15px; bottom: 15px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.task[data-priority="important"]::before { background: var(--blue); }
.task[data-priority="urgent"]::before { background: var(--red); }
.task.overdue { border-color: rgba(255, 114, 133, .20); }
.task.overdue::before { background: var(--red); }
.task.done { opacity: .5; }
.task.done .task-title { text-decoration: line-through; text-decoration-color: var(--muted); }

.task-time {
  flex: 0 0 46px;
  display: flex; flex-direction: column; gap: 1px;
  font-variant-numeric: tabular-nums;
}
.task-time b { font-size: 14.5px; font-weight: 620; letter-spacing: .2px; }
.task-time span { font-size: 10px; color: var(--muted); }

.task-body { flex: 1; min-width: 0; }
.task-title {
  font-size: 14px; font-weight: 540; letter-spacing: .2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.task-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
  margin-top: 4px; font-size: 10.5px; color: var(--muted);
}
.task-meta .warn { color: var(--red); }
.tag {
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(124, 150, 255, .16);
  color: #aabfff;
  font-size: 10px;
}
[data-theme="light"] .tag { background: rgba(63, 102, 224, .1); color: #3f66e0; }
.tag.repeat { background: rgba(185, 140, 255, .16); color: #cdaeff; }
[data-theme="light"] .tag.repeat { background: rgba(124, 77, 255, .1); color: #6a3ce0; }

.task-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.check {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1.6px solid rgba(255, 255, 255, .28);
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all .18s;
}
.check svg { width: 15px; height: 15px; stroke-width: 2.4; opacity: 0; transition: opacity .15s; }
.check:hover { border-color: var(--green); color: var(--green); }
.task.done .check { background: var(--green); border-color: var(--green); color: #04150c; }
[data-theme="light"] .task:not(.done) .check { border-color: rgba(16, 26, 51, .28); }
.task.done .check svg { opacity: 1; }
.play {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 180, 84, .3);
  background: var(--accent-soft);
  color: var(--accent);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform .15s, filter .2s;
}
.play svg { width: 12px; height: 12px; fill: currentColor; stroke: none; margin-left: 1px; }
.play:hover { filter: brightness(1.15); transform: scale(1.05); }

/* ---------- 计划页 ---------- */
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all .2s;
}
.chip:hover { color: var(--text); }
.chip.is-active {
  color: #2b1700;
  background: linear-gradient(135deg, #ffd98a, #ff9a3c);
  border-color: transparent;
  font-weight: 600;
}

.plan-group { margin-top: 18px; }
.plan-group:first-child { margin-top: 14px; }
.plan-date {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12px; color: var(--muted);
  margin: 0 2px 8px;
}
.plan-date b { font-size: 13px; color: var(--text); font-weight: 600; }
.plan-date .today-mark {
  font-size: 10px; color: var(--accent);
  border: 1px solid rgba(255, 180, 84, .35);
  padding: 0 6px; border-radius: 5px;
}

/* ---------- 专注页 ---------- */
.mode-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 6px; }
.mode {
  padding: 10px 6px 9px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: all .2s;
}
.mode b { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.mode span { font-size: 10px; color: var(--muted); }
.mode.is-active {
  border-color: rgba(255, 180, 84, .5);
  background: var(--accent-soft);
}
.mode.is-active b { color: var(--accent); }

.timer-card {
  position: relative;
  display: grid;
  place-items: center;
  margin: 10px auto 4px;
  width: 100%;
  max-width: 330px;
}
.ring { width: 100%; height: auto; }
.ring-track { fill: none; stroke: var(--track); stroke-width: 9; }
.ring-progress {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 9;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 120px 120px;
  transition: stroke-dashoffset .3s linear;
}
.timer-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  pointer-events: none;
}
.timer-phase { font-size: 10px; letter-spacing: 4px; color: var(--accent); font-weight: 600; }
.timer-time {
  font-size: clamp(44px, 14vw, 60px);
  font-weight: 300;
  letter-spacing: 1px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.timer-state { font-size: 11.5px; color: var(--muted); }
.timer-card.is-running .ring-progress { filter: drop-shadow(0 0 8px rgba(255, 160, 60, .45)); }

.focus-setup { display: grid; grid-template-columns: 1fr 1.25fr; gap: 9px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 10.5px; color: var(--muted); letter-spacing: .4px; margin-left: 2px; }
.field input, .field select, .field textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s, background .2s;
  appearance: none;
}
.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 19px, calc(100% - 11px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 62px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(255, 180, 84, .55);
  background: var(--glass-2);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .7; }

.timer-actions {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
}

.session-list { display: flex; flex-direction: column; gap: 8px; }
.session {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--glass);
  font-size: 12px;
}
.session-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex: 0 0 auto;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.session-subject { font-weight: 600; font-size: 12.5px; }
.session-time { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.session-mins { color: var(--accent); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }

/* ---------- 数据页 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--glass);
  padding: 14px 15px;
  display: flex; flex-direction: column; gap: 2px;
}
.stat-label { font-size: 10.5px; color: var(--muted); letter-spacing: .3px; }
.stat-value { font-size: 26px; font-weight: 300; letter-spacing: -.3px; font-variant-numeric: tabular-nums; margin-top: 3px; }
.stat-value small { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 3px; letter-spacing: 0; }
.stat-foot { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.chart { display: flex; align-items: stretch; gap: 7px; height: 156px; padding-top: 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.bar-val { font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; height: 12px; }
.bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar {
  width: min(100%, 26px);
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #ffd479, #ff8a3c);
  min-height: 3px;
  transition: height .5s cubic-bezier(.2, .8, .3, 1);
}
.bar.zero { background: var(--track); }
.bar-label { font-size: 10px; color: var(--muted); }
.bar-col.today .bar-label { color: var(--accent); font-weight: 600; }
.bar-col.today .bar { background: linear-gradient(180deg, #ffe2a3, #ff8a3c); box-shadow: 0 0 18px -4px rgba(255, 160, 60, .75); }

.subject-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.subject-row:last-child { margin-bottom: 0; }
.subject-name { flex: 0 0 62px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject-bar { flex: 1; height: 7px; border-radius: 999px; background: var(--track); overflow: hidden; }
.subject-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffcf6b, #ff9a3c); }
.subject-row:nth-child(2n) .subject-bar i { background: linear-gradient(90deg, #9db4ff, #6c8cff); }
.subject-row:nth-child(3n) .subject-bar i { background: linear-gradient(90deg, #d3b3ff, #a97cff); }
.subject-row:nth-child(4n) .subject-bar i { background: linear-gradient(90deg, #9ff0c8, #3ddc97); }
.subject-val { flex: 0 0 auto; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.heat-cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  background: var(--track);
  border: 1px solid transparent;
}
.heat-cell[data-lv="1"] { background: rgba(255, 180, 84, .22); }
.heat-cell[data-lv="2"] { background: rgba(255, 180, 84, .42); }
.heat-cell[data-lv="3"] { background: rgba(255, 170, 70, .68); }
.heat-cell[data-lv="4"] { background: #ffb454; }
.heat-cell.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.heat-legend { display: flex; align-items: center; gap: 5px; justify-content: flex-end; margin-top: 10px; font-size: 9.5px; color: var(--muted); }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--track); }
.heat-legend i[data-lv="1"] { background: rgba(255, 180, 84, .22); }
.heat-legend i[data-lv="2"] { background: rgba(255, 180, 84, .42); }
.heat-legend i[data-lv="3"] { background: rgba(255, 170, 70, .68); }
.heat-legend i[data-lv="4"] { background: #ffb454; }

/* ---------- 奖励页 ---------- */
.level-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(185, 140, 255, .28), transparent 55%),
    linear-gradient(140deg, rgba(255, 180, 84, .18), rgba(124, 150, 255, .12));
  box-shadow: var(--shadow);
}
[data-theme="light"] .level-card {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(185, 140, 255, .16), transparent 55%),
    linear-gradient(140deg, #fff7e9, #f1f4ff);
}
.level-head { display: flex; align-items: center; gap: 12px; }
.lvl-badge {
  width: 54px; height: 54px;
  flex: 0 0 auto;
  border-radius: 17px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #ffd98a, #ff9a3c);
  color: #2b1700;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.3px;
  box-shadow: 0 10px 24px -12px rgba(255, 154, 60, .9);
}
.lvl-info { flex: 1; min-width: 0; }
.lvl-info b { display: block; font-size: 15px; letter-spacing: .4px; }
.lvl-info p { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
.coin-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 180, 84, .35);
  background: rgba(255, 180, 84, .12);
  font-size: 12px; font-weight: 700;
  color: #ffd8a1;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
[data-theme="light"] .coin-badge { color: #a35400; }
.coin-badge svg { width: 14px; height: 14px; }
.coin { width: 13px; height: 13px; flex: 0 0 auto; }
.coin-badge { gap: 5px; }
.shop-cost .coin { width: 12px; height: 12px; }
html.shot *, html.shot *::before, html.shot *::after { animation: none !important; transition: none !important; }

.meter { height: 7px; border-radius: 999px; background: var(--track); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffd479, #ff8a3c); transition: width .6s cubic-bezier(.2, .8, .3, 1); }
.level-card .meter { margin-top: 15px; }
.level-foot { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 7px; }

.quest-list, .shop-list, .redeem-list { display: flex; flex-direction: column; gap: 8px; }

.quest {
  display: flex; align-items: center; gap: 11px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--glass);
}
.quest-icon {
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--glass-2);
  font-size: 17px;
}
.quest-body { flex: 1; min-width: 0; }
.quest-title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.quest-title .q-coins { font-size: 10px; color: var(--accent); font-weight: 600; }
.quest-progress { margin-top: 7px; display: flex; align-items: center; gap: 8px; }
.quest-progress .meter { flex: 1; height: 5px; }
.quest-progress .meter > i { background: linear-gradient(90deg, #9db4ff, #6c8cff); }
.quest-num { font-size: 9.5px; color: var(--muted); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.quest .primary.sm { flex: 0 0 auto; }
.quest.is-done { opacity: .65; }

.shop-item {
  display: flex; align-items: center; gap: 11px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--glass);
}
.shop-icon {
  width: 38px; height: 38px; flex: 0 0 auto;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  font-size: 17px;
}
.shop-body { flex: 1; min-width: 0; }
.shop-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-cost { font-size: 10.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.shop-cost b { color: var(--accent); font-weight: 600; }
.shop-item .primary.sm { min-width: 62px; }
.shop-item .ghost.sm { min-width: 62px; }
.shop-item.is-afford { border-color: rgba(255, 180, 84, .28); }

.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.ach {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 13px 6px 11px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--glass);
  text-align: center;
}
.ach-icon { font-size: 21px; filter: saturate(1.1); line-height: 1.2; }
.ach-name { font-size: 10.5px; font-weight: 600; letter-spacing: .2px; }
.ach-desc { font-size: 9px; color: var(--muted); line-height: 1.35; }
.ach.locked { opacity: .38; }
.ach.locked .ach-icon { filter: grayscale(1); }
.ach.unlocked { border-color: rgba(255, 180, 84, .3); background: var(--accent-soft); }

.redeem {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--glass);
  border: 1px solid var(--line);
  font-size: 11.5px;
}
.redeem .r-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.redeem .r-cost { color: var(--accent); font-weight: 600; }
.redeem .r-time { color: var(--muted); font-size: 10px; }

/* ---------- 空状态 / 提示条 ---------- */
.empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
  border: 1px dashed var(--line);
  border-radius: 18px;
}
.empty .emoji { font-size: 28px; display: block; margin-bottom: 8px; opacity: .9; }
.empty b { color: var(--text); font-weight: 600; }

.notice {
  display: flex; align-items: center; gap: 11px;
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid rgba(124, 150, 255, .28);
  background: rgba(124, 150, 255, .1);
}
.notice > svg { flex: 0 0 auto; color: var(--blue); width: 18px; height: 18px; }
.notice div { flex: 1; min-width: 0; }
.notice b { font-size: 12px; font-weight: 600; display: block; }
.notice p { margin: 2px 0 0; font-size: 10.5px; color: var(--muted); line-height: 1.5; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--bg) 26%);
  z-index: 40;
}
.tabbar::before {
  content: "";
  position: absolute; inset: 18px 12px 0;
  border-radius: 22px;
  background: var(--sheet);
  border: 1px solid var(--line);
  box-shadow: 0 -8px 30px -12px rgba(0, 0, 0, .5);
  z-index: -1;
  opacity: .96;
  backdrop-filter: blur(20px);
}
.tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  padding: 7px 0 5px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: color .2s, background .2s;
  letter-spacing: .3px;
}
.tab svg { width: 21px; height: 21px; stroke-width: 1.7; transition: transform .2s; }
.tab.is-active { color: var(--accent); }
.tab.is-active svg { transform: translateY(-1px); }
.tab.is-active::after {
  content: "";
  position: absolute;
  bottom: 1px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px 1px rgba(255, 180, 84, .7);
}

/* ---------- 弹窗 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(3, 7, 15, .62);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s ease;
}
.modal {
  width: min(520px, 100%);
  max-height: 91dvh;
  overflow-y: auto;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: sheetIn .3s cubic-bezier(.2, .9, .3, 1);
  box-shadow: 0 -30px 60px -20px rgba(0, 0, 0, .6);
}
@media (min-width: 620px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 24px; animation: popIn .22s ease; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 16px; letter-spacing: .4px; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: grid; place-items: center;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); background: var(--glass); }
.modal-close svg { width: 16px; height: 16px; }

.form { display: flex; flex-direction: column; gap: 12px; }
.form .field > span { font-size: 11px; margin-bottom: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; gap: 8px; margin-top: 6px; }
.form-actions .primary { flex: 1; }
.form-note { font-size: 10.5px; color: var(--muted); line-height: 1.6; margin: 2px 1px 0; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .sr-text b { font-size: 12.5px; font-weight: 550; display: block; }
.switch-row .sr-text span { font-size: 10.5px; color: var(--muted); line-height: 1.45; display: block; margin-top: 2px; }

.switch {
  position: relative;
  width: 44px; height: 26px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--track);
  cursor: pointer;
  transition: background .2s, border-color .2s;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #d7dfef;
  transition: transform .22s cubic-bezier(.2, .9, .3, 1), background .2s;
}
.switch[aria-checked="true"] { background: linear-gradient(135deg, #ffd479, #ff9a3c); border-color: transparent; }
.switch[aria-checked="true"]::after { transform: translateX(18px); background: #2b1700; }

.settings-group { margin-bottom: 18px; }
.settings-group > h4 {
  margin: 0 0 4px;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.settings-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.settings-actions .ghost, .settings-actions .primary { height: 38px; font-size: 12px; }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: calc(72px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100% - 28px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--toast-bg);
  border: 1px solid var(--line-strong);
  color: #eef2ff;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .75);
  animation: toastIn .28s cubic-bezier(.2, .9, .3, 1);
}
[data-theme="light"] .toast { color: #fff; }
.toast .t-icon { font-size: 15px; line-height: 1; }
.toast.success { border-color: rgba(61, 220, 151, .4); }
.toast.level { border-color: rgba(255, 180, 84, .55); background: linear-gradient(135deg, #3a2a12, #1b2740); }
.toast.out { animation: toastOut .25s ease forwards; }

/* ---------- 提醒弹层 ---------- */
.reminder-root {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(500px, calc(100% - 24px));
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reminder {
  border-radius: 18px;
  border: 1px solid rgba(255, 180, 84, .45);
  background: linear-gradient(140deg, #2a2011, #141d31);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .8);
  padding: 13px 14px;
  animation: sheetIn .3s cubic-bezier(.2, .9, .3, 1);
}
[data-theme="light"] .reminder { background: linear-gradient(140deg, #fff7e8, #ffffff); }
.reminder-top { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--accent); letter-spacing: .6px; font-weight: 600; }
.reminder-top svg { width: 13px; height: 13px; }
.reminder-title { font-size: 14px; font-weight: 620; margin-top: 5px; }
.reminder-meta { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.reminder-actions { display: flex; gap: 7px; margin-top: 10px; }
.reminder-actions .primary { height: 32px; font-size: 11.5px; padding: 0 12px; border-radius: 9px; flex: 1; }
.reminder-actions .ghost { height: 32px; font-size: 11.5px; padding: 0 12px; border-radius: 9px; }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 300; }

/* ---------- 动画 ---------- */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 370px) {
  .app { padding: 0 14px; }
  .hero { padding: 16px 15px 14px; }
  .hero-greet { font-size: 16px; }
  .hero-minutes b { font-size: 33px; }
  .focus-setup { grid-template-columns: 1fr; }
  .timer-actions { grid-template-columns: 46px 1fr; }
  .timer-actions .ghost.lg { grid-column: 1 / -1; }
}
