:root {
  --ink: #1c1915;
  --muted: #6e675e;
  --line: #e3d9c8;
  --paper: #e7e1d4;
  --sheet: #fbf7ef;
  --card: #fffdf8;
  --green: #1f6b45;
  --kai: "KaiTi", "STKaiti", "楷体", "Songti SC", PMingLiU, serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --num: "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
}

body.tone-risk { background: #ddd4c6; }

.book {
  max-width: 1040px;
  margin: 28px auto 64px;
  background: var(--sheet);
  border: 1px solid #d9d0c0;
  position: relative;
  box-shadow: 0 18px 50px rgba(60, 42, 20, 0.08);
}

.book::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  background: #243028;
}

.sheet { padding: 28px 36px 42px 46px; }

.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  flex-wrap: wrap;
}

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

.seal {
  width: 48px;
  height: 48px;
  border: 2px solid #243028;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--kai);
  font-size: 26px;
  flex: none;
}

h1 {
  margin: 0;
  font-family: var(--kai);
  font-size: 36px;
  font-weight: normal;
  line-height: 1.1;
}

.lede, .date, .quiet { margin: 4px 0 0; color: #5e574e; }

.date { margin: 0; font-variant-numeric: tabular-nums; }

.side { text-align: right; }

.who {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  color: #5e574e;
}

.who form { margin: 0; }

.who button.quiet { margin-top: 0; }

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 8px;
}

.jump { display: flex; gap: 16px; margin-top: 16px; font-size: 13px; }

