@font-face {
  font-family: "MemorialTitle";
  src:
    local("FZKai-Z03"),
    local("STKaiti"),
    local("KaiTi"),
    local("Kaiti SC");
}

@font-face {
  font-family: "MemorialBody";
  src:
    local("FZShuSong-Z01"),
    local("STFangsong"),
    local("FangSong"),
    local("Songti SC"),
    local("SimSun");
}

:root {
  --font-brush: "Ma Shan Zheng", "STKaiti", "KaiTi", serif;
  --bg: #ddd0b0;
  --bg-deep: #bca178;
  --paper: rgba(244, 234, 210, 0.94);
  --paper-core: rgba(249, 242, 225, 0.92);
  --paper-edge: #9f7b47;
  --ink: #2f2116;
  --muted: #66523d;
  --accent: #8f2a1b;
  --accent-soft: rgba(143, 42, 27, 0.12);
  --gold: #a57b34;
  --shadow: rgba(56, 37, 18, 0.18);
  --line: rgba(86, 58, 28, 0.18);
  --status-board-height: 76px;
  --memorial-cover-width: 232px;
  --memorial-cover-height: 520px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.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;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(255, 248, 231, 0.78), transparent 26%),
    linear-gradient(135deg, rgba(122, 84, 35, 0.1), transparent 28%),
    linear-gradient(180deg, #c7ab7b 0%, var(--bg) 28%, #d8c5a1 100%);
  font-family: var(--font-brush);
}

