:root {
  color-scheme: light;
  --bg: #f3efe4;
  --surface: #fffcf6;
  --surface-2: #f7f2e7;
  --surface-3: #ece4d4;
  --ink: #1e2a24;
  --muted: #6e756d;
  --line: #e4dccb;
  --green: #1f4d3a;
  --green-2: #2f6b4f;
  --green-soft: #e4eee7;
  --gold: #b8893b;
  --gold-2: #d8b36a;
  --gold-soft: #f4e6c5;
  --red: #b4553f;
  --blue: #466b7a;
  --hero: #173b2c;
  --hero-2: #245941;
  --shadow: 0 12px 30px rgba(31, 77, 58, 0.08);
  --topbar-bg: rgba(243, 239, 228, 0.86);
  --tabbar-bg: rgba(255, 252, 246, 0.94);
  --tab-h: 70px;
  --radius: 20px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101713;
  --surface: #17211b;
  --surface-2: #1d2a22;
  --surface-3: #26372c;
  --ink: #f2eee3;
  --muted: #a9b3a9;
  --line: #2c3b31;
  --green: #8fc3a5;
  --green-2: #a6d0b7;
  --green-soft: #24392d;
  --gold: #d9b168;
  --gold-2: #f0d397;
  --gold-soft: #3a3222;
  --red: #e08a74;
  --blue: #91b4c2;
  --hero: #122b20;
  --hero-2: #1d4735;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  --topbar-bg: rgba(16, 23, 19, 0.88);
  --tabbar-bg: rgba(23, 33, 27, 0.95);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101713;
    --surface: #17211b;
    --surface-2: #1d2a22;
    --surface-3: #26372c;
    --ink: #f2eee3;
    --muted: #a9b3a9;
    --line: #2c3b31;
    --green: #8fc3a5;
    --green-2: #a6d0b7;
    --green-soft: #24392d;
    --gold: #d9b168;
    --gold-2: #f0d397;
    --gold-soft: #3a3222;
    --red: #e08a74;
    --blue: #91b4c2;
    --hero: #122b20;
    --hero-2: #1d4735;
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    --topbar-bg: rgba(16, 23, 19, 0.88);
    --tabbar-bg: rgba(23, 33, 27, 0.95);
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(193, 154, 75, 0.14), transparent 28rem),
    radial-gradient(circle at 94% 18%, rgba(31, 77, 58, 0.1), transparent 26rem),
    var(--bg);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

h1, h2, h3, h4, p {
  margin: 0;
}

a {
  color: var(--green);
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app {
  position: relative;
  width: min(100vw, 480px);
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(var(--tab-h) + 24px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 13px;
  color: #f3d89c;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent),
    var(--green);
  box-shadow: inset 0 0 0 1px rgba(216, 179, 106, 0.28), 0 6px 14px rgba(31, 77, 58, 0.18);
  font-size: 20px;
  font-weight: 800;
  font-family: "Songti SC", "SimSun", serif;
}

.brand h1 {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.brand p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-2);
  transition: transform 0.18s ease, background 0.18s ease;
}

.icon-button:active {
  transform: scale(0.94);
}

.main {
  padding: 4px 14px 22px;
}

.page {
  animation: pageIn 0.28s ease both;
}

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

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 13px;
}

.page-head h2 {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.page-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.page-head .head-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  color: var(--green);
  background: var(--green-soft);
}

.card {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 18px;
  border: 0;
  border-radius: 26px;
  color: #f8f4e8;
  background:
    radial-gradient(circle at 100% 0%, rgba(216, 179, 106, 0.24), transparent 42%),
    linear-gradient(135deg, var(--hero), var(--hero-2));
  box-shadow: 0 18px 40px rgba(23, 59, 44, 0.24);
}

