:root {
  --bg: #eef1e9;
  --surface: rgba(255, 252, 244, 0.68);
  --surface-2: rgba(238, 233, 219, 0.56);
  --ink: #1f2a25;
  --muted: #6f756d;
  --line: rgba(113, 121, 104, 0.22);
  --accent: #436f4f;
  --accent-2: #c9523d;
  --accent-3: #376f88;
  --done: #52795b;
  --warn: #b9782f;
  --shadow: 0 18px 50px rgba(53, 65, 54, 0.16);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: url("./assets/dawn-valley-bg.png") center / cover fixed, var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body::after {
  display: none;
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: auto 1fr;
  min-height: 100vh;
  padding: 24px 16px 24px 16px;
  gap: 24px;
}

.sidebar {
  position: sticky;
  top: 24px;
  width: 214px;
  height: calc(100vh - 48px);
  padding: 22px 14px;
  background: rgba(255, 252, 244, 0.64);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: width 180ms ease, transform 180ms ease;
  z-index: 20;
}

.sidebar.collapsed {
  width: 76px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f5d99f, #d8e2cf);
  color: #2f5540;
  font-weight: 900;
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-copy strong {
  font-size: 15px;
  line-height: 1.2;
}

.brand-copy span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .backup-tools {
  display: none;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.backup-tools {
  display: grid;
  gap: 7px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.mini-action {
  min-height: 34px;
  border-color: rgba(113, 121, 104, 0.18);
  background: rgba(255, 252, 244, 0.45);
  color: #536058;
  font-size: 12px;
  font-weight: 700;
}

.mini-action:hover {
  border-color: rgba(67, 111, 79, 0.42);
  color: var(--accent);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: transparent;
  color: #48544c;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: linear-gradient(135deg, rgba(96, 130, 91, 0.88), rgba(118, 151, 108, 0.72));
  color: #fffdf8;
  box-shadow: 0 8px 18px rgba(73, 104, 73, 0.18);
}

.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(66, 96, 73, 0.1);
  font-size: 13px;
  font-weight: 800;
}

.collapse-btn {
  position: absolute;
  right: 12px;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 252, 244, 0.72);
  color: var(--ink);
  cursor: pointer;
}

.sidebar.collapsed .collapse-btn {
  transform: rotate(180deg);
}

.main {
  min-width: 0;
  padding: 34px 18px 0;
}

.mobile-topbar {
  display: none;
}

.view {
  display: none;
  width: min(1220px, 100%);
  margin: 0 auto;
}

.view.active {
  display: block;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px 22px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
  background: rgba(255, 252, 244, 0.6);
  box-shadow: 0 16px 40px rgba(42, 63, 49, 0.08);
  backdrop-filter: blur(14px);
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
}

.lead {
  max-width: 680px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.home-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  min-height: 108px;
  padding: 4px 0 18px;
}

.home-hero h1 {
  font-size: 34px;
  letter-spacing: 0.02em;
}

.home-date {
  color: #5d655f;
  font-size: 14px;
  white-space: nowrap;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 1fr));
  gap: 8px;
  min-width: 220px;
}

.stat-strip div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface);
  backdrop-filter: blur(14px);
}

.stat-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.stat-strip strong {
  font-size: 26px;
}

.home-stats {
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  max-width: 950px;
  margin-bottom: 36px;
}

.home-stats div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
  min-height: 78px;
  padding: 16px 20px;
}

.home-stats div::before {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(218, 226, 203, 0.8);
  color: var(--accent);
  font-weight: 900;
  content: "✓";
}

.home-stats div:nth-child(2)::before { content: "◎"; }
.home-stats div:nth-child(3)::before { content: "◒"; }
.home-stats div:nth-child(4)::before { content: "◇"; }

.home-stats span,
.home-stats strong {
  align-self: end;
}

.home-stats strong {
  align-self: start;
}

.home-ask {
  width: min(780px, 100%);
  margin: 0 auto 10px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.home-card {
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: var(--radius);
  background: rgba(255, 252, 244, 0.62);
  box-shadow: 0 18px 44px rgba(42, 63, 49, 0.11);
  backdrop-filter: blur(15px);
  overflow: hidden;
}

.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

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

.text-action {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  padding: 0;
}

.home-list,
.home-review {
  display: grid;
  padding: 8px 18px 14px;
}

.home-row,
.home-review button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid rgba(113, 121, 104, 0.13);
  border-radius: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  white-space: normal;
}