body.chat-page {
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top center, rgba(151, 190, 255, 0.12), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #fbfdff 78%, #f2f8ff 100%);
  color: #0e1116;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body.home-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(190, 214, 244, 0.34), transparent 30%),
    radial-gradient(circle at bottom right, rgba(215, 194, 154, 0.2), transparent 28%),
    linear-gradient(180deg, #fcfdff 0%, #f2f7fd 100%);
  color: #101722;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: auto;
}

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

.chat-page button {
  border: 0;
  background: none;
}

.home-shell {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: center;
  gap: 36px;
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
  padding: 40px 0;
}

.home-hero {
  display: grid;
  gap: 12px;
  max-width: 720px;
}

.home-eyebrow {
  margin: 0;
  color: #5e7290;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.home-title {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.home-intro {
  margin: 0;
  color: #536275;
  font-size: 1.05rem;
  line-height: 1.8;
}

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

.home-card {
  display: grid;
  gap: 16px;
  min-height: 280px;
  padding: 26px;
  border-radius: 28px;
  color: inherit;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 18px 44px rgba(72, 101, 143, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.home-card:hover,
.home-card:focus-visible {
  transform: translateY(-4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 24px 52px rgba(72, 101, 143, 0.16);
  outline: none;
}

.home-card--memorials {
  background:
    linear-gradient(180deg, rgba(246, 237, 219, 0.94), rgba(233, 214, 178, 0.96)),
    radial-gradient(circle at top right, rgba(160, 120, 66, 0.12), transparent 34%);
}

.home-card--chat {
  background:
    linear-gradient(180deg, rgba(240, 247, 255, 0.96), rgba(217, 233, 251, 0.98)),
    radial-gradient(circle at top right, rgba(103, 145, 210, 0.16), transparent 34%);
}

.home-card__kicker {
  color: #63758f;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.home-card__title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
}

.home-card__body {
  margin: 0;
  color: #4f5f71;
  font-size: 1rem;
  line-height: 1.75;
}

.home-card__action {
  align-self: end;
  color: #173356;
  font-size: 0.96rem;
  font-weight: 700;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  gap: 14px;
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 32px 0 20px;
  overflow: hidden;
}

.chat-thread {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  flex-direction: column;
  gap: 12px;
  padding: 16px 16px 72px;
  overflow-y: auto;
  overflow-x: hidden;
  justify-content: flex-start;
  scroll-padding-bottom: 72px;
  scrollbar-width: thin;
  scrollbar-color: rgba(104, 138, 188, 0.72) rgba(216, 231, 248, 0.72);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-thread::-webkit-scrollbar {
  width: 10px;
}

.chat-thread::-webkit-scrollbar-track {
  margin: 8px 0;
  border-radius: 999px;
  background: rgba(216, 231, 248, 0.72);
}

.chat-thread::-webkit-scrollbar-thumb {
  border: 2px solid rgba(216, 231, 248, 0.9);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(124, 161, 214, 0.95), rgba(96, 131, 182, 0.95));
}

.chat-thread::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(109, 148, 206, 1), rgba(82, 118, 173, 1));
}

.chat-empty {
  margin: auto 0;
  max-width: 520px;
  color: #758296;
  font-size: 0.92rem;
  line-height: 1.6;
  text-align: center;
}

.chat-message {
  display: grid;
  gap: 6px;
}

.chat-message--user {
  justify-items: end;
}

.chat-message--assistant {
  justify-items: start;
}

.chat-message__role {
  color: #7a879a;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.chat-message__content {
  max-width: min(820px, 88%);
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  word-break: break-word;
}

.chat-message__content > :first-child {
  margin-top: 0;
}

.chat-message__content > :last-child {
  margin-bottom: 0;
}

.chat-message__content p,
.chat-message__content ul,
.chat-message__content ol,
.chat-message__content pre,
.chat-message__content blockquote,
.chat-message__content h1,
.chat-message__content h2,
.chat-message__content h3,
.chat-message__content h4 {
  margin: 0 0 0.8em;
}

.chat-message__content ul,
.chat-message__content ol {
  padding-left: 1.4em;
}

.chat-message__content li + li {
  margin-top: 0.28em;
}

.chat-message__content code {
  padding: 0.12em 0.36em;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.08);
  font-family: "Consolas", "SFMono-Regular", "Courier New", monospace;
  font-size: 0.92em;
}

.chat-message__content pre {
  overflow-x: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fbff;
}

.chat-message__content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.chat-message__content blockquote {
  padding-left: 0.9em;
  border-left: 3px solid rgba(104, 138, 188, 0.42);
  color: #526171;
}

.chat-message__content a {
  color: #245ea8;
  text-decoration: underline;
  text-underline-offset: 0.14em;
}

.chat-mermaid {
  overflow-x: auto;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 0 0 1px rgba(180, 203, 231, 0.55);
}

.chat-message--user .chat-message__content {
  background: linear-gradient(180deg, #dcecff 0%, #cfe5ff 100%);
  color: #0d223d;
  box-shadow: 0 10px 24px rgba(104, 152, 222, 0.16);
}

.chat-message--assistant .chat-message__content {
  background: #fff;
  color: #12161c;
  box-shadow: 0 12px 26px rgba(113, 127, 150, 0.1);
}

.chat-hero {
  display: grid;
  justify-items: center;
  gap: 22px;
  padding-top: 8px;
  flex: 0 0 auto;
}

.chat-hero__title {
  margin: 0;
  color: #05070b;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  text-align: center;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}

.chat-chip {
  display: inline-flex;
  flex: 0 1 auto;
  width: fit-content;
  max-width: min(100%, 42rem);
  min-height: 58px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(245, 245, 246, 0.92);
  color: #07090d;
  font-size: clamp(0.9rem, 1.4vw, 1rem);
  line-height: 1.5;
  text-align: center;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 8px 20px rgba(108, 133, 173, 0.07);
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.chat-chip:hover,
.chat-chip:focus-visible {
  background: #eef5ff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 12px 24px rgba(108, 133, 173, 0.1);
  outline: none;
  transform: translateY(-2px);
}

.chat-chip--wide {
  max-width: min(100%, 48rem);
}

.chat-chip--medium {
  max-width: min(100%, 38rem);
}

.chat-composer {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  min-height: 132px;
  padding: 14px 14px 16px;
  border: 1px solid rgba(150, 190, 255, 0.9);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 255, 0.96)),
    radial-gradient(circle at top left, rgba(180, 213, 255, 0.2), transparent 35%);
  box-shadow:
    0 18px 40px rgba(103, 145, 210, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  margin-top: auto;
}

.chat-composer__input {
  flex: 1 1 auto;
  width: 100%;
  min-height: 84px;
  resize: none;
  border: 0;
  background: transparent;
  color: #101318;
  font-size: 0.98rem;
  line-height: 1.5;
  outline: none;
}

.chat-composer__input::placeholder {
  color: #b4b6bd;
}

.chat-composer__send {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 78px;
  height: 42px;
  margin-left: 10px;
  padding: 0 14px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, #eef4fb 0%, #dbe9f8 100%);
  color: #142338;
  -webkit-text-fill-color: #142338;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 8px 18px rgba(92, 129, 176, 0.2);
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.chat-composer__send:hover,
.chat-composer__send:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 12px 22px rgba(92, 129, 176, 0.28);
  outline: none;
}

.chat-composer__send:disabled,
.chat-chip:disabled,
.chat-composer__input:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.chat-status {
  margin: -4px 2px 0;
  color: #5f6d82;
  font-size: 0.84rem;
  line-height: 1.5;
}

.chat-status.is-error {
  color: #b42318;
}

.paper-stage,
.actions {
  border: 1px solid rgba(126, 94, 53, 0.4);
  box-shadow: 0 18px 44px var(--shadow);
}

.status-board__label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.status-board p,
.overview-card__index,
.overview-card__status {
  color: var(--muted);
}

.page-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(1280px, calc(100% - 32px));
  height: 100vh;
  margin: 0 auto;
  padding: 16px 0;
}

.layout {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

.paper-stage {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 20px 22px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(250, 244, 228, 0.96), rgba(235, 223, 193, 0.93)),
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.3), transparent 18%),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 35px,
      rgba(146, 113, 74, 0.1) 35px,
      rgba(146, 113, 74, 0.1) 36px
    );
}

