/* =========================================================
   我的日程助手 — 样式
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #f3f4f8;
  --bg-grad: #e9ebf4;
  --card: #ffffff;
  --card-2: #f7f8fc;
  --ink: #15171e;
  --ink-2: #3b4050;
  --sub: #7b8194;
  --line: #e9ebf2;
  --line-2: #f1f2f7;
  --brand: #5b57f5;
  --brand-2: #8b5cf6;
  --brand-soft: #ecebff;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #e5484d;
  --shadow: 0 10px 30px rgba(24, 27, 48, 0.07), 0 2px 6px rgba(24, 27, 48, 0.04);
  --shadow-sm: 0 2px 8px rgba(24, 27, 48, 0.05);
  --r: 22px;
  --r-sm: 14px;
  --cell: 58px;
  --tab-h: 62px;
}

html[data-theme="dark"] {
  --bg: #0d0f14;
  --bg-grad: #141720;
  --card: #171b23;
  --card-2: #1d222c;
  --ink: #eef1f6;
  --ink-2: #c4cad6;
  --sub: #8b93a5;
  --line: #262b36;
  --line-2: #20242e;
  --brand: #7c79ff;
  --brand-2: #a78bfa;
  --brand-soft: #24224a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
}

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

body.no-scroll { overflow: hidden; }

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 320px;
  background: radial-gradient(120% 100% at 15% 0%, rgba(124, 121, 255, 0.16), transparent 62%),
              radial-gradient(90% 90% at 90% 0%, rgba(139, 92, 246, 0.12), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom));
}

h1, h2, h3, p { margin: 0; }
button { font-family: inherit; font-size: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { display: block; }
input, select { font-family: inherit; }

/* ------------------------- 通用区块 ------------------------- */
.sec { margin-top: 22px; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 10px;
}
.sec-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.sec-sub { font-size: 12px; color: var(--sub); }
.sec-head .icon-btn { width: 30px; height: 30px; }

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
}

.empty-line {
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  padding: 18px 14px;
  color: var(--sub);
  font-size: 13px;
  text-align: center;
  background: color-mix(in srgb, var(--card) 60%, transparent);
}

.hint { font-size: 12px; color: var(--sub); margin-top: 10px; line-height: 1.6; }
.hint.center { text-align: center; }
.foot { text-align: center; font-size: 11px; color: var(--sub); margin: 26px 0 6px; }

/* ------------------------- 顶部页头 ------------------------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 4px 14px;
}
.page-head h1 { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; }
.page-head p { font-size: 12.5px; color: var(--sub); margin-top: 3px; }

/* ------------------------- 按钮 ------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 600;
  background: var(--card-2);
  color: var(--ink);
  transition: transform 0.12s ease, opacity 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 20px rgba(91, 87, 245, 0.3);
}
.btn.ghost { background: color-mix(in srgb, var(--card) 70%, transparent); box-shadow: var(--shadow-sm); }
.btn.danger { color: var(--danger); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn.tiny { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 9px; background: var(--card-2); color: var(--sub); }
.btn.tiny.primary { background: var(--brand-soft); color: var(--brand); box-shadow: none; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--sub);
  flex: none;
}
.icon-btn:active { background: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.del svg { width: 15px; height: 15px; opacity: 0.55; }

/* ------------------------- 今日 hero ------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 26px;
  padding: 20px 20px 18px;
  color: #fff;
  background: linear-gradient(150deg, #5b57f5 0%, #6d5cf7 45%, #8b5cf6 100%);
  box-shadow: 0 18px 40px -12px rgba(91, 87, 245, 0.55);
}
.hero::before {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  right: -70px; top: -110px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35), transparent 65%);
  border-radius: 50%;
}
.hero::after {
  content: "";
  position: absolute;
  width: 160px; height: 160px;
  left: -60px; bottom: -100px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 65%);
  border-radius: 50%;
}
.hero-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-hello { font-size: 13px; opacity: 0.85; letter-spacing: 0.01em; }
.hero-date { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; white-space: nowrap; }
.hero-date span { opacity: 0.55; margin: 0 4px; font-weight: 400; }
.hero-sub { font-size: 12.5px; opacity: 0.82; margin-top: 6px; }

.ring {
  position: relative;
  width: 86px; height: 86px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255, 255, 255, 0.24) 0);
  transition: background 0.4s ease;
}
.ring-in {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #6159f7, #8055f5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.ring-in b { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ring-in b i { font-style: normal; font-size: 12px; font-weight: 500; opacity: 0.6; }
.ring-in span { font-size: 9.5px; opacity: 0.7; margin-top: 2px; letter-spacing: 0.02em; }

.hero-stats {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.hero-stats > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.hero-stats b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 10.5px; opacity: 0.72; }
.hero-stats .vline { flex: none; width: 1px; height: 24px; background: rgba(255, 255, 255, 0.18); margin: 0 4px; }

/* ------------------------- 今日课程 ------------------------- */
.course-list { display: flex; flex-direction: column; gap: 9px; }