.hero::after {
  content: "";
  position: absolute;
  right: -72px;
  bottom: -104px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(216, 179, 106, 0.2);
  border-radius: 50%;
  pointer-events: none;
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-date {
  color: rgba(248, 244, 232, 0.62);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.hero h2 {
  margin: 3px 0 8px;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid rgba(216, 179, 106, 0.3);
  border-radius: 999px;
  color: #f0d397;
  background: rgba(255, 255, 255, 0.08);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.phase-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(216, 179, 106, 0.14);
}

.ring {
  position: relative;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}

.ring-bg {
  stroke: rgba(255, 255, 255, 0.13);
}

.ring-fg {
  stroke: var(--gold-2);
  transition: stroke-dashoffset 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ring-center strong {
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.ring-center span {
  margin-top: 4px;
  color: rgba(248, 244, 232, 0.55);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.hero-meta {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-meta div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-meta strong {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hero-meta span {
  color: rgba(248, 244, 232, 0.52);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.week-strip {
  position: relative;
  z-index: 1;
  margin-top: 13px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
}

.week-strip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: rgba(248, 244, 232, 0.68);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.week-strip-top b {
  color: #f0d397;
  font-weight: 650;
}

.progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.45s ease;
}

.hero .progress {
  background: rgba(255, 255, 255, 0.13);
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(184, 137, 59, 0.22);
  border-radius: 16px;
  color: var(--gold);
  background: var(--gold-soft);
  font-size: 11px;
  line-height: 1.55;
}

.notice .icon {
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.notice b {
  font-weight: 750;
}

.focus-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(184, 137, 59, 0.2);
  border-radius: 18px;
  background: linear-gradient(135deg, var(--surface), var(--gold-soft));
}

.focus-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.55);
}

.focus-card .eyebrow {
  margin-bottom: 3px;
}

.focus-card p {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 4px 9px;
}

.section-head h3 {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.section-head span {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.check-card {
  padding: 4px 0;
  overflow: hidden;
}

.check-item {
  display: grid;
  grid-template-columns: 38px 1fr 26px;
  gap: 11px;
  align-items: center;
  width: 100%;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  transition: background 0.18s ease;
}

.check-item:last-child {
  border-bottom: 0;
}

.check-item:active {
  background: var(--surface-2);
}

.check-item.done {
  background: linear-gradient(90deg, var(--gold-soft), transparent 78%);
}

.item-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: var(--green-2);
  background: var(--green-soft);
  transition: background 0.18s ease, color 0.18s ease;
}

.check-item.done .item-icon {
  color: #fff;
  background: var(--green);
}

.check-item.bottom .item-icon {
  color: var(--red);
  background: rgba(180, 85, 63, 0.1);
}

.item-main {
  min-width: 0;
}

.item-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.3;
}

.item-title .pts {
  flex: none;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--gold);
  background: var(--gold-soft);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.item-title .pts.zero {
  color: var(--red);
  background: rgba(180, 85, 63, 0.1);
}

.item-hint {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.check-box {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  color: transparent;
  background: transparent;
  transition: all 0.18s ease;
}

.check-box .icon {
  width: 15px;
  height: 15px;
  stroke-width: 2.6;
}

.check-item.done .check-box {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.note-card {
  margin-top: 12px;
}

.note-card textarea {
  width: 100%;
  min-height: 64px;
  padding: 0;
  border: 0;
  outline: 0;
  resize: vertical;
  color: var(--ink);
  background: transparent;
  font-size: 12.5px;
  line-height: 1.65;
}

.note-card textarea::placeholder {
  color: var(--muted);
  opacity: 0.72;
}

.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 9px;
}

.quote-card {
  position: relative;
  overflow: hidden;
  margin-top: 12px;
  padding: 15px 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  background: var(--surface-2);
}

.quote-card::before {
  content: "“";
  position: absolute;
  top: -13px;
  right: 14px;
  color: var(--gold);
  opacity: 0.18;
  font-family: Georgia, serif;
  font-size: 76px;
  line-height: 1;
}

.quote-card p {
  position: relative;
  z-index: 1;
  font-family: "Songti SC", "SimSun", Georgia, serif;
  font-size: 13px;
  line-height: 1.65;
  letter-spacing: 0.04em;
}

.quote-card span {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 5px;
  color: var(--gold);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}

.stat-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
}

.stat-card strong {
  font-size: 23px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.heatmap-card {
  padding: 15px 14px 13px;
}

.heatmap-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.heatmap-title h3 {
  font-size: 14px;
  font-weight: 750;
}

.heatmap-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.heatmap-title .month-mark {
  flex: none;
  color: var(--gold);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

.heatmap-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.heat-days {
  display: grid;
  flex: none;
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
  width: 11px;
  color: var(--muted);
  font-size: 7px;
  line-height: 1;
  text-align: center;
}

.heat-days span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.heatmap {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(13, 1fr);
  gap: 4px;
  min-width: 0;
}

.heat-col {
  display: grid;
  grid-template-rows: repeat(7, 1fr);
  gap: 4px;
  min-width: 0;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--surface-3);
  transition: transform 0.15s ease;
}

.heat-cell.l1 { background: rgba(47, 107, 79, 0.24); }
.heat-cell.l2 { background: rgba(47, 107, 79, 0.48); }
.heat-cell.l3 { background: rgba(31, 77, 58, 0.76); }
.heat-cell.l4 { background: var(--gold); }
.heat-cell.future { opacity: 0.28; }
.heat-cell.today { outline: 2px solid var(--gold); outline-offset: 1px; }
.heat-cell:active { transform: scale(0.86); }

.legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 8px;
}

.legend i {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--surface-3);
}

.legend i.l1 { background: rgba(47, 107, 79, 0.24); }
.legend i.l2 { background: rgba(47, 107, 79, 0.48); }
.legend i.l3 { background: rgba(31, 77, 58, 0.76); }
.legend i.l4 { background: var(--gold); }

.week-list {
  padding: 4px 0;
}

.week-row {
  display: grid;
  grid-template-columns: 36px 1fr 52px;
  gap: 9px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.week-row:last-child {
  border-bottom: 0;
}

.week-row.current .week-name {
  color: var(--green);
}

.week-row.future {
  opacity: 0.45;
}

.week-name {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.week-bar-wrap {
  min-width: 0;
}

.week-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 8px;
}

.week-bar-top b {
  color: var(--ink);
  font-size: 9px;
  font-weight: 650;
}

.week-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.week-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green-2);
}

.week-row.hit .week-bar > i {
  background: var(--gold);
}

.week-status {
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
  text-align: right;
}

.week-row.hit .week-status {
  color: var(--gold);
}

.recent-list {
  padding: 2px 0;
}

.recent-row {
  display: grid;
  grid-template-columns: 74px 1fr 44px;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.recent-row:last-child {
  border-bottom: 0;
}

.recent-date {
  color: var(--muted);
  font-size: 10px;
}

.recent-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

.recent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--surface-3);
}

.recent-dot.on {
  background: var(--green-2);
}

.recent-dot.gold {
  background: var(--gold);
}

.recent-score {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.recent-score small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.empty-state {
  padding: 20px 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.reward-hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid rgba(184, 137, 59, 0.2);
  border-radius: 24px;
  background:
    radial-gradient(circle at 100% 0%, rgba(216, 179, 106, 0.22), transparent 45%),
    linear-gradient(135deg, var(--surface), var(--gold-soft));
}

.reward-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.reward-score {
  margin: 5px 0 2px;
  font-size: 40px;
  font-weight: 780;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.reward-score span {
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}

.reward-sub {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.reward-hero .progress {
  margin: 14px 0 12px;
  height: 8px;
  background: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .reward-hero .progress {
  background: rgba(0, 0, 0, 0.28);
}

.reward-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reward-claim {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 12px;
  color: #fff;
  background: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.reward-claim:disabled {
  color: var(--muted);
  background: var(--surface-3);
  cursor: default;
}

.reward-hint {
  color: var(--muted);
  font-size: 9px;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}

.tier {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
}

.tier.earned {
  border-color: rgba(184, 137, 59, 0.45);
  background: linear-gradient(145deg, var(--surface), var(--gold-soft));
}

.tier-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.tier-top .icon {
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.tier-top span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 650;
}

.tier h4 {
  font-size: 12px;
  font-weight: 750;
}

.tier p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.tier-progress {
  margin-top: 8px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.tier-progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.badge {
  padding: 11px 7px;
  border: 1px solid var(--line);
  border-radius: 15px;
  text-align: center;
  opacity: 0.48;
  background: var(--surface-2);
}

.badge.earned {
  opacity: 1;
  border-color: rgba(184, 137, 59, 0.36);
  background: var(--surface);
}

.badge-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 auto 6px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-3);
}

.badge.earned .badge-icon {
  color: #fff;
  background: var(--gold);
}

.badge b {
  display: block;
  font-size: 9px;
  font-weight: 750;
}

.badge span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 7px;
}

.reward-note {
  padding: 13px 15px;
  border: 1px dashed var(--line);
  border-radius: 17px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
  background: var(--surface-2);
}

.timeline {
  position: relative;
  padding: 4px 0;
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 11px;
  padding-bottom: 16px;
}

.tl-item:last-child {
  padding-bottom: 0;
}

.tl-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.tl-marker::after {
  content: "";
  position: absolute;
  top: 17px;
  bottom: -16px;
  width: 1px;
  background: var(--line);
}

.tl-item:last-child .tl-marker::after {
  display: none;
}

.tl-dot {
  position: relative;
  z-index: 1;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.tl-item.done .tl-dot {
  border-color: var(--green-2);
  background: var(--green-2);
}

.tl-item.current .tl-dot {
  border-color: var(--gold);
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(184, 137, 59, 0.16);
}

.tl-body {
  min-width: 0;
}

.tl-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.tl-head h4 {
  font-size: 12.5px;
  font-weight: 700;
}

.tl-head span {
  flex: none;
  color: var(--muted);
  font-size: 8px;
}

.tl-item.current .tl-head h4 {
  color: var(--gold);
}

.tl-body p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.milestone-list {
  padding: 2px 0;
}

.milestone {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.milestone:last-child {
  border-bottom: 0;
}

.milestone-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-3);
}

.milestone.done .milestone-mark {
  color: #fff;
  background: var(--green-2);
}

.milestone.today .milestone-mark {
  color: #fff;
  background: var(--gold);
}

.milestone .icon {
  width: 12px;
  height: 12px;
}

.milestone h4 {
  font-size: 11px;
  font-weight: 700;
}

.milestone p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.45;
}

.milestone-date {
  color: var(--muted);
  font-size: 8px;
  text-align: right;
  white-space: nowrap;
}

.milestone.done .milestone-date {
  color: var(--green-2);
}

.milestone.today .milestone-date {
  color: var(--gold);
}

.teach-card {
  padding: 15px;
}

.teach-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.teach-top h3 {
  font-size: 14px;
  font-weight: 750;
}

.teach-top p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.teach-count {
  color: var(--gold);
  font-size: 21px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.teach-count small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.teach-dots {
  display: flex;
  gap: 5px;
  margin: 14px 0 11px;
}

.teach-dot {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-3);
}

.teach-dot.past {
  background: var(--green-2);
}

.teach-dot.next {
  background: var(--gold);
}

.teach-note {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.std-list {
  display: grid;
  gap: 9px;
}

.std-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
}

.std-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-soft);
}

.std-icon .icon {
  width: 15px;
  height: 15px;
}

.std-item h4 {
  font-size: 11px;
  font-weight: 700;
}

.std-item p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.settings-card {
  padding: 6px 16px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

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

.setting-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--green);
  background: var(--green-soft);
}

.setting-icon .icon {
  width: 16px;
  height: 16px;
}

.setting-main h4 {
  font-size: 11.5px;
  font-weight: 650;
}

.setting-main p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.4;
}