.home-row:last-child,
.home-review button:last-child {
  border-bottom: 0;
}

.home-row span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(72, 88, 74, 0.46);
  border-radius: 5px;
  color: #fff;
  font-size: 12px;
}

.home-row.done span {
  border-color: var(--done);
  background: var(--done);
}

.home-row strong,
.home-review strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.home-review {
  gap: 6px;
}

.home-review button {
  grid-template-columns: 1fr;
  gap: 3px;
  min-height: 58px;
  padding: 6px 0;
}

.home-review span {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.home-knowledge {
  margin-top: 14px;
}

.knowledge-tiles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
}

.knowledge-tiles button {
  display: grid;
  gap: 7px;
  min-height: 112px;
  border-color: rgba(190, 171, 124, 0.34);
  background:
    linear-gradient(110deg, rgba(247, 229, 178, 0.62), rgba(255, 252, 244, 0.76) 46%, rgba(197, 218, 201, 0.72)),
    rgba(255, 252, 244, 0.58);
  padding: 18px 20px;
  text-align: left;
  white-space: normal;
}

.knowledge-tiles strong {
  font-size: 18px;
}

.knowledge-tiles span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.knowledge-tiles em {
  color: #4f684f;
  font-size: 13px;
  font-style: normal;
}

.entry-form {
  display: grid;
  grid-template-columns: minmax(200px, 1.2fr) 140px minmax(200px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 14px 36px rgba(42, 63, 49, 0.1);
  backdrop-filter: blur(14px);
}

.entry-form.stacked {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.knowledge-stats {
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  min-width: 330px;
}

.entry-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.entry-form .wide {
  min-width: 0;
}

.type-only[hidden] {
  display: none;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.knowledge-type {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.knowledge-type legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.knowledge-type label {
  display: block;
}

.knowledge-type input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.knowledge-type span {
  display: grid;
  place-items: center;
  min-height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  cursor: pointer;
}

.knowledge-type input:checked + span {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 5px rgba(54, 47, 37, 0.1);
}

.quote-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.78);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 101, 0.13);
}

.form-actions,
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

button,
.link-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: rgba(255, 252, 244, 0.66);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, #426f4f, #5f835e);
  color: #fff;
  font-weight: 800;
}

.secondary {
  border-color: #c5d7d2;
  background: #e9f3f0;
  color: #1f5b52;
  font-weight: 800;
}

.ghost {
  background: transparent;
}

.danger {
  border-color: #f0c7bf;
  background: #fff1ed;
  color: #a73f2f;
}

.item-list {
  display: grid;
  gap: 10px;
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 253, 248, 0.58);
}

.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 12px 30px rgba(42, 63, 49, 0.09);
  backdrop-filter: blur(14px);
}

.item.done {
  background: #eef5ed;
}

.check-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 8px;
  border-color: #c8d7c8;
  background: #fffefa;
  color: var(--done);
  font-weight: 900;
}

.item.done .check-btn {
  background: var(--done);
  border-color: var(--done);
  color: #fff;
}

.item-main {
  min-width: 0;
}

.item-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.item h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 0 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.item-actions {
  display: flex;
  gap: 7px;
}

.icon-action {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ask-panel {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: rgba(247, 251, 243, 0.62);
  box-shadow: 0 20px 54px rgba(42, 63, 49, 0.13);
  backdrop-filter: blur(16px);
}

.ask-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ask-copy .eyebrow {
  margin: 0;
}

.ask-copy h2 {
  margin: 0;
  font-size: 20px;
}

.ask-form {
  display: grid;
  gap: 10px;
}

.ask-form textarea {
  min-height: 94px;
  background: rgba(255, 255, 255, 0.72);
}

.ask-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ask-answer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #cadbd5;
}

.answer-kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.ask-answer h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}

.ask-answer > p:not(.answer-kicker) {
  margin: 9px 0 0;
  color: #52645e;
  line-height: 1.7;
}