.paper-stage::after {
  content: "臣等谨呈";
  position: absolute;
  top: 24px;
  right: 20px;
  color: rgba(143, 42, 27, 0.78);
  font-family: var(--font-brush);
  font-size: 1rem;
  letter-spacing: 0.2em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.overview-stage,
.detail-stage {
  flex: 1 1 auto;
  min-height: 0;
}

.detail-stage {
  display: flex;
  flex-direction: column;
}

.overview-stage {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(143, 42, 27, 0.78) rgba(121, 93, 56, 0.16);
}

.overview-stage::-webkit-scrollbar {
  width: 14px;
}

.overview-stage::-webkit-scrollbar-track {
  border: 1px solid rgba(122, 94, 56, 0.08);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(214, 194, 157, 0.22), rgba(154, 115, 62, 0.12));
  box-shadow:
    inset 0 0 0 1px rgba(255, 247, 230, 0.18),
    inset 0 6px 10px rgba(113, 83, 48, 0.08);
}

.overview-stage::-webkit-scrollbar-thumb {
  border: 2px solid rgba(245, 236, 216, 0.82);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(175, 86, 62, 0.96), rgba(126, 39, 24, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 237, 216, 0.4),
    0 3px 8px rgba(70, 44, 18, 0.2);
}

.overview-stage::-webkit-scrollbar-thumb:hover {
  background:
    linear-gradient(180deg, rgba(188, 95, 69, 1), rgba(144, 47, 29, 1));
}

.overview-stage::-webkit-scrollbar-corner {
  background: transparent;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  min-height: 100%;
  align-content: start;
}

.overview-card {
  display: grid;
  gap: 10px;
  min-height: 0;
  padding: 14px 12px;
  border: 1px solid rgba(126, 94, 53, 0.28);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(249, 241, 223, 0.92), rgba(231, 216, 182, 0.88)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 30%);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.overview-card:hover,
.overview-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(143, 42, 27, 0.34);
  box-shadow: 0 14px 24px rgba(70, 44, 18, 0.12);
  outline: none;
}

.overview-card.is-active {
  border-color: rgba(143, 42, 27, 0.55);
  box-shadow: 0 0 0 2px rgba(143, 42, 27, 0.12);
}

