:root {
  --bg: #f1e6d3;
  --bg-soft: #f8f0e4;
  --panel: #fffaf1;
  --panel-strong: #fff6e8;
  --text: #2d241b;
  --muted: #7b6d5b;
  --line: rgba(89, 68, 42, 0.14);
  --accent: #7f9567;
  --accent-strong: #536b42;
  --accent-soft: #dfe8cd;
  --orange: #c98f54;
  --red: #b85c4c;
  --yellow: #d1a84b;
  --shadow: 0 18px 45px rgba(92, 70, 44, 0.13);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 250, 241, 0.95), transparent 34%),
    linear-gradient(135deg, var(--bg), #ead8bf 54%, #f6eddc);
  color: var(--text);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 286px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: rgba(255, 250, 241, 0.76);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fffdf7;
  background: linear-gradient(145deg, var(--accent), #a5b587);
  box-shadow: 0 12px 26px rgba(83, 107, 66, 0.25);
  font-weight: 800;
  font-size: 22px;
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.nav-list {
  display: grid;
  gap: 9px;
  overflow: auto;
  padding-right: 4px;
}
.nav-item {
  width: 100%;
  border: 0;
  border-radius: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  transition: 0.2s ease;
}
.nav-item span {
  width: 30px;
  height: 30px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f4eadb;
  color: var(--accent-strong);
  font-weight: 800;
}
.nav-item:hover, .nav-item.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 10px 26px rgba(103, 79, 49, 0.09);
}
.nav-item.active span { background: var(--accent); color: #fffdf7; }
.nav-item b { font-size: 14px; }

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}
.language-toggle, .install-btn, .todo-form button, .note-form button, #saveReview {
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  color: #fffdf7;
  background: var(--accent-strong);
  box-shadow: 0 12px 24px rgba(83, 107, 66, 0.2);
}
.language-toggle { background: #8f7659; }
.install-btn { background: var(--accent); }

.main-content {
  padding: 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 800;
}
.topbar h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.05em;
}
.date-pill, .badge {
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 250, 241, 0.78);
  border-radius: 999px;
  padding: 9px 13px;
  white-space: nowrap;
}