.setting-value {
  flex: none;
  color: var(--muted);
  font-size: 9px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 13px;
  border-radius: 11px;
  color: #fff;
  background: var(--green);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn.ghost {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.btn.gold {
  color: #fff;
  background: var(--gold);
}

.btn.danger {
  color: var(--red);
  border: 1px solid rgba(180, 85, 63, 0.25);
  background: rgba(180, 85, 63, 0.08);
}

.btn.small {
  padding: 7px 10px;
  font-size: 9.5px;
}

.btn.full {
  width: 100%;
}

.btn .icon {
  width: 14px;
  height: 14px;
}

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
}

.segmented button {
  padding: 6px 9px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  text-align: center;
}

.segmented button.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(31, 77, 58, 0.08);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 17px;
  color: #f3d89c;
  background: var(--green);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 22px;
  font-weight: 750;
}

.profile-card h3 {
  font-size: 14px;
  font-weight: 750;
}

.profile-card p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.profile-stats {
  display: flex;
  gap: 14px;
  margin-top: 7px;
}

.profile-stats span {
  color: var(--muted);
  font-size: 8px;
}

.profile-stats b {
  display: block;
  margin-bottom: 1px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.about-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
  text-align: center;
}

.install-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: 100vw;
  max-width: 480px;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding: 0 4px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line);
  background: var(--tabbar-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  transition: color 0.18s ease;
}