.overview-card.is-found:not(.is-completed) {
  background:
    linear-gradient(180deg, rgba(247, 239, 220, 0.96), rgba(230, 220, 189, 0.9)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.22), transparent 30%);
}

.overview-card.is-completed {
  background:
    linear-gradient(180deg, rgba(236, 230, 215, 0.92), rgba(221, 211, 190, 0.88));
}

.overview-card__index {
  font-size: 0.9rem;
  letter-spacing: 0.08em;
}

.overview-card__title {
  font-family: var(--font-brush);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.35;
}

.overview-card__status {
  align-self: end;
  justify-self: start;
  padding: 6px 10px;
  border: 1px solid rgba(122, 94, 56, 0.18);
  border-radius: 999px;
  background: rgba(173, 145, 104, 0.16);
  font-size: 0.88rem;
}

.memorial {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 14px;
  overflow: hidden;
  padding: 22px 22px 18px;
  border: 1px solid rgba(120, 90, 54, 0.16);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(250, 243, 224, 0.92), rgba(234, 222, 192, 0.8)),
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.24), transparent 22%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    inset 0 0 22px rgba(140, 99, 47, 0.08);
}

.memorial-closed {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 0;
}

.memorial-open {
  --sheet-width: 820px;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.memorial-open.is-opening .memorial-sheet {
  animation: memorialSheetReveal 760ms ease-out both;
}

.memorial-open:not(.is-opening) .memorial-cover--open {
  opacity: 0;
  transform: translateX(calc(100% + 32px));
  pointer-events: none;
}

.memorial-cover {
  position: relative;
  width: var(--memorial-cover-width);
  min-height: var(--memorial-cover-height);
  overflow: hidden;
  border: 1px solid rgba(82, 54, 29, 0.48);
  border-radius: 14px;
  background:
    linear-gradient(180deg, #9e7344 0%, #875c31 45%, #714924 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 243, 221, 0.12),
    inset 0 12px 28px rgba(255, 225, 176, 0.08),
    0 18px 30px rgba(65, 40, 16, 0.14);
  cursor: pointer;
  transform-origin: right center;
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
}

.memorial-cover::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(242, 220, 176, 0.22);
  pointer-events: none;
}

.memorial-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateX(24%);
  background:
    linear-gradient(180deg, rgba(255, 236, 202, 0.08), transparent 28%, rgba(55, 33, 16, 0.1) 100%);
  pointer-events: none;
}

.memorial-cover:hover,
.memorial-cover:focus-visible {
  transform: translateX(-2px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 218, 0.2),
    0 22px 34px rgba(65, 40, 16, 0.18);
  outline: none;
}

.memorial-cover--open {
  flex: 0 0 var(--memorial-cover-width);
  width: var(--memorial-cover-width);
  min-height: 100%;
  margin-left: 8px;
  cursor: default;
  box-shadow:
    inset 0 0 0 1px rgba(255, 244, 218, 0.1),
    0 10px 22px rgba(65, 40, 16, 0.08);
}

.memorial-cover--open .memorial-cover__hint {
  display: none;
}

.memorial-cover.is-opening {
  animation: memorialCoverSlideRight 760ms cubic-bezier(0.22, 0.72, 0.16, 0.98) forwards;
}

.memorial-cover.is-opening::after {
  animation: memorialCoverSheen 760ms ease-out forwards;
}

.memorial-cover.is-opening .memorial-cover__title,
.memorial-cover.is-opening .memorial-cover__seal,
.memorial-cover.is-opening .memorial-cover__hint {
  animation: memorialCoverContentFade 760ms ease-out forwards;
}

