@font-face {
  font-family: "LXGW WenKai Lite";
  src: url("lxgwwenkai-common.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

.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;
}

.record-context-row,
.article-mood-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 9px 0 1px;
}

.article-mood-row {
  justify-content: space-between;
  margin: 14px 0 0;
}

.context-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  max-width: min(100%, 290px);
  padding: 5px 10px;
  border: 1px dashed #cfdcd2;
  border-radius: 999px;
  background: #f8faf7;
  color: #65786d;
  font-size: 12px;
  white-space: nowrap;
}

.context-button svg {
  width: 14px;
  height: 14px;
  color: #4d7d66;
}

.context-button > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.context-button[data-state="ready"] {
  border-style: solid;
  border-color: #cfdfd3;
  background: #eef5ef;
  color: #3e6653;
}

.context-button[data-state="stale"] {
  border-style: solid;
  border-color: #e4d5af;
  background: #fbf7ea;
  color: #79633a;
}

.context-button[data-state="loading"] {
  cursor: wait;
  color: #6f7e75;
}

.context-button[data-state="error"] {
  border-color: #e3c8bd;
  color: #995a44;
  background: #fbf4ef;
}

.context-button .context-weather {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 1px;
  color: #7b6344;
}

.context-weather b {
  font-weight: 500;
}

.context-cache-tag {
  flex: none;
  padding: 1px 5px;
  border-radius: 999px;
  background: #efe2bd;
  color: #755f35;
  font-size: 10px;
  line-height: 1.45;
}

.inline-mood-group {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid #e2e8e2;
  border-radius: 999px;
  background: #fafbf8;
}

.inline-mood {
  width: 28px;
  height: 27px;
  padding: 1px;
  border-radius: 50%;
  color: #708277;
}

.inline-mood:hover,
.inline-mood[aria-pressed="true"] {
  background: #eef4ef;
  filter: none;
}

.inline-mood[aria-pressed="true"] {
  color: #2f7058;
  box-shadow: inset 0 0 0 1px #b8d0c0;
}

