:root {
  --paper: #f6efe3;
  --paper-strong: #efe4d2;
  --ink: #241b16;
  --muted: #77685e;
  --accent: #9d4d2f;
  --accent-soft: #c9704b;
  --line: rgba(68, 43, 28, 0.14);
  --peak: #fbf7ef;
  --ah-feng: #2b5d74;
  --xiao-jing: #9f6f37;
  --shadow: 0 18px 55px rgba(41, 26, 16, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(227, 167, 98, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(101, 148, 177, 0.18), transparent 24%),
    linear-gradient(180deg, #fffaf1 0%, #f3eadb 48%, #efe3d2 100%);
  font-family: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", serif;
}

body.is-locked {
  min-height: 100vh;
}

body::before {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(120, 88, 62, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 88, 62, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  pointer-events: none;
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.lock-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.lock-card {
  width: min(460px, 100%);
  padding: 30px 28px 28px;
  border: 1px solid rgba(122, 83, 54, 0.16);
  border-radius: 30px;
  background: rgba(255, 249, 241, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.lock-title {
  margin: 0;
  font-size: clamp(38px, 9vw, 64px);
  line-height: 0.96;
}

.lock-text {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.lock-form {
  margin-top: 22px;
}

.unlock-btn {
  width: 100%;
  margin-top: 14px;
  padding: 14px 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fffaf2;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(157, 77, 47, 0.2);
}

.unlock-btn:hover {
  transform: translateY(-1px);
}

.unlock-btn,
.search-input,
.segmented-btn,
.month-chip {
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.lock-hint,
.lock-error {
  margin: 12px 0 0;
  font-size: 13px;
}

.lock-hint {
  color: var(--muted);
}

.lock-error {
  color: #a3342f;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr;
  gap: 24px;
  align-items: stretch;
}

.hero-copy,
.hero-panel,
.month-rail-card,
.timeline-panel {
  border: 1px solid rgba(122, 83, 54, 0.14);
  border-radius: 28px;
  background: rgba(255, 249, 241, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-copy {
  padding: 34px 34px 30px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 0.96;
}

.hero-text {
  max-width: 30rem;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.participant-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.participant-avatar,
.segmented-avatar,
.message-avatar {
  border-radius: 50%;
  object-fit: cover;
}

.participant-avatar {
  width: 38px;
  height: 38px;
}

.hero-panel {
  padding: 24px;
  display: grid;
  gap: 18px;
  background:
    linear-gradient(140deg, rgba(236, 219, 195, 0.8), rgba(255, 250, 242, 0.92)),
    var(--peak);
}

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

.stat-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.56);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  font-weight: 700;
}

.filter-card {
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.search-label {
  display: block;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
}

.search-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(88, 63, 44, 0.18);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
}

.search-input:focus {
  outline: 2px solid rgba(157, 77, 47, 0.24);
  outline-offset: 2px;
}

.segmented {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(89, 63, 44, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.segmented-btn:hover,
.month-chip:hover {
  transform: translateY(-1px);
}

.segmented-avatar {
  width: 24px;
  height: 24px;
}

.segmented-btn.active {
  background: var(--ink);
  color: #fff7ef;
}

.content-grid {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 24px;
  margin-top: 26px;
}

.month-rail {
  position: relative;
}

.month-rail-card {
  position: sticky;
  top: 20px;
  padding: 18px;
}

.rail-title {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.month-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.month-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}

.month-chip-count {
  color: var(--muted);
  font-size: 12px;
}

.timeline-panel {
  padding: 18px 20px 24px;
}

.timeline-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  padding: 8px 6px 18px;
  border-bottom: 1px solid var(--line);
}

.toolbar-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.toolbar-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.timeline {
  position: relative;
  margin-top: 18px;
  padding-left: 18px;
}

.timeline::before {
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, rgba(157, 77, 47, 0.4), rgba(157, 77, 47, 0.08));
  content: "";
}

.day-block {
  position: relative;
  padding: 0 0 22px 22px;
}

.day-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.day-knot {
  width: 12px;
  height: 12px;
  margin-left: -28px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(157, 77, 47, 0.12);
}

.day-date {
  margin: 0;
  font-size: 25px;
}

.day-count {
  color: var(--muted);
  font-size: 13px;
}

.message-list {
  display: grid;
  gap: 12px;
}

.message-card {
  padding: 14px 16px 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.message-card.sender-ah-feng {
  border-left: 4px solid var(--ah-feng);
}

.message-card.sender-xiao-jing {
  border-left: 4px solid var(--xiao-jing);
}

.message-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.message-author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(70, 44, 28, 0.08);
  background: rgba(255, 255, 255, 0.9);
}

.message-sender {
  font-size: 14px;
  font-weight: 700;
}

.message-kind {
  color: var(--muted);
  font-size: 12px;
}

.message-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.8;
  word-break: break-word;
}

mark {
  padding: 0 0.12em;
  color: inherit;
  background: rgba(233, 192, 120, 0.55);
}

.empty-state {
  padding: 28px 14px 8px;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 960px) {
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .month-rail-card {
    position: static;
  }

  .month-list {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .month-chip {
    flex: 0 0 auto;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(100vw - 20px, 1180px);
    padding: 16px 0 30px;
  }

  .hero-copy,
  .hero-panel,
  .month-rail-card,
  .timeline-panel {
    border-radius: 22px;
  }

  .hero-copy {
    padding: 24px 22px 22px;
  }

  .hero-text {
    font-size: 15px;
  }

  .participant-strip {
    gap: 10px;
  }

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

  .toolbar-title {
    font-size: 19px;
  }

  .timeline-panel {
    padding: 16px 14px 20px;
  }

  .day-date {
    font-size: 22px;
  }

  .message-text {
    font-size: 15px;
  }

  .lock-card {
    padding: 26px 20px 22px;
    border-radius: 24px;
  }
}