.section { display: none; animation: rise 0.35s ease both; }
.section.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.hero-card, .card {
  background: rgba(255, 250, 241, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}
.hero-card {
  min-height: 230px;
  padding: clamp(24px, 4vw, 42px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 280px;
  gap: 20px;
  overflow: hidden;
  position: relative;
}
.hero-card::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -180px;
  bottom: -230px;
  background: radial-gradient(circle, rgba(127, 149, 103, 0.22), transparent 66%);
}
.hero-card h3 { margin: 0; font-size: clamp(28px, 4vw, 48px); line-height: 1.08; letter-spacing: -0.06em; max-width: 760px; }
.hero-card p:not(.eyebrow) { color: var(--muted); line-height: 1.8; max-width: 660px; }
.hero-tree { position: relative; min-height: 190px; }
.sun, .moon {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: #e6bc61;
  position: absolute;
  right: 24px;
  top: 14px;
  box-shadow: 0 0 0 16px rgba(230, 188, 97, 0.12);
}
.tree-preview, .review-tree { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: 170px; height: 170px; }
.leaf, .review-leaf { position: absolute; border-radius: 999px 999px 999px 28px; background: var(--accent); transform: rotate(-35deg); }
.leaf-a { width: 96px; height: 96px; left: 18px; top: 25px; }
.leaf-b { width: 90px; height: 90px; right: 16px; top: 38px; background: #9dac72; transform: rotate(38deg); }
.leaf-c { width: 112px; height: 112px; left: 40px; top: 0; background: #6f8758; transform: rotate(5deg); }
.trunk, .review-trunk { position: absolute; left: 78px; bottom: 0; width: 28px; height: 92px; border-radius: 16px; background: #8c6040; }

.grid { display: grid; gap: 18px; margin-top: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.clock-grid { margin-top: 18px; }
.clock-card { padding: 18px 20px; }
.clock-card.primary { border: 1.5px solid var(--accent-strong); background: linear-gradient(160deg, #fdf6ea, #f6e8d2); }
.clock-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.clock-head h4 { margin: 0; font-size: 0.95rem; }
.clock-sub { font-size: 0.75rem; color: var(--muted, #8a7a63); }
.clock-time { margin: 10px 0 2px; font-size: 1.85rem; font-weight: 800; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.clock-card.primary .clock-time { color: var(--accent-strong); }
.clock-date { margin: 0; font-size: 0.8rem; color: var(--muted, #8a7a63); }
.clock-status { margin: 8px 0 0; font-size: 0.75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; display: inline-block; }
.clock-status.dst { background: #e7f0e2; color: #3d6b34; }
.clock-status.standard { background: #e3eaf3; color: #3a5578; }
.clock-status.none { background: rgba(0, 0, 0, 0.05); color: #6f6250; }
.card { padding: 22px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.card h3 { margin: 0; font-size: 20px; }
.card p { color: var(--muted); line-height: 1.6; }
.card-icon { width: 42px; height: 42px; border-radius: 15px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 900; }
.stat-card h3 { margin: 8px 0 0; font-size: 34px; letter-spacing: -0.05em; }
.stat-card p { margin-bottom: 0; }
.text-button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 800;
}
.section-intro { margin-bottom: 18px; }
.section-intro h3 { margin: 0; font-size: 32px; letter-spacing: -0.04em; }
.section-intro p { color: var(--muted); }

.habit-card, .hobby-card, .day-card, .hot-card, .todo-item, .note-item, .breakdown-item {
  border: 1px solid var(--line);
  background: rgba(255, 246, 232, 0.78);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.habit-card { display: grid; gap: 14px; }
.habit-top { display: flex; justify-content: space-between; gap: 12px; }
.habit-card h4, .hobby-card h4 { margin: 0; font-size: 18px; }
.habit-card p, .hobby-card p { margin: 4px 0 0; }
.check-button, .hobby-card button, .todo-actions button, .note-item button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent-strong);
  border-radius: 14px;
  padding: 9px 12px;
  font-weight: 800;
}
.check-button.done { color: #fffdf7; background: var(--accent-strong); border-color: transparent; }

.progress-wrap { height: 12px; border-radius: 999px; background: #eadac1; overflow: hidden; }
.progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #c8a455); border-radius: inherit; transition: width 0.25s ease; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.day-card { min-height: 126px; display: grid; align-content: space-between; }
.day-card strong { font-size: 16px; }
.day-card label { display: flex; gap: 8px; align-items: center; color: var(--muted); }

.todo-form { display: grid; grid-template-columns: 1fr 110px 160px 96px; gap: 10px; }
.todo-form input, .todo-form select, .note-form textarea, .review-form-card textarea, .review-form-card input, #monthPicker {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
  outline: none;
}
.todo-form input:focus, .todo-form select:focus, textarea:focus { border-color: rgba(83, 107, 66, 0.55); box-shadow: 0 0 0 4px rgba(127, 149, 103, 0.12); }
.filter-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.filter-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 250, 241, 0.7);
  color: var(--muted);
}
.filter-tabs button.active { background: var(--accent-strong); color: #fffdf7; border-color: transparent; }
.todo-list, .notes-list, .news-list, .compact-list { display: grid; gap: 10px; }
.todo-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.todo-item.done .todo-title { text-decoration: line-through; color: var(--muted); }
.todo-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.priority { padding: 3px 8px; border-radius: 999px; color: #fffdf7; font-weight: 800; }
.priority.high { background: var(--red); }
.priority.medium { background: var(--yellow); color: #3f301c; }
.priority.low { background: var(--accent); }
.empty-state { color: var(--muted); padding: 18px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius-lg); }

.hot-card.small { padding: 14px; }
.news-item { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255, 246, 232, 0.78); text-decoration: none; }
.news-item strong { font-size: 16px; }
.news-item span { color: var(--muted); font-size: 13px; line-height: 1.5; }
.news-item:hover { border-color: rgba(83, 107, 66, 0.36); transform: translateY(-1px); }
.breakdown-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.breakdown-item strong { color: var(--accent-strong); }
.notice { font-size: 13px; background: rgba(223, 232, 205, 0.45); border: 1px solid rgba(83, 107, 66, 0.16); border-radius: 16px; padding: 12px; }

.hobby-card { display: grid; gap: 14px; }
.hobby-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.hobby-date { color: var(--muted); font-size: 13px; }
.note-form { display: grid; gap: 12px; }
.note-item { display: grid; gap: 10px; }
.note-item time { color: var(--muted); font-size: 12px; }

.review-layout { align-items: start; }
.tree-card { overflow: hidden; }
.tree-stage { height: 360px; border-radius: 24px; background: linear-gradient(#f5e7d2, #e5d2b5); position: relative; overflow: hidden; margin-bottom: 18px; }
.moon { width: 62px; height: 62px; right: 28px; top: 28px; background: #f8d890; }
.review-tree { bottom: 56px; transform: translateX(-50%) scale(var(--tree-scale, 0.35)); transform-origin: bottom center; transition: transform 0.35s ease; }
.review-leaf.l1 { width: 128px; height: 128px; left: 9px; top: 18px; }
.review-leaf.l2 { width: 122px; height: 122px; right: 2px; top: 38px; background: #9aaa70; transform: rotate(38deg); }
.review-leaf.l3 { width: 150px; height: 150px; left: 30px; top: -18px; background: #687e51; transform: rotate(4deg); }
.review-leaf.l4 { width: 88px; height: 88px; left: 50px; top: 74px; background: #b4be80; transform: rotate(-12deg); }
.review-trunk { height: 120px; width: 34px; left: 82px; }
.ground { position: absolute; left: 0; right: 0; bottom: -32px; height: 110px; border-radius: 50% 50% 0 0; background: #b99a69; }
.range-label { display: flex; justify-content: space-between; margin-bottom: 10px; color: var(--muted); }
#monthlyProgress { accent-color: var(--accent-strong); margin-bottom: 12px; width: 100%; }
.review-form-card { display: grid; gap: 10px; }
.review-form-card label { color: var(--accent-strong); font-weight: 900; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; background: #2d241b; color: #fffaf1; border-radius: 999px; padding: 12px 16px; box-shadow: var(--shadow); transition: 0.25s ease; z-index: 5; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 云同步 ---------- */
.sync-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--panel-strong);
  color: var(--accent-strong);
  font-weight: 800;
}
.sync-dot { width: 9px; height: 9px; border-radius: 999px; background: #b9a98f; flex: none; transition: background 0.2s ease; }
.sync-btn[data-tone="ok"] .sync-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(127, 149, 103, 0.18); }
.sync-btn[data-tone="warn"] .sync-dot { background: var(--red); box-shadow: 0 0 0 4px rgba(184, 92, 76, 0.16); }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(45, 36, 27, 0.42); backdrop-filter: blur(6px); }
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(430px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 24px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.modal-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 10px; }
.modal-close:hover { background: var(--bg-soft); color: var(--text); }

.sync-account-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.sync-account-row strong { color: var(--text); font-size: 14px; overflow-wrap: anywhere; text-align: right; }
.sync-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.sync-actions button { border: 0; border-radius: 14px; padding: 12px 14px; color: #fffdf7; background: var(--accent-strong); box-shadow: 0 12px 24px rgba(83, 107, 66, 0.2); font-weight: 800; }
.sync-actions .ghost-btn { background: transparent; color: var(--muted); border: 1px solid var(--line); box-shadow: none; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.auth-tabs button { flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 10px 8px; background: rgba(255, 250, 241, 0.7); color: var(--muted); font-weight: 700; font-size: 13px; }
.auth-tabs button.active { background: var(--accent-strong); color: #fffdf7; border-color: transparent; }

.auth-form { display: grid; gap: 10px; }
.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
  outline: none;
}
.auth-form input:focus { border-color: rgba(83, 107, 66, 0.55); box-shadow: 0 0 0 4px rgba(127, 149, 103, 0.12); }
.auth-form button[type="submit"] { border: 0; border-radius: 15px; padding: 12px 14px; color: #fffdf7; background: var(--accent-strong); box-shadow: 0 12px 24px rgba(83, 107, 66, 0.2); font-weight: 800; }
.auth-form button[type="submit"]:disabled { opacity: 0.6; cursor: default; }
.otp-row { display: grid; grid-template-columns: 1fr 118px; gap: 10px; }
.otp-row button { border: 0; border-radius: 15px; padding: 12px 8px; color: var(--accent-strong); background: var(--accent-soft); font-weight: 800; font-size: 13px; }
.otp-row button:disabled { opacity: 0.55; cursor: default; }
.link-btn { border: 0; background: transparent; color: var(--accent-strong); font-weight: 800; justify-self: start; padding: 2px 0; }
.auth-hint { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.auth-message { display: none; margin: 12px 0 0; font-size: 13px; border-radius: 12px; padding: 10px 12px; }
.auth-message.show { display: block; }
.auth-message.error { color: var(--red); background: rgba(184, 92, 76, 0.1); }
.auth-message.info { color: var(--accent-strong); background: rgba(223, 232, 205, 0.5); }

@media (max-width: 960px) {
  .sidebar-footer .sync-btn { padding: 10px; }
  .sidebar-footer .sync-btn span { display: none; }
  .sync-dot { width: 14px; height: 14px; }
  .modal-card { padding: 18px; }
  .otp-row { grid-template-columns: 1fr 96px; }
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 92px 1fr; }
  .sidebar { padding: 18px 10px; }
  .brand { justify-content: center; padding: 4px; }
  .brand div:not(.brand-mark), .nav-item b, .sidebar-footer .install-btn { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item span { width: 36px; height: 36px; }
  .main-content { padding: 22px; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-tree { min-height: 170px; }
  .grid.two, .grid.three, .grid.four, .breakdown-grid { grid-template-columns: 1fr; }
  .grid.four.clock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock-time { font-size: 1.5rem; }
  .todo-form { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .app-shell { grid-template-columns: 78px 1fr; }
  .main-content { padding: 16px; }
  .topbar { flex-direction: column; }
  .hero-card, .card { border-radius: 20px; padding: 16px; }
  .hero-card h3 { font-size: 30px; }
  .week-grid { grid-template-columns: 1fr; }
}