.jump a { color: #2c4570; text-decoration: none; }

.jump a:hover { text-decoration: underline; text-underline-offset: 3px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 22px 0 0;
}

.stats div { padding: 4px 14px; border-left: 1px solid var(--line); }

.stats div:first-child { border-left: none; padding-left: 0; }

.stats dt { font-size: 12px; color: var(--muted); }

.stats dd {
  margin: 0;
  font-family: var(--num);
  font-size: 32px;
  font-variant-numeric: slashed-zero tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
}

.stats dd span { font-size: 14px; margin-left: 2px; color: var(--muted); font-family: var(--sans); }

.mini { margin: 2px 0 0; font-size: 13px; color: #3f4a42; }

.band { margin-top: 18px; }

.error {
  margin: 16px 0 0;
  padding: 10px 14px;
  background: #f8ebe6;
  color: #6d2e24;
  border: 1px solid #e4c8bf;
}

.urge { margin: 18px 0 8px; padding: 22px 22px 20px; }

.urge .kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.urge h2 {
  margin: 6px 0 8px;
  font-family: var(--kai);
  font-size: 30px;
  font-weight: normal;
  line-height: 1.35;
}

.urge p:last-child { margin: 0; max-width: 46em; }

.urge.setup { background: #f3ead7; }
.urge.morning, .urge.day { background: #f6f0e4; border: 1px solid var(--line); }
.urge.firm { background: #f6f0e4; border: 1px solid var(--line); border-left: 4px solid #8e3d48; }
.urge.done { background: #e5f0e4; }
.urge.risk { background: #241c16; color: #f6efe4; }
.urge.risk .kicker { color: #e2c48a; }

.block { margin-top: 34px; }

.section-title {
  margin: 0 0 8px;
  font-family: var(--kai);
  font-size: 26px;
  font-weight: normal;
}

.hint, .fine { color: var(--muted); font-size: 13px; }

.modules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 16px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  --tone: #243028;
}

.card.is-done { background: #f4f8f3; }

.tone-health { --tone: #1f6b45; }
.tone-cognition { --tone: #8a4b24; }
.tone-relation { --tone: #8e3d48; }
.tone-craft { --tone: #2c4570; }

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

.bar { display: block; width: 36px; height: 3px; background: var(--tone); }

.card h3 {
  margin: 8px 0 0;
  font-family: var(--kai);
  font-size: 24px;
  font-weight: normal;
}

.stamp {
  border: 1.5px solid var(--green);
  color: var(--green);
  font-family: var(--kai);
  font-size: 14px;
  padding: 2px 6px;
  transform: rotate(6deg);
}

.motto { margin: 0; color: #5c564c; }

.action { margin: 2px 0; font-size: 18px; line-height: 1.45; }

.field {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #3a3228;
}

input[type="text"],
input[type="password"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
  border: 2px solid #5c5144;
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(36, 28, 16, 0.08);
}

input[type="text"]:hover,
input[type="password"]:hover {
  border-color: #243028;
  background: #fffef8;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: #1f6b45;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 107, 69, 0.18);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
  color: #8a8175;
  font-weight: 400;
}

button { font: inherit; cursor: pointer; }

button.primary {
  align-self: flex-start;
  margin-top: 10px;
  padding: 10px 16px;
  background: #243028;
  color: #f7f3ea;
  border: none;
}

button.primary:hover { background: #1a2620; }

button.primary.xl { width: 100%; margin-top: 16px; padding: 14px 16px; font-size: 16px; }

button.quiet {
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 0;
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

details { margin-top: 8px; }

details summary { cursor: pointer; color: var(--muted); font-size: 13px; }

.heat-now {
  margin: 8px 0 0;
  font-family: var(--num);
  font-size: 18px;
}

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

.cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 2px;
  background: #efe6d8;
  color: #243028;
  font-family: var(--num);
  font-size: 12px;
  line-height: 1;
}

.cell.lv1 { background: #7dba8c; }
.cell.lv2 { background: #3f8f5d; color: #f7f3ea; }
.cell.lv3 { background: #1c5c3a; color: #f7f3ea; }
.cell.lv4 { background: #0e3d24; color: #f7f3ea; }
.cell.lvnext {
  background: transparent;
  box-shadow: inset 0 0 0 1px #e4d9c8;
}
.cell.is-today { outline: 2px solid #241c16; outline-offset: 1px; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 4px;
  vertical-align: -1px;
  border-radius: 2px;
}

.legend .lvnext {
  background: transparent;
  box-shadow: inset 0 0 0 1px #e4d9c8;
}
.legend .lv0 { background: #efe6d8; }
.legend .lv1 { background: #7dba8c; }
.legend .lv2 { background: #3f8f5d; }
.legend .lv3 { background: #1c5c3a; }
.legend .lv4 { background: #0e3d24; }

.split {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 22px;
  align-items: center;
}

.metric { margin: 0 0 12px; }

.metric b {
  display: block;
  font-family: var(--num);
  font-size: 28px;
  font-weight: normal;
  font-variant-numeric: tabular-nums;
}

.metric span { color: var(--muted); font-size: 13px; }

.figure { margin: 0; }

.figure svg { width: 100%; height: auto; display: block; }

.notes { list-style: none; padding: 0; margin: 8px 0 0; }

.notes li {
  display: grid;
  grid-template-columns: 88px 96px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid #eee4d4;
  font-size: 14px;
}

.rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 22px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.rules li {
  padding-top: 8px;
  border-top: 1px solid #e6dccb;
  font-size: 14px;
}

.closing {
  margin: 36px 0 0;
  padding: 0;
  font-family: var(--kai);
  font-size: 22px;
  line-height: 1.6;
  color: #3a342c;
}

.foot { margin-top: 18px; max-width: 48em; }

:focus-visible { outline: 2px solid #243028; outline-offset: 2px; }

@media (max-width: 720px) {
  .book { margin: 0; border: none; box-shadow: none; }
  .sheet { padding: 20px 16px 36px 24px; }
  h1 { font-size: 30px; }
  .stats, .modules, .split, .rules, .auth-grid { grid-template-columns: 1fr; }
  .stats div { border-left: none; padding: 8px 0; border-top: 1px solid var(--line); }
  .stats div:first-child { border-top: none; }
  .heat { grid-template-columns: repeat(10, 1fr); }
  .notes li { grid-template-columns: 1fr; gap: 2px; }
  .urge h2 { font-size: 26px; }
}