.inline-mood.mood-0 { color: #7e899f; }
.inline-mood.mood-1 { color: #829a9f; }
.inline-mood.mood-2 { color: #7d936b; }
.inline-mood.mood-3 { color: #ac893e; }
.inline-mood.mood-4 { color: #b87938; }

.inline-mood svg {
  width: 24px;
  height: 24px;
}

.media-tool-group {
  display: inline-flex;
  gap: 2px;
}

.media-tool-group button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 5px 7px;
  border-radius: 7px;
  color: #61766a;
  font-size: 11px;
}

.media-tool-group button:hover {
  background: #edf3ee;
}

.media-tool-group svg {
  width: 15px;
  height: 15px;
}

.style-details {
  position: relative;
  margin-left: auto;
  z-index: 5;
}

.style-details > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 8px;
  border-radius: 7px;
  color: #526a5e;
  font-size: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.style-details > summary::-webkit-details-marker {
  display: none;
}

.style-details > summary:hover,
.style-details[open] > summary {
  background: #e9f2eb;
  color: #2d6d55;
}

.style-details > summary:focus-visible {
  outline: 2px solid #4b927b;
  outline-offset: 2px;
}

.style-details > summary span:first-child {
  font: 600 15px Georgia, serif;
}

.style-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 9px);
  right: 0;
  width: min(340px, calc(100vw - 28px));
  padding: 15px;
  border: 1px solid #dce6df;
  border-radius: 14px;
  background: #fffefb;
  box-shadow: 0 18px 48px #263f3221;
}

.style-panel.is-viewport-raised {
  transform: translateY(var(--style-panel-shift, 0));
}

.writer-tools .style-panel {
  left: 0;
  right: auto;
}

.style-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -15px -15px 12px;
  padding: 6px 14px;
  border-bottom: 1px solid #edf0ec;
  background: #fffefb;
  font-size: 14px;
}

.style-panel .style-panel-done {
  min-height: 44px;
  color: #fff;
}

.writer-tools .style-panel-done:hover,
.writer-tools .style-panel-done:focus-visible {
  background: #225b45;
  color: #fff;
  filter: none;
}

.style-panel section + section {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid #edf0ec;
}

.style-panel h3 {
  margin: 0 0 8px;
  color: #718078;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
}

.font-options,
.paper-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.font-options button,
.paper-options button {
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid #dfe7e0;
  border-radius: 7px;
  background: #fafcf8;
  color: #5e7066;
  font-size: 12px;
}

.font-options button[aria-pressed="true"],
.paper-options button[aria-pressed="true"] {
  border-color: #94b7a2;
  background: #e8f2ea;
  color: #235e47;
}

.font-options button[data-editor-font="wenkai"] { font-family: "LXGW WenKai Lite", serif; }
.font-options button[data-editor-font="song"] { font-family: "Songti SC", SimSun, serif; }
.font-options button[data-editor-font="kai"] { font-family: "Kaiti SC", KaiTi, STKaiti, serif; }
.font-options button[data-editor-font="sans"] { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }

.paper-options button[data-editor-bg="paper"] { background: #fffefb; }
.paper-options button[data-editor-bg="mist"] { background: linear-gradient(135deg, #f8fbf9, #e9f0eb); }
.paper-options button[data-editor-bg="grid"] {
  background-color: #fffefb;
  background-image: linear-gradient(#dce6df66 1px, transparent 1px), linear-gradient(90deg, #dce6df66 1px, transparent 1px);
  background-size: 8px 8px;
}
.paper-options button[data-editor-bg="forest"] {
  color: #315743;
  background: linear-gradient(#fffdf7aa, #fffdf7aa), url("forest.webp") center / cover;
}

.range-options {
  display: grid;
  gap: 10px;
}

.range-options label {
  display: grid;
  grid-template-columns: 34px 1fr 38px;
  align-items: center;
  gap: 8px;
  color: #5c6f64;
  font-size: 12px;
}

.range-options output {
  color: #849188;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.range-options input[type="range"] {
  accent-color: #2e6d56;
  width: 100%;
}

[data-doc-font="wenkai"] { --doc-font-family: "LXGW WenKai Lite", "Songti SC", serif; }
[data-doc-font="song"] { --doc-font-family: "Songti SC", STSong, "Noto Serif CJK SC", SimSun, serif; }
[data-doc-font="kai"] { --doc-font-family: "Kaiti SC", KaiTi, STKaiti, serif; }
[data-doc-font="sans"] { --doc-font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }

#editor,
.edit-box,
.entry-text,
.article-prose {
  font-family: var(--doc-font-family, inherit);
  font-size: var(--doc-font-size, inherit);
  line-height: var(--doc-line-height, inherit);
  letter-spacing: var(--doc-letter-spacing, inherit);
}

.writing-area #editor {
  font-size: var(--doc-font-size, 16px);
  line-height: var(--doc-line-height, 1.8);
  letter-spacing: var(--doc-letter-spacing, 0);
}

#editor p,
#editor div,
.edit-box p,
.edit-box div,
.entry-text p,
.entry-text div,
.article-prose p,
.article-prose div,
.article-prose h3,
.article-prose ul,
.article-prose ol {
  margin-bottom: var(--doc-paragraph-gap, .88em);
}

#editor-surface,
.entry-text,
.article-prose {
  position: relative;
  isolation: isolate;
  border-radius: 10px;
  transition: background-color .2s ease, box-shadow .2s ease;
}

#editor-surface {
  padding: 2px 10px;
  background: transparent;
}

#editor-surface[data-doc-bg],
.entry-text[data-doc-bg],
.article-prose[data-doc-bg] {
  background-image:
    linear-gradient(#fffefbd9, #fffefbd9),
    var(--doc-bg-image, none);
  background-position: center;
  background-size: cover;
}

#editor-surface[data-doc-bg="mist"],
.entry-text[data-doc-bg="mist"],
.article-prose[data-doc-bg="mist"] {
  background-image: radial-gradient(circle at 18% 8%, #eef6f1, transparent 48%), linear-gradient(145deg, #fbfdf9, #eef4ef);
}

#editor-surface[data-doc-bg="grid"],
.entry-text[data-doc-bg="grid"],
.article-prose[data-doc-bg="grid"] {
  background-color: #fffefb;
  background-image: linear-gradient(#dfe8e166 1px, transparent 1px), linear-gradient(90deg, #dfe8e166 1px, transparent 1px);
  background-size: 24px 24px;
}

#editor-surface[data-doc-bg="forest"],
.entry-text[data-doc-bg="forest"],
.article-prose[data-doc-bg="forest"] {
  background-image: linear-gradient(#fffefbe8, #fffefbe8), url("forest.webp");
  background-position: center;
  background-size: cover;
}

#editor-surface[data-doc-bg="custom"],
.entry-text[data-doc-bg="custom"],
.article-prose[data-doc-bg="custom"] {
  background-image: linear-gradient(#fffefbed, #fffefbed), var(--doc-bg-image);
}

#editor-surface[data-doc-bg="paper"],
.entry-text[data-doc-bg="paper"],
.article-prose[data-doc-bg="paper"] {
  background-image: none;
}

#editor u,
.edit-box u,
.entry-text u,
.article-prose u {
  text-decoration-thickness: 1.5px;
  text-underline-offset: .2em;
  text-decoration-color: #b46d50;
}

#editor s,
.edit-box s,
.entry-text s,
.article-prose s {
  color: #697970;
  text-decoration-color: #b46d50;
}

#editor mark,
.entry-text mark,
.article-prose mark {
  padding: .03em .16em;
  border-radius: 3px;
  background: #f3df9c;
  color: inherit;
}

#editor figure,
.edit-box figure,
.entry-text figure,
.article-prose figure {
  margin: 1.15em 0;
}

#editor img,
.edit-box img,
.entry-text img,
.article-prose img {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 70dvh;
  object-fit: contain;
  border-radius: 11px;
  background: #f2f5f1;
  box-shadow: 0 8px 25px #233c3020;
}

.entry-text img {
  max-height: 320px;
}

#editor figcaption,
.edit-box figcaption,
.entry-text figcaption,
.article-prose figcaption {
  margin-top: 7px;
  color: #7e8b84;
  font: 400 12px/1.6 "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  text-align: center;
}

#editor figcaption:empty::before,
.edit-box figcaption:empty::before,
.article-prose figcaption:empty::before {
  content: attr(data-placeholder);
  color: #a1aaa4;
  pointer-events: none;
}

img.is-missing {
  min-height: 150px;
  padding: 58px 16px;
  border: 1px dashed #d8c6bd;
  background: #f9f4ef;
  color: #8f6552;
  object-fit: contain;
}

.writing-area #editor.is-dragging-image {
  outline: 2px dashed #6d9b80;
  outline-offset: 4px;
  background: #edf5ef55;
}

.article-prose.is-dragging-image {
  outline: 2px dashed #8caf9a;
  outline-offset: 6px;
  background-color: #edf5ef44;
}

.entry-context-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 7px;
  color: #78887e;
  font-size: 11px;
}

.entry-mood {
  display: inline-flex;
  align-items: center;
  color: #64806f;
}

.entry-mood svg {
  width: 18px;
  height: 18px;
}

.record-context {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 9px;
  color: #74847a;
}

.record-context > span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.record-context svg {
  width: 12px;
  height: 12px;
}

.record-context .record-weather b {
  color: #977743;
  font-weight: 500;
}

.record-context .record-context-stale {
  padding: 1px 5px;
  border-radius: 999px;
  background: #f3ead3;
  color: #7b6842;
  font-size: 10px;
}

.entry-head .record-context {
  min-width: 0;
  font-size: 11px;
}

.read-context {
  margin-top: 8px;
}

.read-context .record-context {
  font-size: 12px;
}

.read-mood {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 11px;
  color: #63776b;
  font-size: 12px;
}

.read-mood svg {
  width: 25px;
  height: 25px;
  color: #4f7b62;
}

.read-mood span {
  letter-spacing: .04em;
}

body.article-page .context-button {
  min-height: 32px;
  max-width: 100%;
}

body.article-page .inline-mood-group {
  background: #f6faf5e8;
}

.writer-style-details {
  margin-left: 3px;
}

.writer-style-details > summary {
  min-height: 32px;
}

.writer-tools .style-details > summary {
  font-size: 12px;
}

#mobile-nav {
  display: none;
}

.stats-page {
  --stats-green: #24644e;
  --stats-green-soft: #e7f0e9;
  --stats-rule: #dce5de;
  --stats-muted: #75837b;
  color: #263c32;
}

.stats-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 3px 0 18px;
}

.stats-eyebrow,
.stats-panel header p {
  margin: 0 0 5px;
  color: #8b998f;
  font: 600 10px/1.4 Inter, sans-serif;
  letter-spacing: .16em;
}

.stats-head h1 {
  margin: 0;
  font-family: "LXGW WenKai Lite", "Songti SC", serif;
  font-size: clamp(31px, 3.2vw, 43px);
  font-weight: 600;
  letter-spacing: .05em;
}

.stats-head p:not(.stats-eyebrow) {
  margin: 5px 0 0;
  color: var(--stats-muted);
  font-size: 13px;
}

.stats-month {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  padding: 4px;
  border: 1px solid var(--stats-rule);
  border-radius: 999px;
  background: #fffefb;
}

.stats-month strong {
  min-width: 110px;
  color: #53675b;
  font-size: 12px;
  text-align: center;
}

.stats-month button {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #687a6f;
}

.stats-month button:hover {
  background: var(--stats-green-soft);
}

.stats-month svg {
  width: 15px;
  height: 15px;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.stat-tile {
  min-height: 124px;
  padding: 17px 18px;
  border: 1px solid var(--stats-rule);
  border-radius: 14px;
  background: #fffefb;
  box-shadow: 0 3px 11px #294b3a08;
}

.stat-tile--primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #174f40, #276b54);
  color: #fff;
  border-color: #174f40;
}

.stat-tile--primary::after {
  content: "";
  position: absolute;
  right: -25px;
  bottom: -42px;
  width: 130px;
  height: 110px;
  border: 1px solid #ffffff1b;
  border-radius: 50%;
}

.stat-tile span {
  display: block;
  color: #77867d;
  font-size: 11px;
}

.stat-tile--primary span {
  color: #cfe2d5;
}

.stat-tile strong {
  display: inline-block;
  margin-top: 9px;
  color: #243a30;
  font-family: "LXGW WenKai Lite", Georgia, serif;
  font-size: 38px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.03em;
}

.stat-tile--primary strong {
  color: #fff;
}

.stat-tile .stat-period {
  font-family: Inter, "PingFang SC", sans-serif;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.stat-tile small,
.stat-tile i {
  display: block;
  margin-top: 6px;
  color: #859189;
  font-size: 11px;
  font-style: normal;
}

.stat-tile--primary small {
  color: #d4e5da;
}

.stat-tile i {
  line-height: 1.45;
}

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, .92fr);
  gap: 15px;
  margin-top: 15px;
}

.stats-panel {
  padding: 20px;
  border: 1px solid var(--stats-rule);
  border-radius: 16px;
  background: #fffefb;
  box-shadow: 0 4px 16px #294b3a08;
}

.stats-panel > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.stats-panel h2 {
  margin: 0;
  font-family: "LXGW WenKai Lite", "Songti SC", serif;
  font-size: 22px;
  font-weight: 600;
}

.stats-panel > header > span,
.mood-calendar-head span {
  color: #8a968e;
  font-size: 10px;
}

.stats-delta {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf4ee;
  color: #4f7460 !important;
  white-space: nowrap;
}

.stats-delta.is-down {
  background: #f8efea;
  color: #956653 !important;
}

.mood-index-main {
  display: flex;
  align-items: center;
  gap: 25px;
  min-height: 176px;
  padding: 16px 10px 11px;
}

.mood-gauge {
  position: relative;
  width: 15px;
  height: 150px;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(to top, #dadde9, #d9e9df, #f2e4b5);
  box-shadow: inset 0 0 0 1px #cdd8d0;
}

.mood-gauge span {
  position: absolute;
  inset: auto 0 0;
  height: var(--gauge);
  border-radius: inherit;
  background: linear-gradient(to top, #7d8aa4, #83a59c, #b6913e);
  opacity: .82;
}

.mood-gauge i {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #b96d54;
  transform: translate(-50%, 50%);
  box-shadow: 0 0 0 2px #b96d5433;
}

.mood-index-copy strong {
  display: block;
  font-family: "LXGW WenKai Lite", Georgia, serif;
  font-size: 58px;
  font-weight: 500;
  line-height: .9;
  letter-spacing: -.06em;
  color: #234438;
}

.mood-index-copy small {
  color: #909c94;
  font: 600 9px/1 Inter, sans-serif;
  letter-spacing: .14em;
}

.mood-index-copy p {
  margin: 13px 0 4px;
  color: #4c6458;
  font-family: "LXGW WenKai Lite", serif;
  font-size: 17px;
}

.mood-index-copy span {
  color: #8a968e;
  font-size: 10px;
}

.mood-calendar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 10px;
  padding-top: 14px;
  border-top: 1px solid #edf1ed;
}

.mood-calendar-head h3 {
  margin: 0;
  color: #5c6e63;
  font-size: 12px;
  font-weight: 600;
}

.mood-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.mood-calendar-week {
  padding: 2px 0 4px;
  color: #96a098;
  font-size: 9px;
  text-align: center;
}

.mood-calendar-blank {
  min-height: 44px;
}

.mood-calendar-day {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f6f8f4;
  color: #7e8c83;
}

.mood-calendar-day:hover {
  border-color: #bfd2c3;
}

.mood-calendar-day small {
  position: absolute;
  left: 4px;
  top: 2px;
  font-size: 8px;
  color: #919b94;
}

.mood-calendar-day svg {
  width: 22px;
  height: 22px;
}

.mood-calendar-day.mood-0 { color: #7e899f; background: #f0f2f7; }
.mood-calendar-day.mood-1 { color: #829a9f; background: #eef4f4; }
.mood-calendar-day.mood-2 { color: #7d936b; background: #f0f4eb; }
.mood-calendar-day.mood-3 { color: #ac893e; background: #faf5e8; }
.mood-calendar-day.mood-4 { color: #b87938; background: #fbf1df; }
.mood-calendar-day.is-today { box-shadow: inset 0 0 0 1.5px #2e6d56; }

.entry-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #73a086;
}

.hour-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  align-items: end;
  gap: 3px;
  height: 126px;
  margin: 18px 0 17px;
  padding: 8px 0 17px;
  border-bottom: 1px solid #dfe7e1;
}

.hour-bar {
  position: relative;
  height: 100%;
  display: flex;
  align-items: end;
  justify-content: center;
}

.hour-bar i {
  display: block;
  width: min(100%, 11px);
  height: var(--bar-height);
  min-height: 3px;
  border-radius: 4px 4px 2px 2px;
  background: #bcd4c1;
}

.hour-bar.is-peak i {
  background: #d7a461;
  box-shadow: 0 0 0 3px #d7a4611b;
}

.hour-bar small {
  position: absolute;
  top: calc(100% + 4px);
  color: #98a29b;
  font-size: 8px;
  white-space: nowrap;
}

.period-list {
  display: grid;
  gap: 9px;
}

.period-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
}

.period-row > span {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.period-row b {
  color: #4d6055;
  font-size: 11px;
  font-weight: 600;
}

.period-row small {
  color: #98a19b;
  font-size: 9px;
}

.period-row > i {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2ed;
}

.period-row em {
  display: block;
  width: var(--period);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #86af92, #427b60);
}

.period-row strong {
  color: #74827a;
  font-size: 10px;
  font-weight: 500;
  text-align: right;
}

.stats-latest {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 17px;
  padding: 12px;
  border: 1px solid #e1e8e2;
  border-radius: 10px;
  background: #f8faf6;
}

.stats-latest > span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7f0e9;
  color: #4d7c63;
}

.stats-latest svg {
  width: 15px;
  height: 15px;
}

.stats-latest small,
.stats-latest b {
  display: block;
}

.stats-latest small {
  color: #939e97;
  font-size: 9px;
}

.stats-latest b {
  margin-top: 2px;
  color: #56695d;
  font-size: 11px;
  font-weight: 550;
}

@media (max-width: 980px) {
  .stats-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  #menu {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
  }

  .article-page .writer-tools {
    background: #fbfdf9f7;
    backdrop-filter: none;
  }

  .writer-tools .style-panel {
    left: 9px;
    right: 9px;
    width: auto;
  }

  #mobile-nav {
    position: fixed;
    z-index: 18;
    left: 10px;
    right: 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: 58px;
    padding: 5px;
    border: 1px solid #dce5de;
    border-radius: 17px;
    background: #fbfdfaf2;
    box-shadow: 0 16px 45px #18352a2b;
    backdrop-filter: blur(18px);
  }

  body.nav-open #mobile-nav {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  body.nav-open #sidebar {
    display: flex;
    overflow: hidden;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }

  body.nav-open #sidebar > nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 12px;
  }

  body.nav-open #side-foot {
    flex: none;
    margin-top: 0;
    padding-top: 8px;
    background: #fcfdfb;
    box-shadow: 0 -12px 22px #fcfdfb;
  }

  body.nav-open #calendar {
    margin-top: 14px;
    padding-bottom: 16px;
  }

  body.nav-open #profile {
    padding-top: 13px;
    padding-bottom: max(13px, env(safe-area-inset-bottom));
  }

  #mobile-nav button {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 46px;
    border-radius: 12px;
    color: #7b8980;
  }

  #mobile-nav button.selected {
    background: #e7f0e9;
    color: #2a674f;
  }

  #mobile-nav svg {
    width: 19px;
    height: 19px;
  }

  #mobile-nav small {
    font-size: 9px;
  }

  body:not(.article-page) main {
    padding-bottom: 86px;
  }

  .style-panel {
    position: fixed;
    z-index: 40;
    inset: auto 9px max(9px, env(safe-area-inset-bottom)) 9px;
    width: auto;
    max-height: 70dvh;
    overflow-y: auto;
    border-radius: 18px;
    box-shadow: 0 -20px 60px #203c2f38;
  }

  .style-panel.is-viewport-raised {
    transform: none;
  }

  .style-panel-head {
    position: sticky;
    top: -15px;
    z-index: 1;
  }

  .style-details[open] {
    z-index: 60;
  }

  body.style-panel-open #mobile-nav {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .style-details:not([open]) .style-panel {
    display: none;
  }

  .style-details::after {
    display: none;
  }

  .style-details[open]::after {
    content: "";
    display: block;
    position: fixed;
    z-index: 35;
    inset: 0;
    background: #18362b36;
    backdrop-filter: blur(2px);
  }
}

