:root {
  --paper: #f7f2e9;
  --card: #fffdf8;
  --ink: #2c2a25;
  --muted: #7c776c;
  --line: #e6ddcc;
  --accent: #c46f4a;
  --accent-soft: #f3e2d7;
  --sage: #6f8b7a;
  --sage-soft: #e4ece6;
  --warn: #b9812f;
  --danger: #b4483f;
  --shadow: 0 10px 30px rgba(63, 52, 38, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

header.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.brand-kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
}

h1 {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 26px;
  margin: 4px 0 4px;
  letter-spacing: 0.02em;
}

.sub { color: var(--muted); font-size: 13px; margin: 0; }

.code-pill {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 5px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.tabs button {
  border: 0;
  background: transparent;
  padding: 11px 8px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: 0.2s;
}

.tabs button.active {
  background: var(--ink);
  color: #fffaf0;
}

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

.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  letter-spacing: 0.02em;
}

.card h3 {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 600;
}

.status-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.status-line .big {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 24px;
}

.tone-safe .big { color: var(--sage); }
.tone-warn .big { color: var(--warn); }
.tone-danger .big { color: var(--danger); }
.tone-muted .big { color: var(--muted); }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: 0.2s;
  font-size: 14px;
}

.btn.primary {
  background: var(--accent);
  color: #fff8f0;
  width: 100%;
  font-size: 16px;
  padding: 15px;
  box-shadow: 0 8px 18px rgba(196, 111, 74, 0.24);
}

.btn.primary:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

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

.btn.small { padding: 8px 12px; font-size: 12px; }

.btn.sage { background: var(--sage); color: #f6fbf7; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

.grid-days {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 4px;
  margin-top: 12px;
}

.day-cell {
  aspect-ratio: 1;
  border-radius: 5px;
  background: #efe7d9;
}

.day-cell.on { background: var(--sage); }

.legend { font-size: 12px; color: var(--muted); margin-top: 8px; }

.mood-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

.mood-chips button {
  border: 1px solid var(--line);
  background: #fffdf8;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  cursor: pointer;
}

.mood-chips button.active { background: var(--accent-soft); border-color: var(--accent); color: #8c4526; }

textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fffdf8;
  line-height: 1.6;
}

textarea:focus, input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

input[type="text"], input[type="email"] {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  background: #fffdf8;
  width: 100%;
}

.reply {
  background: var(--sage-soft);
  border-radius: 14px;
  padding: 14px;
  line-height: 1.65;
  font-size: 14px;
  margin-top: 12px;
}

.reply.crisis { background: #f7e4df; }

.entry {
  border-top: 1px dashed var(--line);
  padding: 12px 0 4px;
}

.entry:first-child { border-top: 0; }

.entry .meta { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.entry .text { font-size: 14px; line-height: 1.6; white-space: pre-wrap; }

.entry .echo { font-size: 13px; color: #4a6a58; margin-top: 8px; line-height: 1.6; }

.minutes-big {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 46px;
  line-height: 1;
}

.minutes-big small { font-size: 14px; color: var(--muted); font-family: inherit; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 92px; margin-top: 14px; }

.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }

.bar {
  width: 100%;
  max-width: 34px;
  background: var(--accent-soft);
  border-radius: 6px 6px 3px 3px;
  min-height: 4px;
}

.bar.today { background: var(--accent); }

.bar-label { font-size: 10px; color: var(--muted); }

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}

.task:first-of-type { border-top: 0; }

.task input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--sage); }

.task.done .task-title { text-decoration: line-through; color: var(--muted); }

.task-title { flex: 1; line-height: 1.5; font-size: 14px; }

.task .del { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }

.locked {
  background: #fcf4ea;
  border: 1px dashed #e2c9b2;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  color: #8c5a3c;
  line-height: 1.6;
  margin-top: 10px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fffaf0;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s;
  z-index: 50;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(44, 42, 37, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 40;
}

.modal-backdrop.show { display: flex; }

.modal {
  background: var(--card);
  border-radius: 20px;
  padding: 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal h2 { margin: 0 0 8px; font-size: 18px; }

.price-row { display: flex; gap: 10px; margin: 14px 0; }

.price {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

.price strong { font-size: 22px; display: block; }

.price span { font-size: 12px; color: var(--muted); }

.hide { display: none !important; }

.onboard {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.onboard .card { width: 100%; max-width: 440px; }

.onboard h1 { font-size: 30px; }

.footer-note { text-align: center; color: var(--muted); font-size: 11px; line-height: 1.7; margin-top: 20px; }

.share-box {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.share-box input { font-size: 12px; color: var(--muted); }

@media (max-width: 420px) {
  h1 { font-size: 22px; }
  .card { padding: 15px; }
  .minutes-big { font-size: 38px; }
}