.answer-rules {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.answer-rules article {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid #c9d9d3;
  border-radius: 6px;
  background: rgba(255, 253, 248, 0.76);
}

.answer-rules strong {
  font-size: 15px;
}

.answer-rules span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.knowledge-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.knowledge-search {
  display: grid;
  gap: 6px;
  width: min(380px, 100%);
}

.knowledge-search span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.knowledge-item.pinned {
  border-color: #c9d9d3;
  background: #f7fbf8;
}

.knowledge-item blockquote {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid #d8c48d;
  background: #fff9e8;
  color: #4a4032;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.pin-action {
  color: #9a7b29;
}

.pinned-pill {
  background: #f7eed1;
  color: #846719;
}

.scenario-pill {
  background: #e8f1ee;
  color: #38675e;
}

.type-pill {
  background: #e8edf4;
  color: #3f5f88;
}

.range-text {
  color: var(--warn);
  font-weight: 800;
}

#view-review {
  --journal-paper: #f5f3ec;
  --journal-ink: #454b43;
  --journal-muted: #84887e;
  --journal-line: #d7d5cc;
  --journal-wash: #ebe9e0;
  --journal-accent: #6b7664;
  --journal-soft: #e5e8df;
  --journal-serif: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  color: var(--journal-ink);
}

#view-review .view-head {
  align-items: flex-start;
  border-bottom-color: var(--journal-line);
}

#view-review .eyebrow {
  color: var(--journal-accent);
  letter-spacing: 0.12em;
}

#view-review h1 {
  font-family: var(--journal-serif);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

#view-review .lead {
  color: var(--journal-muted);
  font-family: var(--journal-serif);
  font-size: 16px;
}

#view-review .stat-strip div {
  border-color: var(--journal-line);
  background: rgba(245, 243, 236, 0.72);
}

#view-review .stat-strip span {
  color: var(--journal-muted);
}

#view-review .stat-strip strong {
  color: var(--journal-ink);
  font-family: var(--journal-serif);
  font-weight: 500;
}

.journal-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 20px;
  font-family: var(--journal-serif);
}

.journal-main,
.journal-history {
  border: 1px solid var(--journal-line);
  border-radius: 2px;
  background: var(--journal-paper);
}

.journal-main {
  overflow: hidden;
  padding: 0;
}

.journal-datebar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--journal-line);
}

.journal-datebar label {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.journal-datebar span {
  color: var(--journal-muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 11px;
  font-weight: 700;
}

.journal-datebar input {
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--journal-line);
  border-radius: 0;
  background: transparent;
  color: var(--journal-ink);
  font-family: var(--journal-serif);
  font-size: 18px;
  padding: 6px 0;
  box-shadow: none;
}

#view-review .journal-datebar button,
#view-review .journal-actions button {
  border-radius: 1px;
  min-height: 44px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

#view-review .journal-datebar .secondary,
#view-review .journal-actions .secondary {
  border-color: #b6b8af;
  background: transparent;
  color: var(--journal-accent);
}

#view-review .journal-datebar .danger {
  border-color: #d4b8ad;
  background: transparent;
  color: #8a5b4f;
}

.step-nav {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  overflow-x: auto;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--journal-line);
  scrollbar-width: none;
}

.step-nav::-webkit-scrollbar {
  display: none;
}

.step-nav::before {
  position: absolute;
  top: 32px;
  left: 46px;
  right: 46px;
  height: 1px;
  background: var(--journal-line);
  content: "";
}

.step-nav button {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 6px;
  place-items: center;
  min-width: 58px;
  min-height: 54px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--journal-muted);
  font-family: var(--journal-serif);
  line-height: 1;
}

.step-nav button::before {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #b8b9b1;
  border-radius: 50%;
  background: var(--journal-paper);
  color: var(--journal-ink);
  font-size: 15px;
  content: attr(data-id);
}

.step-nav button[data-id="0"]::before { content: "1"; }
.step-nav button[data-id="1"]::before { content: "2"; }
.step-nav button[data-id="2"]::before { content: "3"; }
.step-nav button[data-id="3"]::before { content: "4"; }
.step-nav button[data-id="4"]::before { content: "5"; }
.step-nav button[data-id="5"]::before { content: "6"; }
.step-nav button[data-id="6"]::before { content: "7"; }

.step-nav button span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--journal-muted);
  font-size: 10px;
  white-space: nowrap;
}

.step-nav button.active {
  color: var(--journal-accent);
}

.step-nav button.active::before {
  border-color: var(--journal-accent);
  background: var(--journal-accent);
  color: var(--journal-paper);
}

.step-nav button.done {
  color: var(--journal-accent);
}

.step-nav button.done::before {
  border-color: var(--journal-accent);
  background: var(--journal-soft);
}

