:root {
  --paper: #f8f3e7;
  --surface: #fffdf8;
  --surface-soft: #faf8f4;
  --ink: #2b2723;
  --muted: #756c60;
  --line: #e3dacb;
  --line-strong: #d3c7b6;
  --cinnabar: #9f2f2c;
  --cinnabar-dark: #7a150e;
  --cinnabar-soft: rgba(159, 47, 44, 0.07);
  --gold: #b08a4f;
  --green: #28593a;
  --green-soft: #f2f8f3;
  --green-line: #c8dfcf;
  --shadow: 0 12px 40px rgba(60, 45, 30, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans SC", -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
}

.share-cover {
  position: fixed;
  left: 0;
  top: 0;
  z-index: -1;
  width: 300px;
  height: 300px;
  opacity: 0.01;
  pointer-events: none;
  object-fit: cover;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(159, 47, 44, 0.25);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.3;
  background-image:
    linear-gradient(90deg, rgba(62, 51, 35, 0.025) 1px, transparent 1px),
    linear-gradient(rgba(62, 51, 35, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
}

.eyebrow {
  margin: 0;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-weight: 500;
  line-height: 1.3;
}

.is-positive {
  color: var(--cinnabar);
}

.is-negative {
  color: var(--muted);
}

.is-zero {
  color: #8f877c;
}

.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 16px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button-primary {
  background: var(--cinnabar);
  color: #fff;
}

.button-primary:hover:not(:disabled) {
  background: var(--cinnabar-dark);
}

.button-secondary {
  border-color: var(--cinnabar);
  background: #fff;
  color: var(--cinnabar);
}

.button-secondary:hover:not(:disabled) {
  background: var(--cinnabar-soft);
}

.button-quiet {
  min-height: 44px;
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.button-wide {
  width: 100%;
  min-height: 50px;
}

.brand-seal {
  display: inline-grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid var(--cinnabar);
  border-radius: 6px;
  color: var(--cinnabar);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-seal.small {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  font-size: 12px;
}

.brand-logo {
  display: block;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 6px;
  object-fit: cover;
}

.brand-logo.small {
  width: 42px;
  height: 42px;
}

.site-footer {
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.login-shell {
  display: grid;
  min-height: calc(100vh - 54px);
  min-height: calc(100svh - 54px - env(safe-area-inset-bottom));
  place-items: center;
  padding: 28px 18px;
}

.login-panel {
  width: min(100%, 440px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel .eyebrow {
  margin-top: 18px;
}

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

.login-brand-copy {
  min-width: 0;
}

.login-brand .eyebrow {
  margin-top: 0;
}

.login-panel h1 {
  margin-top: 4px;
  font-size: 30px;
}

.login-intro {
  margin: 8px 0 26px;
  color: var(--muted);
  font-size: 14px;
}

.field-label {
  display: block;
  margin: 16px 0 7px;
  color: #5f574d;
  font-size: 13px;
  font-weight: 600;
}

.text-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d9d0c2;
  border-radius: 6px;
  padding: 10px 13px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}

.text-input::placeholder {
  color: #aaa298;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px;
  gap: 9px;
}

#login-button {
  margin-top: 20px;
}

.form-message {
  min-height: 25px;
  margin: 11px 0 0;
  color: var(--cinnabar);
  font-size: 13px;
}

.privacy-note {
  margin: 22px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  color: var(--muted);
  font-size: 12px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 243, 231, 0.96);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  display: flex;
  width: min(1080px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.brand {
  display: flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

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

.brand-copy strong {
  overflow: hidden;
  color: var(--cinnabar-dark);
  font-family: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.virtue-page {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.privacy-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border: 1px solid var(--green-line);
  border-radius: 6px;
  padding: 9px 13px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
}

.privacy-banner i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #3a8b58;
}

.virtue-panel {
  display: grid;
  min-width: 0;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  background: #fff;
}

.virtue-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e7dfd2;
  padding-bottom: 16px;
}

.virtue-head-copy {
  min-width: 0;
}

.virtue-head h1 {
  margin-top: 3px;
  font-size: 31px;
}

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

.total-score {
  display: grid;
  min-width: 92px;
  flex: 0 0 auto;
  justify-items: end;
  gap: 2px;
}

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

.total-score strong {
  font-family: Arial, sans-serif;
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
}

.version-bar {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.version-trigger {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--surface-soft);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.version-trigger > span {
  display: grid;
  min-width: 0;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: baseline;
  gap: 3px 10px;
}

.version-trigger small {
  color: #7b7266;
  font-size: 12px;
}

.version-trigger strong {
  font-size: 16px;
  font-weight: 600;
}

.version-trigger em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-trigger b {
  flex: 0 0 auto;
  color: var(--cinnabar);
  font-size: 13px;
}

.version-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.version-option {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.version-option.is-current {
  border-color: var(--cinnabar);
  background: var(--cinnabar-soft);
  cursor: default;
}

.version-option:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.version-option > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.version-option strong {
  font-size: 14px;
}

.version-option small {
  overflow: hidden;
  color: #70675b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-option b {
  flex: 0 0 auto;
  color: var(--cinnabar);
  font-size: 11px;
}

.version-lock-note {
  margin: 0;
  border: 1px solid #e6d2aa;
  border-radius: 6px;
  padding: 8px 11px;
  background: #fff9ed;
  color: #6b522a;
  font-size: 12px;
}

.view-bar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e7dfd2;
}

.view-tabs {
  display: flex;
  gap: 2px;
}

.view-tabs button {
  min-width: 76px;
  min-height: 46px;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0 14px;
  background: transparent;
  color: #685f54;
  cursor: pointer;
  font-size: 15px;
}

.view-tabs button[aria-selected="true"] {
  border-bottom-color: var(--cinnabar);
  color: var(--cinnabar);
  font-weight: 700;
}

.view-caption {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-body {
  min-width: 0;
  animation: view-in 180ms ease;
}

.section-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.section-heading-copy {
  min-width: 0;
}

.section-heading h2,
.section-heading h3 {
  font-size: 19px;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-heading > small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.item-list {
  margin-top: 12px;
  border-top: 1px solid #e7dfd2;
}

.item {
  border-bottom: 1px solid #e7dfd2;
}

.item.is-open {
  background: #fcfaf6;
}

.item-toggle {
  display: grid;
  width: 100%;
  min-height: 64px;
  grid-template-columns: 30px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 8px 4px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.item-index,
.event-index {
  color: #a09990;
  font-family: Arial, sans-serif;
  font-size: 12px;
  text-align: center;
}

.item-copy,
.event-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.item-copy strong,
.event-copy strong {
  font-size: 15px;
  font-weight: 600;
}

.item-copy small,
.event-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-score {
  min-width: 38px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.item-score.is-empty {
  color: #aaa298;
  font-size: 12px;
  font-weight: 400;
}

.item-chevron {
  color: #8e857a;
  font-size: 15px;
  text-align: center;
}

.tier-panel {
  display: grid;
  gap: 9px;
  padding: 0 4px 16px 40px;
}

.tier-panel > p {
  margin: 0;
  color: #655d52;
  font-size: 13px;
  line-height: 1.65;
}

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

.tier-option {
  display: grid;
  min-width: 0;
  min-height: 66px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
  border: 1px solid #ddd4c6;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.tier-option[aria-pressed="true"] {
  border-color: var(--cinnabar);
  background: var(--cinnabar-soft);
  box-shadow: inset 3px 0 0 var(--cinnabar);
}

.tier-option.is-negative {
  background: #f6f5f2;
  color: #6f6a63;
}

.tier-option.is-negative[aria-pressed="true"] {
  border-color: #8d857b;
  background: #eeebe6;
  box-shadow: inset 3px 0 0 #8d857b;
}

.tier-option:disabled {
  cursor: wait;
  opacity: 0.58;
}

.tier-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.tier-copy strong {
  font-size: 15px;
}

.tier-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.tier-points {
  font-family: Arial, sans-serif;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
}

.reflection-panel {
  margin-top: 24px;
  border-top: 1px solid #e7dfd2;
  padding-top: 18px;
}

.reflection-input {
  display: block;
  width: 100%;
  min-height: 132px;
  margin-top: 12px;
  resize: vertical;
  border: 1px solid #d8d0c4;
  border-radius: 6px;
  padding: 12px 14px;
  background: #fffdf9;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
}

.reflection-input[aria-invalid="true"] {
  border-color: var(--cinnabar);
}

.reflection-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reflection-count.is-over-limit {
  color: var(--cinnabar);
  font-weight: 700;
}

.reflection-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 10px;
}

.reflection-actions small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.reflection-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.reflection-actions .button {
  min-height: 48px;
  min-width: 0;
  flex: 0 0 auto;
}

.reflection-buttons .button-quiet {
  min-width: 66px;
}

.reflection-buttons .button-primary {
  min-width: 112px;
}

.reflection-undo {
  display: flex;
  min-height: 32px;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.reflection-undo button {
  min-height: 32px;
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: var(--cinnabar);
  font-weight: 600;
  cursor: pointer;
}

.reflection-undo button:hover {
  text-decoration: underline;
}

.event-list {
  margin-top: 12px;
  border-top: 1px solid #e7dfd2;
}

.event-row {
  border-bottom: 1px solid #e7dfd2;
}

.event-row.is-recorded {
  background: #fcfaf6;
}

.event-main {
  display: grid;
  min-height: 64px;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
}

.event-points {
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}

.event-toggle {
  min-width: 78px;
  min-height: 44px;
  border: 1px solid var(--cinnabar);
  border-radius: 5px;
  padding: 0 12px;
  background: #fff;
  color: var(--cinnabar);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.event-toggle[aria-pressed="true"] {
  background: var(--cinnabar);
  color: #fff;
}

.event-toggle:disabled {
  cursor: wait;
  opacity: 0.58;
}

.note-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin: 0 4px 13px 40px;
}

.note-editor textarea {
  min-height: 70px;
  resize: vertical;
  border: 1px solid #d8d0c4;
  border-radius: 5px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.note-editor .button {
  align-self: stretch;
}

.month-head {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 92px;
  align-items: center;
  gap: 10px;
}

.month-head h2 {
  font-size: 19px;
  text-align: center;
}

.month-nav {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 8px;
  background: var(--surface-soft);
  color: #685f54;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.month-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 14px;
  border: 1px solid #e4dccf;
  border-radius: 6px;
  padding: 10px;
  background: var(--surface-soft);
  color: #665e53;
  font-size: 12px;
}

.month-summary strong {
  margin-left: 3px;
  font-family: Arial, sans-serif;
  font-size: 16px;
}

.month-summary b {
  color: #a59d92;
  font-weight: 400;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday-row {
  margin-top: 12px;
}

.weekday-row span {
  padding: 3px 0;
  color: #7e7569;
  font-size: 12px;
  text-align: center;
}

.calendar-grid {
  margin-top: 4px;
}

.calendar-day,
.calendar-empty {
  min-width: 0;
  min-height: 52px;
  aspect-ratio: 1;
}

.calendar-day {
  display: grid;
  place-content: center;
  gap: 2px;
  border: 1px solid #e2dacf;
  border-radius: 6px;
  padding: 3px;
  background: #fff;
  color: #5f574d;
  cursor: pointer;
}

.calendar-day strong {
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
}

.calendar-day small {
  font-family: Arial, sans-serif;
  font-size: 10px;
  line-height: 1;
}

.calendar-day.has-record {
  border-color: #d8c8ae;
  background: #fdf9f2;
}

.calendar-day.is-today {
  box-shadow: inset 0 0 0 1px var(--cinnabar);
}

.calendar-day.is-selected {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
  color: #fff;
}

.calendar-day.is-selected small {
  color: #fff;
}

.day-detail {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  border-top: 1px solid #e7dfd2;
  padding-top: 13px;
}

.day-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.day-detail-head h3 {
  font-size: 17px;
}

.day-detail-head span,
.day-detail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.day-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #eee7dd;
  padding: 8px 0;
}

.day-detail-row > span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.day-detail-row strong {
  font-size: 14px;
}

.day-detail-row small {
  color: #7b7266;
  font-size: 11px;
}

.day-detail-row > b {
  flex: 0 0 auto;
  font-family: Arial, sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.day-detail-row.is-event {
  background: #fcfaf6;
}

.day-detail-reflection {
  margin-top: 4px;
  border-left: 3px solid #d8c8ae;
  padding: 9px 12px;
  background: #fdf9f2;
}

.day-detail-reflection strong {
  font-size: 14px;
}

.day-detail-reflection p {
  margin-top: 5px;
  color: #5f574d;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.empty-state {
  margin: 12px 0 0;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  padding: 20px 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.loading-view {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: var(--paper);
}

.loading-card {
  width: min(88vw, 340px);
  text-align: center;
}

.loading-card p {
  color: var(--muted);
}

.skeleton-lines {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.skeleton-lines i {
  display: block;
  height: 11px;
  border-radius: 999px;
  background: #e4ddd0;
  animation: breathe 1.4s ease-in-out infinite;
}

.skeleton-lines i:nth-child(2) {
  width: 76%;
  margin: 0 auto;
  animation-delay: 120ms;
}

.skeleton-lines i:nth-child(3) {
  width: 54%;
  margin: 0 auto;
  animation-delay: 240ms;
}

.error-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.error-panel {
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  background: var(--surface);
  text-align: center;
}

.error-panel p:not(.eyebrow) {
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(37, 31, 27, 0.28);
  backdrop-filter: blur(8px);
}

.feedback-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(360px, calc(100vw - 24px));
  max-height: min(88vh, 720px);
  gap: 12px;
  overflow: auto;
  border: 1px solid #fff;
  border-radius: 8px;
  padding: 24px 18px 18px;
  background: rgba(255, 252, 246, 0.98);
  box-shadow: 0 24px 64px rgba(35, 29, 24, 0.22);
}

.feedback-dialog > .eyebrow,
.feedback-dialog h2 {
  text-align: center;
}

.feedback-dialog h2 {
  font-size: 23px;
}

.feedback-copy {
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #6c6256;
  cursor: pointer;
  font-size: 24px;
}

.checkin-stats {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.checkin-stats strong {
  color: var(--cinnabar);
  font-family: Arial, sans-serif;
  font-size: 21px;
  font-weight: 600;
}

.checkin-stats i {
  width: 1px;
  height: 16px;
  align-self: center;
  background: #ddd4c7;
}

.checkin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  font-size: 13px;
}

.checkin-heading > span {
  color: #776f64;
  font-size: 11px;
}

.checkin-heading i,
.checkin-day i {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cinnabar);
}

.checkin-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.checkin-weekday {
  color: #746b5f;
  font-size: 11px;
  text-align: center;
}

.checkin-day {
  display: grid;
  min-height: 36px;
  grid-template-rows: 31px 4px;
  place-items: center;
  gap: 2px;
  color: #6b6358;
  font-family: Arial, sans-serif;
  font-size: 13px;
}

.checkin-day b {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  font-weight: 500;
}

.checkin-day.is-recorded {
  color: var(--cinnabar);
  font-weight: 700;
}

.checkin-day.is-today b {
  border-color: var(--cinnabar);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 110;
  max-width: min(92vw, 520px);
  transform: translate(-50%, 24px);
  border-radius: 6px;
  padding: 10px 15px;
  background: #2b2723;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.view-body.is-celebrating {
  animation: celebration-pulse 680ms ease;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.95;
  }
}

@keyframes view-in {
  from {
    transform: translateY(3px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes celebration-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(159, 47, 44, 0.24);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(159, 47, 44, 0);
  }
}

@media (max-width: 760px) {
  .virtue-page,
  .topbar-inner {
    width: min(100% - 20px, 1080px);
  }

  .virtue-page {
    padding-top: 12px;
  }

  .virtue-panel {
    gap: 15px;
    border-inline: 0;
    border-radius: 0;
    padding: 18px 14px;
  }

  .virtue-head {
    gap: 12px;
  }

  .virtue-head h1 {
    font-size: 27px;
  }

  .total-score {
    min-width: 76px;
  }

  .total-score strong {
    font-size: 28px;
  }

  .version-trigger > span {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 9px;
  }

  .version-trigger em {
    width: 100%;
  }

  .version-list {
    grid-template-columns: 1fr;
  }

  .view-caption {
    display: none;
  }

  .view-tabs {
    width: 100%;
  }

  .view-tabs button {
    min-width: 0;
    flex: 1;
    padding-inline: 8px;
  }

  .section-heading h2,
  .section-heading h3 {
    font-size: 18px;
  }

  .tier-panel {
    padding-left: 0;
  }

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

  .note-editor {
    grid-template-columns: 1fr;
    margin-left: 0;
  }

  .reflection-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .reflection-buttons {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(66px, 0.72fr) minmax(0, 1.28fr);
    margin-left: 0;
  }

  .reflection-actions .button {
    width: 100%;
  }

  .reflection-undo {
    justify-content: flex-start;
  }

  .event-main {
    grid-template-columns: 24px minmax(0, 1fr) auto 70px;
    gap: 7px;
  }

  .event-toggle {
    min-width: 70px;
    padding-inline: 7px;
  }

  .weekday-row,
  .calendar-grid {
    gap: 3px;
  }

  .calendar-day,
  .calendar-empty {
    min-height: 44px;
  }

  .calendar-day strong {
    font-size: 13px;
  }
}

@media (max-width: 560px) {
  .topbar-inner {
    min-height: 62px;
  }

  .brand-seal.small,
  .brand-logo.small {
    width: 38px;
    height: 38px;
    font-size: 11px;
  }

  .brand-copy strong {
    font-size: 17px;
  }

  .brand-copy small {
    max-width: 180px;
    font-size: 11px;
  }

  .button-quiet {
    padding-inline: 11px;
    font-size: 13px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .privacy-banner {
    padding: 8px 11px;
    font-size: 12px;
  }

  .item-toggle {
    grid-template-columns: 24px minmax(0, 1fr) auto 14px;
    gap: 7px;
    padding-inline: 2px;
  }

  .item-copy small,
  .event-copy small {
    white-space: normal;
  }

  .event-copy small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .month-head {
    grid-template-columns: 78px minmax(0, 1fr) 78px;
    gap: 5px;
  }

  .month-head h2 {
    font-size: 17px;
  }

  .month-nav {
    font-size: 12px;
  }

  .month-summary {
    gap: 5px;
    padding-inline: 6px;
  }

  .day-detail-head {
    align-items: flex-start;
  }

  .login-shell {
    padding: 14px 10px;
  }

  .login-panel {
    padding: 26px 20px;
    box-shadow: none;
  }
}

@media (max-width: 390px) {
  .code-row {
    grid-template-columns: 1fr;
  }

  .brand-copy small {
    display: none;
  }

  .brand {
    gap: 7px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .topbar-actions {
    gap: 4px;
  }

  .virtue-panel {
    padding-inline: 10px;
  }

  .version-trigger {
    padding-inline: 10px;
  }

  .event-main {
    grid-template-columns: 22px minmax(0, 1fr) auto;
  }

  .event-points {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