@media (max-width: 700px) {
  .record-context-row {
    gap: 5px;
  }

  .context-button {
    max-width: calc(100% - 132px);
    min-height: 40px;
  }

  .inline-mood {
    width: 40px;
    height: 40px;
  }

  .media-tool-group button {
    min-width: 40px;
    min-height: 40px;
  }

  .style-details {
    margin-left: 0;
  }

  .style-details > summary {
    min-height: 40px;
  }

  #editor-surface {
    padding: 2px 7px;
  }

  .article-mood-row {
    margin-top: 12px;
  }

  .article-mood-row .inline-mood {
    width: 38px;
    height: 38px;
  }

  .article-mood-row .media-tool-group button {
    padding-inline: 5px;
  }

  .stats-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .stats-month {
    align-self: stretch;
    justify-content: space-between;
  }

  .stats-summary {
    gap: 8px;
  }

  .stat-tile {
    min-height: 108px;
    padding: 14px;
  }

  .stat-tile strong {
    font-size: 32px;
  }

  .stat-tile .stat-period {
    font-size: 18px;
  }

  .stats-panel {
    padding: 16px 14px;
  }

  .mood-index-main {
    gap: 20px;
  }

  .mood-index-copy strong {
    font-size: 50px;
  }

  .mood-calendar-head span {
    display: none;
  }

  .mood-calendar-grid {
    gap: 3px;
  }

  .mood-calendar-day {
    min-height: 44px;
  }

  .mood-calendar-day svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 430px) {
  .media-tool-group button > span:last-child {
    display: none;
  }

  .media-tool-group button {
    width: 40px;
    padding-inline: 4px;
    justify-content: center;
  }

  .record-context-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "weather weather"
      "mood mood"
      "media style";
    align-items: center;
    gap: 6px 8px;
  }

  .record-context-row .context-button {
    grid-area: weather;
    max-width: none;
    width: 100%;
    min-height: 48px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 7px;
    row-gap: 1px;
    padding: 7px 11px;
    border-radius: 14px;
    white-space: normal;
  }

  .record-context-row .context-button > svg {
    grid-column: 1;
    grid-row: 1;
  }

  .record-context-row .context-button > span:not(.context-weather) {
    grid-column: 2;
    grid-row: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .record-context-row .context-button .context-weather {
    grid-column: 2;
    grid-row: 2;
    margin-left: 0;
    overflow: visible;
    white-space: nowrap;
  }

  .record-context-row .inline-mood-group {
    grid-area: mood;
    justify-self: start;
  }

  .record-context-row .media-tool-group {
    grid-area: media;
    justify-self: start;
  }

  .record-context-row .style-details {
    grid-area: style;
    align-self: center;
    justify-self: end;
  }

  .editor-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 8px;
  }

  .editor-tools .tool-group {
    grid-column: 1 / -1;
    justify-content: space-between;
    width: 100%;
    gap: 2px;
  }

  .editor-tools .tool-group button {
    width: 40px;
    height: 40px;
  }

  .editor-tools #smart {
    justify-self: start;
    margin-left: 0;
    min-height: 40px;
    padding: 5px 8px;
    white-space: nowrap;
  }

  .editor-tools #word-count {
    justify-self: end;
    margin-left: 0;
    white-space: nowrap;
  }

  body.article-page .article-mood-row {
    align-items: flex-start;
  }

  .read-context .record-context {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .stats-head h1 {
    font-size: 34px;
  }

  .stat-tile {
    min-height: 102px;
    padding: 13px;
  }

  .stat-tile strong {
    font-size: 30px;
  }

  .stat-tile .stat-period {
    font-size: 16px;
  }

  .hour-chart {
    gap: 2px;
  }

  .period-row {
    grid-template-columns: 70px minmax(0, 1fr) 18px;
    gap: 7px;
  }

  .mood-calendar-day {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #editor-surface,
  .entry-text,
  .article-prose {
    transition: none;
  }
}

.article-photos { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(96px,100%),1fr)); gap:6px; margin:8px 0; }
.article-photos img { display:block; width:100%; height:85px; object-fit:cover; border-radius:8px; }
.photo-trigger { display:block; width:100%; padding:0; border:0; border-radius:8px; background:transparent; cursor:zoom-in; }