.journal-card {
  padding: 28px 34px 30px;
  border: 0;
  border-radius: 0;
  background: var(--journal-paper);
}

.journal-card h2 {
  margin: 18px 0 12px;
  color: var(--journal-ink);
  font-family: var(--journal-serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.48;
  letter-spacing: 0.02em;
}

.journal-card p {
  max-width: 760px;
  color: var(--journal-muted);
  font-family: var(--journal-serif);
  font-size: 15px;
  line-height: 1.9;
}

.journal-card textarea {
  min-height: 236px;
  margin-top: 20px;
  border: 0;
  border-block: 1px solid var(--journal-line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.16);
  color: var(--journal-ink);
  font-family: var(--journal-serif);
  font-size: 18px;
  line-height: 1.85;
  padding: 16px 2px;
  box-shadow: none;
}

.journal-card textarea:focus {
  border-color: var(--journal-accent);
  box-shadow: none;
}

.example-list {
  display: grid;
  gap: 0;
  margin: 18px 0;
  padding: 12px 16px 12px 18px;
  border-left: 2px solid #b8bbb0;
  background: var(--journal-wash);
}

.example-list button {
  min-height: 34px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #62665e;
  font-family: var(--journal-serif);
  font-size: 14px;
  line-height: 1.55;
  padding: 4px 0;
  white-space: normal;
  text-align: left;
}

.journal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

#view-review .journal-actions .primary {
  border-color: var(--journal-accent);
  background: var(--journal-accent);
  color: var(--journal-paper);
  font-weight: 500;
}

.journal-history {
  align-self: start;
  padding: 18px 18px 20px;
}

.history-head {
  display: grid;
  gap: 7px;
  margin-bottom: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--journal-line);
}

.history-head h2 {
  margin: 0;
  font-family: var(--journal-serif);
  font-size: 20px;
  font-weight: 500;
}

.history-head span {
  color: var(--journal-muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 12px;
}

#journalHistory {
  display: grid;
  gap: 0;
}

.history-item {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 0;
  padding: 16px 3px;
  border: 0;
  border-bottom: 1px solid var(--journal-line);
  border-radius: 0;
  background: transparent;
  text-align: left;
  white-space: normal;
}

.history-item.active {
  color: var(--journal-accent);
}

.history-item span {
  color: var(--journal-muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 12px;
}

.history-item p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--journal-muted);
  font-family: var(--journal-serif);
  font-size: 13px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (max-width: 860px) {
  .app {
    display: block;
    padding: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    height: 100vh;
    border-radius: 0 8px 8px 0;
    transform: translateX(-104%);
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: 244px;
  }

  .sidebar.collapsed .brand-copy,
  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .backup-tools {
    display: grid;
  }

  .collapse-btn {
    display: none;
  }

  .drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(20, 21, 20, 0.34);
    z-index: 15;
  }

  .main {
    padding: 78px 16px 22px;
  }

  .mobile-topbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    height: 62px;
    padding: 0 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 252, 244, 0.86);
    backdrop-filter: blur(12px);
  }

  .mobile-topbar div {
    display: grid;
    gap: 2px;
  }

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

  .icon-btn {
    width: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 20px;
    background: var(--surface);
  }

  .view-head {
    align-items: stretch;
    flex-direction: column;
  }

  .home-hero {
    flex-direction: column;
    min-height: 0;
    padding-top: 8px;
  }

  .home-date {
    display: none;
  }

  h1 {
    font-size: 28px;
  }

  .stat-strip {
    min-width: 0;
  }

  .home-stats,
  .knowledge-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  .home-grid,
  .knowledge-tiles {
    grid-template-columns: 1fr;
  }

  .home-ask {
    width: 100%;
  }

  .knowledge-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .entry-form {
    grid-template-columns: 1fr;
  }

  .quote-grid {
    grid-template-columns: 1fr;
  }

  .form-actions,
  .toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .knowledge-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .knowledge-search {
    width: 100%;
  }

  .item {
    grid-template-columns: auto 1fr;
  }

  .item-actions {
    grid-column: 2;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .journal-shell {
    grid-template-columns: 1fr;
  }

  .step-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .journal-card h2 {
    font-size: 21px;
  }
}

@media (max-width: 480px) {
  .main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .item {
    padding: 12px;
  }

  .item h2 {
    font-size: 16px;
  }

  button,
  .link-btn {
    min-height: 38px;
    padding: 0 11px;
  }
}