.course-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 12px 14px 12px 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}
.course-row:active { transform: scale(0.995); }
.course-time { width: 56px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.course-time b { font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.course-time span { font-size: 10px; color: var(--sub); font-variant-numeric: tabular-nums; }
.course-bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--c); flex: none; }
.course-main { flex: 1; min-width: 0; }
.course-main b { display: block; font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.course-main span { display: block; font-size: 11.5px; color: var(--sub); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  padding: 3px 8px;
  border-radius: 999px;
  flex: none;
}

/* 课程配色 */
.c0 { --c: #6366f1; --cbg: #eef0ff; --ctxt: #4043c9; }
.c1 { --c: #3b82f6; --cbg: #eaf2ff; --ctxt: #1d63c9; }
.c2 { --c: #06b6d4; --cbg: #e5f9fd; --ctxt: #077f95; }
.c3 { --c: #14b8a6; --cbg: #e5faf6; --ctxt: #0b7f72; }
.c4 { --c: #22c55e; --cbg: #e9fbef; --ctxt: #12803b; }
.c5 { --c: #f59e0b; --cbg: #fff6e3; --ctxt: #a56606; }
.c6 { --c: #f97316; --cbg: #fff0e5; --ctxt: #b34c07; }
.c7 { --c: #a855f7; --cbg: #f7ecff; --ctxt: #7a2bc4; }

html[data-theme="dark"] .c0 { --cbg: #23264a; --ctxt: #b9bcff; }
html[data-theme="dark"] .c1 { --cbg: #1b2b45; --ctxt: #9ec8ff; }
html[data-theme="dark"] .c2 { --cbg: #10333c; --ctxt: #7ee5f5; }
html[data-theme="dark"] .c3 { --cbg: #103630; --ctxt: #7ce6d8; }
html[data-theme="dark"] .c4 { --cbg: #123322; --ctxt: #8ce5a9; }
html[data-theme="dark"] .c5 { --cbg: #3a2c12; --ctxt: #fbcb6d; }
html[data-theme="dark"] .c6 { --cbg: #3b2414; --ctxt: #ffb98a; }
html[data-theme="dark"] .c7 { --cbg: #33204a; --ctxt: #d9b0ff; }

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

.day-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 12px;
  margin: 0 -2px;
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
  flex: none;
  width: 52px;
  height: 62px;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: var(--sub);
  position: relative;
  transition: transform 0.15s ease;
}
.day-chip:active { transform: scale(0.95); }
.day-chip b { font-size: 11px; font-weight: 600; }
.day-chip span { font-size: 15.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.day-chip.on {
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 18px rgba(91, 87, 245, 0.28);
  color: rgba(255, 255, 255, 0.9);
}
.day-chip.on span { color: #fff; }
.day-chip .dot { position: absolute; bottom: 6px; width: 4px; height: 4px; border-radius: 50%; background: var(--brand); }
.day-chip.on .dot { background: #fff; }

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 16px;
  padding: 11px 8px 11px 14px;
  box-shadow: var(--shadow-sm);
}
.check {
  width: 24px; height: 24px;
  flex: none;
  border-radius: 50%;
  border: 1.8px solid var(--line);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  transition: all 0.16s ease;
}
.check svg { width: 14px; height: 14px; }
.check.on {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent;
  color: #fff;
}
.task-main { flex: 1; min-width: 0; padding: 2px 0; }
.task-main b { display: block; font-size: 14.5px; font-weight: 550; transition: color 0.2s; }
.task-main span { display: block; font-size: 11px; color: var(--sub); margin-top: 1px; }
.task-row.done .task-main b { color: var(--sub); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--sub) 60%, transparent); }
.task-row.done { opacity: 0.78; }

.add-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 46px;
  border-radius: 16px;
  border: 1.5px dashed var(--line);
  color: var(--sub);
  font-size: 13.5px;
  background: color-mix(in srgb, var(--card) 55%, transparent);
}
.add-row svg { width: 16px; height: 16px; }
.add-row:active { background: var(--line-2); }

/* ------------------------- 结算 / 奖励卡 ------------------------- */
.settle-cta, .settle-lock, .settle-empty, .settle-done { padding: 16px; }

.settle-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.settle-top b { font-size: 15px; font-weight: 650; }
.settle-top span { font-size: 11.5px; color: var(--sub); }
.settle-cta p { font-size: 12.5px; color: var(--sub); margin-bottom: 13px; }
.settle-cta .odds { margin: 10px 0 0; font-size: 10.5px; color: var(--sub); opacity: 0.85; text-align: center; letter-spacing: 0.01em; }

.settle-lock .bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--line-2);
  margin: 12px 0 10px;
  overflow: hidden;
}
.settle-lock .bar i {
  display: block; height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width 0.3s;
}
.settle-lock .bar em { position: absolute; top: -2px; width: 2px; height: 12px; background: var(--sub); opacity: 0.5; }
.settle-lock p { font-size: 12px; color: var(--sub); }

.settle-empty { display: flex; flex-direction: column; gap: 4px; }
.settle-empty b { font-size: 14.5px; }
.settle-empty span { font-size: 12px; color: var(--sub); }

.settle-done { display: flex; align-items: center; gap: 12px; }
.mini-emoji {
  width: 46px; height: 46px;
  flex: none;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 22px;
  background: var(--card-2);
}
.mini-main { flex: 1; min-width: 0; }
.mini-main b { display: block; font-size: 14.5px; font-weight: 650; }
.mini-main span { font-size: 11.5px; color: var(--sub); }
.mini-stamp {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  padding: 4px 9px;
  border-radius: 999px;
  flex: none;
}
.settle-done.rar-legend .mini-emoji { background: linear-gradient(135deg, #fff0c2, #ffd875); }
.settle-done.rar-epic .mini-emoji { background: linear-gradient(135deg, #f3e6ff, #ddc4ff); }

/* ------------------------- 课表 ------------------------- */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--card);
  border-radius: 18px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
}
.week-title { text-align: center; line-height: 1.25; }
.week-title b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.week-title span { font-size: 10.5px; color: var(--sub); font-variant-numeric: tabular-nums; }
.nav-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  font-size: 22px;
  color: var(--sub);
  display: grid; place-items: center;
  background: var(--card-2);
  line-height: 1;
  padding-bottom: 3px;
}
.nav-btn:active { background: var(--line); }

.week-bar { display: flex; align-items: center; gap: 8px; margin: 12px 2px 12px; }
.chip {
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--sub);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.chip.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.week-count { margin-left: auto; font-size: 11px; color: var(--sub); }

.tt-wrap {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 10px 8px 8px;
  --cell: 58px;
}

.tt-head {
  display: grid;
  gap: 2px;
  padding-bottom: 6px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--card);
  border-radius: 12px 12px 0 0;
}
.tt-corner { }
.tt-day {
  text-align: center;
  border-radius: 8px;
  padding: 3px 0 4px;
}
.tt-day b { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.tt-day span { display: block; font-size: 9.5px; color: var(--sub); font-variant-numeric: tabular-nums; }
.tt-day.today b { color: var(--brand); }
.tt-day.today span { color: var(--brand); opacity: 0.8; }
.tt-day.today { background: var(--brand-soft); }

.tt-grid {
  display: grid;
  gap: 2px;
  position: relative;
}
.tt-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 6px;
  gap: 1px;
  border-radius: 8px;
}
.tt-time b { font-size: 10.5px; font-weight: 600; color: var(--ink-2); }
.tt-time span { font-size: 8px; color: var(--sub); opacity: 0.85; font-variant-numeric: tabular-nums; }

.tt-cell {
  border-radius: 8px;
  background: var(--card-2);
  min-height: var(--cell);
}
.tt-cell.today { background: color-mix(in srgb, var(--brand-soft) 55%, var(--card-2)); }
.tt-cell:active { background: var(--line); }

.tt-block {
  z-index: 2;
  margin: 2px;
  border-radius: 9px;
  background: var(--cbg);
  padding: 5px 4px;
  overflow: hidden;
  border-left: 3px solid var(--c);
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.tt-block b {
  font-size: 10.5px;
  font-weight: 650;
  color: var(--ctxt);
  line-height: 1.25;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tt-block span {
  font-size: 8.5px;
  color: var(--ctxt);
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------- 奖励页 ------------------------- */
.balance-card {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.balance-card > div { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.balance-card .vline { flex: none; width: 1px; height: 34px; background: var(--line); margin: 0 6px; }
.balance-card span { font-size: 11px; color: var(--sub); }
.balance-card b { font-size: 26px; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.balance-card b i { font-style: normal; font-size: 12px; font-weight: 500; color: var(--sub); margin-left: 3px; }

.reward-list { display: flex; flex-direction: column; gap: 8px; }
.reward-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-radius: 15px;
  padding: 9px 8px 9px 12px;
  box-shadow: var(--shadow-sm);
}
.pool-emoji {
  width: 34px; height: 34px;
  flex: none;
  display: grid; place-items: center;
  font-size: 18px;
  border-radius: 11px;
  background: var(--card-2);
}
.rr-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.rr-main b { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-main > span:not(.rar-tag) { font-size: 10.5px; color: var(--sub); white-space: nowrap; }

.rar-tag {
  flex: none;
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.rar-common { background: rgba(148, 163, 184, 0.16); color: #64748b; }
.rar-rare { background: rgba(59, 130, 246, 0.14); color: #2563eb; }
.rar-epic { background: rgba(168, 85, 247, 0.14); color: #9333ea; }
.rar-legend { background: rgba(245, 158, 11, 0.16); color: #d97706; }
html[data-theme="dark"] .rar-common { color: #a8b3c4; }
html[data-theme="dark"] .rar-rare { color: #7fb3ff; }
html[data-theme="dark"] .rar-epic { color: #c79bff; }
html[data-theme="dark"] .rar-legend { color: #fbbf24; }

.heat {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  background: var(--card);
  border-radius: var(--r);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.heat-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--line-2);
  position: relative;
}
.heat-cell.lv1 { background: color-mix(in srgb, var(--brand) 22%, var(--line-2)); }
.heat-cell.lv2 { background: color-mix(in srgb, var(--brand) 55%, var(--line-2)); }
.heat-cell.lv3 { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.heat-cell.now { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--brand); }

.hist-list { display: flex; flex-direction: column; gap: 2px; background: var(--card); border-radius: var(--r); padding: 6px 10px; box-shadow: var(--shadow-sm); }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line-2); }
.hist-row:last-child { border-bottom: 0; }
.hist-row .pool-emoji { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
.hist-row .rr-main { flex-direction: column; align-items: flex-start; gap: 1px; }
.hist-row .rr-main b { font-size: 13px; }
.hist-row .rr-main span { font-size: 10px; color: var(--sub); }
.hist-row i { font-style: normal; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.hist-row i.plus { color: var(--ok); }
.hist-row i.minus { color: var(--sub); }

/* ------------------------- 设置页 ------------------------- */
.set-card { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.card { margin-bottom: 14px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { font-size: 14.5px; font-weight: 650; }
.card-head span { font-size: 11px; color: var(--sub); }

.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.field > span { font-size: 11.5px; color: var(--sub); padding-left: 2px; }
.field input, .field select {
  height: 42px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--ink);
  font-size: 16px;
  outline: none;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237b8194' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.field input:focus, .field select:focus { border-color: var(--brand); background: var(--card); }
.field-row { display: flex; gap: 10px; }
.field-row.three .field { flex: 1; }

.period-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.period-row > span { width: 22px; font-size: 12px; color: var(--sub); text-align: center; font-variant-numeric: tabular-nums; }
.period-row > i { font-style: normal; color: var(--sub); font-size: 12px; }
.period-row input {
  flex: 1;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--ink);
  font-size: 15px;
  padding: 0 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
  width: 15px;
  height: 15px;
  margin-left: 2px;
  padding: 0;
  opacity: 0.45;
  cursor: pointer;
}
.period-row input[type="time"]::-webkit-calendar-picker-indicator { opacity: 0.3; }

.btn-row { display: flex; flex-wrap: wrap; gap: 9px; }
.btn-row .btn { flex: 1 1 calc(50% - 5px); }

/* ------------------------- 底部导航 ------------------------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  max-width: 560px;
  margin: 0 auto;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  background: var(--card);
  background: color-mix(in srgb, var(--card) 86%, transparent);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1;
  height: 50px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--sub);
  font-size: 10px;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--brand); font-weight: 600; }
.tab.active svg { stroke-width: 2; }

/* ------------------------- 弹层 ------------------------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; }
.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 22, 0.42);
  opacity: 0;
  transition: opacity 0.24s ease;
  backdrop-filter: blur(2px);
}
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-width: 560px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 26px 26px 0 0;
  padding: 6px 20px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 0.9, 0.25, 1);
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
}
.sheet-wrap.open .sheet-mask { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.grab { width: 38px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0 6px; }
.sheet-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.sheet-body { padding-top: 6px; display: flex; flex-direction: column; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }
.sheet-actions .btn { flex: 1; }

.swatches { display: flex; gap: 9px; flex-wrap: wrap; padding: 2px 0 2px; }
.swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 2px var(--card);
  outline: 2px solid transparent;
  transition: outline-color 0.15s, transform 0.15s;
}
.swatch.sel { outline-color: var(--c); transform: scale(1.06); }

.steps { margin: 4px 0 0; padding-left: 20px; font-size: 13.5px; color: var(--ink-2); line-height: 1.9; }

/* 抽卡 */
.draw-body { align-items: center; }
.draw-sub { font-size: 12px; color: var(--sub); }
.draw-stage { position: relative; padding: 6px 0 2px; perspective: 1200px; }
.draw-card { width: 200px; height: 278px; }
.draw-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s cubic-bezier(0.3, 0.9, 0.3, 1);
}
.draw-card.flipped .draw-inner { transform: rotateY(180deg); }
.face {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}
.face.back {
  background: linear-gradient(155deg, #4f46e5, #7c3aed 55%, #a855f7);
  box-shadow: 0 20px 40px -16px rgba(79, 70, 229, 0.7);
  color: #fff;
}
.face.back::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
}
.face.back .q { font-size: 62px; font-weight: 800; opacity: 0.9; line-height: 1; }
.face.back em { font-style: normal; font-size: 11px; letter-spacing: 0.35em; opacity: 0.75; }
.face.front {
  transform: rotateY(180deg);
  background: linear-gradient(155deg, var(--r1, #cbd5e1), var(--r2, #64748b));
  box-shadow: 0 22px 44px -18px rgba(0, 0, 0, 0.5);
  color: #fff;
  padding: 18px;
}
.face.front .shine {
  position: absolute;
  top: -60%; left: -40%;
  width: 60%; height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: rotate(18deg);
  animation: shine 2.6s ease-in-out infinite;
}
@keyframes shine {
  0% { left: -50%; }
  60%, 100% { left: 130%; }
}
.fc-emoji { font-size: 54px; line-height: 1; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.18)); }
.fc-name { font-size: 19px; font-weight: 750; text-align: center; line-height: 1.3; padding: 0 6px; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.14); }
.fc-rar { font-size: 10px; letter-spacing: 0.24em; opacity: 0.86; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); }

.rar-common.face.front, .face.front.rar-common { --r1: #b6c0cf; --r2: #5f6b7d; }
.face.front.rar-rare { --r1: #7cb2ff; --r2: #2563eb; }
.face.front.rar-epic { --r1: #c48bff; --r2: #7c3aed; }
.face.front.rar-legend { --r1: #ffdc8a; --r2: #ef8b1f; }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  top: 12%;
  border-radius: 2px;
  animation: fall 1.6s cubic-bezier(0.2, 0.6, 0.5, 1) forwards;
}
@keyframes fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x), 300px) rotate(var(--r)); opacity: 0; }
}

/* ------------------------- Toast ------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: rgba(22, 24, 34, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.24s ease;
  z-index: 200;
  max-width: 86vw;
  text-align: center;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------- 桌面端 ------------------------- */
@media (max-width: 360px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .hero { padding: 18px 16px 16px; border-radius: 22px; }
  .hero-date { font-size: 20px; }
  .hero-hello { font-size: 12px; }
  .hero-sub { font-size: 11.5px; }
  .ring { width: 72px; height: 72px; }
  .ring-in b { font-size: 16px; }
  .ring-in span { font-size: 8.5px; }
  .hero-stats b { font-size: 16px; }
  .course-time { width: 50px; }
  .day-chip { width: 48px; }
}

@media (min-width: 620px) {
  body { background: #eaecf3; }
  html[data-theme="dark"] body { background: #08090c; }
  .app { padding-top: 26px; }
  .tabbar { border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.06); }
}
