:root {
  --paper: #f3eee4;
  --paper-2: #e9e0d2;
  --ink: #2a2418;
  --muted: #6f675b;
  --line: rgba(42, 36, 24, 0.1);
  --sage: #4f6f5c;
  --sage-2: #d7e4d8;
  --clay: #c4785a;
  --gold: #c4a056;
  --shadow: 0 16px 40px rgba(80, 60, 30, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fbf7f0, transparent 55%),
    var(--paper);
  font: 15px/1.55 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100%;
}

.rail {
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: rgba(255, 252, 247, 0.55);
  height: 100%;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}
.brand strong {
  display: block;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
  font-size: 20px;
}
.brand em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}
.logo {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 38% 50%, #4f6f5c 0 38%, transparent 39%),
    radial-gradient(circle at 68% 50%, rgba(196, 120, 90, 0.9) 0 34%, transparent 35%),
    #efe6d8;
}

.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-btn {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--muted);
}
.nav-btn.on, .nav-btn:hover {
  background: var(--sage-2);
  color: var(--ink);
}

.rail-energy {
  margin-top: auto;
  padding: 14px;
  border-radius: 16px;
  background: #fffaf3;
  box-shadow: var(--shadow);
}
.rail-energy span { color: var(--muted); font-size: 12px; }
.rail-energy b { display: block; font-size: 28px; margin-top: 4px; }

.main { padding: 28px 36px 48px; height: 100%; overflow: auto; }
.top { margin-bottom: 22px; }
.kicker {
  margin: 0 0 4px;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-size: 12px;
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
}
.hint { margin: 8px 0 0; color: var(--muted); max-width: 46em; }
.lead { color: var(--muted); margin-top: 0; }

.view { display: none; }
.view.on { display: block; }

.card {
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card.muted { background: rgba(255, 250, 243, 0.55); }
.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-family: "Source Han Serif SC", "Noto Serif SC", "Songti SC", Georgia, serif;
}

.today-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 16px;
}
.side-stack { display: flex; flex-direction: column; gap: 16px; }
.hero-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.hero-head span, .fine { color: var(--muted); font-size: 13px; }

.field { display: block; margin: 14px 0; }
.field > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(79, 111, 92, 0.15);
}
textarea { resize: vertical; min-height: 110px; }

.beads, .moods, .pomo-lengths {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.beads { flex-wrap: nowrap; }
.bead, .mood, .chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  cursor: pointer;
}
.bead {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--muted);
}
.bead.on.low { background: #d9d3cc; color: var(--ink); }
.bead.on.mid { background: #ead59a; color: var(--ink); }
.bead.on.high { background: var(--sage-2); color: var(--ink); }
.mood, .chip {
  padding: 8px 12px;
}
.mood.on.疲惫 { background: #ece7e1; }
.mood.on.烦躁 { background: #f3d4cc; }
.mood.on.专注 { background: var(--sage-2); }
.mood.on.开心 { background: #f3e2b8; }
.chip.on { background: var(--sage-2); }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
}
.btn.primary { background: var(--sage); color: #f7f3ea; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
a.btn { color: inherit; text-decoration: none; display: inline-block; }
.btn:hover { filter: brightness(1.03); }
.btn.tiny { padding: 4px 8px; font-size: 12px; border-radius: 8px; }

.pulse-text { font-size: 18px; margin: 8px 0 16px; }
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}
.mini-stats b { display: block; font-size: 22px; }
.mini-stats span { color: var(--muted); font-size: 12px; white-space: nowrap; }

.timeline, .list, .thoughts { display: flex; flex-direction: column; gap: 10px; }
.row, .thought {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(243, 238, 228, 0.7);
}
.row b, .thought p { margin: 0; }
.tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}
.banner {
  background: #efe3c8;
  border-radius: 12px;
  padding: 10px 14px;
  color: #5a4a2a;
}
.insight-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}
.insight {
  padding: 12px 14px;
  border-left: 3px solid var(--sage);
  background: #fffaf3;
  border-radius: 0 12px 12px 0;
}
.report-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.chart svg { width: 100%; height: 180px; display: block; }
.bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 48px;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.bar-track { height: 10px; background: var(--paper-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--sage); }
.mood-bars .bar-fill.疲惫 { background: #8b8178; }
.mood-bars .bar-fill.烦躁 { background: var(--clay); }
.mood-bars .bar-fill.专注 { background: var(--sage); }
.mood-bars .bar-fill.开心 { background: var(--gold); }

.plan-form {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr 0.7fr auto;
  gap: 8px;
}
.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 8px;
  margin: 8px 0 16px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.day-col {
  background: #fffaf3;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  min-height: 220px;
  min-width: 150px;
}
.day-col.today { outline: 2px solid var(--sage); }
.day-col h3 { margin: 0 0 8px; font-size: 13px; }
.slot {
  background: var(--sage-2);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  font-size: 12px;
}
.slot.high { background: #f3d4cc; }
.slot.low { background: #ece7e1; }
.slot button { margin-top: 6px; }

.timer-card { text-align: center; max-width: 560px; }
.timer {
  font-size: 84px;
  letter-spacing: 0.04em;
  font-family: "Georgia", "Source Han Serif SC", serif;
  margin: 8px 0 18px;
}
.pomo-actions, .pomo-lengths { justify-content: center; margin: 12px 0; }
.timer-card .field { text-align: left; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #f7f3ea;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 20;
}
.modal {
  position: fixed;
  inset: 0;
  background: rgba(42, 36, 24, 0.35);
  display: grid;
  place-items: center;
  z-index: 30;
}
.modal[hidden], .toast[hidden], [hidden] { display: none !important; }
.modal-card {
  width: min(460px, 92vw);
  background: #fffaf3;
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.empty { color: var(--muted); padding: 8px 0; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .rail { flex-direction: row; align-items: center; gap: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow: auto; }
  .rail-energy { margin: 0 0 0 auto; min-width: 90px; }
  .today-grid, .report-grid, .plan-form, .week-strip { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .timer { font-size: 64px; }
}