.life-stats-panel {
  margin-top: 15px;
  overflow: hidden;
}

.life-stats-panel > header {
  align-items: center;
}

.life-month-summary {
  display: block;
  margin-top: 5px;
  color: var(--stats-muted);
  font-size: 11px;
}

.life-record-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #d7e4d9;
  border-radius: 999px;
  background: #f2f8f2;
  color: #3d6c53;
  font-size: 11px;
  font-weight: 600;
}

.life-record-link svg {
  width: 14px;
  height: 14px;
}

.life-record-link:hover {
  background: #e8f2e9;
}

.life-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-top: 16px;
}

.life-metric {
  min-width: 0;
  min-height: 104px;
  padding: 13px 14px;
  border: 1px solid #e4ebe5;
  border-radius: 12px;
  background: #f8faf7;
}

.life-metric--poop {
  border-color: #ead9c9;
  background: #fbf5ed;
}

.life-metric--pee {
  border-color: #e6e0c8;
  background: #fbf9ee;
}

.life-metric > span {
  display: block;
  color: #7d8a81;
  font-size: 10px;
}

.life-metric > strong {
  display: block;
  margin-top: 7px;
  color: #2d493c;
  font-family: "LXGW WenKai Lite", Georgia, serif;
  font-size: 31px;
  font-weight: 550;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.life-metric > strong small {
  margin-left: 3px;
  color: #849187;
  font-family: Inter, "PingFang SC", sans-serif;
  font-size: 10px;
  font-weight: 500;
}

.life-metric > i {
  display: block;
  margin-top: 7px;
  color: #8b978f;
  font-size: 9px;
  font-style: normal;
  line-height: 1.45;
}

.life-metric .life-latest {
  margin-top: 9px;
  font-family: Inter, "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.life-chart-shell {
  margin-top: 13px;
  padding: 15px 16px 12px;
  border: 1px solid #e6ece6;
  border-radius: 13px;
  background: linear-gradient(180deg, #fbfcfa, #f7faf6);
}

.life-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.life-chart-head b,
.life-chart-head span {
  display: block;
}

.life-chart-head b {
  color: #445d50;
  font-size: 12px;
  font-weight: 650;
}

.life-chart-head > div:first-child > span {
  margin-top: 3px;
  color: #929d96;
  font-size: 9px;
}

.life-legend {
  display: flex;
  gap: 12px;
  color: #7d8b82;
  font-size: 9px;
}

.life-legend span {
  display: flex !important;
  align-items: center;
  gap: 5px;
}

.life-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.life-legend .life-bar--poop {
  background: #b27a50;
}

.life-legend .life-bar--pee {
  background: #c5a33f;
}

.life-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  min-height: 130px;
  margin-top: 11px;
  padding-top: 4px;
}

.life-chart-day {
  min-width: 0;
  min-height: 118px;
  display: grid;
  grid-template-rows: 78px auto auto;
  justify-items: center;
  align-items: end;
  gap: 3px;
  padding: 3px 2px 2px;
  border-radius: 8px;
  color: #7d8b82;
}

.life-chart-day:hover,
.life-chart-day.is-today {
  background: #edf4ed;
}

.life-chart-day.is-today {
  box-shadow: inset 0 0 0 1px #d3e1d5;
}

.life-bar-pair {
  width: 100%;
  height: 78px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  border-bottom: 1px solid #dfe7e0;
}

.life-bar {
  display: block;
  width: min(28%, 9px);
  min-height: 2px;
  height: var(--life-height);
  border-radius: 4px 4px 1px 1px;
}

.life-bar--poop {
  background: linear-gradient(to top, #96613f, #c39063);
}

.life-bar--pee {
  background: linear-gradient(to top, #a58a32, #d6bc63);
}

.life-chart-day strong {
  color: #53675a;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.life-chart-day small {
  max-width: 100%;
  overflow: hidden;
  color: #8d9991;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .life-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 430px) {
  .life-stats-panel {
    padding-inline: 12px;
  }

  .life-stats-panel > header {
    align-items: flex-start;
  }

  .life-metrics {
    gap: 7px;
  }

  .life-metric {
    min-height: 96px;
    padding: 11px;
  }

  .life-metric > strong {
    font-size: 27px;
  }

  .life-metric .life-latest {
    font-size: 12px;
  }

  .life-chart-shell {
    padding: 13px 9px 10px;
  }

  .life-chart-head {
    gap: 7px;
  }

  .life-chart {
    gap: 2px;
  }

  .life-chart-day {
    padding-inline: 0;
  }

  .life-bar-pair {
    gap: 2px;
  }
}
dialog.photo-viewer[open] { position:fixed; inset:0; display:grid; place-items:center; box-sizing:border-box; width:100%; height:100%; max-width:none; max-height:none; margin:0; padding:0; border:0; border-radius:0; background:#101512; }
.photo-viewer img { display:block; width:100%; height:100vh; height:100dvh; object-fit:contain; pointer-events:none; }
.photo-viewer button { position:absolute; top:max(12px,env(safe-area-inset-top)); right:max(12px,env(safe-area-inset-right)); min-height:44px; padding:0 16px; border:1px solid #ffffff70; border-radius:24px; background:#18221ce6; color:white; }
body:has(.photo-viewer[open]) { overflow:hidden; }