.memorial-cover__label {
  position: absolute;
  inset: 28px auto 28px 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 116px;
  padding: 34px 18px;
  border: 1px solid rgba(94, 59, 28, 0.26);
  border-radius: 999px;
  transform: translateX(-50%);
  background:
    linear-gradient(180deg, rgba(241, 219, 178, 0.96), rgba(223, 189, 135, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(255, 245, 224, 0.44),
    0 8px 18px rgba(60, 36, 15, 0.12);
}

.memorial-cover__title {
  color: #2f1c0f;
  font-family: var(--font-brush);
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: 0.2em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.memorial-cover__seal {
  position: absolute;
  left: 22px;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border: 2px solid rgba(122, 18, 12, 0.78);
  border-radius: 50%;
  background: rgba(211, 51, 31, 0.08);
  color: rgba(122, 18, 12, 0.82);
  font-family: var(--font-brush);
  font-size: 0.96rem;
  letter-spacing: 0.08em;
  opacity: 0.92;
  transform: rotate(-8deg);
}

.memorial-cover__hint {
  position: absolute;
  top: 18px;
  left: 20px;
  color: rgba(248, 234, 201, 0.84);
  font-family: var(--font-brush);
  font-size: 0.96rem;
  letter-spacing: 0.18em;
  text-shadow: 0 1px 2px rgba(22, 13, 8, 0.25);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.memorial-sheet {
  position: relative;
  flex: 0 1 var(--sheet-width);
  min-height: 100%;
  overflow: hidden;
  padding: 18px 72px 20px 28px;
  border: 1px solid rgba(160, 121, 72, 0.2);
  background:
    linear-gradient(180deg, rgba(242, 219, 170, 0.97), rgba(224, 192, 132, 0.94));
}

.memorial-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(96, 63, 30, 0.08), transparent 10%, transparent 92%, rgba(79, 52, 25, 0.1)),
    linear-gradient(180deg, rgba(255, 248, 228, 0.18), rgba(81, 57, 28, 0.06)),
    repeating-linear-gradient(
      180deg,
      transparent 0,
      transparent 35px,
      rgba(146, 113, 74, 0.09) 35px,
      rgba(146, 113, 74, 0.09) 36px
    );
  pointer-events: none;
}

.memorial-sheet__title {
  position: absolute;
  top: 18px;
  right: 18px;
  color: rgba(62, 40, 18, 0.92);
  font-family: var(--font-brush);
  font-size: 0.98rem;
  letter-spacing: 0.2em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.memorial__body {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding-right: 30px;
  color: inherit;
  font-family: var(--font-brush);
  font-size: 1.2rem;
  line-height: 1.65;
  letter-spacing: 0.06em;
  white-space: normal;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.memorial-sheet__closing {
  position: absolute;
  left: 24px;
  bottom: 22px;
  color: rgba(84, 63, 41, 0.88);
  font-family: var(--font-brush);
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.memorial-sheet__seal {
  position: absolute;
  left: 22px;
  bottom: 82px;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid rgba(122, 18, 12, 0.76);
  border-radius: 10px;
  background: rgba(211, 51, 31, 0.06);
  color: rgba(122, 18, 12, 0.8);
  font-family: var(--font-brush);
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  opacity: 0.9;
  transform: rotate(-6deg);
}

.sentence--inline {
  display: inline;
  margin: 0 0 0.2em;
  padding: 0.08em 0.04em;
  border-radius: 0.32em;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-align: start;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.sentence--inline:hover,
.sentence--inline:focus-visible {
  background: rgba(166, 124, 46, 0.11);
  box-shadow: inset 0 0 0 1px rgba(166, 124, 46, 0.16);
  outline: none;
}

.sentence--inline.is-found {
  background: rgba(142, 47, 29, 0.12);
  color: #5b2016;
  box-shadow: inset 0 0 0 1px rgba(142, 47, 29, 0.22);
}

.sentence--inline.is-missed {
  background: rgba(106, 87, 66, 0.08);
}

.status-board,
.actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.status-board {
  flex: 0 0 var(--status-board-height);
  align-items: center;
  min-height: var(--status-board-height);
  max-height: var(--status-board-height);
  overflow: hidden;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.status-board > div {
  flex: 1 1 0;
  min-width: 0;
}

.status-board p {
  margin: 0;
  line-height: 1.5;
}

.actions {
  flex: 0 0 auto;
  align-items: center;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(248, 241, 224, 0.84);
}

.action {
  min-width: 180px;
  padding: 10px 18px;
  border: 1px solid rgba(104, 77, 45, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.action:hover,
.action:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 16px rgba(70, 44, 18, 0.12);
  outline: none;
}

.action--ghost {
  background: rgba(255, 247, 230, 0.82);
  color: var(--ink);
}

.action--primary {
  background: linear-gradient(180deg, #9b412b, #7b2918);
  color: #fff5e5;
}

@keyframes memorialCoverSlideRight {
  0% {
    opacity: 1;
    transform: translateX(0);
    filter: saturate(1);
  }

  40% {
    opacity: 1;
    transform: translateX(40px);
    filter: saturate(1.02);
  }

  100% {
    opacity: 0.15;
    transform: translateX(260px);
    filter: blur(0.8px) saturate(0.94);
  }
}

@keyframes memorialCoverSheen {
  0% {
    opacity: 0;
    transform: translateX(26%);
  }

  30% {
    opacity: 0.68;
  }

  100% {
    opacity: 0;
    transform: translateX(-26%);
  }
}

@keyframes memorialCoverContentFade {
  0% {
    opacity: 1;
  }

  45% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes memorialSheetReveal {
  0% {
    opacity: 0.25;
    transform: translateX(36px);
    clip-path: inset(0 0 0 100%);
  }

  100% {
    opacity: 1;
    transform: translateX(0);
    clip-path: inset(0 0 0 0);
  }
}

@media (max-width: 820px) {
  .home-shell {
    width: min(100% - 24px, 900px);
    gap: 22px;
    padding: 24px 0;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .home-card {
    min-height: 220px;
    padding: 20px;
    border-radius: 22px;
  }

  body.chat-page {
    overflow: hidden;
  }

  .chat-shell {
    width: min(100% - 20px, 900px);
    gap: 10px;
    padding: 18px 0 14px;
  }

  .chat-thread {
    padding: 14px 14px 56px;
    border-radius: 18px;
  }

  .chat-hero {
    gap: 16px;
    padding-top: 2px;
  }

  .chat-suggestions,
  .chat-suggestions {
    gap: 10px;
  }

  .chat-chip--medium,
  .chat-chip--wide {
    max-width: 100%;
  }

  .chat-chip {
    min-height: 52px;
    padding: 12px 14px;
    border-radius: 16px;
    text-align: left;
    justify-content: flex-start;
  }

  .chat-composer {
    min-height: 112px;
    padding: 12px;
    border-radius: 18px;
  }

  .chat-composer__input {
    min-height: 72px;
    font-size: 0.94rem;
  }

  .chat-composer__send {
    min-width: 72px;
    height: 40px;
    margin-left: 8px;
    padding: 0 12px;
  }

  .chat-message__content {
    max-width: 100%;
  }

  .page-shell {
    width: min(100% - 20px, 1100px);
    gap: 10px;
    padding: 10px 0;
  }

  .status-board,
  .actions {
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .paper-stage,
  .actions {
    border-radius: 18px;
  }

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

  .memorial {
    min-height: 0;
    padding: 14px 12px;
  }

  .memorial-closed {
    height: 100%;
    min-height: 0;
  }

  .memorial-cover {
    width: min(100%, 196px);
  }

  .memorial-open {
    --sheet-width: 100%;
    justify-content: flex-start;
  }

  .memorial-sheet {
    flex-basis: 100%;
    width: 100%;
    min-height: 100%;
    padding: 14px 44px 14px 14px;
  }

  .memorial-cover--open {
    position: absolute;
    top: 0;
    right: 0;
    width: min(48vw, 196px);
    min-height: 100%;
    margin-left: 0;
  }

  .memorial__body {
    max-height: 100%;
    padding-right: 18px;
    font-size: 0.98rem;
  }

  .status-board {
    --status-board-height: 84px;
  }

  .memorial-sheet__title,
  .memorial-sheet__closing,
  .memorial-sheet__seal,
  .paper-stage::after {
    display: none;
  }

  .action {
    width: 100%;
  }
}