.tab .icon {
  width: 21px;
  height: 21px;
  stroke-width: 1.7;
}

.tab.active {
  color: var(--green);
}

.tab.active::before {
  content: "";
  position: absolute;
  top: 5px;
  width: 20px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--gold);
}

.tab:active {
  opacity: 0.65;
}

.toast {
  position: fixed;
  bottom: calc(var(--tab-h) + 18px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 100;
  max-width: calc(100% - 44px);
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--bg);
  background: var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.confetti {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: -12px;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  animation: confettiFall 1.35s cubic-bezier(0.18, 0.72, 0.32, 1) forwards;
}

@keyframes confettiFall {
  0% { opacity: 0; transform: translate3d(0, -10px, 0) rotate(0deg); }
  12% { opacity: 1; }
  100% { opacity: 0; transform: translate3d(var(--dx), 105vh, 0) rotate(var(--rot)); }
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 720px) {
  body {
    padding: 24px 0;
  }

  .app {
    min-height: calc(100dvh - 48px);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 34px;
    box-shadow: 0 30px 80px rgba(31, 77, 58, 0.16);
  }

  .topbar {
    border-radius: 34px 34px 0 0;
  }

  .tabbar {
    bottom: 24px;
    border-radius: 0 0 34px 34px;
  }
}

@media (max-width: 360px) {
  .main {
    padding: 3px 11px 20px;
  }

  .hero {
    padding: 15px;
  }

  .hero h2 {
    font-size: 21px;
  }

  .ring {
    flex-basis: 82px;
    width: 82px;
    height: 82px;
  }

  .ring-center strong {
    font-size: 24px;
  }

  .check-item {
    grid-template-columns: 34px 1fr 24px;
    gap: 9px;
    padding: 10px 12px;
  }

  .item-icon {
    width: 32px;
    height: 32px;
  }

  .badge-grid {
    gap: 6px;
  }

  .badge {
    padding: 9px 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.main.no-anim .page {
  animation: none;
}

.day-nav {
  display: flex;
  gap: 8px;
  margin: 0 2px 12px;
}

.day-nav .btn {
  flex: 1;
  padding: 8px 6px;
  font-size: 9px;
}

.day-nav .btn .icon {
  width: 13px;
  height: 13px;
}

.notice {
  flex-wrap: wrap;
}

.notice > div {
  flex: 1;
  min-width: 150px;
}

.notice .btn {
  flex: none;
  margin-left: auto;
}

.heat-cell {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  cursor: pointer;
}

.heat-cell:focus-visible {
  position: relative;
  z-index: 2;
}

.badge-icon .icon {
  width: 15px;
  height: 15px;
}

.reward-claim .icon {
  width: 14px;
  height: 14px;
}

.settings-card .setting-row .segmented {
  flex: none;
}

@media (max-width: 360px) {
  .settings-card .setting-row {
    gap: 8px;
  }

  .settings-card .segmented button {
    padding: 6px 7px;
    font-size: 8.5px;
  }

  .notice > div {
    min-width: 120px;
  }
}

/* ---------- multi-user auth + account ---------- */
.is-auth .tabbar { display: none; }
.is-auth .main { padding-bottom: 28px; }

.auth-page { max-width: 440px; margin: 0 auto; }
.auth-brand { text-align: center; padding: 18px 8px 16px; }
.auth-mark {
  width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 18px;
  display: grid; place-items: center;
  color: var(--gold-soft); background: linear-gradient(145deg, var(--hero), var(--green-2));
  font-size: 26px; font-weight: 800; box-shadow: var(--shadow);
}
.auth-brand h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.auth-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin: 0 0 12px; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface-2);
}
.auth-switch button {
  border: 0; border-radius: 10px; padding: 10px 8px;
  background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer;
}
.auth-switch button.active { background: var(--surface); color: var(--green); box-shadow: 0 2px 8px rgba(31,77,58,.08); }
.auth-card {
  padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.auth-card .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.auth-card .field span { color: var(--muted); font-size: 12px; font-weight: 700; }
.auth-card input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--ink); font: inherit;
}
.auth-card input:focus { outline: 2px solid var(--gold-2); outline-offset: 1px; }
.auth-error { min-height: 20px; color: var(--red); font-size: 12px; line-height: 1.5; }
.auth-submit { width: 100%; height: 46px; margin-top: 4px; }
.auth-note { padding: 14px 6px 0; color: var(--muted); font-size: 12px; line-height: 1.6; text-align: center; }

.account-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px; padding: 14px;
}
.account-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-main h3 { margin: 0 0 2px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-main p { margin: 0; color: var(--muted); font-size: 12px; }
.account-card .btn { flex: none; }
